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

Developer defined methods for data retrieval and setting. More...

#include <ui.h>

Public Attributes

int(* NumColumns )(uiTableModelHandler *, uiTableModel *)
 Returns the number of columns in the uiTableModel. More...
 
uiTableValueType(* ColumnType )(uiTableModelHandler *, uiTableModel *, int column)
 Returns the column type in for of a uiTableValueType. More...
 
int(* NumRows )(uiTableModelHandler *, uiTableModel *)
 Returns the number of rows in the uiTableModel. More...
 
uiTableValue *(* CellValue )(uiTableModelHandler *mh, uiTableModel *m, int row, int column)
 Returns the cell value for (row, column). More...
 
void(* SetCellValue )(uiTableModelHandler *, uiTableModel *, int, int, const uiTableValue *)
 Sets the cell value for (row, column). More...
 

Detailed Description

Developer defined methods for data retrieval and setting.

These methods get called whenever the associated uiTableModel needs to retrieve data or a uiTable wants to set data.

Warning
These methods are NOT allowed to change as soon as the uiTableModelHandler is associated with a uiTableModel.
Todo:

Validate ranges

Validate types on each getter/setter call (? table columns only?)

Member Data Documentation

◆ CellValue

uiTableValue *(* uiTableModelHandler::CellValue) (uiTableModelHandler *mh, uiTableModel *m, int row, int column)

Returns the cell value for (row, column).

Make sure to use the uiTableValue constructors. The returned value must match the uiTableValueType defined in ColumnType().

Some columns may return NULL as a special value. Refer to the appropriate uiTableAppend*Column() documentation.

Note
uiTableValue objects are automatically freed when requested by a uiTable.

◆ ColumnType

uiTableValueType(* uiTableModelHandler::ColumnType) (uiTableModelHandler *, uiTableModel *, int column)

Returns the column type in for of a uiTableValueType.

Warning
This value MUST remain constant throughout the lifetime of the uiTableModel.
This method is not guaranteed to be called depending on the system.

◆ NumColumns

int(* uiTableModelHandler::NumColumns) (uiTableModelHandler *, uiTableModel *)

Returns the number of columns in the uiTableModel.

Warning
This value MUST remain constant throughout the lifetime of the uiTableModel.
This method is not guaranteed to be called depending on the system.
Todo:
strongly check column numbers and types on all platforms so these clauses can go away

◆ NumRows

int(* uiTableModelHandler::NumRows) (uiTableModelHandler *, uiTableModel *)

Returns the number of rows in the uiTableModel.

◆ SetCellValue

void(* uiTableModelHandler::SetCellValue) (uiTableModelHandler *, uiTableModel *, int, int, const uiTableValue *)

Sets the cell value for (row, column).

It is up to the handler to decide what to do with the value: change the model or reject the change, keeping the old value.

Some columns may call this function with NULL as a special value. Refer to the appropriate uiTableAppend*Column() documentation.

Note
uiTableValue objects are automatically freed upon return when set by a uiTable.

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