tbx  0.7.6
Public Member Functions | Protected Member Functions | Friends | List of all members
tbx::res::ResMenuItem Class Reference

Menu item object. More...

#include <resmenu.h>

Inheritance diagram for tbx::res::ResMenuItem:
tbx::res::ResBase

Public Member Functions

 ResMenuItem (const ResMenuItem &other)
 Create a ResMenuItem as a copy of another. More...
 
ResMenuItemoperator= (const ResMenuItem &other)
 Assign this menu item to be equal to another. More...
 
 ResMenuItem ()
 Construct a ResMenuItem with flags unset, item text "" and show objects and help message null.
 
unsigned int flags () const
 Get all flags as a word raw access. More...
 
void flags (unsigned int value)
 Set all flags as a word. More...
 
bool ticked () const
 Check if the item is ticked. More...
 
void ticked (bool t)
 Set if the item is ticked. More...
 
bool dotted_line () const
 Check if this entry is followed by a dotted line. More...
 
void dotted_line (bool value)
 Set if this entry is followed by a dotted line. More...
 
bool faded () const
 Check if entry is faded. More...
 
void faded (bool value)
 Set if entry is faded. More...
 
bool sprite () const
 Check if this entry shows a sprite. More...
 
bool has_submenu () const
 Check if this entry has a sub menu. More...
 
void has_submenu (bool value)
 Set if this entry has a sub menu. More...
 
bool generate_submenu_event () const
 Check if the sub menu event will be generated. More...
 
void generate_submenu_event (bool value)
 Set if the sub menu event will be generated. More...
 
bool show_transient () const
 Check if shown object will be shown transiently. More...
 
void show_transient (bool value)
 Set if shown object will be shown transiently. More...
 
ComponentId component_id () const
 Get component ID of menu item.
 
void component_id (ComponentId id)
 Set component ID. More...
 
const char * text () const
 Get text or sprite name for entry. More...
 
void text (const char *value, int max_length=-1)
 Set text or sprite name for entry. More...
 
void text (const std::string &value, int max_length=-1)
 Set text or sprite name for entry. More...
 
int max_text () const
 Maximum space for text or sprite name.
 
const char * click_show () const
 Get the name of the object to show on click. More...
 
void click_show (const char *show_name)
 Set the name of the object to show on click. More...
 
void click_show (const std::string &show_name)
 Set the name of the object to show on click. More...
 
const char * submenu_show () const
 Get the name of the sub menu to show for this menu item. More...
 
void submenu_show (char *show_name)
 Set the name of the sub menu to show for this menu item. More...
 
void submenu_show (const std::string &show_name)
 Set the name of the sub menu to show for this menu item. More...
 
int submenu_event () const
 Get the event ID generated when sub menu is shown. More...
 
void submenu_event (int event_id)
 Set the event ID generated when sub menu is shown. More...
 
int click_event () const
 Get the event ID generated when the item is clicked. More...
 
void click_event (int event_id)
 Set the event ID generated when the item is clicked. More...
 
const char * help_message () const
 Get the menu item help message. More...
 
void help_message (const char *value, int max_length=-1)
 Set the item help message. More...
 
void help_message (const std::string &value, int max_length=-1)
 Set the item help message. More...
 
int max_help_message () const
 Get the maximum help message length.
 
- Public Member Functions inherited from tbx::res::ResBase
 ResBase (const ResBase &other)
 Copy constructor. More...
 
virtual ~ResBase ()
 Destructor.
 
ResBaseoperator= (const ResBase &other)
 Assignment. More...
 

Protected Member Functions

void make_writeable ()
 Make item writeable.
 
- Protected Member Functions inherited from tbx::res::ResBase
 ResBase (ResImpl *impl)
 Create from internal resource implementation. More...
 
const char * string (int offset) const
 Return a string at the given offset. More...
 
void string (int offset, const char *value)
 Set a string at the given offset. More...
 
void string (int offset, std::string value)
 Set a string at the given offset. More...
 
void string_with_length (int offset, const char *value, int length=-1)
 Assign a string where the length is at offset+4. More...
 
void string_with_length (int offset, const std::string &value, int length=-1)
 Assign a string where the length is at offset+4. More...
 
const char * message (int offset) const
 Get the message string at the given offset. More...
 
void message (int offset, const char *value)
 Set a message at the given offset. More...
 
void message (int offset, std::string value)
 Set a message at the given offset. More...
 
void message_with_length (int offset, const char *value, int length=-1)
 Assign a message where the length is at offset+4. More...
 
void message_with_length (int offset, const std::string &value, int length=-1)
 Assign a message where the length is at offset+4. More...
 
int int_value (int offset) const
 Get an integer value. More...
 
