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

NumberRange wrapper for an underlying toolbox NumberRange gadget. More...

#include <numberrange.h>

Inheritance diagram for tbx::NumberRange:
tbx::Gadget tbx::Component

Public Types

enum  { TOOLBOX_CLASS = 832 }
 

Public Member Functions

 NumberRange ()
 Construct an uninitialised number range.
 
 ~NumberRange ()
 Destroy a number range gadget. More...
 
 NumberRange (const NumberRange &other)
 Construct a number range from another number range. More...
 
 NumberRange (const Gadget &other)
 Construct a number range from another gadget. More...
 
 NumberRange (const Component &other)
 Construct a number range from a gadget. More...
 
NumberRangeoperator= (const NumberRange &other)
 Assign a number range to refer to the same underlying toolbox gadget as another.
 
NumberRangeoperator= (const Gadget &other)
 Assign a number range to refer to the same underlying toolbox gadget as an existing Gadget. More...
 
NumberRangeoperator= (const Component &other)
 Assign a number range to refer to the same underlying toolbox component as an existing Gadget. More...
 
bool operator== (const Gadget &other) const
 Check if this number range refers to the same underlying toolbox gadget as another gadget. More...
 
bool operator!= (const Gadget &other) const
 Check if this number range refers to the same underlying toolbox gadget as another gadget. More...
 
void value (int value)
 Set the value of the number range. More...
 
int value () const
 Get the value of the number range. More...
 
void set_bounds (int lower, int upper, int step_size, int precision)
 Set bounds, step size and precision. More...
 
void get_bounds (int &lower, int &upper, int &step_size, int &precision) const
 Get the bounds, step size and precision. More...
 
void set_bounds (int lower, int upper, int step_size)
 Set bounds and step size. More...
 
void get_bounds (int &lower, int &upper, int &step_size) const
 Get the bounds and step size. More...
 
void set_bounds (int lower, int upper)
 Set lower and upper bounds. More...
 
void get_bounds (int &lower, int &upper) const
 Get the lower and upper bounds. More...
 
void lower_bound (int value)
 Set the Lower bound of NumberRange.
 
int lower_bound () const
 Get Lower bound of NumberRange. More...
 
void upper_bound (int value)
 Set Upper bound of NumberRange. More...
 
int upper_bound () const
 Get Upper bound of NumberRange. More...
 
void step_size (int value)
 Set step size of NumberRange. More...
 
int step_size () const
 Get step size of NumberRange. More...
 
void precision (int value)
 Set the precision of the NumberRange. More...
 
int precision () const
 Get the precision of the NumberRange. More...
 
Gadget numeric_gadget () const
 Get the gadget that displays the value of the NumberRange. More...
 
Adjuster left_adjuster () const
 Get the left adjuster. More...
 
Adjuster right_adjuster () const
 Get the right adjuster. More...
 
Slider slider () const
 Get the slider. More...
 
void add_value_changed_listener (ValueChangedListener *listener)
 Add listener for when the value of the number range changes. More...
 
void remove_value_changed_listener (ValueChangedListener *listener)
 Remove listener for when the value of the number range changes.
 
- 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...
 
 operator bool () const
 Operator to check if this component has been initialised. 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

NumberRange wrapper for an underlying toolbox NumberRange gadget.

A NumberRange is a gadget that shows a number in a Window that has arrows next to it that can be used to adjust its value.

Constructor & Destructor Documentation

◆ ~NumberRange()

tbx::NumberRange::~NumberRange ( )
inline

Destroy a number range gadget.

This does not delete the underlying toolbox gadget.

◆ NumberRange() [1/3]

tbx::NumberRange::NumberRange ( const NumberRange other)
inline

Construct a number range from another number range.

Both NumberRange will refer to the same underlying toolbox gadget.

◆ NumberRange() [2/3]

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

Construct a number range from another gadget.

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

Exceptions
GadgetClassErrorif the underlying toolbox gadget isn't a number range

◆ NumberRange() [3/3]

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

Construct a number range from a gadget.

The NumberRange and the Component will refer to the same underlying toolbox component.

Member Function Documentation

◆ add_value_changed_listener()

void tbx::NumberRange::add_value_changed_listener ( ValueChangedListener listener)

Add listener for when the value of the number range changes.

The default value change event must have been enabled in the resources for this number range.

◆ get_bounds() [1/3]

void tbx::NumberRange::get_bounds ( int &  lower,
int &  upper 
) const

Get the lower and upper bounds.

The returned parameters are multiplied by 10^precision

Parameters
lowerupdated to lower bound before transformation by precision
upperupdated to upper bound before transformation by precision

◆ get_bounds() [2/3]

