Rogue Wave Views Studio Package API Reference Guide |
Rogue Wave Views Documentation Home |
Inspector class. More...
#include <ivstudio/inspectors/genacces.h>
Public Types | |
enum | BuildMode { , Create, Copy } |
This enumeration type defines the build mode of the inspected properties. More... | |
enum | DependencyMode { InitializeAfter, InitializeBefore, ApplyBefore, ApplyAfter, NoApply, Default, InitializeAndApplyBefore } |
This enumeration type specifies when the dependent accessor is initialized and applied. properties. More... | |
enum | UpdateMode { NoUpdate, OnApply, Immediate, Inherited } |
This enumeration type specifies when the accessor must update the inspected property. The provided modes are mutually exclusive. More... | |
Public Member Functions | |
void | addDependentAccessor (IlvStIAccessor *acc, DependencyMode mode=Default) |
Adds a dependent accessor with the specified dependency mode. More... | |
void | addEditor (IlvStIEditor *edt) |
Adds the specified editor to the editors stored by the accessor. More... | |
virtual IlBoolean | apply () |
Called to apply all the changes made to the accessor. More... | |
virtual IlvStIError * | check () const |
Validates the accessor value. More... | |
virtual IlvStIError * | checkAll (const IlvStIAccessor **accessor, IlBoolean modifiedOnly=IlTrue) const |
Checks the accessor and its hierarchical tree of dependencies. More... | |
IlvStIAccessor * | findDependentAccessor (const char *name) const |
Searches an dependent accessor. More... | |
IlvStIEditor * | findEditor (const char *name) const |
Searches the specified editor inside all dependent accessors. More... | |
virtual IlvStIEditor * | findFirstEditor () const |
Returns the first editor owned by the accessor. More... | |
BuildMode | getBuildMode () const |
Returns the building mode for the accessor. More... | |
IlvStIAccessor * | getDependentAccessor (const char *name) const |
Returns the dependent accessor whose name is specified. More... | |
IlvStIAccessor ** | getDependentAccessors (IlUInt &count) const |
Returns all direct dependent accessors. More... | |
IlvStIEditor * | getEditor (IlUInt index) const |
Returns the editor stored at the wished position. More... | |
IlUInt | getNumberOfEditors () const |
Returns the number of editors stored by the accessor. More... | |
virtual UpdateMode | getUpdateMode () const |
Returns the update mode for the accessor. More... | |
virtual IlBoolean | initialize () |
Called to initialize the accessor according to the inspected data. More... | |
IlBoolean | isModified () const |
Returns IlTrue if the accessor has been modified. More... | |
void | lock () |
Locks the accessor once. More... | |
IlBoolean | removeDependentAccessor (IlvStIAccessor *acc) |
Removes the specified dependent accessor. More... | |
IlBoolean | removeEditor (IlvStIEditor *edt) |
Removes the specified editor from the accessor. More... | |
void | setBuildMode (BuildMode mode) |
Sets the building mode for the accessor. More... | |
void | setUpdateMode (UpdateMode updateMode) |
Sets the update mode for the accessor. More... | |
void | unLock () |
Unlocks the accessor once. More... | |
Public Member Functions inherited from IlvStNamedObject | |
const char * | getName () const |
Returns the name of the object. More... | |
virtual void | setName (const char *name) |
Sets the name of the object. More... | |
Protected Member Functions | |
IlvStIAccessor (const char *name=0, UpdateMode mode=NoUpdate, BuildMode build=None) | |
Initializes a new instance of the IlvStIAccessor class. More... | |
Inspector class.
Library: ivstudio
An accessor can be considered as an interface to an object to be inspected. Usually, an accessor that inherits from the class IlvStIPropertyAccessor
lets you access a property of a given object, such as the label of a text field.
From a functional point of view, an accessor has two behaviors:
initialize()
method). apply()
method). In other words, when an inspector is initialized to inspect a new object and when the Apply button is clicked, it calls the initialize()
and the apply()
methods of all its accessors.
Certain inspected values directly depend on other inspected values. Thus, if the float mode is not set for a number field, the scientific mode for this field cannot be inspected and its editors must be grayed. To achieve this, accessors are stored in a hierarchical tree of dependencies. Accessors are initialized from root to branches. When an accessor is modified, all its dependencies are reinitialized. Thus, in our previous example, the scientific mode accessor is stored as a child of the float mode accessor (via the member function IlvStIAccessor::addDependentAccessor()
). When the float mode is modified, the scientific mode is reinitialized automatically and its state is indicated by a precondition. For more information, see IlvStIPrecondition
.
Because accessors can be shared by many other accessors (through dependencies, for example), deleting an accessor is not a safe operation. Therefore, an accessor must always be stored using a reference count mechanism (via a call to the lock()
and unLock()
methods).
Accessors manage the gadgets of an inspector panel via editors. These editors, which inherit from the class IlvStIEditor
, provide a common interface for most of the gadget classes. Editors can be added to or removed from an accessor via the addEditor()
or removeEditor()
member functions so that, for example, more than one editor can edit the same property. Accessors initialize the editors when they are initialized (typically with the values of the inspected properties) and store the user's modifications notified by editors.
Two modes are provided for inspecting a property, an update mode and a building mode:
BuildMode::Create
, the accessor creates a property if the inspected object does not contain one. If BuildMode::Copy
is set, it makes a copy of this property, which will be inspected in place of the original property. This is particularly useful if the accessor inspects a data pointer with UpdateMode
set to OnApply
. This enumeration type defines the build mode of the inspected properties.
This enumeration type specifies when the dependent accessor is initialized and applied. properties.
This enumeration type specifies when the accessor must update the inspected property. The provided modes are mutually exclusive.
Enumerator | |
---|---|
NoUpdate | No update is performed. |
OnApply | The update is performed only when the |
Immediate | The update is carried out as soon as the accessor is notified of the changes. |
Inherited | The current mode is that of the accessor on which this accessor depends, if any. |
|
protected |
Initializes a new instance of the IlvStIAccessor
class.
name | The name of the accessor used to reference this accessor from the inspector by calling the getAccessor method. |
mode | The update mode. |
build | The build mode. |
void IlvStIAccessor::addDependentAccessor | ( | IlvStIAccessor * | acc, |
DependencyMode | mode = Default |
||
) |
Adds a dependent accessor with the specified dependency mode.
acc | The dependent accessor. |
mode | The dependency mode. |
void IlvStIAccessor::addEditor | ( | IlvStIEditor * | edt | ) |
Adds the specified editor to the editors stored by the accessor.
edt | The editor. |
|
virtual |
Called to apply all the changes made to the accessor.
Called to apply all the changes made to the accessor to the inspected object. By default, this method only requests that modifications be applied by its dependent accessors.
IlTrue
if successfull, otherwise return IlFalse
.
|
virtual |
Validates the accessor value.
0
. Reimplemented in IlvStIPropertyAccessor.
|
virtual |
Checks the accessor and its hierarchical tree of dependencies.
accessor | Contains the accessor which failed. |
modifiedOnly | If IlTrue , the check is run only on accessors that have been modified. |
0
. IlvStIAccessor* IlvStIAccessor::findDependentAccessor | ( | const char * | name | ) | const |
Searches an dependent accessor.
name | The accessor name which is searching in the hierarchical tree of dependencies. |
0
if no dependent accessor with the specified name is found otherwise returns the accessor. IlvStIEditor* IlvStIAccessor::findEditor | ( | const char * | name | ) | const |
Searches the specified editor inside all dependent accessors.
name | The editor name. |
0
if no editor with the specified name is found.
|
virtual |
Returns the first editor owned by the accessor.
check()
method generates an error, you can use this function to find the editor associated with the checked accessor and give it the focus so that the user can modify it. It returns 0
if no editors with the specified name is found. Reimplemented in IlvStIPropertiesAccessor.
BuildMode IlvStIAccessor::getBuildMode | ( | ) | const |
Returns the building mode for the accessor.
IlvStIAccessor* IlvStIAccessor::getDependentAccessor | ( | const char * | name | ) | const |
Returns the dependent accessor whose name is specified.
name | The accessor name. |
IlvStIAccessor** IlvStIAccessor::getDependentAccessors | ( | IlUInt & | count | ) | const |
Returns all direct dependent accessors.
count | Contains the accessor count. |
IlvStIEditor* IlvStIAccessor::getEditor | ( | IlUInt | index | ) | const |
Returns the editor stored at the wished position.
index | The editor position. |
0
. IlUInt IlvStIAccessor::getNumberOfEditors | ( | ) | const |
Returns the number of editors stored by the accessor.
|
virtual |
Returns the update mode for the accessor.
Reimplemented in IlvStICombinedAccessor.
|
virtual |
Called to initialize the accessor according to the inspected data.
By default, this method only initializes all dependent accessors.
IlTrue
if successfull, otherwise return IlFalse
. Reimplemented in IlvStICombinedAccessor, IlvStIPropertyAccessor, and IlvStIPropertiesAccessor.
IlBoolean IlvStIAccessor::isModified | ( | ) | const |
Returns IlTrue
if the accessor has been modified.
IlTrue
if the accessor has been modified since the last call to initialize()
or apply()
. When apply()
is called, the accessor does nothing if it has not been modified. void IlvStIAccessor::lock | ( | ) |
Locks the accessor once.
Call this method if you want this object to be shared by different objects.
IlBoolean IlvStIAccessor::removeDependentAccessor | ( | IlvStIAccessor * | acc | ) |
Removes the specified dependent accessor.
acc | The dependent accessor. |
IlFalse
if the specified accessor does not depend on this accessor, otherwise returns IlTrue
. IlBoolean IlvStIAccessor::removeEditor | ( | IlvStIEditor * | edt | ) |
Removes the specified editor from the accessor.
edt | The editor which must be removed from the editors stored by the accessor. |
IlTrue
if successfull otherwise returns IlFalse
. void IlvStIAccessor::setBuildMode | ( | BuildMode | mode | ) |
Sets the building mode for the accessor.
mode | The new build mode. |
void IlvStIAccessor::setUpdateMode | ( | UpdateMode | updateMode | ) |
Sets the update mode for the accessor.
updateMode | The new update mode. |
void IlvStIAccessor::unLock | ( | ) |
Unlocks the accessor once.
The accessor is destroyed when it is no longer locked.
© Copyright 2018, 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.