gui::slider Class Reference

A frame with a movable texture. More...

#include <gui_slider.hpp>

Inheritance diagram for gui::slider:
gui::frame gui::event_receiver gui::region gui::uiobject

List of all members.

Public Types

enum  orientation { ORIENT_VERTICAL, ORIENT_HORIZONTAL }

Public Member Functions

 slider (manager *pManager)
 Constructor.
virtual ~slider ()
 Destructor.
virtual std::string serialize (const std::string &sTab) const
 Prints all relevant information about this widget in a string.
virtual bool can_use_script (const std::string &sScriptName) const
 Returns 'true' if this slider can use a script.
virtual void copy_from (uiobject *pObj)
 Copies an uiobject's parameters into this slider (inheritance).
void set_thumb_texture (texture *pTexture)
 Sets the texture to use for the thumb.
textureget_thumb_texture () const
 Returns the texture used for the thumb.
void set_orientation (orientation mOrientation)
 Sets the orientation of this slider.
orientation get_orientation () const
 Returns the orientation of this slider.
void set_min_max_values (float fMin, float fMax)
 Sets the slider's value range.
void set_min_value (float fMin)
 Sets this slider's minimum value.
void set_max_value (float fMax)
 Sets this slider's maximum value.
float get_min_value () const
 Returns this slider's minimum value.
float get_max_value () const
 Returns this slider's maximum value.
void set_value (float fValue, bool bSilent=false)
 Sets this slider's value.
float get_value () const
 Returns this slider's value.
void set_value_step (float fValueStep)
 Sets this slider's value step.
float get_value_step () const
 Returns this slider's value step.
void set_thumb_draw_layer (layer_type mThumbLayer)
 Sets the draw layer of this slider's thumb texture.
void set_thumb_draw_layer (const std::string &sBarLayer)
 Sets the draw layer of this slider's thumb texture.
layer_type get_thumb_draw_layer () const
 Returns the draw layer of this slider's thumb texture.
void set_allow_clicks_outside_thumb (bool bAllow)
 Allows the user to click anywhere in the slider to relocate the thumb.
bool are_clicks_outside_thumb_allowed ()
 Checks if clicks are allowed outside of the thumb.
virtual bool is_in_frame (int iX, int iY) const
 Checks if the provided coordinates are in the frame.
virtual void notify_mouse_in_frame (bool bMouseInFrame, int iX, int iY)
 Tells this frame it is being overed by the mouse.
virtual void on_event (const event &mEvent)
 Calls the on_event script.
virtual void create_glue ()
 Returns this widget's Lua glue.
virtual void parse_block (xml::block *pBlock)
 Parses data from an xml::block.
virtual void fire_update_borders () const
 Tells this widget to update its borders.
virtual void update (float fDelta)
 updates this widget's logic.

Static Public Member Functions

static void register_glue (utils::wptr< lua::state > pLua)
 Registers this widget to the provided lua::state.

Protected Member Functions

void constrain_thumb_ ()
texturecreate_thumb_texture_ ()
void fire_update_thumb_texture_ () const

Protected Attributes

bool bUpdateThumbTexture_
orientation mOrientation_
float fValue_
float fMinValue_
float fMaxValue_
float fValueStep_
bool bAllowClicksOutsideThumb_
layer_type mThumbLayer_
texturepThumbTexture_
bool bThumbMoved_
bool bMouseInThumb_

Detailed Description

A frame with a movable texture.

This widget contains a special texture, the slider thumb. It can be moved along a single axis (X or Y) and its position can be used to represent a value (for configuration menus, or scroll bars).

Definition at line 17 of file gui_slider.hpp.


Member Enumeration Documentation

Enumerator:
ORIENT_VERTICAL 
ORIENT_HORIZONTAL 

Definition at line 21 of file gui_slider.hpp.


Constructor & Destructor Documentation

gui::slider::slider ( manager pManager  )  [explicit]

Constructor.

Definition at line 20 of file gui_slider.cpp.

gui::slider::~slider (  )  [virtual]

Destructor.

