lecui 1.0.0-alpha.20
lecui C++ user interface library
|
Icon widget. To instantiate and add to a container use the add static method. More...
#include <icon.h>
Public Types | |
enum class | icon_text_position { right , left , top , bottom } |
Text position in icon. More... | |
![]() | |
enum class | cursor_type { arrow , hand , caret } |
Mouse cursor type. More... | |
Public Member Functions | |
icon () | |
Constructor. | |
bool | operator== (const icon ¶m) |
Check whether widget specs are equal. Only those properties that require the widget resources to be re-created are considered. More... | |
bool | operator!= (const icon ¶m) |
Check whether widget specs are NOT equal. Only those properties that require the widget resources to be re-created are considered. More... | |
std::string & | text () override |
Get or set the widget text. More... | |
icon & | text (const std::string &text) |
Set the widget's text. More... | |
std::string & | tooltip () override |
Get or set the widget's tooltip text. More... | |
icon & | tooltip (const std::string &tooltip) |
Set the tooltip text. More... | |
badge_specs & | badge () override |
Get or set the badge specs. More... | |
icon & | badge (const badge_specs &badge) |
Set the badge specs. More... | |
lecui::rect & | rect () override |
Get or set the position and dimensions of the widget. More... | |
icon & | rect (const lecui::rect &rect) |
Set the position and dimensions of the widget. More... | |
resize_params & | on_resize () override |
Get or set the behaviour of the widget when its container is resized. More... | |
icon & | on_resize (const resize_params &on_resize) |
Set the behaviour of the widget when its container is resized. More... | |
cursor_type & | cursor () override |
Get or set the mouse cursor to use then over the widget. More... | |
icon & | cursor (const cursor_type cursor) |
Set the mouse cursor to use when over the widget. More... | |
std::string & | font () override |
Get or set the default widget font, e.g. "Georgia". More... | |
icon & | font (const std::string &font) |
Set the default widget font. More... | |
float & | font_size () override |
Get or set the default widget font size in points, e.g. 9.0f. More... | |
icon & | font_size (const float &font_size) |
Set the widget's font size. More... | |
color & | color_text () override |
Get or set the color of the widget's text. More... | |
icon & | color_text (const color &color_text) |
Set the color of the widget's text. More... | |
color & | color_fill () override |
Get or set the fill color of the widget. More... | |
icon & | color_fill (const color &color_fill) |
Set the fill color of the widget. More... | |
color & | color_hot () override |
Get or set the widget's color when the mouse is hovered over it. More... | |
icon & | color_hot (const color &color_hot) |
Set the widget's color when the mouse is hovered over it. More... | |
color & | color_selected () override |
Get or set the widget's color when selected. More... | |
icon & | color_selected (const color &color_selected) |
Set the widget's color when selected. More... | |
color & | color_disabled () override |
Get or set the widget's color when it is disabled. More... | |
icon & | color_disabled (const color &color_disabled) |
Set the widget's color when it is disabled. More... | |
float & | border () |
Get or set the thickness of the border. More... | |
icon & | border (const float &border) |
Set the thickness of the border. More... | |
color & | color_border () |
Get or set the color of the border. More... | |
icon & | color_border (const color &color_border) |
Set the color of the border. More... | |
float & | corner_radius_x () |
Get or set the horizontal radius of the corners. More... | |
icon & | corner_radius_x (const float &corner_radius_x) |
Set the horizontal radius of the corners. More... | |
float & | corner_radius_y () |
Get or set the vertical radius of the corners. More... | |
icon & | corner_radius_y (const float &corner_radius_y) |
Set the vertical radius of the corners. More... | |
float & | max_image_size () |
Get or set the maximum size of the image square's side. More... | |
icon & | max_image_size (const float &max_image_size) |
Set the maximum size of the image square's side. More... | |
color & | color_text_description () |
Get or set the color of the description text. More... | |
icon & | color_text_description (const color &color_text_description) |
Set the color of the description text. More... | |
float & | font_size_description () |
Get or set the size of the description text. More... | |
icon & | font_size_description (const float &font_size_description) |
Set the size of the description text. More... | |
int & | png_resource () |
Get or set the icon's PNG resource. More... | |
icon & | png_resource (const int &png_resource) |
Set the icon's PNG resource. More... | |
std::string & | file () |
Get or set the path to the icon's image file. More... | |
icon & | file (const std::string &file) |
Set the path to the icon's image file. More... | |
image_quality & | quality () |
Get or set the quality of the image in the icon. More... | |
icon & | quality (const image_quality &quality) |
Set the quality of the image in the icon. More... | |
std::string & | description () |
Get or set the description text. More... | |
icon & | description (const std::string &description) |
Set the description text. More... | |
icon_text_position & | text_position () |
Get or set the position of the text. More... | |
icon & | text_position (const icon_text_position &text_position) |
Set the position of the text. More... | |
float & | gap () |
Get or set the gap between the text and the image and the text. More... | |
icon & | gap (const float &gap) |
Set the gap between the text and the image and the text. More... | |
float & | padding () |
Get or set the padding to use around the icon. More... | |
icon & | padding (const float &padding) |
Set the padding to use around the icon. More... | |
float & | opacity () |
Get or set the opacity of the image. More... | |
icon & | opacity (const float &opacity) |
Set the opacity of the image. More... | |
![]() | |
widget () | |
Widget constructor. | |
virtual | ~widget () |
Widget descructor. | |
bool | operator== (const widget ¶m) |
Check whether widget's basic specifications are equal. Only those properties that require the widget's basic resources to be re-created are considered. More... | |
bool | operator!= (const widget ¶m) |
Check whether widget's basic specifications are NOT equal. Only those properties that require the widget's basic resources to be re-created are considered. More... | |
virtual std::string & | text ()=0 |
Get or set the widget text. More... | |
virtual std::string & | tooltip ()=0 |
Get or set the widget's tooltip text. More... | |
virtual lecui::rect & | rect ()=0 |
Get or set the position and dimensions of the widget. More... | |
virtual resize_params & | on_resize ()=0 |
Get or set the behaviour of the widget when its container is resized. More... | |
virtual cursor_type & | cursor ()=0 |
Get or set the mouse cursor to use then over the widget. More... | |
virtual std::string & | font ()=0 |
Get or set the default widget font, e.g. "Georgia". More... | |
virtual float & | font_size ()=0 |
Get or set the default widget font size in points, e.g. 9.0f. More... | |
virtual color & | color_text ()=0 |
Get or set the color of the widget's text. More... | |
virtual color & | color_fill ()=0 |
Get or set the fill color of the widget. More... | |
virtual color & | color_hot ()=0 |
Get or set the widget's color when the mouse is hovered over it. More... | |
virtual color & | color_selected ()=0 |
Get or set the widget's color when selected. More... | |
virtual color & | color_disabled ()=0 |
Get or set the widget's color when it's disabled. More... | |
basic_events & | events () |
Widget events. More... | |
const std::string & | alias () |
The widget's alias, either user defined or automatically generated by the library. More... | |
![]() | |
bool | operator== (const badge_widget ¶m) |
Check whether two badges are equal. Only those badge properties that require the badge's resources to be re-created are considered. More... | |
bool | operator!= (const badge_widget ¶m) |
Check whether two badges are NOT equal. Only those badge properties that require the badge's resources to be re-created are considered. More... | |
virtual badge_specs & | badge ()=0 |
Get or set the widget's badge. More... | |
Static Public Member Functions | |
static icon & | add (containers::page &page, const std::string &alias=std::string()) |
Add an icon to a container. More... | |
static icon & | get (form &fm, const std::string &path) |
Get the specifications of an icon. More... | |
Additional Inherited Members | |
![]() | |
std::string | _text |
The widget's text. | |
std::string | _tooltip |
The widget's tooltip text. | |
lecui::rect | _rect |
The widget's rectangle. | |
resize_params | _on_resize = { 0.f, 0.f, 0.f, 0.f } |
The widget's behaviour when container is resized. | |
cursor_type | _cursor = cursor_type::arrow |
The widget's cursor. | |
std::string | _font = "Segoe UI" |
The widget's font. | |
float | _font_size = 9.f |
The widget's font size. | |
color | _color_text = { 0, 0, 0, 255 } |
The color of the widget's text. | |
color | _color_fill = { 0, 120, 170, 255 } |
The fill color of the widget. | |
color | _color_hot = { 0, 120, 170, 255 } |
The color to indicate when the mouse hovers over the widget. | |
color | _color_selected = { 0, 120, 170, 30 } |
The color to indicate when the widget is selected. | |
color | _color_disabled = { 180, 180, 180, 255 } |
The color to indicate when the widget is disabled. | |
![]() | |
badge_specs | _badge |
The badge's specs. | |
Icon widget. To instantiate and add to a container use the add static method.
Recommended size with defaults is 180x58px.
|
strong |
|
static |
Add an icon to a container.
page | The container to place the widget in. |
alias | The in-page unique alias, e.g. "users". |
If an empty alias is given an internally generated random alias will be assigned.
|
overridevirtual |
Get or set the badge specs.
Implements liblec::lecui::widgets::badge_widget.
icon & liblec::lecui::widgets::icon::badge | ( | const badge_specs & | badge | ) |
Set the badge specs.
badge | The badge specs. |
float & liblec::lecui::widgets::icon::border | ( | ) |
Get or set the thickness of the border.
icon & liblec::lecui::widgets::icon::border | ( | const float & | border | ) |
Set the thickness of the border.
border | The border thickness, in pixels. |
color & liblec::lecui::widgets::icon::color_border | ( | ) |
Get or set the color of the border.
Set the color of the border.
color_border | The border color, as defined in color. |
|
overridevirtual |
Get or set the widget's color when it is disabled.
Implements liblec::lecui::widgets::widget.
Set the widget's color when it is disabled.
color_disabled | The color of the widget when it is disabled, as defined in color. |
|
overridevirtual |
Get or set the fill color of the widget.
Implements liblec::lecui::widgets::widget.
Set the fill color of the widget.
color_fill | The fill color. |
|
overridevirtual |
Get or set the widget's color when the mouse is hovered over it.
Implements liblec::lecui::widgets::widget.
Set the widget's color when the mouse is hovered over it.
color_hot | The color. |
|
overridevirtual |
Get or set the widget's color when selected.
Implements liblec::lecui::widgets::widget.
Set the widget's color when selected.
color_selected | The widget's color when selected. |
|
overridevirtual |
Get or set the color of the widget's text.
Implements liblec::lecui::widgets::widget.
Set the color of the widget's text.
color_text | The color of the widget's text. |
color & liblec::lecui::widgets::icon::color_text_description | ( | ) |
Get or set the color of the description text.
Set the color of the description text.
color_text_description | The color, as defined in color. |
float & liblec::lecui::widgets::icon::corner_radius_x | ( | ) |
Get or set the horizontal radius of the corners.
icon & liblec::lecui::widgets::icon::corner_radius_x | ( | const float & | corner_radius_x | ) |
Set the horizontal radius of the corners.
corner_radius_x | The horizontal radius of the corner, in pixels. |
float & liblec::lecui::widgets::icon::corner_radius_y | ( | ) |
Get or set the vertical radius of the corners.
icon & liblec::lecui::widgets::icon::corner_radius_y | ( | const float & | corner_radius_y | ) |
Set the vertical radius of the corners.
corner_radius_y | The horizontal radius of the corner, in pixels. |
|
overridevirtual |
Get or set the mouse cursor to use then over the widget.
Implements liblec::lecui::widgets::widget.
icon & liblec::lecui::widgets::icon::cursor | ( | const cursor_type | cursor | ) |
Set the mouse cursor to use when over the widget.
cursor | The cursor type as defined in cursor_type. |
std::string & liblec::lecui::widgets::icon::description | ( | ) |
Get or set the description text.
icon & liblec::lecui::widgets::icon::description | ( | const std::string & | description | ) |
Set the description text.
description | The description text. |
std::string & liblec::lecui::widgets::icon::file | ( | ) |
Get or set the path to the icon's image file.
icon & liblec::lecui::widgets::icon::file | ( | const std::string & | file | ) |
Set the path to the icon's image file.
file | The path to the file. |
PNG resource takes precedence over image file.
|
overridevirtual |
Get or set the default widget font, e.g. "Georgia".
Implements liblec::lecui::widgets::widget.
icon & liblec::lecui::widgets::icon::font | ( | const std::string & | font | ) |
Set the default widget font.
font | The font's name, e.g. "Georgia". |
|
overridevirtual |
Get or set the default widget font size in points, e.g. 9.0f.
Implements liblec::lecui::widgets::widget.
icon & liblec::lecui::widgets::icon::font_size | ( | const float & | font_size | ) |
Set the widget's font size.
font_size | The font size in points, e.g. 9.0f. |
float & liblec::lecui::widgets::icon::font_size_description | ( | ) |
Get or set the size of the description text.
icon & liblec::lecui::widgets::icon::font_size_description | ( | const float & | font_size_description | ) |
Set the size of the description text.
font_size_description | The size of the font, in points. |
float & liblec::lecui::widgets::icon::gap | ( | ) |
Get or set the gap between the text and the image and the text.
icon & liblec::lecui::widgets::icon::gap | ( | const float & | gap | ) |
Set the gap between the text and the image and the text.
gap | The gap, in pixels. |
Get the specifications of an icon.
fm | A reference to the form. |
path | The full path to the widget, e.g. "sample_page/sample_pane/users". |
Throws on failure. For faster coding and more readable code consider calling this static method through the helper macro provided.
float & liblec::lecui::widgets::icon::max_image_size | ( | ) |
Get or set the maximum size of the image square's side.
Set to 0.f for unlimited image size.
icon & liblec::lecui::widgets::icon::max_image_size | ( | const float & | max_image_size | ) |
Set the maximum size of the image square's side.
max_image_size | The size of the side, in pixels. |
Set to 0.f for unlimited image size.
|
overridevirtual |
Get or set the behaviour of the widget when its container is resized.
Implements liblec::lecui::widgets::widget.
icon & liblec::lecui::widgets::icon::on_resize | ( | const resize_params & | on_resize | ) |
Set the behaviour of the widget when its container is resized.
on_resize | The resize parameters as defined in resize_params. |
float & liblec::lecui::widgets::icon::opacity | ( | ) |
Get or set the opacity of the image.
icon & liblec::lecui::widgets::icon::opacity | ( | const float & | opacity | ) |
Set the opacity of the image.
opacity | The opacity of the image, as a percentage. |
bool liblec::lecui::widgets::icon::operator!= | ( | const icon & | param | ) |
Check whether widget specs are NOT equal. Only those properties that require the widget resources to be re-created are considered.
param | The specs to compare to. |
bool liblec::lecui::widgets::icon::operator== | ( | const icon & | param | ) |
Check whether widget specs are equal. Only those properties that require the widget resources to be re-created are considered.
param | The specs to compare to. |
float & liblec::lecui::widgets::icon::padding | ( | ) |
Get or set the padding to use around the icon.
icon & liblec::lecui::widgets::icon::padding | ( | const float & | padding | ) |
Set the padding to use around the icon.
padding | The padding, in pixels. |
int & liblec::lecui::widgets::icon::png_resource | ( | ) |
Get or set the icon's PNG resource.
PNG resource takes precedence over image file.
icon & liblec::lecui::widgets::icon::png_resource | ( | const int & | png_resource | ) |
Set the icon's PNG resource.
png_resource | The ID of PNG resource. |
PNG resource takes precedence over image file.
image_quality & liblec::lecui::widgets::icon::quality | ( | ) |
Get or set the quality of the image in the icon.
Lower quality means greater performance and vice-versa.
icon & liblec::lecui::widgets::icon::quality | ( | const image_quality & | quality | ) |
Set the quality of the image in the icon.
quality | The quality of the image, as defined in image_quality. |
Lower quality means greater performance and vice-versa.
|
overridevirtual |
Get or set the position and dimensions of the widget.
The position is in reference to the widget's container.
Implements liblec::lecui::widgets::widget.
icon & liblec::lecui::widgets::icon::rect | ( | const lecui::rect & | rect | ) |
Set the position and dimensions of the widget.
rect | The widget's rectangle. |
|
overridevirtual |
Get or set the widget text.
Implements liblec::lecui::widgets::widget.
icon & liblec::lecui::widgets::icon::text | ( | const std::string & | text | ) |
Set the widget's text.
text | The text. |
icon_text_position & liblec::lecui::widgets::icon::text_position | ( | ) |
Get or set the position of the text.
icon & liblec::lecui::widgets::icon::text_position | ( | const icon_text_position & | text_position | ) |
Set the position of the text.
text_position | The position of the text as defined in icon_text_position. |
|
overridevirtual |
Get or set the widget's tooltip text.
Implements liblec::lecui::widgets::widget.
icon & liblec::lecui::widgets::icon::tooltip | ( | const std::string & | tooltip | ) |
Set the tooltip text.
tooltip | The tooltip text. |