void tbx::NumberRange::get_bounds ( int &  lower,
int &  upper,
int &  step_size 
) const

Get the bounds and step size.

The returned parameters are multiplied by 10^precision

Parameters
lowerupdated to lower bound before transformation by precision
upperupdated to upper bound before transformation by precision
step_sizeupdated to step size before transformation by precision

◆ get_bounds() [3/3]

void tbx::NumberRange::get_bounds ( int &  lower,
int &  upper,
int &  step_size,
int &  precision 
) const

Get the bounds, step size and precision.

The values returned are multiplied by 10^precision

Parameters
lowerupdated to lower bound before transformation by precision
upperupdated to upper bound before transformation by precision
step_sizeupdated to step size before transformation by precision
precisionupdated to precision of number range i.e. number of decimal places.

◆ left_adjuster()

Adjuster tbx::NumberRange::left_adjuster ( ) const

Get the left adjuster.

Returns
the Adjuster used for reducing the value of the Number range

◆ lower_bound()

int tbx::NumberRange::lower_bound ( ) const

Get Lower bound of NumberRange.

Returns
lower bound multiplied by 10^current precision

◆ numeric_gadget()

Gadget tbx::NumberRange::numeric_gadget ( ) const

Get the gadget that displays the value of the NumberRange.

Returns
display gadget. This will be a WritableField or a DisplayField depending on if the NumberRange allows a value to be typed.

◆ operator!=()

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

Check if this number range 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]

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

Assign a number range 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 number range

◆ operator=() [2/2]

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

Assign a number range to refer to the same underlying toolbox gadget as an existing Gadget.

Exceptions
GadgetClassErrorif the underlying toolbox gadget isn't a number range

◆ operator==()

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

Check if this number range refers to the same underlying toolbox gadget as another gadget.

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

◆ precision() [1/2]

int tbx::NumberRange::precision ( ) const

Get the precision of the NumberRange.

The precision effects how all other parameters are set. They are all set as an integer and then internally divided by 10 ^ precision.

Returns
the new precision

◆ precision() [2/2]

void tbx::NumberRange::precision ( int  value)

Set the precision of the NumberRange.

The precision effects how all other parameters are set. They are all set as an integer and then internally divided by 10 ^ precision.

Parameters
valuenew precision

◆ right_adjuster()

Adjuster tbx::NumberRange::right_adjuster ( ) const

Get the right adjuster.

Returns
the Adjuster used for increasing the value of the Number range

◆ set_bounds() [1/3]

void tbx::NumberRange::set_bounds ( int  lower,
int  upper 
)

Set lower and upper bounds.

The given parameters are divided by 10^current precision

Parameters
lowerlower bound before transformation by precision
upperupper bound before transformation by precision

◆ set_bounds() [2/3]

void tbx::NumberRange::set_bounds ( int  lower,
int  upper,
int  step_size 
)

Set bounds and step size.

The given parameters are divided by 10^current precision

Parameters
lowerlower bound before transformation by precision
upperupper bound before transformation by precision
step_sizestep size before transformation by precision

◆ set_bounds() [3/3]

void tbx::NumberRange::set_bounds ( int  lower,
int  upper,
int  step_size,
int  precision 
)

Set bounds, step size and precision.

The non-precision parameters are divided by 10^precision for use in the number range. i.e. set_bound(100,499,40,2) would create a number range from 1.00 to 4.99 with step size 0.4.

Parameters
lowerlower bound before transformation by precision
upperupper bound before transformation by precision
step_sizestep size before transformation by precision
precisionprecision of number range i.e. number of decimal places.

◆ slider()

Slider tbx::NumberRange::slider ( ) const

Get the slider.

Returns
the Slider used by the number range

◆ step_size() [1/2]

int tbx::NumberRange::step_size ( ) const

Get step size of NumberRange.

Returns
step size multiplied by 10^current precision

◆ step_size() [2/2]

void tbx::NumberRange::step_size ( int  value)

Set step size of NumberRange.

Parameters
valuenew step size before transformation by precision

◆ upper_bound() [1/2]

int tbx::NumberRange::upper_bound ( ) const

Get Upper bound of NumberRange.

Returns
upper bound multiplied by 10^current precision

◆ upper_bound() [2/2]

void tbx::NumberRange::upper_bound ( int  value)

Set Upper bound of NumberRange.

Parameters
valuenew upper bound before transformation by precision

◆ value() [1/2]

int tbx::NumberRange::value ( ) const
inline

Get the value of the number range.

This is the integer version of what is displayed and does not take into account the number range precision.

◆ value() [2/2]

void tbx::NumberRange::value ( int  value)
inline

Set the value of the number range.

The value will be displayed taking into account it's precision.


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