Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

os::Slider Class Reference

#include <slider.h>

Inheritance diagram for os::Slider:

os::Control os::View os::Invoker os::Handler List of all members.

Public Types

enum  { TICKS_ABOVE = 0x0001, TICKS_BELOW = 0x0002, TICKS_LEFT = 0x0001, TICKS_RIGHT = 0x0002 }
enum  knob_mode { KNOB_SQUARE, KNOB_TRIANGLE, KNOB_DIAMOND }

Public Methods

 Slider (const Rect &cFrame, const std::string &cName, Message *pcMsg, uint32 nTickFlags=TICKS_BELOW, int nTickCount=10, knob_mode eKnobMode=KNOB_SQUARE, orientation eOrientation=HORIZONTAL, uint32 nResizeMask=0)
 ~Slider ()
virtual void RenderLabels (View *pcRenderView)
virtual void RenderSlider (View *pcRenderView)
virtual void RenderKnob (View *pcRenderView)
virtual void RenderTicks (View *pcRenderView)
virtual float PosToVal (const Point &cPos) const
virtual Point ValToPos (float vVal) const
virtual Rect GetKnobFrame () const
virtual Rect GetSliderFrame () const
virtual void SetSliderColors (const Color32_s &sColor1, const Color32_s &sColor2)
 Modify the fill color of the slider bar. More...

virtual void GetSliderColors (Color32_s *psColor1, Color32_s *psColor2) const
 Get the slider-bar fill color. More...

virtual void SetSliderSize (float vSize)
 Set the thickness of the slider bar. More...

virtual float GetSliderSize () const
 Get the current slider thickness. More...

virtual void SetProgStrFormat (const std::string &cFormat)
 Set format string for the progress label. More...

virtual std::string GetProgStrFormat () const
virtual std::string GetProgressString () const
void SetStepCount (int nCount)
 Set the number of possible knob positions. More...

int GetStepCount () const
 Obtain the step-count as set by SetStepCount(). More...

void SetTickCount (int nCount)
 Set number of "ticks" rendered along the slider. More...

int GetTickCount () const
 Obtain the tick count as set with SetTickCount(). More...

void SetTickFlags (uint32 nFlags)
 Configure where the slider ticks should be rendered. More...

uint32 GetTickFlags () const
 Obtain the tick-flags as set with SetTickFlags(). More...

void SetLimitLabels (const std::string &cMinLabel, const std::string &cMaxLabel)
 Set the static labels rendere at each end of the slider. More...

void GetLimitLabels (std::string *pcMinLabel, std::string *pcMaxLabel)
 Obtain the limit-labels as set with SetLimitLabels(). More...

virtual void SetSteps (float vSmall, float vBig)
virtual void GetSteps (float *pvSmall, float *pvBig) const
virtual void SetMinMax (float vMin, float vMax)
status_t Invoke (Message *pcMessage=NULL)
void SetCurValue (float nValue)
virtual void SetCurValue (float nValue, bool bInvoke)
virtual float GetCurValue () const
virtual void AttachedToWindow ()
 Sets the background color to the one of the parent view. More...

virtual void MouseMove (const Point &cNewPos, int nCode, uint32 nButtons, Message *pcData)
virtual void MouseDown (const Point &cPosition, uint32 nButtons)
virtual void MouseUp (const Point &cPosition, uint32 nButtons, Message *pcData)
virtual void FrameSized (const Point &cDelta)
virtual void Paint (const Rect &cUpdateRect)
 Called by the system update "damaged" areas of the view. More...

virtual Point GetPreferredSize (bool bLargest) const

Detailed Description

Description:
See also:
Author(s):
Kurt Skauen (kurt@atheos.cx)


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
TICKS_ABOVE  
TICKS_BELOW  
TICKS_LEFT  
TICKS_RIGHT  

enum os::Slider::knob_mode
 

Enumeration values:
KNOB_SQUARE  
KNOB_TRIANGLE  
KNOB_DIAMOND  


Constructor & Destructor Documentation

Slider::Slider ( const Rect & cFrame,
const std::string & cName,
Message * pcMsg,
uint32 nTickFlags = TICKS_BELOW,
int nTickCount = 10,
knob_mode eKnobMode = KNOB_SQUARE,
orientation eOrientation = HORIZONTAL,
uint32 nResizeMask = 0 )
 

Slider::~Slider ( )
 


Member Function Documentation

void Slider::AttachedToWindow ( void ) [virtual]
 

Sets the background color to the one of the parent view.

Author(s):
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::Control.

void Slider::FrameSized ( const Point & cDelta ) [virtual]
 

Reimplemented from os::View.

float Slider::GetCurValue ( ) const [virtual]
 

Rect Slider::GetKnobFrame ( ) const [virtual]
 

void Slider::GetLimitLabels ( std::string * pcMinLabel,
std::string * pcMaxLabel )
 

Obtain the limit-labels as set with SetLimitLabels().

Parameters:
pcMinLabel   - Pointer to a string receiving the min-label or NULL.
pcMaxLabel   - Pointer to a string receiving the max-label or NULL.
See also:
SetLimitLabels()
Author(s):
Kurt Skauen (kurt@atheos.cx)

Point Slider::GetPreferredSize ( bool bLargest ) const [virtual]
 

Reimplemented from os::View.

std::string Slider::GetProgStrFormat ( ) const [virtual]
 

std::string Slider::GetProgressString ( ) const [virtual]
 

void Slider::GetSliderColors ( Color32_s * psColor1,
Color32_s * psColor2 ) const [virtual]
 

Get the slider-bar fill color.

Description:
Return the two slider-bar colors. Each of the two pointers might be NULL.
Parameters:
psColor1   - Color used left/below the knob
psColor2   - Color used right/abow the knob
See also:
SetSliderColors(), SetLimitLabels(), GetSliderSize()
Author(s):
Kurt Skauen (kurt@atheos.cx)

Rect Slider::GetSliderFrame ( ) const [virtual]
 

float Slider::GetSliderSize ( ) const [virtual]
 

Get the current slider thickness.

Description:
Returns the width for a horizontal and the height for a vertical slider of the slider-bar.
Returns:
The thickness of the slider-bar in pixels.
See also:
SetSliderSize(), GetSliderFrame()
Author(s):
Kurt Skauen (kurt@atheos.cx)

int Slider::GetStepCount ( ) const
 

Obtain the step-count as set by SetStepCount().

Returns:
The number of possible knob positions.
See also:
SetStepCount()
Author(s):
Kurt Skauen (kurt@atheos.cx)

void os::Slider::GetSteps ( float * pvSmall,
float * pvBig ) const [inline, virtual]
 

int Slider::GetTickCount ( ) const
 

Obtain the tick count as set with SetTickCount().

Returns:
The number of ticks to be rendered
See also:
SetTickCount()
Author(s):
Kurt Skauen (kurt@atheos.cx)

uint32 Slider::GetTickFlags ( ) const
 

Obtain the tick-flags as set with SetTickFlags().

Returns:
The current tick-flags
See also:
SetTickFlags()
Author(s):
Kurt Skauen (kurt@atheos.cx)

status_t Slider::Invoke ( Message * a_pcMessage = NULL ) [virtual]
 

Reimplemented from os::Control.

void Slider::MouseDown ( const Point & cPosition,
uint32 nButtons ) [virtual]
 

Reimplemented from os::View.

void Slider::MouseMove ( const Point & cNewPos,
int nCode,
uint32 nButtons,
Message * pcData ) [virtual]
 

Reimplemented from os::View.

void Slider::MouseUp ( const Point & cPosition,
uint32 nButtons,
Message * pcData ) [virtual]
 

Reimplemented from os::View.

void Slider::Paint ( const Rect & cUpdateRect ) [virtual]
 

Called by the system update "damaged" areas of the view.

Description:
Note:
Warning:
Parameters:
cUpdateRect   A rectangle enclosing all damaged areas. This is just a rough "worst-case", further fine-grained clipping will be performed by the Application Server to avoid updating non-damaged pixels and make the update as fast and flicker-free as possible.

See also:
Invalidate(), Flush()
Author(s):
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::View.

float Slider::PosToVal ( const Point & a_cPos ) const [virtual]
 

void Slider::RenderKnob ( View * pcRenderView ) [virtual]
 

void Slider::RenderLabels ( View * pcRenderView ) [virtual]
 

void Slider::RenderSlider ( View * pcRenderView ) [virtual]
 

void Slider::RenderTicks ( View * pcRenderView ) [virtual]
 

void Slider::SetCurValue ( float vValue,
bool bInvoke ) [virtual]
 

void Slider::SetCurValue ( float vValue )
 

