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

StringSet wrapper class for an underlying toolbox StringSet gadget. More...

#include <stringset.h>

Inheritance diagram for tbx::StringSet:
tbx::Gadget tbx::Component

Public Types

enum  { TOOLBOX_CLASS = 896 }
 

Public Member Functions

 StringSet ()
 Construct an uninitialised display field.
 
 ~StringSet ()
 Destroy a string set gadget. More...
 
 StringSet (const StringSet &other)
 Construct a string set from another string set. More...
 
 StringSet (const Gadget &other)
 Construct a string set from another gadget. More...
 
 StringSet (const Component &other)
 Construct a string set from a Component. More...
 
StringSetoperator= (const StringSet &other)
 Assign a string set to refer to the same underlying toolbox gadget as another.
 
StringSetoperator= (const Gadget &other)
 Assign a string set to refer to the same underlying toolbox gadget as an existing Gadget. More...
 
StringSetoperator= (const Component &other)
 Assign a string set field to refer to the same underlying toolbox component as an existing Gadget. More...
 
bool operator== (const Gadget &other) const
 Check if this string set refers to the same underlying toolbox gadget as another gadget. More...
 
bool operator!= (const Gadget &other) const
 Check if this string set refers to the same underlying toolbox gadget as another gadget. More...
 
void available (const std::string &value)
 Set the list of strings available. More...
 
void selected (const std::string &value)
 Set the string to be selected.
 
std::string selected () const
 Get the currently selected string.
 
void selected_index (int index)
 Set the string to be selected by it's position in the available list.
 
int selected_index () const
 Get the index of the selected string in the available list.
 
void allowable (const std::string &value)
 Set the characters that are allowed to be entered into a string set. More...
 
Gadget alphanumeric_gadget () const
 Get the gadget used to display the selected string. More...
 
Menu popup_menu () const
 Get the popup menu used with the string set. More...
 
void add_text_changed_listener (TextChangedListener *listener)
 Add a listener to report when the text has changed in the string set. More...
 
void remove_text_changed_listener (TextChangedListener *listener)
 Remove a text changed listener.
 
void add_about_to_be_shown_listener (StringSetAboutToBeShownListener *listener)
 Add a listener to be called just before the string set's menu is shown. More...
 
void remove_about_to_be_shown_listener (StringSetAboutToBeShownListener *listener)
 Remove a listener to be called just before the string set's menu is shown. More...
 
- Public Member Functions inherited from tbx::Gadget
 Gadget ()
 Construct an uninitialised gadget. More...
 
 Gadget (const Gadget &other)
 Construct a gadget as a copy of another gadget object. More...
 
 Gadget (const Component &other)
 Construct a gadget as a copy of another component object. More...
 
Window window ()
 Get the window that contains this gadget.
 
Window window () const
 Get the window that contains this gadget.
 
Gadgetoperator= (const Gadget &other)
 Assign this gadget to refer to the same underlying toolbox gadget as another gadget.
 
Gadgetoperator= (const Component &other)
 Assign this gadget to refer to the same underlying toolbox gadget as the specified Component. More...
 
bool operator== (const Component &other) const
 Check if this gadget refers to the same underlying toolbox component as the given Component. More...
 
bool operator!= (const Component &other) const
 Check if this gadget refers to the same underlying toolbox component as the given Component. More...
 
bool operator== (const Gadget &other) const
 Check if this gadget refers to the same underlying toolbox component as the given Gadget. More...
 
bool operator!= (const Gadget &other) const
 Check if this gadget refers to the same underlying toolbox component as the given Gadget. More...
 
void check_toolbox_class (int class_id) const
 Check the underlying gadget class for this object has the given class id. More...
 
int toolbox_class () const
 Get the toolbox class for a gadget. More...
 
int toolbox_class_and_size () const
 Get the toolbox class and size for a gadget. More...
 
unsigned int flags () const
 Return the gadget flags. More...
 
void set_flag (unsigned int set)
 Sets bits in the gadgets flags. More...
 
void clear_flag (unsigned int clear)
 Clear bits in the gadget flags. More...
 
void fade ()
 Fade the gadget.
 
void unfade ()
 Clear the gadgets fade state.
 
void fade (bool fade)
 Fade/unfade the gadget. More...
 
bool faded () const
 Check if the gadget is faded. More...
 
void focus ()
 Set input focus to the gadget. More...
 
std::vector< IconHandleicon_list ()
 Get list of icons used in this gadget. More...
 
BBox bounds () const
 Get the bounding box of the gadget.
 
void bounds (const BBox &bounds)
 Set the bounds of the gadget. More...
 
Point bottom_left () const
 Get the bottom left location of gadget. More...
 
Point top_left () const
 Get the top left location of gadget. More...
 
void move_to (const Point &pos)
 Move gadget (without resizing) More...
 
void move_to (int x, int y)
 Move gadget without resizing. More...
 
void move_by (int bx, int by)
 Move gadget relative to it's current position without resizing. More...
 
Size size () const
 Return the size of the gadget. More...
 
