libui-ng
A portable GUI library for C
|
A control to display data in a tabular fashion. More...
#include <ui.h>
Public Member Functions | |
void | uiTableAppendTextColumn (uiTable *t, const char *name, int textModelColumn, int textEditableModelColumn, uiTableTextColumnOptionalParams *textParams) |
Appends a text column to the table. More... | |
void | uiTableAppendImageColumn (uiTable *t, const char *name, int imageModelColumn) |
Appends an image column to the table. More... | |
void | uiTableAppendImageTextColumn (uiTable *t, const char *name, int imageModelColumn, int textModelColumn, int textEditableModelColumn, uiTableTextColumnOptionalParams *textParams) |
Appends a column to the table that displays both an image and text. More... | |
void | uiTableAppendCheckboxColumn (uiTable *t, const char *name, int checkboxModelColumn, int checkboxEditableModelColumn) |
Appends a column to the table containing a checkbox. More... | |
void | uiTableAppendCheckboxTextColumn (uiTable *t, const char *name, int checkboxModelColumn, int checkboxEditableModelColumn, int textModelColumn, int textEditableModelColumn, uiTableTextColumnOptionalParams *textParams) |
Appends a column to the table containing a checkbox and text. More... | |
void | uiTableAppendProgressBarColumn (uiTable *t, const char *name, int progressModelColumn) |
Appends a column to the table containing a progress bar. More... | |
void | uiTableAppendButtonColumn (uiTable *t, const char *name, int buttonModelColumn, int buttonClickableModelColumn) |
Appends a column to the table containing a button. More... | |
int | uiTableHeaderVisible (uiTable *t) |
Returns whether or not the table header is visible. More... | |
void | uiTableHeaderSetVisible (uiTable *t, int visible) |
Sets whether or not the table header is visible. More... | |
uiTable * | uiNewTable (uiTableParams *params) |
Creates a new table. More... | |
void | uiTableOnRowClicked (uiTable *t, void(*f)(uiTable *t, int row, void *data), void *data) |
Registers a callback for when the user single clicks a table row. More... | |
void | uiTableOnRowDoubleClicked (uiTable *t, void(*f)(uiTable *t, int row, void *data), void *data) |
Registers a callback for when the user double clicks a table row. More... | |
void | uiTableHeaderSetSortIndicator (uiTable *t, int column, uiSortIndicator indicator) |
Sets the column's sort indicator displayed in the table header. More... | |
uiSortIndicator | uiTableHeaderSortIndicator (uiTable *t, int column) |
Returns the column's sort indicator displayed in the table header. More... | |
void | uiTableHeaderOnClicked (uiTable *t, void(*f)(uiTable *sender, int column, void *senderData), void *data) |
Registers a callback for when a table column header is clicked. More... | |
int | uiTableColumnWidth (uiTable *t, int column) |
Returns the table column width. More... | |
void | uiTableColumnSetWidth (uiTable *t, int column, int width) |
Sets the table column width. More... | |
uiTableSelectionMode | uiTableGetSelectionMode (uiTable *t) |
Returns the table selection mode. More... | |
void | uiTableSetSelectionMode (uiTable *t, uiTableSelectionMode mode) |
Sets the table selection mode. More... | |
void | uiTableOnSelectionChanged (uiTable *t, void(*f)(uiTable *t, void *data), void *data) |
Registers a callback for when the table selection changed. More... | |
uiTableSelection * | uiTableGetSelection (uiTable *t) |
Returns the current table selection. More... | |
void | uiTableSetSelection (uiTable *t, uiTableSelection *sel) |
Sets the current table selection clearing any previous selection. More... | |
Public Member Functions inherited from uiControl | |
void | uiControlDestroy (uiControl *c) |
Dispose and free all allocated resources. More... | |
uintptr_t | uiControlHandle (uiControl *c) |
Returns the control's OS-level handle. More... | |
uiControl * | uiControlParent (uiControl *c) |
Returns the parent control. More... | |
void | uiControlSetParent (uiControl *c, uiControl *parent) |
Sets the control's parent. More... | |
int | uiControlToplevel (uiControl *c) |
Returns whether or not the control is a top level control. More... | |
int | uiControlVisible (uiControl *c) |
Returns whether or not the control is visible. More... | |
void | uiControlShow (uiControl *c) |
Shows the control. More... | |
void | uiControlHide (uiControl *c) |
Hides the control. More... | |
int | uiControlEnabled (uiControl *c) |
Returns whether or not the control is enabled. More... | |
void | uiControlEnable (uiControl *c) |
Enables the control. More... | |
void | uiControlDisable (uiControl *c) |
Disables the control. More... | |
uiControl * | uiAllocControl (size_t n, uint32_t OSsig, uint32_t typesig, const char *typenamestr) |
Allocates a uiControl. More... | |
void | uiFreeControl (uiControl *c) |
Frees the memory associated with the control reference. More... | |
void | uiControlVerifySetParent (uiControl *c, uiControl *parent) |
Makes sure the control's parent can be set to parent . More... | |
int | uiControlEnabledToUser (uiControl *c) |
Returns whether or not the control can be interacted with by the user. More... | |
Additional Inherited Members | |
Public Attributes inherited from uiControl | |
uint32_t | Signature |
uint32_t | OSSignature |
uint32_t | TypeSignature |
void(* | Destroy )(uiControl *) |
uintptr_t(* | Handle )(uiControl *) |
uiControl *(* | Parent )(uiControl *) |
void(* | SetParent )(uiControl *, uiControl *) |
int(* | Toplevel )(uiControl *) |
int(* | Visible )(uiControl *) |
void(* | Show )(uiControl *) |
void(* | Hide )(uiControl *) |
int(* | Enabled )(uiControl *) |
void(* | Enable )(uiControl *) |
void(* | Disable )(uiControl *) |
A control to display data in a tabular fashion.
The view of the architecture.
Data is retrieved from a uiTableModel via methods that you need to define in a uiTableModelHandler.
Make sure the uiTableModel columns return the right type, as specified in the uiTableAppend*Column()
parameters.
The *EditableModelColumn
parameters typically point to a uiTableModel column index, that specifies the property on a per row basis.
They can however also be passed two special values defining the property for all rows: uiTableModelColumnNeverEditable
and uiTableModelColumnAlwaysEditable
.
uiTable * uiNewTable | ( | uiTableParams * | params | ) |
void uiTableAppendButtonColumn | ( | uiTable * | t, |
const char * | name, | ||
int | buttonModelColumn, | ||
int | buttonClickableModelColumn | ||
) |
Appends a column to the table containing a button.
Button clicks are signaled to the uiTableModelHandler via a call to SetCellValue() with a value of NULL
for the buttonModelColumn
.
CellValue() must return the button text to display.
t | uiTable instance. |
name | Column title text. A valid, NUL terminated UTF-8 string.Data is copied internally. Ownership is not transferred. |
buttonModelColumn | Column that holds the button text to be displayed. uiTableValueTypeString |
buttonClickableModelColumn | Column that defines whether or not the button is clickable. uiTableValueTypeInt TRUE to make button clickable, FALSE otherwise.uiTableModelColumnNeverEditable to make all rows never clickable.uiTableModelColumnAlwaysEditable to make all rows always clickable. |
void uiTableAppendCheckboxColumn | ( | uiTable * | t, |
const char * | name, | ||
int | checkboxModelColumn, | ||
int | checkboxEditableModelColumn | ||
) |
Appends a column to the table containing a checkbox.
t | uiTable instance. |
name | Column title text. A valid, NUL terminated UTF-8 string.Data is copied internally. Ownership is not transferred. |
checkboxModelColumn | Column that holds the data to be displayed. uiTableValueTypeInt TRUE for a checked checkbox, FALSE otherwise. |
checkboxEditableModelColumn | Column that defines whether or not the checkbox is editable. uiTableValueTypeInt TRUE to make checkbox editable, FALSE otherwise.uiTableModelColumnNeverEditable to make all rows never editable.uiTableModelColumnAlwaysEditable to make all rows always editable. |
void uiTableAppendCheckboxTextColumn | ( | uiTable * | t, |
const char * | name, | ||
int | checkboxModelColumn, | ||
int | checkboxEditableModelColumn, | ||
int | textModelColumn, | ||
int | textEditableModelColumn, | ||
uiTableTextColumnOptionalParams * | textParams | ||
) |
Appends a column to the table containing a checkbox and text.
t | uiTable instance. |
name | Column title text. A valid, NUL terminated UTF-8 string.Data is copied internally. Ownership is not transferred. |
checkboxModelColumn | Column that holds the data to be displayed. uiTableValueTypeInt TRUE for a checked checkbox, FALSE otherwise. |
checkboxEditableModelColumn | Column that defines whether or not the checkbox is editable. uiTableValueTypeInt TRUE to make checkbox editable, FALSE otherwise.uiTableModelColumnNeverEditable to make all rows never editable.uiTableModelColumnAlwaysEditable to make all rows always editable. |
textModelColumn | Column that holds the text to be displayed. uiTableValueTypeString |
textEditableModelColumn | Column that defines whether or not the text is editable. uiTableValueTypeInt TRUE to make text editable, FALSE otherwise.uiTableModelColumnNeverEditable to make all rows never editable.uiTableModelColumnAlwaysEditable to make all rows always editable. |
textParams | Text display settings, NULL to use defaults. |
void uiTableAppendImageColumn | ( | uiTable * | t, |
const char * | name, | ||
int | imageModelColumn | ||
) |
Appends an image column to the table.
Images are drawn at icon size, using the representation that best fits the pixel density of the screen.
t | uiTable instance. |
name | Column title text. A valid, NUL terminated UTF-8 string.Data is copied internally. Ownership is not transferred. |
imageModelColumn | Column that holds the images to be displayed. uiTableValueTypeImage |
void uiTableAppendImageTextColumn | ( | uiTable * | t, |
const char * | name, | ||
int | imageModelColumn, | ||
int | textModelColumn, | ||
int | textEditableModelColumn, | ||
uiTableTextColumnOptionalParams * | textParams | ||
) |
Appends a column to the table that displays both an image and text.
Images are drawn at icon size, using the representation that best fits the pixel density of the screen.
t | uiTable instance. |
name | Column title text. A valid, NUL terminated UTF-8 string.Data is copied internally. Ownership is not transferred. |
imageModelColumn | Column that holds the images to be displayed. uiTableValueTypeImage |
textModelColumn | Column that holds the text to be displayed. uiTableValueTypeString |
textEditableModelColumn | Column that defines whether or not the text is editable. uiTableValueTypeInt TRUE to make text editable, FALSE otherwise.uiTableModelColumnNeverEditable to make all rows never editable.uiTableModelColumnAlwaysEditable to make all rows always editable. |
textParams | Text display settings, NULL to use defaults. |
void uiTableAppendProgressBarColumn | ( | uiTable * | t, |
const char * | name, | ||
int | progressModelColumn | ||
) |
Appends a column to the table containing a progress bar.
The workings and valid range are exactly the same as that of uiProgressBar.
t | uiTable instance. |
name | Column title text. A valid, NUL terminated UTF-8 string.Data is copied internally. Ownership is not transferred. |
progressModelColumn | Column that holds the data to be displayed. uiTableValueTypeInt Integer in range of [-1, 100] , see uiProgressBar for details. |
void uiTableAppendTextColumn | ( | uiTable * | t, |
const char * | name, | ||
int | textModelColumn, | ||
int | textEditableModelColumn, | ||
uiTableTextColumnOptionalParams * | textParams | ||
) |
Appends a text column to the table.
t | uiTable instance. |
name | Column title text. A valid, NUL terminated UTF-8 string.Data is copied internally. Ownership is not transferred. |
textModelColumn | Column that holds the text to be displayed. uiTableValueTypeString |
textEditableModelColumn | Column that defines whether or not the text is editable. uiTableValueTypeInt TRUE to make text editable, FALSE otherwise.uiTableModelColumnNeverEditable to make all rows never editable.uiTableModelColumnAlwaysEditable to make all rows always editable. |
textParams | Text display settings, NULL to use defaults. |
void uiTableColumnSetWidth | ( | uiTable * | t, |
int | column, | ||
int | width | ||
) |
Sets the table column width.
Setting the width to -1
will restore automatic column sizing matching either the width of the content or column header (which ever one is bigger).
-1
.t | uiTable instance. |
column | Column index. |
width | Column width to set in pixels, -1 to restore automatic column sizing. |
int uiTableColumnWidth | ( | uiTable * | t, |
int | column | ||
) |
Returns the table column width.
t | uiTable instance. |
column | Column index. |
uiTableSelection * uiTableGetSelection | ( | uiTable * | t | ) |
Returns the current table selection.
t | uiTable instance. |
uiFreeTableSelection()
.Rows
pointer will be NULL. uiTableSelectionMode uiTableGetSelectionMode | ( | uiTable * | t | ) |
Returns the table selection mode.
t | uiTable instance. |
uiTableSelectionModeZeroOrOne
] void uiTableHeaderOnClicked | ( | uiTable * | t, |
void(*)(uiTable *sender, int column, void *senderData) | f, | ||
void * | data | ||
) |
Registers a callback for when a table column header is clicked.
t | uiTable instance. |
f | Callback function.sender Back reference to the instance that triggered the callback.column Column index that was clicked.senderData User data registered with the sender instance. |
data | User data to be passed to the callback. |
void uiTableHeaderSetSortIndicator | ( | uiTable * | t, |
int | column, | ||
uiSortIndicator | indicator | ||
) |
Sets the column's sort indicator displayed in the table header.
Use this to display appropriate arrows in the table header to indicate a sort direction.
t | uiTable instance. |
column | Column index. |
indicator | Sort indicator. |
void uiTableHeaderSetVisible | ( | uiTable * | t, |
int | visible | ||
) |
Sets whether or not the table header is visible.
t | uiTable instance. |
visible | TRUE to show header, FALSE to hide header. |
uiSortIndicator uiTableHeaderSortIndicator | ( | uiTable * | t, |
int | column | ||
) |
Returns the column's sort indicator displayed in the table header.
t | uiTable instance. |
column | Column index. |
uiSortIndicatorNone
] int uiTableHeaderVisible | ( | uiTable * | t | ) |
Returns whether or not the table header is visible.
t | uiTable instance. |
TRUE
if visible, FALSE
otherwise. [Default TRUE
] Registers a callback for when the user single clicks a table row.
t | uiTable instance. |
f | Callback function.sender Back reference to the instance that triggered the callback.row Row index that was clicked.senderData User data registered with the sender instance. |
data | User data to be passed to the callback. |
void uiTableOnRowDoubleClicked | ( | uiTable * | t, |
void(*)(uiTable *t, int row, void *data) | f, | ||
void * | data | ||
) |
Registers a callback for when the user double clicks a table row.
t | uiTable instance. |
f | Callback function.sender Back reference to the instance that triggered the callback.row Row index that was double clicked.senderData User data registered with the sender instance. |
data | User data to be passed to the callback. |
GTK < 3.14
the preceding uiTableOnRowClicked() callback will be triggered twice. Registers a callback for when the table selection changed.
t | uiTable instance. |
f | Callback function.sender Back reference to the instance that triggered the callback.senderData User data registered with the sender instance. |
data | User data to be passed to the callback. |
void uiTableSetSelection | ( | uiTable * | t, |
uiTableSelection * | sel | ||
) |
Sets the current table selection clearing any previous selection.
t | uiTable instance. |
sel | Table selection. Data is copied internally. Ownership is not transferred. |
void uiTableSetSelectionMode | ( | uiTable * | t, |
uiTableSelectionMode | mode | ||
) |
Sets the table selection mode.
t | uiTable instance. |
mode | Table selection mode to set. |