GG::Slider Class Reference

A slider control. More...

#include <Slider.h>

Inheritance diagram for GG::Slider:

GG::Control GG::Wnd

List of all members.

Signal Types



typedef boost::signal< void(int,
int, int)> 
SlidSignalType
typedef boost::signal< void(int,
int, int)> 
SlidAndStoppedSignalType

Accessors



SlidSignalType SlidSignal
SlidAndStoppedSignalType SlidAndStoppedSignal
virtual Pt MinUsableSize () const
int Posn () const
std::pair< int, int > SliderRange () const
unsigned int PageSize () const
Orientation GetOrientation () const
unsigned int TabWidth () const
unsigned int LineWidth () const
SliderLineStyle LineStyle () const

Structors



 Slider (X x, Y y, X w, Y h, int min, int max, Orientation orientation, SliderLineStyle style, Clr color, unsigned int tab_width, unsigned int line_width=5, Flags< WndFlag > flags=INTERACTIVE)

Mutators



virtual void Render ()
virtual void SizeMove (const Pt &ul, const Pt &lr)
virtual void Disable (bool b=true)
virtual void SetColor (Clr c)
void SizeSlider (int min, int max)
void SetMax (int max)
void SetMin (int min)
void SlideTo (int p)
void SetPageSize (unsigned int size)
void SetLineStyle (SliderLineStyle style)
virtual void DefineAttributes (WndEditor *editor)

Structors



 Slider ()

Accessors



ButtonTab () const
int PtToPosn (const Pt &pt) const

Mutators



virtual void LClick (const Pt &pt, Flags< ModKey > mod_keys)
virtual void KeyPress (Key key, boost::uint32_t key_code_point, Flags< ModKey > mod_keys)
virtual bool EventFilter (Wnd *w, const WndEvent &event)
void MoveTabToPosn ()


Detailed Description

A slider control.

This control allows the user to drag a tab to a desired setting; it is somewhat like a Scroll. Sliders can be either vertical or horizontal, but cannot switch between the two. Unlike vertical Scrolls, whose values increase downward, vertical Sliders increase upward by default. Note that it is acceptible to define a range that increases from min to max, or one that decreases from min to max; both are legal.

Definition at line 51 of file Slider.h.


Member Typedef Documentation

typedef boost::signal<void (int, int, int)> GG::Slider::SlidSignalType

emitted whenever the slider is moved; the tab position and the upper and lower bounds of the slider's range are indicated, respectively

Definition at line 55 of file Slider.h.

typedef boost::signal<void (int, int, int)> GG::Slider::SlidAndStoppedSignalType

emitted when the slider's tab is stopped after being dragged, the slider is adjusted using the keyboard, or the slider is moved programmatically; the tab position and the upper and lower bounds of the slider's range are indicated, respectively

Definition at line 56 of file Slider.h.


Constructor & Destructor Documentation

GG::Slider::Slider ( X  x,
Y  y,
X  w,
Y  h,
int  min,
int  max,
Orientation  orientation,
SliderLineStyle  style,
Clr  color,
unsigned int  tab_width,
unsigned int  line_width = 5,
Flags< WndFlag >  flags = INTERACTIVE 
)

ctor

GG::Slider::Slider (  )  [protected]

default ctor


Member Function Documentation

virtual Pt GG::Slider::MinUsableSize (  )  const [virtual]

Returns the size of the minimum bounding box that can enclose the Wnd and still show all of its elements, plus enough room for interaction with those elements (if applicable). For example, a TextControl's MinUsableSize() is just the area of its text, and a Scroll's MinUsableSize() is the combined sizes of its up-button, down-button, and tab (plus a bit of room in which to drag the tab).

Reimplemented from GG::Wnd.

int GG::Slider::Posn (  )  const

returns the current tab position

std::pair<int, int> GG::Slider::SliderRange (  )  const

returns the defined possible range of control

unsigned int GG::Slider::PageSize (  )  const

Returns the current page size, or the amount that the slider increments/decrements when a click occurs off of the tab. If not set, this defaults to 10% of the slider's range.

Orientation GG::Slider::GetOrientation (  )  const

