Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::UI::Widget::GradientWithStops Class Reference

#include <gradient-with-stops.h>

Inheritance diagram for Inkscape::UI::Widget::GradientWithStops:
Inkscape::UI::Widget::WidgetVfuncsClassInit

Classes

struct  layout_t
 
struct  limits_t
 
struct  stop_pos_t
 
struct  stop_t
 

Public Member Functions

 GradientWithStops ()
 
 ~GradientWithStops () override
 
void set_gradient (SPGradient *gradient)
 
void set_focused_stop (int index)
 
sigc::signal< void(size_t)> & signal_stop_selected ()
 
sigc::signal< void(size_t, double)> & signal_stop_offset_changed ()
 
sigc::signal< void(double)> & signal_add_stop_at ()
 
sigc::signal< void(size_t)> & signal_delete_stop ()
 

Private Member Functions

void draw_func (Cairo::RefPtr< Cairo::Context > const &cr, int width, int height)
 
void css_changed (GtkCssStyleChange *change) final
 Called after gtk_widget_css_changed(): when a CSS widget node is validated & style changed.
 
void on_click_pressed (int n_press, double x, double y)
 
void on_click_released (int n_press, double x, double y)
 
void on_motion (double x, double y)
 
bool on_key_pressed (unsigned keyval, unsigned keycode, Gdk::ModifierType state)
 
std::optional< bool > focus (Gtk::DirectionType direction) final
 Called before gtk_widget_focus(): return true if moving in direction keeps focus w/in self, false if moving left focus outside widget, or nullopt for no decision & to call base vfunc.
 
void modified ()
 
void update ()
 
int find_stop_at (double x, double y) const
 
void move_stop (int stop_index, double offset_shift)
 
layout_t get_layout () const
 
stop_pos_t get_stop_position (size_t index, const layout_t &layout) const
 
limits_t get_stop_limits (int index) const
 
Glib::RefPtr< Gdk::Cursor > const * get_cursor (double x, double y) const
 
void set_stop_cursor (Glib::RefPtr< Gdk::Cursor > const *cursor)
 

Private Attributes

SPGradient_gradient = nullptr
 
std::vector< stop_t_stops
 
svg_renderer _template
 
svg_renderer _tip_template
 
sigc::scoped_connection _release
 
sigc::scoped_connection _modified
 
Gdk::RGBA _background_color
 
sigc::signal< void(size_t)> _signal_stop_selected
 
sigc::signal< void(size_t, double)> _signal_stop_offset_changed
 
sigc::signal< void(double)> _signal_add_stop_at
 
sigc::signal< void(size_t)> _signal_delete_stop
 
bool _dragging = false
 
int _focused_stop = -1
 
double _pointer_x = 0
 
double _stop_offset = 0
 
Glib::RefPtr< Gdk::Cursor > _cursor_mouseover
 
Glib::RefPtr< Gdk::Cursor > _cursor_dragging
 
Glib::RefPtr< Gdk::Cursor > _cursor_insert
 
Glib::RefPtr< Gdk::Cursor > const * _cursor_current = nullptr
 
double _stop_move_increment = 0.01
 

Additional Inherited Members

- Protected Member Functions inherited from Inkscape::UI::Widget::WidgetVfuncsClassInit
 WidgetVfuncsClassInit ()
 
 ~WidgetVfuncsClassInit () override
 

Detailed Description

Definition at line 41 of file gradient-with-stops.h.

Constructor & Destructor Documentation

◆ GradientWithStops()

Inkscape::UI::Widget::GradientWithStops::GradientWithStops ( )

◆ ~GradientWithStops()

Inkscape::UI::Widget::GradientWithStops::~GradientWithStops ( )
overridedefault

Member Function Documentation

◆ css_changed()

void Inkscape::UI::Widget::GradientWithStops::css_changed ( GtkCssStyleChange *  change)
finalprivatevirtual

Called after gtk_widget_css_changed(): when a CSS widget node is validated & style changed.

Reimplemented from Inkscape::UI::Widget::WidgetVfuncsClassInit.

Definition at line 123 of file gradient-with-stops.cpp.

References _background_color, _cursor_dragging, _cursor_insert, _cursor_mouseover, get_color_with_class(), and set_stop_cursor().

◆ draw_func()

