os::Slider Class Reference
[The Syllable Graphical User Interface API]

Description:
More...

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 Member Functions

 Slider (const Rect &cFrame, const 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.
virtual void GetSliderColors (Color32_s *psColor1, Color32_s *psColor2) const
 Get the slider-bar fill color.
virtual void SetSliderSize (float vSize)
 Set the thickness of the slider bar.
virtual float GetSliderSize () const
 Get the current slider thickness.
virtual void SetProgStrFormat (const String &cFormat)
 Set format string for the progress label.
virtual String GetProgStrFormat () const
virtual String GetProgressString () const
void SetStepCount (int nCount)
 Set the number of possible knob positions.
int GetStepCount () const
 Obtain the step-count as set by SetStepCount().
void SetTickCount (int nCount)
 Set number of "ticks" rendered along the slider.
int GetTickCount () const
 Obtain the tick count as set with SetTickCount().
void SetTickFlags (uint32 nFlags)
 Configure where the slider ticks should be rendered.
uint32 GetTickFlags () const
 Obtain the tick-flags as set with SetTickFlags().
void SetLimitLabels (const String &cMinLabel, const String &cMaxLabel)
 Set the static labels rendere at each end of the slider.
void GetLimitLabels (String *pcMinLabel, String *pcMaxLabel)
 Obtain the limit-labels as set with SetLimitLabels().
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)
virtual bool Invoked (Message *pcMessage)
 Intercept outgoing messages.
virtual void AttachedToWindow ()
 Sets the background color to the one of the parent view.
virtual void MouseMove (const Point &cNewPos, int nCode, uint32 nButtons, Message *pcData)
 Hook called by the system when the mouse is moved.
virtual void MouseDown (const Point &cPosition, uint32 nButtons)
 Hook called by the system when a mouse button is pressed.
virtual void MouseUp (const Point &cPosition, uint32 nButtons, Message *pcData)
 Hook called by the system when a mouse button is release.
virtual void KeyDown (const char *pzString, const char *pzRawString, uint32 nQualifiers)
 Hook called by the system when a key is pressed while the view has focus.
virtual void FrameSized (const Point &cDelta)
 Virtual hook called by the system when the view is resized.
virtual void Paint (const Rect &cUpdateRect)
 Called by the system update "damaged" areas of the view.
virtual Point GetPreferredSize (bool bLargest) const
virtual void Activated (bool bIsActive)
 Hook called when the view gain or loose focus.

Classes

class  Private

Detailed Description

See also:
Author:
Kurt Skauen ([email protected])


Member Enumeration Documentation

anonymous enum

Enumerator:
TICKS_ABOVE 
TICKS_BELOW 
TICKS_LEFT 
TICKS_RIGHT 

enum os::Slider::knob_mode

Enumerator:
KNOB_SQUARE 
KNOB_TRIANGLE 
KNOB_DIAMOND 


Constructor & Destructor Documentation

Slider::Slider ( const Rect cFrame,
const 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::RenderLabels ( View pcRenderView  )  [virtual]

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

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

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

float Slider::PosToVal ( const Point cPos  )  const [virtual]

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

Rect Slider::GetKnobFrame (  )  const [virtual]

Rect Slider::GetSliderFrame (  )  const [virtual]

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 ([email protected])

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 ([email protected])

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 ([email protected])

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 ([email protected])

void Slider::SetProgStrFormat ( const 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 ([email protected])

String Slider::GetProgStrFormat (  )  const [virtual]

String Slider::GetProgressString (  )  const [virtual]

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 ([email protected])

int Slider::GetStepCount (  )  const

Returns:
The number of possible knob positions.
See also:
SetStepCount()
Author:
Kurt Skauen ([email protected])

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 ([email protected])

int Slider::GetTickCount (  )  const

Returns:
The number of ticks to be rendered
See also:
SetTickCount()
Author:
Kurt Skauen ([email protected])

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 ([email protected])

uint32 Slider::GetTickFlags (  )  const

Returns:
The current tick-flags
See also:
SetTickFlags()
Author:
Kurt Skauen ([email protected])

void Slider::SetLimitLabels ( const String cMinLabel,
const 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 ([email protected])

void Slider::GetLimitLabels ( String pcMinLabel,
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 ([email protected])

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

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

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

void Slider::PostValueChange ( const Variant cNewValue  )  [virtual]

Reimplemented from os::Control.

void Slider::EnableStatusChanged ( bool  bIsEnabled  )  [virtual]

Implements os::Control.

bool Slider::Invoked ( Message pcMessage  )  [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 ([email protected])

Reimplemented from os::Control.

void Slider::AttachedToWindow ( void   )  [virtual]

Author:
Kurt Skauen ([email protected])

Reimplemented from os::Control.

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 has 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 has 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 ([email protected])

Reimplemented from os::View.

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 ([email protected])

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 ([email protected])

Reimplemented from os::View.

void Slider::KeyDown ( const char *  pzString,
const char *  pzRawString,
uint32  nQualifiers 
) [virtual]

Description:
Overload this member if your view need to handle keyboard input. This member is called to allow the view to handle M_KEY_DOWN messages. The most common members are exctracted from the message and passed as parameters but you might need to obtain the raw message with os::Looper::GetCurrentMessage() and find some members yourself if you the data you needed are not passed in.
For example if you need the raw key-code for the pressed key you will have to lookup the "_raw_key" member from the message.
Parameters:
pzString String containing a single UTF-8 encoded character. This is the character generated by the pressed key according to the current keymap accounting for any qualifiers that might be pressed.
pzRawString Same as pzString except that the key is converted without accounting for qualifiers. Ie. if 'A' is pressed while pressing <SHIFT> pzString will contain 'A' and pzRawString will contain 'a'.
nQualifiers Bitmask describing which qualifiers that was active when the key was pressed.
See also:
KeyUp(), os::Looper::GetCurrentMessage()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::View.

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 ([email protected])

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 ([email protected])

Reimplemented from os::View.

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

Reimplemented from os::View.

void Slider::Activated ( bool  bIsActive  )  [virtual]

Description:
This is a callback member that can be overloaded by derived classes to learn when the view is activated and when it is deactivated. The bIsActive parameter tell whether the focus was lost or gained.
The view has focus when it is the active view in the active window.
Note:
This is a hook function that is called by the system to notify about an event. You should never call this member yourself.
The window is locked when this member is called.
Parameters:
bIsActive - true if the view gain and false if it loose focus.
See also:
MakeFocus(), WindowActivated()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::View.


Generated on Sat May 9 22:51:43 2009 for Syllable higlevel API by  doxygen 1.5.1