void size (const Size &sz)
 Set size of gadget without moving it. More...
 
void add_loader (Loader *loader, int file_type=-2)
 Add a file loader. More...
 
void remove_loader (Loader *loader, int file_type=-2)
 Remove a file loader. More...
 
- Public Member Functions inherited from tbx::Component
 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...
 
Componentoperator= (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...
 
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...
 

Additional Inherited Members

- Protected Member Functions inherited from tbx::Component
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...
 
- Protected Attributes inherited from tbx::Component
ObjectId _handle
 Underlying toolbox handle.
 
int _id
 Underlying toolbox component id.
 

Detailed Description

StringSet wrapper class for an underlying toolbox StringSet gadget.

A StringSet is a gadget that a value to be entered and/or chosen from a list.

The list is a shown in a popup menu.

Constructor & Destructor Documentation

◆ ~StringSet()

tbx::StringSet::~StringSet ( )
inline

Destroy a string set gadget.

This does not delete the underlying toolbox gadget.

◆ StringSet() [1/3]

tbx::StringSet::StringSet ( const StringSet other)
inline

Construct a string set from another string set.

Both string sets will refer to the same underlying toolbox gadget.

◆ StringSet() [2/3]

tbx::StringSet::StringSet ( const Gadget other)
inline

Construct a string set from another gadget.

The StringSet and the Gadget will refer to the same underlying toolbox gadget.

Exceptions
GadgetClassErrorif the underlying toolbox gadget isn't a string set

◆ StringSet() [3/3]

tbx::StringSet::StringSet ( const Component other)
inline

Construct a string set from a Component.

Exceptions
ObjectClassErrorif the component is not in a window.
GadgetClassErrorif the underlying toolbox gadget isn't a string set

Member Function Documentation

◆ add_about_to_be_shown_listener()

void tbx::StringSet::add_about_to_be_shown_listener ( StringSetAboutToBeShownListener listener)

Add a listener to be called just before the string set's menu is shown.

Parameters
listenerlistener to add

◆ add_text_changed_listener()

void tbx::StringSet::add_text_changed_listener ( TextChangedListener listener)

Add a listener to report when the text has changed in the string set.

The string set must have been set to deliver the default event for this listener to run.

◆ allowable()

void tbx::StringSet::allowable ( const std::string &  value)
inline

Set the characters that are allowed to be entered into a string set.

allow-spec ::= { char-spec }* { ~ { char-spec }* }* char-spec ::= char | char-char char ::= - | \; | \ | | any character other than - ;

Each char-spec in the 'allow' string specifies a character or range
of characters; the ~ character toggles whether they are included or
excluded from the icon text string:

e.g. 0-9a-z~dpu   allows the digits 0 - 9 and the lower-case letters
a - z, except for 'd', 'p' and 'u'

If the first character following the A command is a ~ all normal
characters are initially included:

e.g. ~0-9   allows all characters except for the digits 0 - 9

If you use any of the four special characters - ; ~ \ in a char-spec
you must precede them with a backslash \:

e.g. ~\-\;\\ allows all characters except the four special ones
- ; ~ \

@param value string specifying what character can be entered into the list box.

◆ alphanumeric_gadget()

Gadget tbx::StringSet::alphanumeric_gadget ( ) const

Get the gadget used to display the selected string.

This may be either a DisplayField or a WritableField depending on how the StringSet was created.

Returns
gadget used for the display

◆ available()

void tbx::StringSet::available ( const std::string &  value)
inline

Set the list of strings available.

The list is separated by comma's. If a comma is required in the data it must be escaped out by proceeding by a "\".

◆ operator!=()

bool tbx::StringSet::operator!= ( const Gadget other) const
inline

Check if this string set refers to the same underlying toolbox gadget as another gadget.

Returns
true if they do not refer to the same underlying toolbox gadget.

◆ operator=() [1/2]

StringSet& tbx::StringSet::operator= ( const Gadget other)
inline

Assign a string set to refer to the same underlying toolbox gadget as an existing Gadget.

Exceptions
GadgetClassErrorif the underlying toolbox gadget isn't a string set

◆ operator=() [2/2]

StringSet& tbx::StringSet::operator= ( const Component other)
inline

Assign a string set field to refer to the same underlying toolbox component as an existing Gadget.

Exceptions
ObjectClassErrorif the component is not in a window.
GadgetClassErrorif the underlying toolbox gadget isn't a string set

◆ operator==()

bool tbx::StringSet::operator== ( const Gadget other) const
inline

Check if this string set refers to the same underlying toolbox gadget as another gadget.

Returns
true if they refer to the same underlying toolbox gadget.

◆ popup_menu()

Menu tbx::StringSet::popup_menu ( ) const

Get the popup menu used with the string set.

Returns
Menu used by the string set

◆ remove_about_to_be_shown_listener()

void tbx::StringSet::remove_about_to_be_shown_listener ( StringSetAboutToBeShownListener listener)

Remove a listener to be called just before the string set's menu is shown.

Parameters
listenerlistener to remove

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