|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
Custom button to be drawn inside drawing areas. More...
#include <src/gui/backend/gtk_widgets/custom_button.h>

Public Types | |
| enum class | State { NORMAL , HOVERED , ACTIVE , TOGGLED , SEMI_TOGGLED } |
| enum class | Owner { TRACK , LANE , AT } |
Public Member Functions | |
| CustomButtonWidget (const std::string &iicon_name, int isize) | |
| CustomButtonWidget (const CustomButtonWidget &)=delete | |
| CustomButtonWidget & | operator= (const CustomButtonWidget &)=delete |
| CustomButtonWidget (CustomButtonWidget &&)=default | |
| CustomButtonWidget & | operator= (CustomButtonWidget &&)=default |
| void | draw (GtkSnapshot *snapshot, double ix, double iy, State state) |
| void | draw_with_text (GtkSnapshot *snapshot, double ix, double iy, double iwidth, State state) |
| void | set_text (PangoLayout *ilayout, const std::string &itext, const std::string &font_descr) |
| Sets the text and layout to draw the text width. | |
Data Fields | |
| Color | def_color = {} |
| Default color. | |
| Color | hovered_color = {} |
| Hovered color. | |
| Color | toggled_color = {} |
| Toggled color. | |
| Color | held_color = {} |
| Held color (used after clicking and before releasing). | |
| std::string | icon_name |
| Name of the icon to show. | |
| int | size = 0 |
| Size in pixels (width and height will be set to this). | |
| int | width = 0 |
| if non-zero, the button has "size" height and this width. | |
| double | aspect = 1.0 |
| Aspect ratio for the rounded rectangle. | |
| double | corner_radius = 0.0 |
| Corner curvature radius for the rounded rectangle. | |
| GdkTexture * | icon_texture = nullptr |
| The icon surface. | |
| State | last_state = State::NORMAL |
| Used to update caches if state changed. | |
| Owner | owner_type = Owner::TRACK |
| Owner type. | |
| void * | owner = nullptr |
| Owner. | |
| Color | last_color = {} |
| Used during transitions. | |
| std::string | text |
| Text, if any, to show after the icon. | |
| int | text_height = 0 |
| PangoLayout * | layout = nullptr |
| Cache layout for drawing the text. | |
| double | x = 0 |
| X/y relative to parent drawing area. | |
| double | y = 0 |
| unsigned int | button_id = 0 |
| The id of the button returned by a symap of its icon name, for better performance vs comparing strings. | |
| int | transition_frames = 0 |
| Frames left for a transition in color. | |
Custom button to be drawn inside drawing areas.
Definition at line 29 of file custom_button.h.
|
strong |
Definition at line 43 of file custom_button.h.
|
strong |
| Enumerator | |
|---|---|
| SEMI_TOGGLED | Only border is toggled. |
Definition at line 32 of file custom_button.h.
| void CustomButtonWidget::draw_with_text | ( | GtkSnapshot * | snapshot, |
| double | ix, | ||
| double | iy, | ||
| double | iwidth, | ||
| State | state ) |
| width | Max width for the button to use. |
| void CustomButtonWidget::set_text | ( | PangoLayout * | ilayout, |
| const std::string & | itext, | ||
| const std::string & | font_descr ) |
Sets the text and layout to draw the text width.
| font_descr | Font description to set the pango layout font to. |
| double CustomButtonWidget::aspect = 1.0 |
Aspect ratio for the rounded rectangle.
Definition at line 125 of file custom_button.h.
| unsigned int CustomButtonWidget::button_id = 0 |
The id of the button returned by a symap of its icon name, for better performance vs comparing strings.
TODO
Definition at line 168 of file custom_button.h.
| double CustomButtonWidget::corner_radius = 0.0 |
Corner curvature radius for the rounded rectangle.
Definition at line 128 of file custom_button.h.
| Color CustomButtonWidget::def_color = {} |
Default color.
Definition at line 103 of file custom_button.h.
| Color CustomButtonWidget::held_color = {} |
Held color (used after clicking and before releasing).
Definition at line 113 of file custom_button.h.
| Color CustomButtonWidget::hovered_color = {} |
Hovered color.
Definition at line 106 of file custom_button.h.
| std::string CustomButtonWidget::icon_name |
Name of the icon to show.
Definition at line 116 of file custom_button.h.
| GdkTexture* CustomButtonWidget::icon_texture = nullptr |
The icon surface.
Definition at line 131 of file custom_button.h.
| Color CustomButtonWidget::last_color = {} |
Used during transitions.
Definition at line 143 of file custom_button.h.
| State CustomButtonWidget::last_state = State::NORMAL |
Used to update caches if state changed.
Definition at line 134 of file custom_button.h.
| PangoLayout* CustomButtonWidget::layout = nullptr |
Cache layout for drawing the text.
Definition at line 155 of file custom_button.h.
| void* CustomButtonWidget::owner = nullptr |
Owner.
Definition at line 140 of file custom_button.h.
| Owner CustomButtonWidget::owner_type = Owner::TRACK |
Owner type.
Definition at line 137 of file custom_button.h.
| int CustomButtonWidget::size = 0 |
Size in pixels (width and height will be set to this).
Definition at line 119 of file custom_button.h.
| std::string CustomButtonWidget::text |
Text, if any, to show after the icon.
This will be ellipsized.
Definition at line 150 of file custom_button.h.
| int CustomButtonWidget::text_height = 0 |
Definition at line 152 of file custom_button.h.
| Color CustomButtonWidget::toggled_color = {} |
Toggled color.
Definition at line 109 of file custom_button.h.
| int CustomButtonWidget::transition_frames = 0 |
Frames left for a transition in color.
Definition at line 171 of file custom_button.h.
| int CustomButtonWidget::width = 0 |
if non-zero, the button has "size" height and this width.
Definition at line 122 of file custom_button.h.
| double CustomButtonWidget::x = 0 |
X/y relative to parent drawing area.
Definition at line 158 of file custom_button.h.
| double CustomButtonWidget::y = 0 |
Definition at line 159 of file custom_button.h.