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

Table model delegate to retrieve data and inform about model changes. More...

#include <ui.h>

Public Member Functions

uiTableModeluiNewTableModel (uiTableModelHandler *mh)
 Creates a new table model. More...
 
void uiFreeTableModel (uiTableModel *m)
 Frees the table model. More...
 
void uiTableModelRowInserted (uiTableModel *m, int newIndex)
 Informs all associated uiTable views that a new row has been added. More...
 
void uiTableModelRowChanged (uiTableModel *m, int index)
 Informs all associated uiTable views that a row has been changed. More...
 
void uiTableModelRowDeleted (uiTableModel *m, int oldIndex)
 Informs all associated uiTable views that a row has been deleted. More...
 

Detailed Description

Table model delegate to retrieve data and inform about model changes.

This is a wrapper around uiTableModelHandler where the actual data is held.

The main purpose it to provide methods to the developer to signal that underlying data has changed.

Row indexes match both the row indexes in uiTable and uiTableModelHandler.

A uiTableModel can be used as the backing store for multiple uiTable views.

Once created, the number of columns and their data types are not allowed to change.

Warning
Not informing the uiTableModel about out-of-band data changes is an error. User edits via uiTable do not fall in this category.

Member Function Documentation

◆ uiFreeTableModel()

void uiFreeTableModel ( uiTableModel m)

Frees the table model.

Parameters
mTable model to free.
Warning
It is an error to free table models currently associated with a uiTable.

◆ uiNewTableModel()

uiTableModel * uiNewTableModel ( uiTableModelHandler mh)

Creates a new table model.

Parameters
mhTable model handler.
Returns
A new uiTableModel instance.

◆ uiTableModelRowChanged()

void uiTableModelRowChanged ( uiTableModel m,
int  index 
)

Informs all associated uiTable views that a row has been changed.

You do NOT need to call this in your SetCellValue() handlers, but NEED to call this if your data changes at any other point.

Parameters
mTable model that has changed.
indexIndex of the row that has changed.

◆ uiTableModelRowDeleted()

void uiTableModelRowDeleted ( uiTableModel m,
int  oldIndex 
)

Informs all associated uiTable views that a row has been deleted.

You must delete the row from your model before you call this function.

NumRows() must represent the new row count before you call this function.

Parameters
mTable model that has changed.
oldIndexIndex of the row that has been deleted.

◆ uiTableModelRowInserted()

void uiTableModelRowInserted ( uiTableModel m,
int  newIndex 
)

Informs all associated uiTable views that a new row has been added.

You must insert the row data in your model before calling this function.

NumRows() must represent the new row count before you call this function.

Parameters
mTable model that has changed.
newIndexIndex of the row that has been added.

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