void Inkscape::UI::Widget::GradientWithStops::draw_func ( Cairo::RefPtr< Cairo::Context > const &  cr,
int  width,
int  height 
)
private

◆ find_stop_at()

int Inkscape::UI::Widget::GradientWithStops::find_stop_at ( double  x,
double  y 
) const
private

Definition at line 197 of file gradient-with-stops.cpp.

References _gradient, _stops, get_layout(), and get_stop_position().

Referenced by get_cursor(), and on_click_pressed().

◆ focus()

std::optional< bool > Inkscape::UI::Widget::GradientWithStops::focus ( Gtk::DirectionType  direction)
finalprivatevirtual

Called before gtk_widget_focus(): return true if moving in direction keeps focus w/in self, false if moving left focus outside widget, or nullopt for no decision & to call base vfunc.

Reimplemented from Inkscape::UI::Widget::WidgetVfuncsClassInit.

Definition at line 255 of file gradient-with-stops.cpp.

References _focused_stop, _stops, Inkscape::UI::direction(), and set_focused_stop().

◆ get_cursor()

Glib::RefPtr< Gdk::Cursor > const * Inkscape::UI::Widget::GradientWithStops::get_cursor ( double  x,
double  y 
) const
private

◆ get_layout()

◆ get_stop_limits()

GradientWithStops::limits_t Inkscape::UI::Widget::GradientWithStops::get_stop_limits ( int  index) const
private

◆ get_stop_position()

◆ modified()

void Inkscape::UI::Widget::GradientWithStops::modified ( )
private

◆ move_stop()

void Inkscape::UI::Widget::GradientWithStops::move_stop ( int  stop_index,
double  offset_shift 
)
private

Definition at line 370 of file gradient-with-stops.cpp.

References _signal_stop_offset_changed, get_layout(), and get_stop_limits().

Referenced by on_key_pressed().

◆ on_click_pressed()

void Inkscape::UI::Widget::GradientWithStops::on_click_pressed ( int  n_press,
double  x,
double  y 
)
private

◆ on_click_released()

void Inkscape::UI::Widget::GradientWithStops::on_click_released ( int  n_press,
double  x,
double  y 
)
private

Definition at line 363 of file gradient-with-stops.cpp.

References _dragging, get_cursor(), and set_stop_cursor().

Referenced by GradientWithStops().

◆ on_key_pressed()

bool Inkscape::UI::Widget::GradientWithStops::on_key_pressed ( unsigned  keyval,
unsigned  keycode,
Gdk::ModifierType  state 
)
private

◆ on_motion()

void Inkscape::UI::Widget::GradientWithStops::on_motion ( double  x,
double  y 
)
private

◆ set_focused_stop()

void Inkscape::UI::Widget::GradientWithStops::set_focused_stop ( int  index)

◆ set_gradient()

void Inkscape::UI::Widget::GradientWithStops::set_gradient ( SPGradient gradient)

◆ set_stop_cursor()

void Inkscape::UI::Widget::GradientWithStops::set_stop_cursor ( Glib::RefPtr< Gdk::Cursor > const *  cursor)
private

Definition at line 423 of file gradient-with-stops.cpp.

References _cursor_current.

Referenced by css_changed(), on_click_pressed(), on_click_released(), and on_motion().

◆ signal_add_stop_at()

sigc::signal< void(double)> & Inkscape::UI::Widget::GradientWithStops::signal_add_stop_at ( )
inline

◆ signal_delete_stop()

sigc::signal< void(size_t)> & Inkscape::UI::Widget::GradientWithStops::signal_delete_stop ( )
inline

◆ signal_stop_offset_changed()

sigc::signal< void(size_t, double)> & Inkscape::UI::Widget::GradientWithStops::signal_stop_offset_changed ( )
inline

◆ signal_stop_selected()

sigc::signal< void(size_t)> & Inkscape::UI::Widget::GradientWithStops::signal_stop_selected ( )
inline

◆ update()

void Inkscape::UI::Widget::GradientWithStops::update ( )
private

Definition at line 118 of file gradient-with-stops.cpp.

Referenced by modified(), and set_focused_stop().

Member Data Documentation

◆ _background_color

Gdk::RGBA Inkscape::UI::Widget::GradientWithStops::_background_color
private

Definition at line 130 of file gradient-with-stops.h.

Referenced by css_changed(), draw_func(), and GradientWithStops().

◆ _cursor_current

