SophiaFramework UNIVERSE 5.3 |
#include <SFOTableModel.h.hpp>
class SFOTableModel : public SFOTableModelBase;
SFMTYPEDEFREFOBJECT(SFOTableModel)
This class is an concrete table model class which is used by the SFZTableView class.
This class implements various interfaces to access the table model.
Table data is implemented as an array (SFXArray) of table items [rows] (SFXTableItemBase).
Constructor/Destructor |
---|
SFOTableModel( Void ) Constructor of the SFOTableModel class.
|
~SFOTableModel( Void ) Destructor of the SFOTableModel class.
|
Public Functions | |
---|---|
SFXAnyPtr |
GetColumnRow(
SInt32 col
, SInt32 row
) Get the pointer to the cell object specified by row-column indices.
|
SInt32 |
GetRowLength( Void ) Get the length of the table row.
|
SFCError |
InsertLast(
SFXTableItemBaseConstRef item
) Insert the table item [row] at the tail.
|
static SFOTableModelSmp |
NewInstance(
SFCErrorPtr exception = null
) Create a new instance of this class.
|
Protected Functions | |
---|---|
static SFORefObjectSmp |
Factory(
SFORefObjectPtr object
, SFCErrorPtr exception
)
(inherits from SFORefObject)
This function is used to implement the NewInstance function.
|
SFCError |
Initialize( Void )
(inherits from SFORefObject)
Make the initialization which may raise an error.
|
[ protected, explicit ] SFOTableModel(Void);
[ protected, virtual ] ~SFOTableModel(Void);
Release the heap of the all table items.
Pointer to the cell object
If a row index or a column index out of range is specified, a null pointer will be returned.
[ public, virtual, const ] SInt32 GetRowLength(Void);
Length of table row
[ public, virtual ] SFCError InsertLast( SFXTableItemBaseConstRef item // table item [row] );
When the item is inserted, the item will be copied to heap.
SFOTableModelSmp model;
SFXTableItem<2> item;
SFCError error;
model = SFOTableModel::NewInstance(&error);
if (model != null) {
for (SInt32 row = 0; row < 10; row++) {
item.data[0] = static_cast<Bool>((row % 2));
item.data[1] = SFXAnsiString::Format("item_%d", row);
// Insert the item [row] to the model.
error = model->InsertLast(item);
if (error != SFERR_NO_ERROR) {
break;
}
}
}
SFOTableModel::NewInstance | SFXTableItemBase | SFXTableItem
[ public, static ] SFOTableModelSmp NewInstance( SFCErrorPtr exception = null // error value );
Return the error value generated inside the function
This function creates a new instance of the SFOTableModel class.
If succeeds, a not null pointer will be returned, and the "exception" argument is SFERR_NO_ERROR. If fails such as insufficient memory, a null pointer will be returned, and the "exception" argument holds the error value
The following is a code to create a new instance of the table model.
SFOTableModelSmp model;
SFCError error;
if ((model = SFOTableModel::NewInstance(&error)) != null) {
// .. (omitted) ..
}
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |