GG

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

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

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
ButtonTab () const
int PtToPosn (const Pt &pt) const

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)
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 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.

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.

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.

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.

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.

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.


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