tbx
0.7.6
|
Base class for components in an object. More...
#include <component.h>
Public Member Functions | |
Component () | |
Construct an uninitialised component. More... | |
Component (Object obj, ComponentId id) | |
Construct a component from an object and component id. More... | |
Component (ObjectId handle, ComponentId id) | |
Construct a component from an object handle and component id. More... | |
bool | null () const |
Check if this component is in an uninitialised state. More... | |
Object | object () |
Return the object his component belongs to. | |
Object | object () const |
Return the object his component belongs to. | |
ObjectId | handle () const |
Return the object handle for his component. | |
ComponentId | id () const |
Get the component ID of this component. More... | |
Component & | operator= (const Component &other) |
Assign the Component to refer to the same underlying toolbox component. | |
bool | operator== (const Component &other) const |
Check if this component refers to the same underlying toolbox component. More... | |
bool | operator!= (const Component &other) const |
Check if this component refers to the same underlying toolbox gadget. More... | |
operator bool () const | |
Operator to check if this component has been initialised. More... | |
void | add_command (int command_id, Command *command) |
Add a command to this Component. More... | |
void | remove_command (int command_id, Command *command) |
Remove a command from this component. More... | |
void | add_user_event_listener (int event_id, UserEventListener *listener) |
Add a user event listener. More... | |
void | remove_user_event_listener (int event_id, UserEventListener *listener) |
Remove a user event listener from this component. More... | |
void | remove_all_listeners () |
Remove all the listeners on this component. More... | |
Protected Member Functions | |
void | add_listener (int action, Listener *listener, RawToolboxEventHandler handler) |
Helper function to add listeners to this component. More... | |
void | remove_listener (int action, Listener *listener) |
Helper function to remove listeners from this component. | |
void | add_window_listener (int event_code, Listener *listener) |
Helper function to add a listener for a WIMP window event. | |
void | remove_window_listener (int event_code, Listener *listener) |
Helper function to remove a listener for a WIMP window event. | |
int | int_property (int property_id) const |
Get an integer property from the toolbox Component. More... | |
void | int_property (int property_id, int value) |
Set an integer property from the toolbox object. More... | |
bool | bool_property (int property_id) const |
Get a boolean property from the toolbox Component. More... | |
void | bool_property (int property_id, bool value) |
Set a boolean property from the toolbox object. More... | |
std::string | string_property (int property_id) const |
Get a string property from the toolbox object. More... | |
int | string_property_length (int property_id) const |
Get a the length of a string property from the toolbox object. More... | |
void | string_property (int property_id, const std::string &value) |
Set a string property in the toolbox object. More... | |
bool | flag_property (int property_id, int flag) const |
Check if a particular flag is set in a property. More... | |
void | flag_property (int property_id, int flag, bool value) |
Set a particular flag in a property. More... | |
Protected Attributes | |
ObjectId | _handle |
Underlying toolbox handle. | |
int | _id |
Underlying toolbox component id. | |
Base class for components in an object.
|
inline |
Construct an uninitialised component.
The component should be assigned to an initialised component before it is used.
|
inline |
Construct a component from an object and component id.
Note: There is no checking of the object or id for validity
obj | object that contains the component |
id | toolbox component id |
|
inline |
Construct a component from an object handle and component id.
Note: There is no checking of the object handle or id for validity
handle | Object toolbox handle |
id | toolbox component id |
void tbx::Component::add_command | ( | int | command_id, |
Command * | command | ||
) |
Add a command to this Component.
For more details on events and commands see The tbx event system
command_id | The event id to associate the command with. |
command | The command to run when this event is received. |
ComponentNullError | toolbox handle is NULL_ComponentId |
|
protected |
Helper function to add listeners to this component.
Derived classes usually call this specifying the action and handler for the events specific to them.
void tbx::Component::add_user_event_listener | ( | int | event_id, |
UserEventListener * | listener | ||
) |
Add a user event listener.
For more details on events and commands see The tbx event system
event_id | The event ID to associate the listener with. |
listener | The listener to use. |
ComponentNullError | toolbox handle is NULL_ComponentId |
|
protected |
|
protected |
Set a boolean property from the toolbox object.
Helper function to implement specific properties in subclasses. Calls Toolbox_ObjectMiscOp and with value in r4.
property_id | the method code to get the property |
value | The new value for the property |
OsError |
|
protected |
Check if a particular flag is set in a property.
property_id | - id to check |
flag | - flag value to test |
OsError |
|
protected |
Set a particular flag in a property.
property_id | - property id to get the flags, property_id+1 must be the id to set the flags |
flag | - flag value to set |
value | - true set the flag, false clear it |
OsError |
|
inline |
|
protected |
|
protected |
Set an integer property from the toolbox object.
Helper function to implement specific properties in subclasses. Calls Toolbox_ObjectMiscOp and with value in r4.
property_id | the method code to get the property |
value | the new value for the property |
OsError |
|
inline |
Check if this component is in an uninitialised state.
|
inline |
Operator to check if this component has been initialised.
|
inline |
Check if this component refers to the same underlying toolbox gadget.
|
inline |
Check if this component refers to the same underlying toolbox component.
void tbx::Component::remove_all_listeners | ( | ) |
Remove all the listeners on this component.
Remove all the listeners and commands from this component.
ComponentNullError | if this is an uninitialised component |
void tbx::Component::remove_command | ( | int | command_id, |
Command * | command | ||
) |
Remove a command from this component.
command_id | The event id that was associated with the command. |
command | The command to remove. |
ComponentNullError | toolbox handle is NULL_ComponentId |
void tbx::Component::remove_user_event_listener | ( | int | event_id, |
UserEventListener * | listener | ||
) |
Remove a user event listener from this component.
event_id | The event id that was associated with the listener. |
listener | The listener to remove. |
ComponentNullError | toolbox handle is NULL_ComponentId |
|
protected |
Get a string property from the toolbox object.
Helper function to implement specific properties in subclasses. Calls Toolbox_ObjectMiscOp and with buffer for return in r4, size in r5.
property_id | the method code to get the property |
OsError |
|
protected |
Set a string property in the toolbox object.
Helper function to implement specific properties in subclasses. Calls Toolbox_ObjectMiscOp and with value pointed to by r3.
property_id | the method code to get the property |
value | the new string value for the property |
OsError |
|
protected |
Get a the length of a string property from the toolbox object.
Helper function to implement specific properties in subclasses. Calls Toolbox_ObjectMiscOp and with buffer for return in r3, size in r4.
property_id | the method code to get the property |
OsError |