Glib::RefPtr<Gdk::Cursor> const* Inkscape::UI::Widget::GradientWithStops::_cursor_current = nullptr
private

Definition at line 145 of file gradient-with-stops.h.

Referenced by set_stop_cursor().

◆ _cursor_dragging

Glib::RefPtr<Gdk::Cursor> Inkscape::UI::Widget::GradientWithStops::_cursor_dragging
private

Definition at line 143 of file gradient-with-stops.h.

Referenced by css_changed(), and on_click_pressed().

◆ _cursor_insert

Glib::RefPtr<Gdk::Cursor> Inkscape::UI::Widget::GradientWithStops::_cursor_insert
private

Definition at line 144 of file gradient-with-stops.h.

Referenced by css_changed(), and get_cursor().

◆ _cursor_mouseover

Glib::RefPtr<Gdk::Cursor> Inkscape::UI::Widget::GradientWithStops::_cursor_mouseover
private

Definition at line 142 of file gradient-with-stops.h.

Referenced by css_changed(), and get_cursor().

◆ _dragging

bool Inkscape::UI::Widget::GradientWithStops::_dragging = false
private

Definition at line 135 of file gradient-with-stops.h.

Referenced by on_click_pressed(), on_click_released(), and on_motion().

◆ _focused_stop

int Inkscape::UI::Widget::GradientWithStops::_focused_stop = -1
private

Definition at line 138 of file gradient-with-stops.h.

Referenced by draw_func(), focus(), on_key_pressed(), on_motion(), and set_focused_stop().

◆ _gradient

SPGradient* Inkscape::UI::Widget::GradientWithStops::_gradient = nullptr
private

◆ _modified

sigc::scoped_connection Inkscape::UI::Widget::GradientWithStops::_modified
private

Definition at line 129 of file gradient-with-stops.h.

Referenced by set_gradient().

◆ _pointer_x

double Inkscape::UI::Widget::GradientWithStops::_pointer_x = 0
private

Definition at line 140 of file gradient-with-stops.h.

Referenced by on_click_pressed(), and on_motion().

◆ _release

sigc::scoped_connection Inkscape::UI::Widget::GradientWithStops::_release
private

Definition at line 128 of file gradient-with-stops.h.

Referenced by set_gradient().

◆ _signal_add_stop_at

sigc::signal<void (double)> Inkscape::UI::Widget::GradientWithStops::_signal_add_stop_at
private

Definition at line 133 of file gradient-with-stops.h.

Referenced by on_click_pressed(), and signal_add_stop_at().

◆ _signal_delete_stop

sigc::signal<void (size_t)> Inkscape::UI::Widget::GradientWithStops::_signal_delete_stop
private

Definition at line 134 of file gradient-with-stops.h.

Referenced by on_key_pressed(), and signal_delete_stop().

◆ _signal_stop_offset_changed

sigc::signal<void (size_t, double)> Inkscape::UI::Widget::GradientWithStops::_signal_stop_offset_changed
private

Definition at line 132 of file gradient-with-stops.h.

Referenced by move_stop(), on_motion(), and signal_stop_offset_changed().

◆ _signal_stop_selected

sigc::signal<void (size_t)> Inkscape::UI::Widget::GradientWithStops::_signal_stop_selected
private

Definition at line 131 of file gradient-with-stops.h.

Referenced by set_focused_stop(), and signal_stop_selected().

◆ _stop_move_increment

double Inkscape::UI::Widget::GradientWithStops::_stop_move_increment = 0.01
private

Definition at line 148 of file gradient-with-stops.h.

Referenced by on_key_pressed().

◆ _stop_offset

double Inkscape::UI::Widget::GradientWithStops::_stop_offset = 0
private

Definition at line 141 of file gradient-with-stops.h.

Referenced by on_click_pressed(), and on_motion().

◆ _stops

std::vector<stop_t> Inkscape::UI::Widget::GradientWithStops::_stops
private

◆ _template

svg_renderer Inkscape::UI::Widget::GradientWithStops::_template
private

Definition at line 123 of file gradient-with-stops.h.

Referenced by draw_func(), get_layout(), and get_stop_position().

◆ _tip_template

svg_renderer Inkscape::UI::Widget::GradientWithStops::_tip_template
private

Definition at line 126 of file gradient-with-stops.h.

Referenced by draw_func().


The documentation for this class was generated from the following files: