VCF::Component Class Reference
The base class for all objects within the Visual Component Framework that wish to manipulated dynamically within the an IDE. More...
#include <vcf/ApplicationKit/Component.h>
Inheritance diagram for VCF::Component:

Public Types | |
| enum | ComponentEvents { COMPONENT_CREATED = 0, COMPONENT_DESTROYED, COMPONENT_NEEDS_UPDATING, COMPONENT_ADDED, COMPONENT_REMOVED, COMPONENT_LOADED, COMPONENT_SAVED, COMPONENT_EVENTS_LAST } |
| enum | ComponentState { csUnknown = 0, csLoading = 0x1000, csSaving = 0x2000, csCreated = 1, csDesigning = 0x100, csNormal = 3, csDestroying = 4, csUsesLocaleStrings = 0x10000 } |
| The ComponentState enum represents the current state of the component. More... | |
Public Member Functions | |
| virtual void | handleEvent (Event *event) |
| generic handler method for events. | |
| void | loading () |
| This is called to make sure the csLoading bit is set in the component state. | |
| void | saving () |
| This is called to make sure the csSaving bit is set in the component state. | |
| void | loaded () |
| Fires an event to the ComponentLoaded delegate. | |
| void | saved () |
| Fires an event to the ComponentSaved delegate. | |
| virtual String | getName () |
| The name of the component. | |
| virtual void | setName (const String &name) |
| sets the name of the component. | |
| virtual void | beforeDestroy (ComponentEvent *event) |
| called just prior to completely destroying the component and it's associated memory. | |
| virtual void | afterCreate (ComponentEvent *event) |
| after the component has been created/instantiated the afterCreate() method is called. | |
| uint32 | getComponentState () |
| returns the current state of the component. | |
| bool | isNormal () const |
| queries the component state to check if it's set to csNormal or not. | |
| bool | isDestroying () const |
| queries the component state to check if it's set to csDestroying or not. | |
| bool | isLoading () const |
| queries the component state to check if it's csLoading bit is set or not. | |
| bool | isSaving () const |
| queries the component state to check if it's csSaving bit is set or not. | |
| bool | isDesigning () const |
| queries the component state to check if it's csDesigning bit is set or not. | |
| bool | isCreated () const |
| queries the component state to check if it's set to csCreated or not. | |
| void | setComponentState (const uint32 &componentState) |
| Sets the component's state. | |
| void | setCreated () |
| convenience fundtions for setting the component state | |
| void | setNormal () |
| void | setDestroying () |
| void | setDesigning (const bool &designing) |
| virtual void | addComponent (Component *component) |
| adds a component to this component. | |
| virtual void | removeComponent (Component *component) |
| removes the component. | |
| void | removeFromOwner (const bool &freeInstance=true) |
| virtual Enumerator< Component * > * | getComponents () |
| returns an enumeration of all the component's that this component currently owns. | |
| virtual uint32 | getComponentCount () |
| returns the number of components owned by this component | |
| Component * | findComponent (const String &componentName, const bool &recursive=false) |
| finds a particular component as specified by the componentName parameter within the list of owned components. | |
| bool | bindVariable (Component **variablePtr, const String &variableName) |
| Used to bind a variable to a component by attempting to bind the variable passed in to the component in the variablePtr parameter to the component instance with the same name as the variableName parameter. | |
| int32 | getTag () |
| returns the Component's tag value. | |
| void | setTag (const int32 &tag) |
| Sets the tag value. | |
| Component * | getOwner () |
Returns the owner of the component. | |
| Action * | getAction () |
| Returns the Action associated with this component. | |
| void | setAction (Action *action) |
| Set's the action for the component. | |
| virtual bool | updateAction () |
| Calling this triggers an update event to be fired. | |
| void | addToUpdateList () |
| Adds the component to the framework's update list. | |
| void | removeFromUpdateList () |
| Removes the component from the framework's update list. | |
| void | setUseLocaleStrings (const bool &val) |
| Allows the user to control whether or not the component should attempt to translate the text of a specific component. | |
| bool | getUseLocaleStrings () |
| Returns a value indicating whether or not the component will attempt to translate any text using the current thread's locale. | |
| Dictionary * | getSettings () |
| Returns the dictionary that holds this component's settings. | |
| ComponentSetting * | getSetting (const String &name) |
| Returns a specific setting specified by the name argument. | |
| ComponentSetting * | assignSetting (const String &settingName, const String &valueName, const VariantData &v) |
| Assigns a setting to the component's settings dictionary. | |
| ComponentSetting * | assignSetting (const String &settingName, const String &valueName) |
| Assigns a setting to the component's settings dictionary. | |
| void | assignSetting (const String &settingName, ComponentSetting *setting) |
| virtual void | initializeSettings (const bool &recursive) |
| virtual void | storeSettings (const bool &recursive) |
Static Public Member Functions | |
| static bool | registerComponent (const String &componentClassName, const String &category) |
| registers a component in the system component map. | |
| static Enumerator< Class * > * | getComponentClassesForCategory (const String &category) |
| Used by IDE's to list the various Component classes for a given category. | |
| static Enumerator< String > * | getRegisteredComponentCategories () |
| returns a list of all the known, registered, component categories. | |
| static void | initComponentRegistrar () |
| static void | clearRegistedComponents () |
| static void | initComponent (Component *instance, Class *clazz, Class *rootClazz, ResourceBundle *resBundle=NULL) |
| Takes a valid component instance and initializes it from a VFF file that is assumed to be present in the programs resource bundle. | |
| static Component * | createComponentFromResources (Class *clazz, Class *rootClazz, ResourceBundle *resBundle=NULL) |
Public Attributes | |
| VCF::Delegate | ComponentCreated |
| VCF::Delegate | ComponentDestroyed |
| VCF::Delegate | ComponentAdded |
| VCF::Delegate | ComponentRemoved |
| VCF::Delegate | ComponentLoaded |
| VCF::Delegate | ComponentSaved |
Protected Member Functions | |
| Component () | |
| The constructor and destructor is hidden - this is an abstract class and should NEVER be instantiated directly. | |
| Component (Component *owner) | |
| Component (const String &name, Component *owner) | |
| Component (const String &name) | |
| virtual | ~Component () |
| This is protected - you should call free, or release to destroy the component. | |
| virtual void | destroy () |
| called by the free() method. | |
Protected Attributes | |
| Component * | owner_ |
| uint32 | componentState_ |
| String | name_ |
| int32 | tag_ |
| Action * | action_ |
| std::vector< Component * > | components_ |
| EnumeratorContainer< std::vector< Component * >, Component * > | componentContainer_ |
| Dictionary * | settings_ |
Static Protected Attributes | |
| static std::map< String, std::vector< Class * > * > * | registeredComponentMap |
| a map of component classes to categories | |
| static std::vector< String > * | registeredCategory |
| static EnumeratorContainer< std::vector< String >, String > * | registeredCategoryContainer |
| static EnumeratorContainer< std::vector< Class * >, Class * > * | registeredCompContainer |
Detailed Description
The base class for all objects within the Visual Component Framework that wish to manipulated dynamically within the an IDE.All UI controls are descended from this class.
Some of the services that are provided are as follows:
- provides methods for registering components into logical groups, that can then be displayed with an IDE
- provides the ability to own other components
- the ability to be manipulated by the IDE UI designer
- methods for uniquely identifying each instance, either by name or by a numerical tag.
The component itself is a non visual object, thus it can be used as a base class for a wide variety of things, in addition to serving as a base class for UI controls. The Component by itself is an abstract class and should never be created by itself, instead you should be created derived instances of classes derived from Component.
- Event Delegates for this class:
Member Enumeration Documentation
|
|
|
|
|
The ComponentState enum represents the current state of the component. Some states will prevent the Component from responding to events, for example, a Control with it state set to CS_DESIGNING, will not respond to certain UI events, while a Control with it's state set to CS_DESTROYING, will not respond to any pending UI events. |
Constructor & Destructor Documentation
|
|
The constructor and destructor is hidden - this is an abstract class and should NEVER be instantiated directly.
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
This is protected - you should call free, or release to destroy the component.
|
Member Function Documentation
|
|
adds a component to this component. Components may contain one or more child, or owned, components. When the component is destroyed, all owned components are destroyed as well. This is entirely independent from the Container interface's add() method. This provides a convenient way to clean up memory of components added on the heap. For example, a Window may have a popup menu that is created during initialization. By adding the popup menu (which is derived from Component), the popup menu will be destroyed automatically for you once the Window is destroyed. The implementation checks to prevent multiple adds of the same component instance in the internal list. |
|
|
Adds the component to the framework's update list. This list will be traversed periodically, during idle time, and the framework will create a COMPONENT_NEEDS_UPDATING event and pass it to the component. The component can specialize this functionality by customizing the behaviour of the handleEvent() method. |
|
|
after the component has been created/instantiated the afterCreate() method is called. Special initializations may then happen here. Reimplemented in VCF::CommonDialog, VCF::Control, VCF::Frame, VCF::ImageList, VCF::ScrollbarManager, VCF::TimerComponent, VCF::HTMLBrowserControl, and VCF::OpenGLControl. |
|
||||||||||||
|
|
|
||||||||||||
|
Assigns a setting to the component's settings dictionary. If the setting already exists it's value is modified, otherwise a new setting is created. Returns the setting that was modified or created. This version uses the component's property to get the initial value for the setting. Therefore the value name needs to be a valid component property name.
|
|
||||||||||||||||
|
Assigns a setting to the component's settings dictionary. If the setting already exists it's value is modified, otherwise a new setting is created. Returns the setting that was modified or created.
|
|
|
called just prior to completely destroying the component and it's associated memory.
Reimplemented in VCF::Control, and VCF::Window. |
|
||||||||||||
|
Used to bind a variable to a component by attempting to bind the variable passed in to the component in the variablePtr parameter to the component instance with the same name as the variableName parameter. This functions looks at all the owned components first, then checks to see if the Container interface is supported, and if so, it checks all the child controls of the container.
|
|
|
|
|
||||||||||||||||
|
|
|
|
called by the free() method. Should be overriden and any clean up code performed here Reimplemented from VCF::Object. Reimplemented in VCF::ComboBoxControl, VCF::Control, VCF::Frame, VCF::ListBoxControl, VCF::Menu, VCF::MenuBar, VCF::PopupMenu, VCF::SystemTray, and VCF::Window. |
|
||||||||||||
|
finds a particular component as specified by the componentName parameter within the list of owned components.
|
|
|
Returns the Action associated with this component. Any component can have an action associated with it. This allows multiple component components (like a menu item, and a push button) to share the same action and to respond in a coordinated manner to changes in state. |
|
|
Used by IDE's to list the various Component classes for a given category. Each Class pointer that is contained in the Enumerator guarantees the ability to create an instance of the component it represents. |
|
|
returns the number of components owned by this component
|
|
|
returns an enumeration of all the component's that this component currently owns.
|
|
|
returns the current state of the component. Some states will prevent the Component from responding to events, for example, a Control with it's state set to CS_DESIGNING, will not respond to certain UI events, while a Control with it's state set to CS_DESTROYING, will not respond to any pending UI events. |
|
|
The name of the component. While technically the name can be any character sequence, it is preferred if the name follow C++ variable name rules, i.e. must start with a character of [a..z] or [A..Z], followed by any sequence of characters in the set [a..z,A..Z,0..9,_]. The name of the component should be unique.
Reimplemented in VCF::Document. |
|
|
The owner (you could also think of this as the component's "parent") is responsible for destroying the component when the owner is destroyed.
Reimplemented in VCF::Dialog. |
|
|
returns a list of all the known, registered, component categories. These in turn may be used to gather the classes for each category with a call to the getComponentClassesForCategory() static method. |
|
|
Returns a specific setting specified by the name argument. The name is the key that is used to store the setting in the component's settings dictionary. This name may be completely different from the setting's value name.
|
|
|
Returns the dictionary that holds this component's settings. May return NULL. The default value for a component's settings is NULL, so if no settings have been assigned this will definitely return NULL. |
|
|
returns the Component's tag value. A Tag is borrowed from the NeXTStep idea of tags. A unique number is automatically associated with the component when it is created, but can be changed by the programmer. The following info is lifted directly from the NeXTSTEP docs. "Tags are integers that you use in your code to identify objects. They offer a convenient alternative to such methods of object identification as fetching an object's title. (What if the object't title changes while the application is running, or the object has no title?)"
|
|
|
Returns a value indicating whether or not the component will attempt to translate any text using the current thread's locale. By default, this is true.
|
|
|
generic handler method for events. All UI events are sent here and then dispatched accordingly to a more specific event handler. If an Application class is present, then it is given a chance to "see" the event first before delegating it to the Component. All events are dispatched by their type so it is important to correctly identify the event objects type if you would like it to be dispatched correctly. The method will call the appropriate component method, like afterCreate(), beforeDestroy(), etc.
Reimplemented in VCF::Control, VCF::DefaultMenuItem, VCF::DropTarget, VCF::HeaderControl, VCF::ListViewControl, VCF::Menu, VCF::MenuBar, VCF::TableControl, VCF::TextControl, VCF::ToolbarItem, VCF::Toolbar, VCF::TreeControl, and VCF::Window. |
|
||||||||||||||||||||
|
Takes a valid component instance and initializes it from a VFF file that is assumed to be present in the programs resource bundle.
|
|
|
|
|
|
|
|
|
queries the component state to check if it's set to csCreated or not.
|
|
|
queries the component state to check if it's csDesigning bit is set or not.
|
|
|
queries the component state to check if it's set to csDestroying or not.
|
|
|
queries the component state to check if it's csLoading bit is set or not.
|
|
|
queries the component state to check if it's set to csNormal or not.
|
|
|
queries the component state to check if it's csSaving bit is set or not.
|
|
|
Fires an event to the ComponentLoaded delegate. The csLoading bit is removed from the component's state. |
|
|
This is called to make sure the csLoading bit is set in the component state. Called by streams that read in a component object |
|
||||||||||||
|
registers a component in the system component map. The map is organized into a series of keys called categories, with 1 or more entries in each category. The UIToolkit registers the default ApplicationKit components, and other developers may use this to extend the list with their own components. |
|
|
removes the component.
|
|
|
|
|
|
Removes the component from the framework's update list.
|
|
|
Fires an event to the ComponentSaved delegate. The csSaving bit is removed from the component's state. |
|
|
This is called to make sure the csSaving bit is set in the component state. Called by streams that write out a component object |
|
|
Set's the action for the component.
|
|
|
Sets the component's state.
|
|
|
convenience fundtions for setting the component state
|
|
|
|
|
|
|
|
|
sets the name of the component. For naming conventions/rules please see getName(). Reimplemented in VCF::CommandButton, VCF::Document, VCF::Label, VCF::ProgressControl, VCF::PushButton, and VCF::ToggledButton. |
|
|
|
|
|
Sets the tag value.
|
|
|
Allows the user to control whether or not the component should attempt to translate the text of a specific component. This is typically used in derived control classes paint() methods, which would check this value before calling System::getCurrentThreadLocale()->translate() to translate the text to a specific locale sensitive value. Setting this value will also set it for any child components.
|
|
|
|
|
|
Calling this triggers an update event to be fired. The default behaviour is to see if the component has an action associated with it, and then calls the action's update() method.
Reimplemented in VCF::ToolbarItem. |
Member Data Documentation
|
|
|
|
|
|
