Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Model class. More...
#include <ilviews/dataccess/gadgets/gdtmodel.h>
Public Member Functions | |
IliModel () | |
The constructor initializes a new IliModel instance. | |
IlInt | declareProperty (const IliDatatype *typ, const char *name, const char *title, IlBoolean pub) |
Declares a new property. | |
virtual void | defineProperties () |
Called to define the list of properties. | |
virtual const char * | getLabel () const =0 |
Returns the model label, it is used by the gadget inspector. | |
virtual const char * | getMappingInspectorModelName () const |
Returns the mapping inspector model name. | |
virtual const char * | getName () const |
Returns the model name. | |
IlInt | getPropertyCount () const |
Returns the property count. | |
IlInt | getPropertyIndex (const char *name) const |
Returns a property index. | |
const char * | getPropertyName (IlInt index) const |
Returns a property name. | |
const IliValue & | getPropertyValue (IlInt index) const |
Returns a property value. | |
const IliValue & | getPropertyValue (const char *name) const |
Returns a property value. | |
virtual IlBoolean | isPublic () const |
Returns the model visibility. | |
void | setPropertyValue (IlInt index, const IliValue &val) |
Sets a property value. | |
void | setPropertyValue (const char *name, const IliValue &val) |
Sets a property value. |
Model class.
Library: dbgadget
The class IliModel
defines the interface for all models. A model class is used to associate a behavior to an event. The models are used by the gadgets to execute a specific task. A gadgets can use several models to work. For example, the tree gadget uses: a model to extract the data from data source and a model to build the popup menu when the user click on tree item with the mouse right button. For each basic behavior, there is a model class with its specific virtual functions and all these model classes inherit from the IliModel
class.
Each model class can have a list of properties. A properties is a couple name - value (with a type). The properties are persistent data (there is an automatic system of read/write for model properties).
When you define a model class, you must use the macro IliDeclareModel
into the header file and the macro IliDefineCodeModel into your source file. The constructor of your model class has no argument.
For example:
Header file
class MyModel : public IliModel { public: MyModel(); ~MyModel(); IliDeclareModel(); // The model virtual functions };
Source file
IliDefineCodeModel(IliModel,MyModel,"My Model");
IlInt IliModel::declareProperty | ( | const IliDatatype * | typ, | |
const char * | name, | |||
const char * | title, | |||
IlBoolean | pub | |||
) |
Declares a new property.
Each property has a name, a value (with a type), a title which is used by the gadget inspector and a flag to indicate if the property is public. A property is public if the gadget inspector can display this property (some gadget inspectors can not display the public properties, it is not a bug but a future for the next version).
typ | It is the property value type. | |
name | It is the property name. | |
title | It is the property title. | |
pub | The parameter value is IlTrue if the property is public otherwise it is IlFalse . |
-1
if an error occurs. virtual void IliModel::defineProperties | ( | ) | [virtual] |
Called to define the list of properties.
To define a property, you should use the declareProperty
function. To set a value, you should use the initializeProperty
function.
virtual const char* IliModel::getLabel | ( | ) | const [pure virtual] |
Returns the model label, it is used by the gadget inspector.
virtual const char* IliModel::getMappingInspectorModelName | ( | ) | const [virtual] |
Returns the mapping inspector model name.
This model is used to manage the mapping definition gadget into the gadget inspector.
virtual const char* IliModel::getName | ( | ) | const [virtual] |
Returns the model name.
Reimplemented in IliDbGanttModel, IliMappingInspectorModel, and IliGadgetModel.
IlInt IliModel::getPropertyCount | ( | ) | const |
Returns the property count.
IlInt IliModel::getPropertyIndex | ( | const char * | name | ) | const |
Returns a property index.
name | The property name. |
-1
. const char* IliModel::getPropertyName | ( | IlInt | index | ) | const |
Returns a property name.
index | The property index. |
0
. Returns a property value.
index | The property index. |
null
value. const IliValue& IliModel::getPropertyValue | ( | const char * | name | ) | const |
Returns a property value.
name | The property name. |
null
value. virtual IlBoolean IliModel::isPublic | ( | ) | const [virtual] |
Returns the model visibility.
IlTrue
if the model can be displayed by the gadget inspector, the default value is IlTrue
. Sets a property value.
index | The property index. | |
val | The value. |
void IliModel::setPropertyValue | ( | const char * | name, | |
const IliValue & | val | |||
) |
Sets a property value.
name | The property name. | |
val | The value. |
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.