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)
virtual void PostValueChange (const Variant &cNewValue)
virtual void EnableStatusChanged (bool bIsEnabled)
bool Invoked (Message *pcMessage)
 Intercept outgoing messages. More...

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)
 Hook called by the system when the mouse is moved. More...

virtual void MouseDown (const Point &cPosition, uint32 nButtons)
 Hook called by the system when a mouse button is pressed. More...

virtual void MouseUp (const Point &cPosition, uint32 nButtons, Message *pcData)
 Hook called by the system when a mouse button is release. More...

virtual void FrameSized (const Point &cDelta)
 Virtual hook called by the system when the view is resized. More...

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:
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]
 

Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::Control.

void Slider::EnableStatusChanged bool bIsEnabled [virtual]
 

Reimplemented from os::Control.

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

Description:
Overload this member if you need to know when the view is resized.
Note:
This member is called after the view is resized. If you need the old size you can subtract the cDelta calue from the current size.
Parameters:
cDelta   The distance the bottom/right corner was moved relative to the upper/left corner.
See also:
FrameMoved(), SetFrame, ResizeBy(), ResizeTo()
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::View.

Rect Slider::GetKnobFrame const [virtual]
 

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

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:
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]
 

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:
Kurt Skauen (kurt@atheos.cx)

Rect Slider::GetSliderFrame const [virtual]
 

float Slider::GetSliderSize const [virtual]
 

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:
Kurt Skauen (kurt@atheos.cx)

int Slider::GetStepCount const
 

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

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

int Slider::GetTickCount const
 

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

uint32 Slider::GetTickFlags const
 

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

bool Slider::Invoked Message * pcMsg [virtual]
 

Description:
This member is called from Invoke() just before a message is sendt to the target.

This allow classes that inherits from os::Invoker to add data to or otherwhice modify the message before it is sendt. The message can also be canceled entirely by returning false from this member.

The message passed to Invoked() is a copy of the internal message or the message passed to Invoke() (if any) so any changes made here will not affect the internal message or the message passed to Invoke(). When this method returns the message will imidiatly be sendt to the target and then discarded (unless false is returned in which case the message is simply discarded).

The default implementation of this member does nothing and return true.

Parameters:
pcMessage   Pointer to the message that is about to be sendt. You can do any modification you like to this message (but never delete it).
Returns:
Normally you should return true to indicate that the message should be sendt. You can however return false if you for some reason want to cancel the invokation.
See also:
Invoke(), SetMessage(), SetTarget()
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::Control.

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

Description:
This member is called from the window thread whenever a mouse button is clicked above the view. You can overload this member if your view need to know about mouse-down events.

A view will not automatically take focus when clicked so if you want that behaviour you must call MakeFocus() from an overloaded version of this member.

The default implementation of this member will call MouseDown() on it's parent view if one exists.

Parameters:
cPosition   Mouse position in the views coordinate system at the time the mouse was pressed.
nButtons   Index of the pressed button. Buttons start at 1 for the left button, 2 for the right button, 3 for the middle button. Additional buttons might be supported by the mouse driver and will then be assigned numbers from 4 and up.

See also:
MouseUp(), MouseMove(), WheelMoved()
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::View.

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

Description:
This member is called from the window thread whenever the mouse is moved above the view or if the view have focus.

Oveload this member if your view need to handle mouse-move events.

The default implementation of this member will call MouseMove() on it's parent view if one exists.

Parameters:
cNewPos   New mouse position given in the views coordinate system.
nCode   Enter/exit code. This is MOUSE_ENTERED when the mouse first enter the view, MOUSE_EXITED when the mouse leaves the view, MOUSE_INSIDE whenever the mouse move withing the boundary of the view and MOUSE_OUTSIDE when the mouse move outside the view (will only happen if the view have focus).
nButtons   Bitmask telling which buttons that are currently pressed. Bit 0 is button 1 (left), bit 1 is button 2 (right), and bit 2 is button 3 (middle), and so on.
pcData   Pointer to a Message object containing the dragged data if the user is in the middle of a drag and drop operation. Otherwise this pointer is NULL. Look at BeginDrag() for a more detailed description of the drag and drop system.

See also:
MouseDown(), MouseUp(), WheelMoved(), BeginDrag()
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::View.

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

Description:
This member is called from the window thread whenever a mouse button is released above the view. You can overload this member if your view need to know about mouse-up events or if your view support drag and drop.

If mouse-up was the result of ending a drag and drop operation the pcData member will point to a Message containing the dragged data. Look at BeginDrag() for a more detailed description of the drag and drop system.

The default implementation of this member will call MouseDown() on it's parent view if one exists.

Parameters:
cPosition   Mouse position in the views coordinate system at the time the mouse was pressed.
nButtons   Index of the pressed button. Buttons start at 1 for the left button, 2 for the right button, 3 for the middle button. Additional buttons might be supported by the mouse driver and will then be assigned numbers from 4 and up.
pcData   Pointer to a Message object containing the dragged data if this mouse-up was the end of a drag and drop operation. If no data was dragged it will be NULL.

See also:
MouseDown(), MouseMove(), WheelMoved()
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::View.

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

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:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::View.

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

void Slider::PostValueChange const Variant & cNewValue [virtual]
 

Reimplemented from os::Control.

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::SetLimitLabels const std::string & cMinLabel,
const std::string & cMaxLabel
 

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:
Kurt Skauen (kurt@atheos.cx)

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

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

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:
Kurt Skauen (kurt@atheos.cx)

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

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:
Kurt Skauen (kurt@atheos.cx)

void Slider::SetSliderSize float vSize [virtual]
 

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:
Kurt Skauen (kurt@atheos.cx)

void Slider::SetStepCount int nCount
 

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:
Kurt Skauen (kurt@atheos.cx)

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

void Slider::SetTickCount int nCount
 

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:
Kurt Skauen (kurt@atheos.cx)

void Slider::SetTickFlags uint32 nFlags
 

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:
Kurt Skauen (kurt@atheos.cx)

Point Slider::ValToPos float vVal const [virtual]
 


Generated at Tue Sep 11 15:27:53 2001 for AtheOS higlevel API by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001