tbx  0.7.3
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
tbx::res::ResGadget Class Reference

Base class for gadget memory resources. More...

#include <resgadget.h>

Inheritance diagram for tbx::res::ResGadget:
tbx::res::ResBase tbx::res::ResActionButton tbx::res::ResAdjuster tbx::res::ResButton tbx::res::ResDisplayField tbx::res::ResDraggable tbx::res::ResLabel tbx::res::ResLabelledBox tbx::res::ResNumberRange tbx::res::ResOptionButton tbx::res::ResPopUp tbx::res::ResRadioButton tbx::res::ResScrollList tbx::res::ResSlider tbx::res::ResStringSet tbx::res::ResTextArea tbx::res::ResToolAction tbx::res::ResWritableField

Public Member Functions

 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...
 

Static Public Member Functions

static int gadget_size (unsigned int type_and_size)
 Get gadget size given its type and size value. 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 ResWindow
 
class tbx::Window
 

Additional Inherited Members

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

Detailed Description

Base class for gadget memory resources.

Constructor & Destructor Documentation

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

Construct a resource gadget as a copy of another.

Parameters
othergadget to copy
tbx::res::ResGadget::ResGadget ( int  type,
int  size 
)

Construct an empty gadget of the given type and size.

The gadget is constructed with all fields 0 except the type and size field and the help message field registered as a message string.

Parameters
typegadget type
sizegadget size. This must always be specified it will not be deduced from the type.

Member Function Documentation

bool tbx::res::ResGadget::back ( ) const
inline

Check if gadget is at the back (created first)

Returns
true if gadget is at the back
void tbx::res::ResGadget::back ( bool  value)
inline

Set if gadget should be at the back.

Parameters
valueset to true if the gadget should be at the back
void tbx::res::ResGadget::check_type ( int  type_id) const

Check if this gadgets type is as specified.

Parameters
type_idthe gadget type id to check against
Exceptions
ResGadgetTypeMismatchif the types do not match
ComponentId tbx::res::ResGadget::component_id ( ) const
inline

Get the Component ID.

Returns
Component ID for the gadget
void tbx::res::ResGadget::component_id ( ComponentId  value)
inline

Set the Component ID.

Parameters
valueComponent ID for the gadget
bool tbx::res::ResGadget::faded ( ) const
inline

Check if the gadget is faded.

Returns
true if the gadget is faded
void tbx::res::ResGadget::faded ( bool  value)
inline

Set if the gadget is faded.

Parameters
valueset to true if the gadget should be faded
unsigned int tbx::res::ResGadget::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

void tbx::res::ResGadget::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

Parameters
valueunsigned 32 bit values with the flags
int tbx::res::ResGadget::gadget_size ( unsigned int  type_and_size)
static

Get gadget size given its type and size value.

Get gadget size including for built in types is size is not specified.

Returns
gadget size
const char* tbx::res::ResGadget::help_message ( ) const
inline

Get the help message for the gadget.

Returns
pointer to zero terminated help message or 0 if none
void tbx::res::ResGadget::help_message ( const char *  msg,
int  max_length = -1 
)
inline

Set the help message for the gadget.

Parameters
msgpointer to zero terminated help message or 0 if none
max_lengthmaximum length the help message will be changed to or -1 (the default) to use the length of msg.
void tbx::res::ResGadget::help_message ( const std::string &  msg,
int  max_length = -1 
)
inline

Set the help message for the gadget.

Parameters
msghelp message
max_lengthmaximum length the help message will be changed to or -1 (the default) to use the length of msg.
ResGadget& tbx::res::ResGadget::operator= ( const ResGadget other)
inline

Assign a resource gadget as a copy of another.

Parameters
othergadget to copy
int tbx::res::ResGadget::size ( ) const
inline

Size of gadget (including header).

Takes into account size of standard controls.

Returns
size of gadget
unsigned short tbx::res::ResGadget::stored_size ( ) const
inline

Get the size stored in template.

Standard gadgets have a known size so this method may return 0 for standard gadgets.

Returns
the size stored in the gadget template.
unsigned short tbx::res::ResGadget::type ( ) const
inline

Get the gadget type.

Returns
Toolbox gadget type ID for this gadget
int tbx::res::ResGadget::xmax ( ) const
inline

Get the maximum x coordinate of the gadget's bounding box.

Returns
maximum x coordinate of bounding box (in window work area coordinates).
void tbx::res::ResGadget::xmax ( int  x)
inline

Set the maximum x coordinate of the gadget's bounding box.

Parameters
xmaximum x coordinate of bounding box (in window work area coordinates).
int tbx::res::ResGadget::xmin ( ) const
inline

Get the minimum x coordinate of the gadget's bounding box.

Returns
minimum x coordinate of bounding box (in window work area coordinates).
void tbx::res::ResGadget::xmin ( int  x)
inline

Set the minimum x coordinate of the gadget's bounding box.

Parameters
xminimum x coordinate of bounding box (in window work area coordinates).
int tbx::res::ResGadget::ymax ( ) const
inline

Get the maximum y coordinate of the gadget's bounding box.

Returns
maximum y coordinate of bounding box (in window work area coordinates).
void tbx::res::ResGadget::ymax ( int  y)
inline

Set the maximum y coordinate of the gadget's bounding box.

Parameters
ymaximum y coordinate of bounding box (in window work area coordinates).
int tbx::res::ResGadget::ymin ( ) const
inline

Get the minimum y coordinate of the gadget's bounding box.

Returns
minimum y coordinate of bounding box (in window work area coordinates).
void tbx::res::ResGadget::ymin ( int  y)
inline

Set the minimum y coordinate of the gadget's bounding box.

Parameters
yminimum y coordinate of bounding box (in window work area coordinates).

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