libui-ng
A portable GUI library for C
uiTable Struct Reference

A control to display data in a tabular fashion. More...

#include <ui.h>

Inheritance diagram for uiTable:
uiControl

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...
 
uiTableuiNewTable (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...
 
uiTableSelectionuiTableGetSelection (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...
 
uiControluiControlParent (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...
 
uiControluiAllocControl (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 *)
 

Detailed Description

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.

Member Function Documentation

◆ uiNewTable()

uiTable * uiNewTable ( uiTableParams params)

Creates a new table.

Parameters
paramsTable parameters.
Returns
A new uiTable instance.

◆ uiTableAppendButtonColumn()

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.

Parameters
tuiTable instance.
nameColumn title text.
A valid, NUL terminated UTF-8 string.
Data is copied internally. Ownership is not transferred.
buttonModelColumnColumn that holds the button text to be displayed.
uiTableValueTypeString
buttonClickableModelColumnColumn 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.

◆ uiTableAppendCheckboxColumn()

void uiTableAppendCheckboxColumn ( uiTable t,
const char *  name,
int  checkboxModelColumn,
int  checkboxEditableModelColumn 
)

Appends a column to the table containing a checkbox.

Parameters
tuiTable instance.
nameColumn title text.
A valid, NUL terminated UTF-8 string.
Data is copied internally. Ownership is not transferred.
checkboxModelColumnColumn that holds the data to be displayed.
uiTableValueTypeInt TRUE for a checked checkbox, FALSE otherwise.
checkboxEditableModelColumnColumn 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.

◆ uiTableAppendCheckboxTextColumn()

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.

Parameters
tuiTable instance.
nameColumn title text.
A valid, NUL terminated UTF-8 string.
Data is copied internally. Ownership is not transferred.
checkboxModelColumnColumn that holds the data to be displayed.
uiTableValueTypeInt TRUE for a checked checkbox, FALSE otherwise.
checkboxEditableModelColumnColumn 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.
textModelColumnColumn that holds the text to be displayed.
uiTableValueTypeString
textEditableModelColumnColumn 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.
textParamsText display settings, NULL to use defaults.

◆ uiTableAppendImageColumn()

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.

Parameters
tuiTable instance.
nameColumn title text.
A valid, NUL terminated UTF-8 string.
Data is copied internally. Ownership is not transferred.
imageModelColumnColumn that holds the images to be displayed.
uiTableValueTypeImage

◆ uiTableAppendImageTextColumn()

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.

Parameters
tuiTable instance.
nameColumn title text.
A valid, NUL terminated UTF-8 string.
Data is copied internally. Ownership is not transferred.
imageModelColumnColumn that holds the images to be displayed.
uiTableValueTypeImage
textModelColumnColumn that holds the text to be displayed.
uiTableValueTypeString
textEditableModelColumnColumn 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.
textParamsText display settings, NULL to use defaults.

◆ uiTableAppendProgressBarColumn()

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.

Parameters
tuiTable instance.
nameColumn title text.
A valid, NUL terminated UTF-8 string.
Data is copied internally. Ownership is not transferred.
progressModelColumnColumn that holds the data to be displayed.
uiTableValueTypeInt Integer in range of [-1, 100], see uiProgressBar for details.
See also
uiProgressBar

◆ uiTableAppendTextColumn()

void uiTableAppendTextColumn ( uiTable t,
const char *  name,
int  textModelColumn,
int  textEditableModelColumn,
uiTableTextColumnOptionalParams textParams 
)

Appends a text column to the table.

Parameters
tuiTable instance.
nameColumn title text.
A valid, NUL terminated UTF-8 string.
Data is copied internally. Ownership is not transferred.
textModelColumnColumn that holds the text to be displayed.
uiTableValueTypeString
textEditableModelColumnColumn 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.
textParamsText display settings, NULL to use defaults.

◆ uiTableColumnSetWidth()

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).

Note
Darwin currently only resizes to the column header width on -1.
Parameters
tuiTable instance.
columnColumn index.
widthColumn width to set in pixels, -1 to restore automatic column sizing.

◆ uiTableColumnWidth()

int uiTableColumnWidth ( uiTable t,
int  column 
)

Returns the table column width.

Parameters
tuiTable instance.
columnColumn index.
Returns
Column width in pixels.

◆ uiTableGetSelection()

uiTableSelection * uiTableGetSelection ( uiTable t)

Returns the current table selection.

Parameters
tuiTable instance.
Returns
The number of selected rows and corresponding row indices.
Caller is responsible for freeing the data with uiFreeTableSelection().
Note
For empty selections the Rows pointer will be NULL.

◆ uiTableGetSelectionMode()

uiTableSelectionMode uiTableGetSelectionMode ( uiTable t)

Returns the table selection mode.

Parameters
tuiTable instance.
Returns
The table selection mode. [Default uiTableSelectionModeZeroOrOne]

◆ uiTableHeaderOnClicked()

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.

Parameters
tuiTable instance.
fCallback 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.
dataUser data to be passed to the callback.
Note
Only one callback can be registered at a time.

◆ uiTableHeaderSetSortIndicator()

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.

Parameters
tuiTable instance.
columnColumn index.
indicatorSort indicator.
Note
Setting the indicator is purely visual and does not perform any sorting.

◆ uiTableHeaderSetVisible()

void uiTableHeaderSetVisible ( uiTable t,
int  visible 
)

Sets whether or not the table header is visible.

Parameters
tuiTable instance.
visibleTRUE to show header, FALSE to hide header.

◆ uiTableHeaderSortIndicator()

uiSortIndicator uiTableHeaderSortIndicator ( uiTable t,
int  column 
)

Returns the column's sort indicator displayed in the table header.

Parameters
tuiTable instance.
columnColumn index.
Returns
The current sort indicator. [Default: uiSortIndicatorNone]

◆ uiTableHeaderVisible()

int uiTableHeaderVisible ( uiTable t)

Returns whether or not the table header is visible.

Parameters
tuiTable instance.
Returns
TRUE if visible, FALSE otherwise. [Default TRUE]

◆ uiTableOnRowClicked()

void uiTableOnRowClicked ( uiTable t,
void(*)(uiTable *t, int row, void *data)  f,
void *  data 
)

Registers a callback for when the user single clicks a table row.

Parameters
tuiTable instance.
fCallback 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.
dataUser data to be passed to the callback.
Note
Only one callback can be registered at a time.

◆ uiTableOnRowDoubleClicked()

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.

Parameters
tuiTable instance.
fCallback 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.
dataUser data to be passed to the callback.
Note
The double click callback is always preceded by one uiTableOnRowClicked() callback.
Bug:
For unix systems linking against GTK < 3.14 the preceding uiTableOnRowClicked() callback will be triggered twice.
Note
Only one callback can be registered at a time.

◆ uiTableOnSelectionChanged()

void uiTableOnSelectionChanged ( uiTable t,
void(*)(uiTable *t, void *data)  f,
void *  data 
)

Registers a callback for when the table selection changed.

Parameters
tuiTable instance.
fCallback function.
sender Back reference to the instance that triggered the callback.
senderData User data registered with the sender instance.
dataUser data to be passed to the callback.
Note
The callback is not triggered when calling uiTableSetSelection() or when needing to clear the selection on uiTableSetSelectionMode().
Only one callback can be registered at a time.

◆ uiTableSetSelection()

void uiTableSetSelection ( uiTable t,
uiTableSelection sel 
)

Sets the current table selection clearing any previous selection.

Parameters
tuiTable instance.
selTable selection.
Data is copied internally. Ownership is not transferred.
Note
Selecting more rows than the selection mode allows for results in nothing happening.
For empty selections the Rows pointer is never accessed.

◆ uiTableSetSelectionMode()

void uiTableSetSelectionMode ( uiTable t,
uiTableSelectionMode  mode 
)

Sets the table selection mode.

Parameters
tuiTable instance.
modeTable selection mode to set.
Warning
All rows will be deselected if the existing selection is illegal in the new selection mode.

The documentation for this struct was generated from the following file: