tbx  0.7.5
Public Types | Public Member Functions | List of all members
tbx::res::ResDraggable Class Reference

Class for Draggable gadget template. More...

#include <resdraggable.h>

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

Public Types

enum  { TYPE_ID = 640 }
 
enum  DraggableType { DRAG_ONLY, DRAG_CLICK_DOUBLECLICK, DRAG_SELECT_DOUBLECLICK }
 Enumerations for mouse actions allowed on the draggable. More...
 

Public Member Functions

 ResDraggable (const ResGadget &other)
 Construct an draggable gadget resource. More...
 
 ResDraggable (const ResDraggable &other)
 Construct an draggable gadget resource. More...
 
ResDraggableoperator= (const ResGadget &other)
 Assign from a ResGadget. More...
 
ResDraggableoperator= (const ResDraggable &other)
 Assign from another draggable gadget resource. More...
 
 ResDraggable ()
 Construct a draggable gadget resource. More...
 
bool generate_drag_started () const
 Check if draggable should generate an event when the drag has started. More...
 
void generate_drag_started (bool value)
 Set if the draggable should generate an event when the drag has started. More...
 
bool has_sprite () const
 Check if the draggable includes a sprite. More...
 
void has_sprite (bool value)
 Set if the draggable includes a sprite. More...
 
bool has_text () const
 Check if the draggable includes text. More...
 
void has_text (bool value)
 Set if the draggable includes text. More...
 
DraggableType draggable_type () const
 Get the interaction with the mouse for this draggable. More...
 
void draggable_type (DraggableType value)
 Set the interaction with the mouse for this draggable. More...
 
bool deliver_toolbox_ids () const
 Check if the draggable will deliver Toolbox IDs on drag completion. More...
 
void deliver_toolbox_ids (bool value)
 Set if the draggable will deliver Toolbox IDs on drag completion. More...
 
bool drop_shadow () const
 Check if the draggable will show a drop shadow when dragged. More...
 
void drop_shadow (bool value)
 Set if the draggable will show a drop shadow when dragged. More...
 
bool not_dithered () const
 Check if the draggable will be dithered when dragged. More...
 
void not_dithered (bool value)
 Set if the draggable will be dithered when dragged. More...
 
const char * text () const
 Get the text for the draggable. More...
 
void text (const char *value, int max_length=-1)
 Set the text for the draggable. More...
 
void text (const std::string &value, int max_length=-1)
 Set the text for the draggable. More...
 
int max_text_len () const
 Get the maximum length for the text. More...
 
const char * sprite () const
 Get the sprite name for the draggable. More...
 
void sprite (const char *value, int max_length=-1)
 Set the sprite name for the draggable. More...
 
void sprite (const std::string &value, int max_length=-1)
 Set the sprite name for the draggable. More...
 
int max_sprite_len () const
 Get the maximum length of the sprite name for the draggable.
 
- 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 Draggable gadget template.

Member Enumeration Documentation

◆ DraggableType

Enumerations for mouse actions allowed on the draggable.

Enumerator
DRAG_ONLY 

only allows a drag

DRAG_CLICK_DOUBLECLICK 

click, drag and double click allowed

DRAG_SELECT_DOUBLECLICK 

click selects, double click and drag allowed

Constructor & Destructor Documentation

◆ ResDraggable() [1/3]

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

Construct an draggable gadget resource.

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

◆ ResDraggable() [2/3]

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

Construct an draggable gadget resource.

Parameters
otherdraggable to copy resource from

◆ ResDraggable() [3/3]

tbx::res::ResDraggable::ResDraggable ( )
inline

Construct a draggable gadget resource.

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

Member Function Documentation

◆ deliver_toolbox_ids() [1/2]

bool tbx::res::ResDraggable::deliver_toolbox_ids ( ) const
inline

Check if the draggable will deliver Toolbox IDs on drag completion.

Returns
true to return Toolbox IDs, false to return WIMP handles.

◆ deliver_toolbox_ids() [2/2]

void tbx::res::ResDraggable::deliver_toolbox_ids ( bool  value)
inline

Set if the draggable will deliver Toolbox IDs on drag completion.

