tbx
0.7.6
|
Class representing a single menu item on a menu. More...
#include <menu.h>
Public Member Functions | |
MenuItem () | |
Construct an uninitialised menu item. | |
MenuItem (const MenuItem &other) | |
Construct a menu item from an existing menu item. More... | |
MenuItem (const Component &other) | |
Construct a menu item from a Component. More... | |
MenuItem & | operator= (const MenuItem &other) |
Assign to another menu item. More... | |
MenuItem & | operator= (const Component &other) |
Assign a menuitem field to refer to the same underlying toolbox component as an existing component. More... | |
bool | operator== (const MenuItem &other) |
Check if this menu item refers to the same underlying toolbox menu option. More... | |
bool | operator!= (const MenuItem &other) |
Check if this menu item refers to the same underlying toolbox menu option. More... | |
Menu | menu () |
Return the menu this menu item belongs to. | |
void | tick (bool set) |
Put a tick by the menu item. | |
bool | ticked () const |
Check if the menu item is ticked. | |
void | fade (bool set) |
Fade the menu item. | |
bool | faded () const |
Check if the menu item is faded. | |
void | text (const std::string &text) |
Set the text for the menu item. More... | |
std::string | text () const |
Get the text of the menu item. | |
int | text_length () const |
Get the length of the buffer for the menu item text. | |
void | sprite_name (const std::string &name) |
Set the sprite name for the menu item. More... | |
std::string | sprite_name () const |
Get the sprite name for a sprite menu item. | |
int | sprite_name_length () const |
Get the length of the buffer for the sprite name. | |
void | submenu (const Object &object) |
Set the object to show as a submenu from this item. | |
void | clear_submenu () |
Clear the submenu from this item. | |
bool | has_submenu () const |
Returns true if this object has a submenu. | |
Object | submenu () |
Return submenu or Object::null if none. | |
void | submenu_event (int id) |
Set event to raise when mouse if moved over the submenu arrow. More... | |
int | submenu_event () const |
Get the event raised when the mouse is moved over the submenu arrow. More... | |
void | click_show (const Object &object, bool transient=true) |
Set object to show if menu item is clicked. More... | |
void | clear_click_show () |
Clear the click show object. | |
bool | has_click_show () const |
Check if menu item has a click show object. More... | |
Object | click_show (bool *transient=0) |
Get click show object for menu item. More... | |
void | click_event (int id) |
Set click event for menu item. More... | |
int | click_event () const |
Get the click event for this menu item. More... | |
void | help_message (const std::string &msg) |
Set the help message for a menu item. More... | |
std::string | help_message () const |
Get the items help message. | |
int | help_message_length () const |
Get the length of the buffer for the help message. | |
void | add_submenu_listener (SubMenuListener *listener) |
Add listener for mouse moving over the menu arrow when no other toolbox event is associated 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 associated 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... | |
void | add_selection_command (Command *command) |
Add command to be run when this menu item is selected. More... | |
void | remove_selection_command (Command *command) |
![]() | |
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... | |
Friends | |
class | Menu |
Additional Inherited Members | |
![]() | |
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... | |
![]() | |
ObjectId | _handle |
Underlying toolbox handle. | |
int | _id |
Underlying toolbox component id. | |
Class representing a single menu item on a menu.
|
inline |
Construct a menu item from an existing menu item.
Both menu items will refer to the same underlying toolbox menu option
|
inline |
Construct a menu item from a Component.
ObjectClassError | if the component is not on a menu. |
void tbx::MenuItem::add_selection_command | ( | Command * | command | ) |
Add command to be run when this menu item is selected.
This is only generated if no other toolbox event is associated with the menu items selection.
command | command to add |
void tbx::MenuItem::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.
listener | to add |
void tbx::MenuItem::add_submenu_listener | ( | SubMenuListener * | listener | ) |
Add listener for mouse moving over the menu arrow when no other toolbox event is associated with this event.
listener | to add |
int tbx::MenuItem::click_event | ( | ) | const |
Get the click event for this menu item.
void tbx::MenuItem::click_event | ( | int | id | ) |
Set click event for menu item.
id | event id or 0 to generate Menu_Selection toolbox event |
Object tbx::MenuItem::click_show | ( | bool * | transient = 0 | ) |
Get click show object for menu item.
transient | pointer to variable to receive transient flag or 0 if not interested in transient flag. Defaults to 0 |
void tbx::MenuItem::click_show | ( | const Object & | object, |
bool | transient = true |
||
) |
Set object to show if menu item is clicked.
object | object to show |
transient | show object as transient (defaults to true) |
bool tbx::MenuItem::has_click_show | ( | ) | const |
Check if menu item has a click show object.
void tbx::MenuItem::help_message | ( | const std::string & | msg | ) |
Set the help message for a menu item.
OsError | the entries help text buffer is not large enough to hold the message. |
|
inline |
Check if this menu item refers to the same underlying toolbox menu option.
Assign a menuitem field to refer to the same underlying toolbox component as an existing component.
ObjectClassError | if the component is not in a menu. |
Assign to another menu item.
Both menu items will refer to the same underlying toolbox menu option
|
inline |
Check if this menu item refers to the same underlying toolbox menu option.
void tbx::MenuItem::remove_selection_listener | ( | MenuSelectionListener * | listener | ) |
Remove menu selection listener.
listener | to remove |
void tbx::MenuItem::remove_submenu_listener | ( | SubMenuListener * | listener | ) |
Remove listener for mouse moving over the menu arrow when no other toolbox event is associated with this event.
listener | to remove |
void tbx::MenuItem::sprite_name | ( | const std::string & | name | ) |
Set the sprite name for the menu item.
OsError | the entries sprite name buffer is not large enough to hold the name or the entry is a sprite entry. |
int tbx::MenuItem::submenu_event | ( | ) | const |
Get the event raised when the mouse is moved over the submenu arrow.
If no event has been specified then 0 is returned.
void tbx::MenuItem::submenu_event | ( | int | id | ) |
Set event to raise when mouse if moved over the submenu arrow.
If id is 0 then Menu_SubMenu toolbox event is raised instead
void tbx::MenuItem::text | ( | const std::string & | text | ) |
Set the text for the menu item.
OsError | the entries text buffer is not large enough to hold the text or the entry is a sprite entry. |