Class to create a list view with each line made up of one or more gadgets.
More...
#include <gadgetlistview.h>
|
void | setup (tbx::Window window, tbx::res::ResWindow &res_window, tbx::ComponentId first_gadget_id, tbx::ComponentId last_gadget_id, unsigned int spacing, bool first_row_created) |
| Setup the gadget list view. More...
|
|
unsigned int | num_gadgets () const |
| Return the number of gadgets in a row.
|
|
unsigned int | count () const |
| Return the number of rows.
|
|
tbx::Window & | window () |
| Return the window this view is attached to.
|
|
const tbx::Margin & | margin () const |
| Return the margin around the data in the window.
|
|
void | margin (const tbx::Margin &margin) |
| Set the margin around the view to the edge of the extent. More...
|
|
void | copy_interface (GadgetListCopyRow *copy) |
| Set object that implement the copy row interface to copy data from one row to another. More...
|
|
bool | updates_enabled () const |
| Check if updating of the window extent is enabled. More...
|
|
void | updates_enabled (bool enabled) |
| Set if updating of the window extent is enabled. More...
|
|
void | update_window_extent () |
| Update the windows extents to fit the current size of the list and its margin.
|
|
tbx::ComponentId | gadget_id (int row, int col) const |
| Return the gadget_id for a specific row and column. More...
|
|
tbx::Gadget | gadget (int row, int col) |
| Return the gadget for a specified row and column. More...
|
|
tbx::ComponentId | add (unsigned int count=1) |
| Add row(s) to the end of the list. More...
|
|
tbx::ComponentId | insert (unsigned int row, unsigned int count=1) |
| Insert row(s) before the given row number. More...
|
|
void | remove (unsigned int row, unsigned int count=1) |
| Remove row(s) from the list. More...
|
|
void | clear () |
| Clear all gadgets from the list.
|
|
void | copy (unsigned int from_row, unsigned int to_row) |
| Use currently assigned copy function to copy from one row to another. More...
|
|
Class to create a list view with each line made up of one or more gadgets.
Add row(s) to the end of the list.
- Parameters
-
count | number of rows to add (default 1) |
- Returns
- id of the first component in the new rows
- Exceptions
-
std::invalid_argument | if count is 0 |
void tbx::view::GadgetListView::copy |
( |
unsigned int |
from_row, |
|
|
unsigned int |
to_row |
|
) |
| |
Use currently assigned copy function to copy from one row to another.
- Parameters
-
from_row | row to copy from |
to_row | row to copy to |
Set object that implement the copy row interface to copy data from one row to another.
If not set the default will copy the "value/text" property for some of the standard gadgets.
- Parameters
-
copy | object implementing the GadgetListCopyRow interface or 0 to restore it to the default. |
tbx::Gadget tbx::view::GadgetListView::gadget |
( |
int |
row, |
|
|
int |
col |
|
) |
| |
|
inline |
Return the gadget for a specified row and column.
tbx::ComponentId tbx::view::GadgetListView::gadget_id |
( |
int |
row, |
|
|
int |
col |
|
) |
| const |
|
inline |
Return the gadget_id for a specific row and column.
- Parameters
-
row | the 0 based row number |
col | the 0 based column number |
- Returns
- component id at the given row or column
tbx::ComponentId tbx::view::GadgetListView::insert |
( |
unsigned int |
row, |
|
|
unsigned int |
count = 1 |
|
) |
| |
Insert row(s) before the given row number.
The new rows are not cleared or initialised, so must be initialised after calling this function.
- Parameters
-
row | the number of the row to insert before. Can be the value of count() to insert at the end. |
count | the number of rows to insert (default 1) |
- Returns
- id of the first component in the first new row
- Exceptions
-
std::out_of_range | if row is greater than count() |
std::invalid_argument | if count is 0 |
void tbx::view::GadgetListView::margin |
( |
const tbx::Margin & |
margin | ) |
|
Set the margin around the view to the edge of the extent.
Changing the top or left will move any gadgets already added to the list
- Parameters
-
void tbx::view::GadgetListView::remove |
( |
unsigned int |
row, |
|
|
unsigned int |
count = 1 |
|
) |
| |
Remove row(s) from the list.
- Parameters
-
row | first row to remove |
count | number of rows to remove (default 1) |
- Exceptions
-
std::out_of_range | if row >= count() or row + count > count() |
std::invalid_argument | if count == 0 |
Setup the gadget list view.
The margin is calculated from the bounding box of the gadget compared to the window extent. first_gadget_id to last_gadget_id must be a continuos range new rows are created with ids from last_gadget_id + 1
- Parameters
-
window | - the window gadgets will be created on |
res_window | - The resource to get the gadget templates from and calculate the margin |
first_gadget_id | - id of first gadget for list in resource |
last_gadget_id | - id of last gadget for list in resource |
spacing | vertical spacing between rows |
first_row_created | true if the first row of the list has already been created |
bool tbx::view::GadgetListView::updates_enabled |
( |
| ) |
const |
|
inline |
Check if updating of the window extent is enabled.
- Returns
- true if updates are enabled
void tbx::view::GadgetListView::updates_enabled |
( |
bool |
enabled | ) |
|
|
inline |
Set if updating of the window extent is enabled.
After turning on updates call update_window_extent to refresh the windows extent &
- Parameters
-
enabled | true to turn on extent updates |
The documentation for this class was generated from the following files: