tbx  0.7.6
Public Types | Public Member Functions | List of all members
tbx::res::ResButton Class Reference

Class for Button gadget template. More...

#include <resbutton.h>

Inheritance diagram for tbx::res::ResButton:
tbx::res::ResGadget tbx::res::ResBase

Public Types

enum  { TYPE_ID = 960 }
 
enum  ButtonType {
  IGNORE_CLICKS, CONTINUOUS, CLICK_AUTO_REPEAT, CLICK_ONCE,
  CLICK_SELECTS, CLICK_SELECTS_DOUBLE, CLICK_ONCE_DRAG, CLICK_SELECTS_DRAG,
  CLICK_SELECTS_DOUBLE_DRAG, OVER_SELECTS, CLICK_DOUBLE_DRAG, CLICK_NOTIFY_AND_SELECTS_DRAG,
  FOCUS_AND_DRAG = 14, WRITEABLE
}
 Enumeration for how the button processes clicks.
 

Public Member Functions

 ResButton (const ResGadget &other)
 Construct an button gadget resource. More...
 
 ResButton (const ResButton &other)
 Construct an button gadget resource. More...
 
ResButtonoperator= (const ResGadget &other)
 Assign from a ResGadget. More...
 
ResButtonoperator= (const ResButton &other)
 Assign from another button gadget resource. More...
 
 ResButton ()
 Construct a button gadget resource. More...
 
bool use_task_sprite_area () const
 Check if button uses the task sprite area. More...
 
void use_task_sprite_area (bool value)
 Set if button uses the task sprite area. More...
 
bool return_menu_clicks () const
 Check if button will return clicks with the menu button. More...
 
void return_menu_clicks (bool value)
 Set if button will return clicks with the menu button. More...
 
int button_flags () const
 Raw access to all button flags. More...
 
void button_flags (int value)
 Raw access to all button flags. More...
 
bool has_text () const
 Check if the button shows text. More...
 
void has_text (bool value)
 Set if the button shows text. More...
 
bool is_sprite () const
 Check if the button shows a sprite. More...
 
void is_sprite (bool value)
 Set if the button shows a sprite. More...
 
bool has_border () const
 Check if the button has a border. More...
 
void has_border (bool value)
 Set if the button has a border. More...
 
bool hcentred () const
 Check if the contents of the button are horizontally centred. More...
 
void hcentred (bool value)
 Set if the contents of the button are horizontally centred. More...
 
bool vcentred () const
 Check if the contents of the button are vertically centred. More...
 
void vcentred (bool value)
 Set if the contents of the button are vertically centred. More...
 
bool filled () const
 Check if the button background is filled. More...
 
void filled (bool value)
 Set if the button background is filled. More...
 
bool anti_aliased_font () const
 Check if the button uses an anti aliased font. More...
 
void anti_aliased_font (bool value)
 Set if the button uses an anti aliased font. More...
 
bool redraw_needs_help () const
 Check if the button need help from the user application to be redrawn. More...
 
void redraw_needs_help (bool value)
 Set if the button need help from the user application to be redrawn. More...
 
bool text_right_justified () const
 Check if the text on the button is right justified. More...
 
void text_right_justified (bool value)
 Set if the text on the button is right justified. More...
 
bool adjust_does_not_cancel () const
 Check if the adjust does not cancel other selections in the same ESG group. More...
 
void adjust_does_not_cancel (bool value)
 Set if the adjust does not cancel other selections in the same ESG group. More...
 
bool half_size_sprite () const
 Check if the button display the sprite half size. More...
 
void half_size_sprite (bool value)
 Set if the button shows the sprite half size. More...
 
ButtonType button_type () const
 Get how the button processes mouse clicks. More...
 
void button_type (ButtonType type)
 Set how the button processes mouse clicks. More...
 
int esg () const
 Return the exclusive selection group (ESG) for the button. More...
 
void esg (int value)
 Set the exclusive selection group (ESG) for the button. More...
 
int foreground () const
 Return the foreground WIMP colour. More...
 
void foreground (int value)
 Set the foreground WIMP colour. More...
 
int background () const
 Return the background WIMP colour. More...
 
void background (int value)
 Set the background WIMP colour. More...
 
int font_handle () const
 Get the WIMP font handle for drawing text. More...
 
void font_handle (int value)
 Set the WIMP font handle for drawing text. More...
 
const char * value () const
 Get the value (text or sprite name) of the button. More...
 
void value (const char *value, int max_length=-1)
 Set the value (text or sprite name) of the button. More...
 
void value (const std::string &value, int max_length=-1)
 Set the value (text or sprite name) of the button. More...
 
int max_value () const
 Get the maximum length of the value string. More...
 
const char * validation () const
 Get the validation (sprite name) for the button. More...
 
void validation (const char *value, int max_length=-1)
 Set the validation (sprite name) for the button. More...
 
void validation (const std::string &value, int max_length=-1)
 Set the validation (sprite name) for the button. More...
 
int max_validation () const
 Get the maximum length the validation (sprite name) that can be used.
 
- Public Member Functions inherited from tbx::res::ResGadget
 ResGadget (const ResGadget &other)
 Construct a resource gadget as a copy of another. More...
 
ResGadgetoperator= (const ResGadget &other)
 Assign a resource gadget as a copy of another. More...
 
 ResGadget (int type, int size)
 Construct an empty gadget of the given type and size. More...
 
void check_type (int type) const
 Check if this gadgets type is as specified. More...
 
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 back () const
 Check if gadget is at the back (created first) More...
 
void back (bool value)
 Set if gadget should be at the back. More...
 
bool faded () const
 Check if the gadget is faded. More...
 
void faded (bool value)
 Set if the gadget is faded. More...
 
unsigned short type () const
 Get the gadget type. More...
 
unsigned short stored_size () const
 Get the size stored in template. More...
 
int size () const
 Size of gadget (including header). More...
 
int xmin () const
 Get the minimum x coordinate of the gadget's bounding box. More...
 
void xmin (int x)
 Set the minimum x coordinate of the gadget's bounding box. More...
 
int ymin () const
 Get the minimum y coordinate of the gadget's bounding box. More...
 
void ymin (int y)
 Set the minimum y coordinate of the gadget's bounding box. More...
 
int xmax () const
 Get the maximum x coordinate of the gadget's bounding box. More...
 
void xmax (int x)
 Set the maximum x coordinate of the gadget's bounding box. More...
 
int ymax () const
 Get the maximum y coordinate of the gadget's bounding box. More...
 
void ymax (int y)
 Set the maximum y coordinate of the gadget's bounding box. More...
 
ComponentId component_id () const
 Get the Component ID. More...
 
void component_id (ComponentId value)
 Set the Component ID. More...
 
const char * help_message () const
 Get the help message for the gadget. More...
 
void help_message (const char *msg, int max_length=-1)
 Set the help message for the gadget. More...
 
void help_message (const std::string &msg, int max_length=-1)
 Set the help message for the gadget. More...
 
int max_help () const
 Max size of message.
 
- Public Member Functions inherited from tbx::res::ResBase
 ResBase (const ResBase &other)
 Copy constructor. More...
 
virtual ~ResBase ()
 Destructor.
 
ResBaseoperator= (const ResBase &other)
 Assignment. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from tbx::res::ResGadget
static int gadget_size (unsigned int type_and_size)
 Get gadget size given its type and size value. More...
 
- Protected Member Functions inherited from tbx::res::ResGadget
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...
 
- Protected Attributes inherited from tbx::res::ResBase
ResImpl * _impl
 Internal Resource implementation.
 

Detailed Description

Class for Button gadget template.

Constructor & Destructor Documentation

◆ ResButton() [1/3]

tbx::res::ResButton::ResButton ( const ResGadget other)
inline

Construct an button gadget resource.

Parameters
otherResGadget to copy resource from
Exceptions
ResGadgetTypeMismatchif the ResGadget is not an button

◆ ResButton() [2/3]

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

Construct an button gadget resource.

Parameters
otherbutton to copy resource from

◆ ResButton() [3/3]

tbx::res::ResButton::ResButton ( )
inline

Construct a button gadget resource.

All options are false, events unset and messages are null.

Member Function Documentation

◆ adjust_does_not_cancel() [1/2]

bool tbx::res::ResButton::adjust_does_not_cancel ( ) const
inline

Check if the adjust does not cancel other selections in the same ESG group.

Returns
true if the button adjust does not cancel other selections

◆ adjust_does_not_cancel() [2/2]

void tbx::res::ResButton::adjust_does_not_cancel ( bool  value)
inline

Set if the adjust does not cancel other selections in the same ESG group.

Parameters
valuetrue so set the button so adjust does not cancel other selections

◆ anti_aliased_font() [1/2]

bool tbx::res::ResButton::anti_aliased_font ( ) const
inline

Check if the button uses an anti aliased font.

Returns
true if the button uses an anti aliased font

◆ anti_aliased_font() [2/2]

void tbx::res::ResButton::anti_aliased_font ( bool  value)
inline

Set if the button uses an anti aliased font.

Note: if the anti-aliased flag is set the font_handle methods become available, but the foreground and background methods should not be used.

Parameters
valuetrue to make the button use an anti aliased font

◆ background() [1/2]

int tbx::res::ResButton::background ( ) const
inline

Return the background WIMP colour.

This method is only valid when anti_aliased_font() == false

Returns
background WIMP colour (0-15)

◆ background() [2/2]

void tbx::res::ResButton::background ( int  value)
inline

Set the background WIMP colour.

This method is only valid when anti_aliased_font() == false

Parameters
valuebackground WIMP colour (0-15)

◆ button_flags() [1/2]

int tbx::res::ResButton::button_flags ( ) const
inline

Raw access to all button flags.

It is recommended you use the other methods in this class rather than use this directly.

◆ button_flags() [2/2]

void tbx::res::ResButton::button_flags ( int  value)
inline

Raw access to all button flags.

It is recommended you use the other methods in this class rather than use this directly.

Parameters
valuenew button flags

◆ button_type() [1/2]

ButtonType tbx::res::ResButton::button_type ( ) const
inline

Get how the button processes mouse clicks.

Returns
ButtonType value for how clicks are handled

◆ button_type() [2/2]

void tbx::res::ResButton::button_type ( ButtonType  type)
inline

Set how the button processes mouse clicks.

Parameters
typeButtonType for how clicks are handled

◆ esg() [1/2]

int tbx::res::ResButton::esg ( ) const
inline

Return the exclusive selection group (ESG) for the button.

Selecting one button that is an ESG will unselect all the others in the same ESG.

Returns
ESG number (0-31). 0 Means not in a group.

◆ esg() [2/2]

void tbx::res::ResButton::esg ( int  value)
inline

Set the exclusive selection group (ESG) for the button.

Selecting one button that is an ESG will unselect all the others in the same ESG.

Parameters
valueESG number (0-31). 0 Means not in a group.

◆ filled() [1/2]

bool tbx::res::ResButton::filled ( ) const
inline

Check if the button background is filled.

Returns
true if the button background is filled

◆ filled() [2/2]

void tbx::res::ResButton::filled ( bool  value)
inline

Set if the button background is filled.

Parameters
valuetrue to fill the button background

◆ font_handle() [1/2]

int tbx::res::ResButton::font_handle ( ) const
inline

Get the WIMP font handle for drawing text.

This method is only valid when anti_aliased_font() == true

Returns
WIMP font handle

◆ font_handle() [2/2]

void tbx::res::ResButton::font_handle ( int  value)
inline

Set the WIMP font handle for drawing text.

This method is only valid when anti_aliased_font() == true

Returns
WIMP font handle

◆ foreground() [1/2]

int tbx::res::ResButton::foreground ( ) const
inline

Return the foreground WIMP colour.

This method is only valid when anti_aliased_font() == false

Returns
foreground WIMP colour (0-15)

◆ foreground() [2/2]

void tbx::res::ResButton::foreground ( int  value)
inline

Set the foreground WIMP colour.

This method is only valid when anti_aliased_font() == false

Parameters
valueforeground WIMP colour (0-15)

◆ half_size_sprite() [1/2]

bool tbx::res::ResButton::half_size_sprite ( ) const
inline

Check if the button display the sprite half size.

Returns
true if the button display the sprite half size

◆ half_size_sprite() [2/2]

void tbx::res::ResButton::half_size_sprite ( bool  value)
inline

Set if the button shows the sprite half size.

Parameters
valuetrue to set the button to display the sprite half size

◆ has_border() [1/2]

bool tbx::res::ResButton::has_border ( ) const
inline

Check if the button has a border.

Returns
true if the button border

◆ has_border() [2/2]

void tbx::res::ResButton::has_border ( bool  value)
inline

Set if the button has a border.

Parameters
valuetrue to give the button a border

◆ has_text() [1/2]

bool tbx::res::ResButton::has_text ( ) const
inline

Check if the button shows text.

Returns
true if the button shows text

◆ has_text() [2/2]

void tbx::res::ResButton::has_text ( bool  value)
inline

Set if the button shows text.

Parameters
valueset to true if the button should show text

◆ hcentred() [1/2]

