lecui 1.0.0-alpha.20
lecui C++ user interface library
|
Table view widget. To instantiate and add to a container use the add static method. More...
#include <table_view.h>
Classes | |
struct | table_view_events |
Events specific to this widget. More... | |
Public Member Functions | |
table_view () | |
Constructor. | |
table_view_events & | events () |
Get or set table view events. More... | |
bool | operator== (const table_view ¶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 table_view ¶m) |
Check whether widget specs are NOT equal. Only those properties that require the widget resources to be re-created are considered. More... | |
table_view & | operator= (const table_view ¶m) |
Copy table view specs. Only essential properties are copied. More... | |
table_view (const table_view ¶m) | |
Copy constructor. More... | |
std::string & | text () override |
Get or set the widget text. More... | |
table_view & | text (const std::string &text) |
Set the widget's text. More... | |
std::string & | tooltip () override |
Get or set the widget's tooltip text. More... | |
table_view & | tooltip (const std::string &tooltip) |
Set the tooltip text. More... | |
lecui::rect & | rect () override |
Get or set the position and dimensions of the widget. More... | |
table_view & | 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... | |
table_view & | 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... | |
table_view & | 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... | |
table_view & | 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... | |
table_view & | 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... | |
table_view & | 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... | |
table_view & | 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... | |
table_view & | 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... | |
table_view & | 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... | |
table_view & | 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... | |
table_view & | border (const float &border) |
Set the thickness of the border. More... | |
float & | grid_line () |
Get or set the thickness of the grid-lines. More... | |
table_view & | grid_line (const float &grid_line) |
Set the thickness of the grid-line. More... | |
color & | color_border () |
Get or set the color of the border. More... | |
table_view & | 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... | |
table_view & | 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... | |
table_view & | corner_radius_y (const float &corner_radius_y) |
Set the vertical radius of the corners. More... | |
color & | color_text_selected () |
Get or set the color of the text in a selected row. More... | |
table_view & | color_text_selected (const color &color_text_selected) |
Set the color of the text in a selected row. More... | |
color & | color_grid () |
Get or set the color of the grid lines. More... | |
table_view & | color_grid (const color &color_grid) |
Set the color of the grid lines. More... | |
color & | color_text_header () |
Get or set the color of the header text. More... | |
table_view & | color_text_header (const color &color_text_header) |
Set the color of the header text. More... | |
color & | color_text_header_hot () |
Get or set the color of the header text when the mouse is over it (if user sorting is allowed). More... | |
table_view & | color_text_header_hot (const color &color_text_header_hot) |
Set the color of the header text when the mouse is over it (if user sorting is allowed). More... | |
color & | color_fill_header () |
Get or set the table header's fill color. More... | |
table_view & | color_fill_header (const color &color_fill_header) |
Set the table header's fill color. More... | |
color & | color_fill_alternate () |
Get or set the table's alternate row color (used for the background of even rows). More... | |
table_view & | color_fill_alternate (const color &color_fill_alternate) |
Set the table's alternate row color (used for the background of even rows). More... | |
color & | color_row_hot () |
Get or set the background color of a row when the mouse is over it. More... | |
table_view & | color_row_hot (const color &color_row_hot) |
Set the background color of a row when the mouse is over it. More... | |
color & | color_row_selected () |
Get or set the background color of a selected row. More... | |
table_view & | color_row_selected (const color &color_row_selected) |
Set the background color of a selected row. More... | |
std::vector< table_column > & | columns () |
Get or set the table view columns. More... | |
table_view & | columns (const std::vector< table_column > &columns) |
Set the table view columns. More... | |
std::vector< table_row > & | data () |
Get or set the table's data. Each entry of the vector (a map) is a row and should mirror the column structure. The key is the column name and the value is the contents of the cell. Therefore the map size should be equivalent to the number of columns, while the size of the vector will determine the number of rows. More... | |
table_view & | data (const std::vector< table_row > &data) |
Set the table's data. Each entry of the vector (a map) is a row and should mirror the column structure. The key is the column name and the value is the contents of the cell. Therefore the map size should be equivalent to the number of columns, while the size of the vector will determine the number of rows. More... | |
std::vector< long > & | selected () |
Get or set the rows to select by default, numbered from 0. More... | |
table_view & | selected (const std::vector< long > &selected) |
Set the rows to select by default, numbered from 0. More... | |
bool & | user_sort () |
Get or set whether to allow sorting by clicking columns. More... | |
table_view & | user_sort (const bool &user_sort) |
Set whether to allow sorting by clicking columns. More... | |
bool & | fixed_number_column () |
Get or set whether to add a fixed number column. More... | |
table_view & | fixed_number_column (const bool &fixed_number_column) |
Set whether to add a fixed number column. More... | |
std::string & | fixed_number_column_name () |
Get or set the name of the fixed number column. More... | |
table_view & | fixed_number_column_name (const std::string &fixed_number_column_name) |
Set the name of the fixed number column. More... | |
void | scroll_vertically (const float &amount) |
Programmatically scroll the table vertically. More... | |
void | scroll_horizontally (const float &amount) |
Programmatically scroll the table horizontally. 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... | |
Static Public Member Functions | |
static table_view & | add (containers::page &page, const std::string &alias=std::string()) |
Add a table_view to a container. More... | |
static table_view & | get (form &fm, const std::string &path) |
Get the specifications of a table_view. More... | |
Additional Inherited Members | |
![]() | |
enum class | cursor_type { arrow , hand , caret } |
Mouse cursor type. More... | |
![]() | |
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. | |
Table view widget. To instantiate and add to a container use the add static method.
Default size is 200x200px.
liblec::lecui::widgets::table_view::table_view | ( | const table_view & | param | ) |
Copy constructor.
param | The table view specs to copy. |
|
static |
Add a table_view to a container.
page | The container to place the widget in. |
alias | The in-page unique alias, e.g. "debtors". |
If an empty alias is given an internally generated random alias will be assigned.
float & liblec::lecui::widgets::table_view::border | ( | ) |
Get or set the thickness of the border.
table_view & liblec::lecui::widgets::table_view::border | ( | const float & | border | ) |
Set the thickness of the border.
border | The border thickness, in pixels. |
color & liblec::lecui::widgets::table_view::color_border | ( | ) |
Get or set the color of the border.
table_view & liblec::lecui::widgets::table_view::color_border | ( | const color & | color_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.
table_view & liblec::lecui::widgets::table_view::color_disabled | ( | const color & | color_disabled | ) |
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.
table_view & liblec::lecui::widgets::table_view::color_fill | ( | const color & | color_fill | ) |
Set the fill color of the widget.
color_fill | The fill color. |
color & liblec::lecui::widgets::table_view::color_fill_alternate | ( | ) |
Get or set the table's alternate row color (used for the background of even rows).
table_view & liblec::lecui::widgets::table_view::color_fill_alternate | ( | const color & | color_fill_alternate | ) |
Set the table's alternate row color (used for the background of even rows).
color_fill_alternate |
color & liblec::lecui::widgets::table_view::color_fill_header | ( | ) |
Get or set the table header's fill color.
table_view & liblec::lecui::widgets::table_view::color_fill_header | ( | const color & | color_fill_header | ) |
Set the table header's fill color.
color_fill_header | The color. |
color & liblec::lecui::widgets::table_view::color_grid | ( | ) |
Get or set the color of the grid lines.
table_view & liblec::lecui::widgets::table_view::color_grid | ( | const color & | color_grid | ) |
Set the color of the grid lines.
color_grid | The color. |
|
overridevirtual |
Get or set the widget's color when the mouse is hovered over it.
Implements liblec::lecui::widgets::widget.
table_view & liblec::lecui::widgets::table_view::color_hot | ( | const color & | color_hot | ) |
Set the widget's color when the mouse is hovered over it.
color_hot | The color. |
color & liblec::lecui::widgets::table_view::color_row_hot | ( | ) |
Get or set the background color of a row when the mouse is over it.
table_view & liblec::lecui::widgets::table_view::color_row_hot | ( | const color & | color_row_hot | ) |
Set the background color of a row when the mouse is over it.
color_row_hot | The color. |
color & liblec::lecui::widgets::table_view::color_row_selected | ( | ) |
Get or set the background color of a selected row.
table_view & liblec::lecui::widgets::table_view::color_row_selected | ( | const color & | color_row_selected | ) |
Set the background color of a selected row.
color_row_selected | The color. |
|
overridevirtual |
Get or set the widget's color when selected.
Implements liblec::lecui::widgets::widget.
table_view & liblec::lecui::widgets::table_view::color_selected | ( | const color & | color_selected | ) |
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.
table_view & liblec::lecui::widgets::table_view::color_text | ( | const color & | color_text | ) |
Set the color of the widget's text.
color_text | The color of the widget's text. |
color & liblec::lecui::widgets::table_view::color_text_header | ( | ) |
Get or set the color of the header text.
table_view & liblec::lecui::widgets::table_view::color_text_header | ( | const color & | color_text_header | ) |
Set the color of the header text.
color_text_header | The color. |
color & liblec::lecui::widgets::table_view::color_text_header_hot | ( | ) |
Get or set the color of the header text when the mouse is over it (if user sorting is allowed).
table_view & liblec::lecui::widgets::table_view::color_text_header_hot | ( | const color & | color_text_header_hot | ) |
Set the color of the header text when the mouse is over it (if user sorting is allowed).
color_text_header_hot | The color. |
color & liblec::lecui::widgets::table_view::color_text_selected | ( | ) |
Get or set the color of the text in a selected row.
table_view & liblec::lecui::widgets::table_view::color_text_selected | ( | const color & | color_text_selected | ) |
Set the color of the text in a selected row.
color_text_selected | The color. |
std::vector< table_column > & liblec::lecui::widgets::table_view::columns | ( | ) |
Get or set the table view columns.
Two columns can be defined as follows: columns = { { "Name", 130 }, { "Surname", 210 } };
table_view & liblec::lecui::widgets::table_view::columns | ( | const std::vector< table_column > & | columns | ) |
Set the table view columns.
columns | The list of columns. |
Two columns can be defined as follows: columns = { { "Name", 130 }, { "Surname", 210 } };
float & liblec::lecui::widgets::table_view::corner_radius_x | ( | ) |
Get or set the horizontal radius of the corners.
table_view & liblec::lecui::widgets::table_view::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::table_view::corner_radius_y | ( | ) |
Get or set the vertical radius of the corners.
table_view & liblec::lecui::widgets::table_view::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.
table_view & liblec::lecui::widgets::table_view::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::vector< table_row > & liblec::lecui::widgets::table_view::data | ( | ) |
Get or set the table's data. Each entry of the vector (a map) is a row and should mirror the column structure. The key is the column name and the value is the contents of the cell. Therefore the map size should be equivalent to the number of columns, while the size of the vector will determine the number of rows.
A table with two columns 'Name' and 'Surname' can be populated as follows to a total of three rows: data = { { {"Name", "Emily Yolanda"}, { "Surname", "Moyo" } }, { {"Name", "Tanaka"}, {"Surname", "Sibanda"} }, { {"Name", "Precious"}, {"Surname", "Ncube"} }
table_view & liblec::lecui::widgets::table_view::data | ( | const std::vector< table_row > & | data | ) |
Set the table's data. Each entry of the vector (a map) is a row and should mirror the column structure. The key is the column name and the value is the contents of the cell. Therefore the map size should be equivalent to the number of columns, while the size of the vector will determine the number of rows.
data | The table's data. |
A table with two columns 'Name' and 'Surname' can be populated as follows to a total of three rows: data = { { {"Name", "Emily Yolanda"}, { "Surname", "Moyo" } }, { {"Name", "Tanaka"}, {"Surname", "Sibanda"} }, { {"Name", "Precious"}, {"Surname", "Ncube"} }
|
inline |
Get or set table view events.
bool & liblec::lecui::widgets::table_view::fixed_number_column | ( | ) |
Get or set whether to add a fixed number column.
Counts from 1 and is not sorted when the table's columns are user sorted.
table_view & liblec::lecui::widgets::table_view::fixed_number_column | ( | const bool & | fixed_number_column | ) |
Set whether to add a fixed number column.
fixed_number_column | The property. |
Counts from 1 and is not sorted when the table's columns are user sorted.
std::string & liblec::lecui::widgets::table_view::fixed_number_column_name | ( | ) |
Get or set the name of the fixed number column.
table_view & liblec::lecui::widgets::table_view::fixed_number_column_name | ( | const std::string & | fixed_number_column_name | ) |
Set the name of the fixed number column.
fixed_number_column_name | The property. |
|
overridevirtual |
Get or set the default widget font, e.g. "Georgia".
Implements liblec::lecui::widgets::widget.
table_view & liblec::lecui::widgets::table_view::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.
table_view & liblec::lecui::widgets::table_view::font_size | ( | const float & | font_size | ) |
Set the widget's font size.
font_size | The font size in points, e.g. 9.0f. |
|
static |
Get the specifications of a table_view.
fm | A reference to the form. |
path | The full path to the widget, e.g. "sample_page/sample_pane/debtors". |
Throws on failure. For faster coding and more readable code consider calling this static method through the helper macro provided.
float & liblec::lecui::widgets::table_view::grid_line | ( | ) |
Get or set the thickness of the grid-lines.
table_view & liblec::lecui::widgets::table_view::grid_line | ( | const float & | grid_line | ) |
Set the thickness of the grid-line.
grid_line | The line thickness, in pixels. |
|
overridevirtual |
Get or set the behaviour of the widget when its container is resized.
Implements liblec::lecui::widgets::widget.
table_view & liblec::lecui::widgets::table_view::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. |
bool liblec::lecui::widgets::table_view::operator!= | ( | const table_view & | 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. |
table_view & liblec::lecui::widgets::table_view::operator= | ( | const table_view & | param | ) |
Copy table view specs. Only essential properties are copied.
param | The table view specs to copy. |
bool liblec::lecui::widgets::table_view::operator== | ( | const table_view & | 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. |
|
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.
table_view & liblec::lecui::widgets::table_view::rect | ( | const lecui::rect & | rect | ) |
Set the position and dimensions of the widget.
rect | The widget's rectangle. |
void liblec::lecui::widgets::table_view::scroll_horizontally | ( | const float & | amount | ) |
Programmatically scroll the table horizontally.
amount | The amount of pixels to scroll the table by. |
A negative value moves the table to the left; it's equivalent to sliding the horizontal scroll bar towards the right, and vice-versa. If the table has no horizontal scroll bar this method has no effect.
void liblec::lecui::widgets::table_view::scroll_vertically | ( | const float & | amount | ) |
Programmatically scroll the table vertically.
amount | The amount of pixels to scroll the table by. |
A negative value moves the table upwards; it's equivalent to sliding the vertical scroll bar downwards, and vice-versa. If the table has no vertical scroll bar this method has no effect.
std::vector< long > & liblec::lecui::widgets::table_view::selected | ( | ) |
Get or set the rows to select by default, numbered from 0.
table_view & liblec::lecui::widgets::table_view::selected | ( | const std::vector< long > & | selected | ) |
Set the rows to select by default, numbered from 0.
selected | The selected rows. |
|
overridevirtual |
Get or set the widget text.
This property is not used.
Implements liblec::lecui::widgets::widget.
table_view & liblec::lecui::widgets::table_view::text | ( | const std::string & | text | ) |
Set the widget's text.
text | The text. |
This property is not used.
|
overridevirtual |
Get or set the widget's tooltip text.
This property is not used.
Implements liblec::lecui::widgets::widget.
table_view & liblec::lecui::widgets::table_view::tooltip | ( | const std::string & | tooltip | ) |
Set the tooltip text.
tooltip | The tooltip text. |
This property is not used.
bool & liblec::lecui::widgets::table_view::user_sort | ( | ) |
Get or set whether to allow sorting by clicking columns.
table_view & liblec::lecui::widgets::table_view::user_sort | ( | const bool & | user_sort | ) |
Set whether to allow sorting by clicking columns.
user_sort | The property. |