returns the orientation of the slider (VERTICAL or HORIZONTAL)

unsigned int GG::Slider::TabWidth (  )  const

returns the width of the slider's tab, in pixels

unsigned int GG::Slider::LineWidth (  )  const

returns the width of the line along which the tab slides, in pixels

SliderLineStyle GG::Slider::LineStyle (  )  const

returns the style of line used to render the control

virtual void GG::Slider::Render (  )  [virtual]

Draws this Wnd. Note that Wnds being dragged for a drag-and-drop operation are rendered twice -- once in-place as normal, once in the location of the drag operation, attached to the cursor. Such Wnds may wish to render themselves differently in those two cases. To determine which render is being performed, they can call GUI::GetGUI()->RenderingDragDropWnds().

Implements GG::Control.

virtual void GG::Slider::SizeMove ( const Pt ul,
const Pt lr 
) [virtual]

Resizes and/or moves window to new upper-left and lower right boundaries.

Reimplemented from GG::Wnd.

virtual void GG::Slider::Disable ( bool  b = true  )  [virtual]

disables/enables the control; disabled controls appear greyed

Reimplemented from GG::Control.

virtual void GG::Slider::SetColor ( Clr  c  )  [virtual]

sets the color of the control

Reimplemented from GG::Control.

void GG::Slider::SizeSlider ( int  min,
int  max 
)

sets the logical range of the control; min must not equal max

void GG::Slider::SetMax ( int  max  ) 

sets the maximum value of the control

void GG::Slider::SetMin ( int  min  ) 

sets the minimum value of the control

void GG::Slider::SlideTo ( int  p  ) 

slides the control to a certain spot

void GG::Slider::SetPageSize ( unsigned int  size  ) 

Sets the size of a "page", or the amount that the slider increments/decrements when a click occurs off of the tab. If not set, this defaults to 10% of the slider's range. To disable clicks off the tab, set the page size to 0.

void GG::Slider::SetLineStyle ( SliderLineStyle  style  ) 

returns the style of line used to render the control

virtual void GG::Slider::DefineAttributes ( WndEditor *  editor  )  [virtual]

Provides the attributes of this object that are appropriate for a user to edit in a WndEditor; see WndEditor for details.

Reimplemented from GG::Control.

Button* GG::Slider::Tab (  )  const [protected]

returns a pointer to the Button used as this control's sliding tab

int GG::Slider::PtToPosn ( const Pt pt  )  const [protected]

maps an arbitrary screen point to its nearest logical slider position

virtual void GG::Slider::LClick ( const Pt pt,
Flags< ModKey >  mod_keys 
) [protected, virtual]

Respond to release of left mouse button over this Wnd, if it was also originally depressed over this Wnd. A Wnd will receive an LButtonUp() message whenever a drag that started over its area ends over its area as well.

Reimplemented from GG::Wnd.

virtual void GG::Slider::KeyPress ( Key  key,
boost::uint32_t  key_code_point,
Flags< ModKey >  mod_keys 
) [protected, virtual]

Respond to down-keystrokes (focus window only). A window may receive KeyPress() messages passed up to it from its children. For instance, Control-derived classes pass KeyPress() messages to their Parent() windows by default.

Note:
Though mouse clicks consist of a press and a release, all Control classes by default respond immediately to KeyPress(), not KeyRelease(); in fact, by default no Wnd class does anything at all on a KeyRelease event.

key_code_point will be zero if Unicode support is unavailable.

Reimplemented from GG::Control.

virtual bool GG::Slider::EventFilter ( Wnd w,
const WndEvent event 
) [protected, virtual]

Handles an WndEvent destined for Wnd w, but which this Wnd is allowed to handle first. Returns true if this filter processed the message.

Reimplemented from GG::Wnd.

void GG::Slider::MoveTabToPosn (  )  [protected]

moves the tab to the current logical position


Member Data Documentation

returns the slid signal object for this Slider

Definition at line 81 of file Slider.h.

returns the slid-and-stopped signal object for this Slider

Definition at line 82 of file Slider.h.


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

Generated on Sat Mar 26 07:08:38 2011 for GG by  doxygen 1.5.9