Definition at line 29 of file gui_slider.cpp.


Member Function Documentation

bool gui::slider::are_clicks_outside_thumb_allowed (  ) 

Checks if clicks are allowed outside of the thumb.

Returns:
'true' if it is the case
Note:
See set_allow_clicks_outside_thumb().

Definition at line 391 of file gui_slider.cpp.

bool gui::slider::can_use_script ( const std::string &  sScriptName  )  const [virtual]

Returns 'true' if this slider can use a script.

Parameters:
sScriptName The name of the script
Note:
This method can be overriden if needed.

Reimplemented from gui::frame.

Definition at line 54 of file gui_slider.cpp.

void gui::slider::constrain_thumb_ (  )  [protected]

Definition at line 107 of file gui_slider.cpp.

void gui::slider::copy_from ( uiobject pObj  )  [virtual]

Copies an uiobject's parameters into this slider (inheritance).

Parameters:
pObj The uiobject to copy

Reimplemented from gui::frame.

Definition at line 64 of file gui_slider.cpp.

void gui::slider::create_glue (  )  [virtual]

Returns this widget's Lua glue.

Reimplemented from gui::frame.

Definition at line 497 of file gui_slider.cpp.

texture * gui::slider::create_thumb_texture_ (  )  [protected]

Definition at line 396 of file gui_slider.cpp.

void gui::slider::fire_update_borders (  )  const [virtual]

Tells this widget to update its borders.

Reimplemented from gui::uiobject.

Definition at line 491 of file gui_slider.cpp.

void gui::slider::fire_update_thumb_texture_ (  )  const [protected]

Definition at line 517 of file gui_slider.cpp.

float gui::slider::get_max_value (  )  const

Returns this slider's maximum value.

Returns:
This slider's maximum value

Definition at line 356 of file gui_slider.cpp.

float gui::slider::get_min_value (  )  const

Returns this slider's minimum value.

Returns:
This slider's minimum value

Definition at line 351 of file gui_slider.cpp.

slider::orientation gui::slider::get_orientation (  )  const

Returns the orientation of this slider.

Returns:
The orientation of this slider

Definition at line 376 of file gui_slider.cpp.

layer_type gui::slider::get_thumb_draw_layer (  )  const

Returns the draw layer of this slider's thumb texture.

Returns:
The draw layer of this slider's thumb texture

Definition at line 381 of file gui_slider.cpp.

texture * gui::slider::get_thumb_texture (  )  const

Returns the texture used for the thumb.

Returns:
The texture used for the thumb

Definition at line 371 of file gui_slider.cpp.

float gui::slider::get_value (  )  const

Returns this slider's value.

Returns:
This slider's value

Definition at line 361 of file gui_slider.cpp.

float gui::slider::get_value_step (  )  const

Returns this slider's value step.

Returns:
This slider's value step

Definition at line 366 of file gui_slider.cpp.

bool gui::slider::is_in_frame ( int  iX,
int  iY 
) const [virtual]

Checks if the provided coordinates are in the frame.

Parameters:
iX The horizontal coordinate
iY The vertical coordinate
Returns:
'true' if the provided coordinates are in the frame
Note:
The slider version of this function also checks if the mouse is over the thumb texture.

Reimplemented from gui::frame.

Definition at line 409 of file gui_slider.cpp.

void gui::slider::notify_mouse_in_frame ( bool  bMouseInFrame,
int  iX,
int  iY 
) [virtual]

Tells this frame it is being overed by the mouse.

Parameters:
bMouseInFrame 'true' if the mouse is above this frame
iX The horizontal mouse coordinate
iY The vertical mouse coordinate

Reimplemented from gui::frame.

Definition at line 427 of file gui_slider.cpp.

void gui::slider::on_event ( const event mEvent  )  [virtual]

Calls the on_event script.

Parameters:
mEvent The Event that occured

Reimplemented from gui::frame.

Definition at line 140 of file gui_slider.cpp.

void gui::slider::parse_block ( xml::block *  pBlock  )  [virtual]

Parses data from an xml::block.