bool tbx::res::ResButton::hcentred ( ) const
inline

Check if the contents of the button are horizontally centred.

Returns
true if the button is horizontally centred

◆ hcentred() [2/2]

void tbx::res::ResButton::hcentred ( bool  value)
inline

Set if the contents of the button are horizontally centred.

Parameters
valuetrue to horizontally centre the button

◆ is_sprite() [1/2]

bool tbx::res::ResButton::is_sprite ( ) const
inline

Check if the button shows a sprite.

Returns
true if the button shows a sprite

◆ is_sprite() [2/2]

void tbx::res::ResButton::is_sprite ( bool  value)
inline

Set if the button shows a sprite.

Parameters
valuetrue if the button will show a sprite

◆ max_value()

int tbx::res::ResButton::max_value ( ) const
inline

Get the maximum length of the value string.

Returns
maximum length

◆ operator=() [1/2]

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

Assign from another button gadget resource.

Parameters
otherbutton gadget resource to copy

◆ operator=() [2/2]

ResButton& tbx::res::ResButton::operator= ( const ResGadget other)
inline

Assign from a ResGadget.

Parameters
otherResGadget to copy
Exceptions
ResGadgetTypeMismatchif the ResGadget is not an button

◆ redraw_needs_help() [1/2]

bool tbx::res::ResButton::redraw_needs_help ( ) const
inline

Check if the button need help from the user application to be redrawn.

Returns
true if the button needs help to be redrawn

◆ redraw_needs_help() [2/2]

void tbx::res::ResButton::redraw_needs_help ( bool  value)
inline

Set if the button need help from the user application to be redrawn.

Parameters
valuetrue if the button needs help to be redrawn

◆ return_menu_clicks() [1/2]

bool tbx::res::ResButton::return_menu_clicks ( ) const
inline

Check if button will return clicks with the menu button.

Returns
true if menu clicks are returned

◆ return_menu_clicks() [2/2]

void tbx::res::ResButton::return_menu_clicks ( bool  value)
inline

Set if button will return clicks with the menu button.

Parameters
valuetrue to make the button return menu clicks

◆ text_right_justified() [1/2]

bool tbx::res::ResButton::text_right_justified ( ) const
inline

Check if the text on the button is right justified.

Returns
true if the text on the button is right justified

◆ text_right_justified() [2/2]

void tbx::res::ResButton::text_right_justified ( bool  value)
inline

Set if the text on the button is right justified.

Parameters
valuetrue to make the text on the button right justified

◆ use_task_sprite_area() [1/2]

bool tbx::res::ResButton::use_task_sprite_area ( ) const
inline

Check if button uses the task sprite area.

Returns
true if button uses the task sprite area, false if button uses the WIMP sprite area

◆ use_task_sprite_area() [2/2]

void tbx::res::ResButton::use_task_sprite_area ( bool  value)
inline

Set if button uses the task sprite area.

Parameters
valuetrue to make the button use the task sprite area, false to make the button use the WIMP sprite area

◆ validation() [1/3]

const char* tbx::res::ResButton::validation ( ) const
inline

Get the validation (sprite name) for the button.

Returns
pointer to null terminated validation string or 0 if no validation

◆ validation() [2/3]

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

Set the validation (sprite name) for the button.

Parameters
valuenew validation or 0 for none
max_lengthmaximum length for the validation string

◆ validation() [3/3]

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

Set the validation (sprite name) for the button.

Parameters
valuenew validation or 0 for none
max_lengthmaximum length for the validation string

◆ value() [1/3]

const char* tbx::res::ResButton::value ( ) const
inline

Get the value (text or sprite name) of the button.

Returns
pointer to null terminate value string

◆ value() [2/3]

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

Set the value (text or sprite name) of the button.

Parameters
valuepointer to null terminate value string
max_lengthmaximum length the value will be set to or -1 (the default) to use the length of the value.

◆ value() [3/3]

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

Set the value (text or sprite name) of the button.

Parameters
valuenew value
max_lengthmaximum length the value will be set to or -1 (the default) to use the length of the value.

◆ vcentred() [1/2]

bool tbx::res::ResButton::vcentred ( ) const
inline

Check if the contents of the button are vertically centred.

Returns
true if the button is vertically centred

◆ vcentred() [2/2]

void tbx::res::ResButton::vcentred ( bool  value)
inline

Set if the contents of the button are vertically centred.

Parameters
valuetrue to vertically centre the button

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