void int_value (int offset, int value)
 Set a number at the specified offset. More...
 
unsigned int uint_value (int offset) const
 Get an unsigned integer value. More...
 
void uint_value (int offset, unsigned int value)
 Set an unsigned number at the specified offset. More...
 
unsigned char byte_value (int offset) const
 Get a byte value. More...
 
void byte_value (int offset, unsigned char value)
 Set an unsigned byte (8 bit value) at the specified offset. More...
 
unsigned short ushort_value (int offset) const
 Get a unsigned short value. More...
 
void ushort_value (int offset, unsigned short value)
 Set an unsigned short (16 bit value) at the specified offset. More...
 
bool flag (int offset, int mask) const
 Check if any of the bits in a mask are set. More...
 
void flag (int offset, int mask, bool on)
 Set/clear the bits in mask. More...
 
int flag_value (int offset, int mask) const
 Get the bits for the given mask. More...
 
void flag_value (int offset, int mask, int value)
 Set bits in given mask clearing others. More...
 
void init_string (int offset, const char *value)
 Initialise a string in a constructor helper. More...
 
void init_message (int offset, const char *value)
 Initialise a message in a constructor helper. More...
 
void init_sprite_area_ref (int offset)
 Initialise a sprite area reference. More...
 
void init_object_ref (int offset)
 Initialise an object reference. More...
 

Friends

class ResMenu
 
class tbx::Menu
 

Additional Inherited Members

- Protected Attributes inherited from tbx::res::ResBase
ResImpl * _impl
 Internal Resource implementation.
 

Detailed Description

Menu item object.

Constructor & Destructor Documentation

◆ ResMenuItem()

tbx::res::ResMenuItem::ResMenuItem ( const ResMenuItem other)
inline

Create a ResMenuItem as a copy of another.

Parameters
otherResMenuItem to copy

Member Function Documentation

◆ click_event() [1/2]

int tbx::res::ResMenuItem::click_event ( ) const
inline

Get the event ID generated when the item is clicked.

Returns
event ID or 0 for the default

◆ click_event() [2/2]

void tbx::res::ResMenuItem::click_event ( int  event_id)
inline

Set the event ID generated when the item is clicked.

Parameters
event_idevent ID or 0 for the default

◆ click_show() [1/3]

const char* tbx::res::ResMenuItem::click_show ( ) const
inline

Get the name of the object to show on click.

Returns
pointer to zero terminated object name or 0 if none

◆ click_show() [2/3]

void tbx::res::ResMenuItem::click_show ( const char *  show_name)
inline

Set the name of the object to show on click.

Parameters
show_namepointer to zero terminated object name or 0 if none

◆ click_show() [3/3]

void tbx::res::ResMenuItem::click_show ( const std::string &  show_name)
inline

Set the name of the object to show on click.

Parameters
show_nameobject name

◆ component_id()

void tbx::res::ResMenuItem::component_id ( ComponentId  id)
inline

Set component ID.

Parameters
idcomponent ID of menu item

◆ dotted_line() [1/2]

bool tbx::res::ResMenuItem::dotted_line ( ) const
inline

Check if this entry is followed by a dotted line.

Returns
true if the entry is followed by a dotted line

◆ dotted_line() [2/2]

void tbx::res::ResMenuItem::dotted_line ( bool  value)
inline

Set if this entry is followed by a dotted line.

Parameters
valueset to true if the entry is followed by a dotted line

◆ faded() [1/2]

bool tbx::res::ResMenuItem::faded ( ) const
inline

Check if entry is faded.

Returns
true if entry is faded

◆ faded() [2/2]

void tbx::res::ResMenuItem::faded ( bool  value)
inline

Set if entry is faded.

Parameters
valueset to true if the entry should be faded

◆ flags() [1/2]

unsigned int tbx::res::ResMenuItem::flags ( ) const
inline

Get all flags as a word raw access.

Not normally used as there are named methods that allow access to the individual items in the flags

◆ flags() [2/2]

void tbx::res::ResMenuItem::flags ( unsigned int  value)
inline

Set all flags as a word.

Not normally used as there are named methods that allow access to the individual items in the flags

◆ generate_submenu_event() [1/2]

bool tbx::res::ResMenuItem::generate_submenu_event ( ) const
inline

Check if the sub menu event will be generated.

The sub menu event occurs when the user traverses this entry's sub menu arrow with the mouse pointer (if has_submenu() == true).

Returns
true if the sub menu event will be generated

◆ generate_submenu_event() [2/2]

void tbx::res::ResMenuItem::generate_submenu_event ( bool  value)
inline

Set if the sub menu event will be generated.

