tbx
0.7.6
|
Class representing a toolbox menu. More...
#include <menu.h>
Public Types | |
enum | { TOOLBOX_CLASS = 0x828c0 } |
Public Member Functions | |
Menu () | |
Construct an uninitiased menu. More... | |
Menu (const Menu &other) | |
Construct a menu from another menu. More... | |
Menu (const Object &other) | |
Construct a menu from another toolbox object. More... | |
Menu (const char *template_name) | |
Create the toolbox object with the given name from the Toolbox resources for the application and assign a reference to it to this application. More... | |
Menu & | operator= (const Menu &other) |
Assign a menu to an existing menu. More... | |
Menu & | operator= (const Object &other) |
Assign a menu to an existing object. More... | |
bool | operator== (const Object &other) const |
Checks if this menu refers to the same underlying toolbox object as the given object. More... | |
bool | operator!= (const Object &other) const |
Checks if this menu refers to the same underlying toolbox object as the given object. More... | |
MenuItem | item (ComponentId id) |
Retrieve the menu item for a given component id. More... | |
void | help_message (const std::string &msg) |
Set the help message text for the menu. | |
std::string | help_message () const |
Get the help message text. | |
int | help_message_length () const |
Get the length of buffer for the help message text. | |
MenuItem | add (const res::ResMenuItem &res_item, MenuItem *after=0) |
Add a new menu entry to the menu. More... | |
MenuItem | insert (const res::ResMenuItem &res_item, MenuItem *before=0) |
Insert a new menu entry in the menu. More... | |
void | erase (ComponentId id) |
Erase the menu item with the given id. More... | |
void | erase (MenuItem &item) |
Erase the menu item given. More... | |
int | height () const |
Return the height of the work area of the menu in OS units. | |
int | width () const |
Return the width of the work area of the menu in OS units. | |
void | title (const std::string &title) |
Set the title of the menu. | |
std::string | title () const |
Get the title of the menu. | |
int | title_length () const |
Get the size of the buffer for the title. | |
void | add_about_to_be_shown_listener (AboutToBeShownListener *listener) |
Add listener triggered when a menu is about to be shown. More... | |
void | remove_about_to_be_shown_listener (AboutToBeShownListener *listener) |
Remover listener triggered when a menu is about to be shown. More... | |
void | add_has_been_hidden_listener (HasBeenHiddenListener *listener) |
Add listener triggered when a menu is hidden. More... | |
void | remove_has_been_hidden_listener (HasBeenHiddenListener *listener) |
Remove listener triggered when a menu is about to be shown. More... | |
void | add_submenu_listener (SubMenuListener *listener) |
Add listener for mouse moving over the menu arrow when no other toolbox event is assosiated with this event. More... | |
void | remove_submenu_listener (SubMenuListener *listener) |
Remove listener for mouse moving over the menu arrow when no other toolbox event is assosiated with this event. More... | |
void | add_selection_listener (MenuSelectionListener *listener) |
Add listener for menu item selection. More... | |
void | remove_selection_listener (MenuSelectionListener *listener) |
Remove menu selection listener. More... | |
![]() | |
Object () | |
Constructs an object unattached to a toolbox object. More... | |
Object (ObjectId handle) | |
Construct an object referencing the given toolbox object. More... | |
Object (const Object &other) | |
Construct an object referencing the same toolbox object as another. | |
Object (const std::string &template_name) | |
Create a toolbox object with the given name in the application resources and assign a reference to it in this object. More... | |
void | delete_object () |
Delete the underlying toolbox object. More... | |
bool | null () const |
Check if object has been initialised. More... | |
ObjectId | handle () const |
Return the underlying toolbox object id this object references. More... | |
Object & | operator= (const Object &other) |
Assign this object to reference the same toolbox object as another. More... | |
bool | operator== (const Object &other) const |
Check if this object references the same toolbox object as another. More... | |
bool | operator!= (const Object &other) const |
Check if this object does not reference the same toolbox object as another. More... | |
operator bool () const | |
Operator to check if an object has been initialised. More... | |
int | toolbox_class () const |
Get the toolbox class of this object. More... | |
void | check_toolbox_class (int class_id) const |
Check if this objects toolbox class is as specified. More... | |
void * | client_handle () const |
Return user defined handle stored against this object. More... | |
void | client_handle (void *client_handle) |
Set a user defined handle for this object. More... | |
Object | parent_object () const |
Get parent object. More... | |
Component | parent_component () const |
Get parent component. More... | |
Object | ancestor_object () const |
Get ancestor object. More... | |
Component | ancestor_component () const |
Get ancestor component. More... | |
void | show () |
Show the object at the default place. More... | |
void | show_centred () |
Show the object in the centre of the screen. More... | |
void | show_at_pointer () |
Show the object at the current mouse position. More... | |
void | hide () |
Hide the object. More... | |
bool | showing () const |
Check if an object is currently showing. | |
void | add_command (int command_id, Command *command) |
Add a command to this Object. More... | |
void | remove_command (int command_id, Command *command) |
Remove a command from this object. 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 object. More... | |
void | add_object_deleted_listener (ObjectDeletedListener *listener) |
Add listener for when the toolbox object referenced by this object has been deleted. More... | |
void | remove_object_deleted_listener (ObjectDeletedListener *listener) |
Remove listener for when the toolbox object referenced by this object has been deleted. More... | |
void | remove_all_listeners () |
Remove all listeners and commands from this object. More... | |
Additional Inherited Members | |
![]() | |
Object (const res::ResObject &object_template) | |
Protected constructor to create an object. | |
void | add_listener (int action, Listener *listener, RawToolboxEventHandler handler) |
Add a listener for the given toolbox event. More... | |
void | remove_listener (int action, Listener *listener) |
Remove listener for toolbox event. More... | |
void | set_handler (int action, Listener *listener, RawToolboxEventHandler handler) |
Set handler for an event that should not have more than one listener. More... | |
int | int_property (int property_id) const |
Return the value of a property that returns an integer. More... | |
void | int_property (int property_id, int value) |
Set the value of a property that requires an integer. More... | |
std::string | string_property (int property_id) const |
Return the value of a property that returns text. More... | |
void | string_property (int property_id, const std::string &value) |
Set the value of a property that requires a string. More... | |
int | string_property_length (int property_id) const |
Gets the size of a string properties buffer. More... | |
bool | bool_property (int property_id) const |
Get a boolean property from the toolbox Cobject. More... | |
void | bool_property (int property_id, bool value) |
Set a boolean property from the toolbox object. More... | |
![]() | |
ObjectId | _handle |
Handle for toolbox object. | |
Class representing a toolbox menu.
|
inline |
Construct an uninitiased menu.
The menu should not be used until it has been initialised by assigning it to another initialised menu.
|
inline |
Construct a menu from another menu.
Both menus will refer to the same underlying toolbox menu
|
inline |
Construct a menu from another toolbox object.
The menu and the object will refer to the same underlying toolbox menu
ObjectClassError | The object assigned to does not refer to a toolbox menu |
|
inline |
Create the toolbox object with the given name from the Toolbox resources for the application and assign a reference to it to this application.
OsError | The toolbox object could not be created from the tmeplate |
ObjectClassError | The created object is not a Toolbox menu |
MenuItem tbx::Menu::add | ( | const res::ResMenuItem & | res_item, |
MenuItem * | after = 0 |
||
) |
Add a new menu entry to the menu.
If the component id of the menu item definition is set to -1 then the lowest available component id is used.
res_item | definition of new entry. |
after | item to add it after or 0 (the default) to add to end of the menu |
OsError | add failed. |
void tbx::Menu::add_about_to_be_shown_listener | ( | AboutToBeShownListener * | listener | ) |
Add listener triggered when a menu is about to be shown.
This event is only triggered if the menu has been set to deliver the default event before showing.
listener | to add |
void tbx::Menu::add_has_been_hidden_listener | ( | HasBeenHiddenListener * | listener | ) |
Add listener triggered when a menu is hidden.
This event is only triggered if the menu has been set to deliver the default event when hidden.
listener | to add |
void tbx::Menu::add_selection_listener | ( | MenuSelectionListener * | listener | ) |
Add listener for menu item selection.
This is only generated if no other toolbox event is assosiated with this event.
This will be called for any menu item that has no other event associated with it. (including those with their own menu selection listener).
listener | to add |
void tbx::Menu::add_submenu_listener | ( | SubMenuListener * | listener | ) |
Add listener for mouse moving over the menu arrow when no other toolbox event is assosiated with this event.
listener | to add |
void tbx::Menu::erase | ( | ComponentId | id | ) |
Erase the menu item with the given id.
OsError | erase failed. |
void tbx::Menu::erase | ( | MenuItem & | item | ) |
MenuItem tbx::Menu::insert | ( | const res::ResMenuItem & | res_item, |
MenuItem * | before = 0 |
||
) |
Insert a new menu entry in the menu.
If the component id of the menu item definition is set to -1 then the lowest available component id is used.
res_item | definition of new entry. |
before | item to insert it before or 0 (the default) to insert at the beginning of the menu |
OsError | insert failed. |
MenuItem tbx::Menu::item | ( | ComponentId | id | ) |
Retrieve the menu item for a given component id.
Note: There is no check the id is valid.
|
inline |
Checks if this menu refers to the same underlying toolbox object as the given object.
Assign a menu to an existing menu.
Both menus will refer to the same underlying toolbox menu
Assign a menu to an existing object.
The menu and the object will refer to the same underlying toolbox menu
ObjectClassError | The object assigned to does not refer to a toolbox menu |
|
inline |
Checks if this menu refers to the same underlying toolbox object as the given object.
void tbx::Menu::remove_about_to_be_shown_listener | ( | AboutToBeShownListener * | listener | ) |
Remover listener triggered when a menu is about to be shown.
listener | to remove |
void tbx::Menu::remove_has_been_hidden_listener | ( | HasBeenHiddenListener * | listener | ) |
Remove listener triggered when a menu is about to be shown.
listener | to remove |
void tbx::Menu::remove_selection_listener | ( | MenuSelectionListener * | listener | ) |
Remove menu selection listener.
listener | to remove |
void tbx::Menu::remove_submenu_listener | ( | SubMenuListener * | listener | ) |
Remove listener for mouse moving over the menu arrow when no other toolbox event is assosiated with this event.
listener | to remove |