Parameters
valueset to true to return Toolbox IDs or false to return WIMP handles.

◆ draggable_type() [1/2]

DraggableType tbx::res::ResDraggable::draggable_type ( ) const
inline

Get the interaction with the mouse for this draggable.

Returns
DraggableType enumeration value

◆ draggable_type() [2/2]

void tbx::res::ResDraggable::draggable_type ( DraggableType  value)
inline

Set the interaction with the mouse for this draggable.

Parameters
valueDraggableType enumeration value

◆ drop_shadow() [1/2]

bool tbx::res::ResDraggable::drop_shadow ( ) const
inline

Check if the draggable will show a drop shadow when dragged.

Returns
true if a drop shadow will be shown

◆ drop_shadow() [2/2]

void tbx::res::ResDraggable::drop_shadow ( bool  value)
inline

Set if the draggable will show a drop shadow when dragged.

Parameters
valuetrue to show a drop shadow

◆ generate_drag_started() [1/2]

bool tbx::res::ResDraggable::generate_drag_started ( ) const
inline

Check if draggable should generate an event when the drag has started.

Returns
true if the draggable will generate the drag started event

◆ generate_drag_started() [2/2]

void tbx::res::ResDraggable::generate_drag_started ( bool  value)
inline

Set if the draggable should generate an event when the drag has started.

Parameters
valuetrue if the draggable should generate the drag started event

◆ has_sprite() [1/2]

bool tbx::res::ResDraggable::has_sprite ( ) const
inline

Check if the draggable includes a sprite.

Returns
true if the draggable includes a sprite

◆ has_sprite() [2/2]

void tbx::res::ResDraggable::has_sprite ( bool  value)
inline

Set if the draggable includes a sprite.

Use the sprite() method to set the sprite name

Parameters
valueset to true if the draggable includes a sprite

◆ has_text() [1/2]

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

Check if the draggable includes text.

Returns
true if the draggable includes text

◆ has_text() [2/2]

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

Set if the draggable includes text.

Use the text() method to set the text

Parameters
valueset to true if the draggable includes text

◆ max_text_len()

int tbx::res::ResDraggable::max_text_len ( ) const
inline

Get the maximum length for the text.

Returns
maximum buffer size for the text.

◆ not_dithered() [1/2]

bool tbx::res::ResDraggable::not_dithered ( ) const
inline

Check if the draggable will be dithered when dragged.

Returns
true if a the draggable will be dithered

◆ not_dithered() [2/2]

void tbx::res::ResDraggable::not_dithered ( bool  value)
inline

Set if the draggable will be dithered when dragged.

Parameters
valueset to true if dithering is required

◆ operator=() [1/2]

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

Assign from a ResGadget.

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

◆ operator=() [2/2]

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

Assign from another draggable gadget resource.

Parameters
otherdraggable gadget resource to copy

◆ sprite() [1/3]

const char* tbx::res::ResDraggable::sprite ( ) const
inline

Get the sprite name for the draggable.

Returns
sprite name for draggable or 0 if sprite name not set

◆ sprite() [2/3]

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

Set the sprite name for the draggable.

The sprite will only be used if has_sprite(true) has been set.

Parameters
valuesprite name for the draggable or 0 if none
max_lengththe maximum length the spritename will be changed to after the gadget is created. The default (-1) will use the length of value.

◆ sprite() [3/3]

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

Set the sprite name for the draggable.

The sprite will only be used if has_sprite(true) has been set.

Parameters
valuesprite name for the draggable
max_lengththe maximum length the spritename will be changed to after the gadget is created. The default (-1) will use the length of value.

◆ text() [1/3]

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

Get the text for the draggable.

Returns
text for draggable or 0 if text not set

◆ text() [2/3]

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

Set the text for the draggable.

The text will only be used if has_text(true) has been set.

Parameters
valuetext for the draggable or 0 if text none
max_lengththe maximum length the text will be changed to after the gadget is created. The default (-1) will use the length of value.

◆ text() [3/3]

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

Set the text for the draggable.

The text will only be used if has_text(true) has been set.

Parameters
valuetext for the draggable
max_lengththe maximum length the text will be changed to after the gadget is created. The default (-1) will use the length of value.

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