void Slider::SetLimitLabels ( const std::string & cMinLabel,
const std::string & cMaxLabel )
 

Set the static labels rendere at each end of the slider.

Description:
The min/max labels are rendered below a horizontal slider and to the right of a vertical slider.
Note:
Both label must be set for the labels to be rendered.
Parameters:
cMin   - The label to be rendered at the "smaller" end of the slider.
cMax   - The label to be rendered at the "greater" end of the slider.
See also:
GetLimitLabels(), SetProgStrFormat()
Author(s):
Kurt Skauen (kurt@atheos.cx)

void os::Slider::SetMinMax ( float vMin,
float vMax ) [inline, virtual]
 

void Slider::SetProgStrFormat ( const std::string & cFormat ) [virtual]
 

Set format string for the progress label.

Description:
Set a printf() style string that will be used to format the "progress" label printed above the slider. The format function will be passed the sliders value as a parameter so if you throw in an f somewhere it will be replaced with the current value.
Note:
If you need some more advanced formatting you can inherit a new class from os::Slider and overload the GetProgressString() and return the string to be used as a progress label.
Parameters:
cFormat   - The printf() style format string used to generate the progress label.
See also:
GetProgStrFormat(), GetProgressString(), SetLimitLabels(), GetLimitLabels()
Author(s):
Kurt Skauen (kurt@atheos.cx)

void Slider::SetSliderColors ( const Color32_s & sColor1,
const Color32_s & sColor2 ) [virtual]
 

Modify the fill color of the slider bar.

Description:
Set the two colors used to fill the slider bar. The first color is used to fill the "lesser" part of the slider while the seccond color is used in the "greater" part of the slider.
Parameters:
sColor1   - Color used left/below the knob
sColor2   - Color used right/abow the knob
See also:
GetSliderColors(), SetSliderSize(), SetLimitLabels(), SetProgStrFormat()
Author(s):
Kurt Skauen (kurt@atheos.cx)

void Slider::SetSliderSize ( float vSize ) [virtual]
 

Set the thickness of the slider bar.

Description:
Set the size in slider bar in pixels. For a horizontal slider it sets the heigth and for a vertical it sets the width.
Note:
Warning:
Parameters:
vSize   - Slider-bar thickness in pixels.
See also:
GetSliderSize(), GetSliderFrame()
Author(s):
Kurt Skauen (kurt@atheos.cx)

void Slider::SetStepCount ( int nCount )
 

Set the number of possible knob positions.

Description:
The step count is used to limit the number of possible knob positions. The points are equaly spread out over the length of the slider and the knob will "snap" to these points. If set to the same value as SetTickCount() the knob will snap to the ticks.

If the value is less than 2 the knob is not snapped.
Parameters:
nCound   - Number of possible knob positions. 0 to disable snapping.
See also:
GetStepCount(), SetTickCount(), GetTickCount()
Author(s):
Kurt Skauen (kurt@atheos.cx)

void os::Slider::SetSteps ( float vSmall,
float vBig ) [inline, virtual]
 

void Slider::SetTickCount ( int nCount )
 

Set number of "ticks" rendered along the slider.

Description:
The slider can render "ticks" along both sides of the slider-bar. With SetTickCount() you can set how many such ticks should be rendered and with SetTickFlags() you can set on which side (if any) the ticks should be rendered. To make the knob "snap" to the ticks you can set the same count with SetStepCount().
Parameters:
nCount   - The number of ticks to be rendered.
See also:
GetTickCount(), SetTickFlags(), GetTickFlags(), SetStepCount()
Author(s):
Kurt Skauen (kurt@atheos.cx)

void Slider::SetTickFlags ( uint32 nFlags )
 

Configure where the slider ticks should be rendered.

Description:
The flag can be any combination of TICKS_ABOVE and TICKS_BELOW for horizontal sliders and TICKS_LEFT and TICKS_RIGHT for vertical sliders. The render ticks on both side you can bitwize "or" the flags together.
Warning:
Parameters:
nFlags   - The new tick flags.
See also:
GetTickFlags(), SetTickCount(), GetTickCount()
Author(s):
Kurt Skauen (kurt@atheos.cx)

Point Slider::ValToPos ( float vVal ) const [virtual]
 


The documentation for this class was generated from the following files:
Generated at Sat Apr 7 16:11:40 2001 for AtheOS higlevel API by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001