Parameters:
pBlock The slider's xml::block

Reimplemented from gui::frame.

Definition at line 10 of file gui_slider_parser.cpp.

void gui::slider::register_glue ( utils::wptr< lua::state >  pLua  )  [static]

Registers this widget to the provided lua::state.

Definition at line 8 of file gui_slider_glues.cpp.

std::string gui::slider::serialize ( const std::string &  sTab  )  const [virtual]

Prints all relevant information about this widget in a string.

Parameters:
sTab The offset to give to all lines
Returns:
All relevant information about this widget

Reimplemented from gui::frame.

Definition at line 33 of file gui_slider.cpp.

void gui::slider::set_allow_clicks_outside_thumb ( bool  bAllow  ) 

Allows the user to click anywhere in the slider to relocate the thumb.

Parameters:
bAllow 'true' to allow it, 'false' to allow clicks on the thumb only

Definition at line 386 of file gui_slider.cpp.

void gui::slider::set_max_value ( float  fMax  ) 

Sets this slider's maximum value.

Parameters:
fMax The maximum value

Definition at line 220 of file gui_slider.cpp.

void gui::slider::set_min_max_values ( float  fMin,
float  fMax 
)

Sets the slider's value range.

Parameters:
fMin The minimum value
fMax The maximum value

Definition at line 238 of file gui_slider.cpp.

void gui::slider::set_min_value ( float  fMin  ) 

Sets this slider's minimum value.

Parameters:
fMin The minimum value

Definition at line 202 of file gui_slider.cpp.

void gui::slider::set_orientation ( orientation  mOrientation  ) 

Sets the orientation of this slider.

Parameters:
mOrientation The orientation of this slider

Definition at line 304 of file gui_slider.cpp.

void gui::slider::set_thumb_draw_layer ( const std::string &  sBarLayer  ) 

Sets the draw layer of this slider's thumb texture.

Parameters:
sBarLayer The layer

Definition at line 328 of file gui_slider.cpp.

void gui::slider::set_thumb_draw_layer ( layer_type  mThumbLayer  ) 

Sets the draw layer of this slider's thumb texture.

Parameters:
mThumbLayer The layer

Definition at line 321 of file gui_slider.cpp.

void gui::slider::set_thumb_texture ( texture pTexture  ) 

Sets the texture to use for the thumb.

Parameters:
pTexture The new texture

Definition at line 292 of file gui_slider.cpp.

void gui::slider::set_value ( float  fValue,
bool  bSilent = false 
)

Sets this slider's value.

Parameters:
fValue The value
bSilent 'true' to prevent OnValueChanged to be fired

Definition at line 257 of file gui_slider.cpp.

void gui::slider::set_value_step ( float  fValueStep  ) 

Sets this slider's value step.

Parameters:
fValueStep The new step

Definition at line 272 of file gui_slider.cpp.

void gui::slider::update ( float  fDelta  )  [virtual]

updates this widget's logic.

Reimplemented from gui::frame.

Definition at line 435 of file gui_slider.cpp.


Member Data Documentation

Definition at line 197 of file gui_slider.hpp.

bool gui::slider::bMouseInThumb_ [protected]

Definition at line 202 of file gui_slider.hpp.

bool gui::slider::bThumbMoved_ [protected]

Definition at line 201 of file gui_slider.hpp.

bool gui::slider::bUpdateThumbTexture_ [mutable, protected]

Definition at line 188 of file gui_slider.hpp.

float gui::slider::fMaxValue_ [protected]

Definition at line 194 of file gui_slider.hpp.

float gui::slider::fMinValue_ [protected]

Definition at line 193 of file gui_slider.hpp.

float gui::slider::fValue_ [protected]

Definition at line 192 of file gui_slider.hpp.

float gui::slider::fValueStep_ [protected]

Definition at line 195 of file gui_slider.hpp.

Definition at line 190 of file gui_slider.hpp.

Definition at line 199 of file gui_slider.hpp.

Definition at line 200 of file gui_slider.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Tue Jan 1 21:58:12 2013 for gui by  doxygen 1.6.1