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

Slot Types

typedef SlidSignalType::slot_type SlidSlotType
typedef SlidSignalType::slot_type SlidAndStoppedSlotType

Accessors

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

Structors

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

Mutators

virtual void Render ()
virtual void LClick (const Pt &pt, Flags< ModKey > mod_keys)
virtual void KeyPress (Key key, Flags< ModKey > mod_keys)
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 (int size)
void SetLineStyle (SliderLineStyle style)
virtual void DefineAttributes (WndEditor *editor)

Structors

 Slider ()

Accessors

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

Mutators

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 47 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 51 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 52 of file Slider.h.

typedef SlidSignalType::slot_type GG::Slider::SlidSlotType

type of functor(s) invoked on a SlidSignalType

Definition at line 56 of file Slider.h.

typedef SlidSignalType::slot_type GG::Slider::SlidAndStoppedSlotType

type of functor(s) invoked on a SlidAndStoppedSignalType

Definition at line 57 of file Slider.h.


Constructor & Destructor Documentation

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

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 RenderableMinSize() 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

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)

int GG::Slider::TabWidth (  )  const

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

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::LClick ( const Pt pt,
Flags< ModKey >  mod_keys 
) [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,
Flags< ModKey >  mod_keys 
) [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.

Reimplemented from 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 ( 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 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

SlidSignalType GG::Slider::SlidSignal [mutable]

returns the slid signal object for this Slider

Definition at line 79 of file Slider.h.

SlidAndStoppedSignalType GG::Slider::SlidAndStoppedSignal [mutable]

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

Definition at line 80 of file Slider.h.


The documentation for this class was generated from the following file:
Generated on Wed Mar 26 14:35:42 2008 for GG by  doxygen 1.5.2