The sub menu event occurs when the user traverses this entry's sub menu arrow with the mouse pointer (if has_submenu() == true).

Parameters
valueset to true if the sub menu event should be generated

◆ has_submenu() [1/2]

bool tbx::res::ResMenuItem::has_submenu ( ) const
inline

Check if this entry has a sub menu.

ie a sub menu arrow appears next to the entry

Returns
true if this menu has a sub menu

◆ has_submenu() [2/2]

void tbx::res::ResMenuItem::has_submenu ( bool  value)
inline

Set if this entry has a sub menu.

ie a sub menu arrow appears next to the entry

Parameters
valueset to true if this menu has a sub menu

◆ help_message() [1/3]

const char* tbx::res::ResMenuItem::help_message ( ) const
inline

Get the menu item help message.

Returns
pointer to zero terminated help message or 0 for none.

◆ help_message() [2/3]

void tbx::res::ResMenuItem::help_message ( const char *  value,
int  max_length = -1 
)
inline

Set the item help message.

@param value pointer to zero terminated menu help message or 0 for none.
@param max_length maximum length for help message or -1 to use current value.
                  This is alway adjusted to allow for the full length of the help message.

◆ help_message() [3/3]

void tbx::res::ResMenuItem::help_message ( const std::string &  value,
int  max_length = -1 
)
inline

Set the item help message.

@param value menu help message.
@param max_length maximum length for help message or -1 to use current value.
                  This is alway adjusted to allow for the full length of the help message.

◆ operator=()

ResMenuItem& tbx::res::ResMenuItem::operator= ( const ResMenuItem other)
inline

Assign this menu item to be equal to another.

Parameters
otherResMenuItem to copy

◆ show_transient() [1/2]

bool tbx::res::ResMenuItem::show_transient ( ) const
inline

Check if shown object will be shown transiently.

Returns
true if object will be shown transiently

◆ show_transient() [2/2]

void tbx::res::ResMenuItem::show_transient ( bool  value)
inline

Set if shown object will be shown transiently.

Parameters
valueset to true if object will be shown transiently

◆ sprite()

bool tbx::res::ResMenuItem::sprite ( ) const
inline

Check if this entry shows a sprite.

When not set this entry shows text

Returns
true if this is a sprite menu item

◆ submenu_event() [1/2]

int tbx::res::ResMenuItem::submenu_event ( ) const
inline

Get the event ID generated when sub menu is shown.

Returns
event ID or 0 for the default

◆ submenu_event() [2/2]

void tbx::res::ResMenuItem::submenu_event ( int  event_id)
inline

Set the event ID generated when sub menu is shown.

Parameters
event_idevent ID or 0 for the default

◆ submenu_show() [1/3]

const char* tbx::res::ResMenuItem::submenu_show ( ) const
inline

Get the name of the sub menu to show for this menu item.

Returns
pointer to zero terminated sub menu object name or 0 for none.

◆ submenu_show() [2/3]

void tbx::res::ResMenuItem::submenu_show ( char *  show_name)
inline

Set the name of the sub menu to show for this menu item.

Parameters
show_namepointer to zero terminated sub menu object name or 0 for none.

◆ submenu_show() [3/3]

void tbx::res::ResMenuItem::submenu_show ( const std::string &  show_name)
inline

Set the name of the sub menu to show for this menu item.

Parameters
show_namesub menu object name

◆ text() [1/3]

const char* tbx::res::ResMenuItem::text ( ) const
inline

Get text or sprite name for entry.

The sprite() flag determines if this is a sprite or text entry

Returns
pointer to zero terminated text or sprite name

◆ text() [2/3]

void tbx::res::ResMenuItem::text ( const char *  value,
int  max_length = -1 
)
inline

Set text or sprite name for entry.

The sprite() flag determines if this is a sprite or text entry

Parameters
valuepointer to zero terminated text or sprite name
max_lengthmaximum length of the text or sprite name that will be used with this menu item or -1 (the default) for the length of value

◆ text() [3/3]

void tbx::res::ResMenuItem::text ( const std::string &  value,
int  max_length = -1 
)
inline

Set text or sprite name for entry.

The sprite() flag determines if this is a sprite or text entry

Parameters
valuetext or sprite name
max_lengthmaximum length of the text or sprite name that will be used with this menu item or -1 (the default) for the length of value

◆ ticked() [1/2]

bool tbx::res::ResMenuItem::ticked ( ) const
inline

Check if the item is ticked.

Returns
true if the item is ticked

◆ ticked() [2/2]

void tbx::res::ResMenuItem::ticked ( bool  t)
inline

Set if the item is ticked.

Parameters
tset to true if the item should be ticked

The documentation for this class was generated from the following files: