Planeshift
Public Member Functions | Protected Member Functions | Protected Attributes

pawsScrollBar Class Reference

A simple scroll bar widget. More...

#include <pawscrollbar.h>

List of all members.

Public Member Functions

virtual void Draw ()
 Draws the widget and all of it's children.
virtual void EnableValueLimit (bool limited)
 Sets if the constraint of current scrollbar value should be used.
virtual float GetCurrentValue ()
 Get the current value of the scroll bar.
virtual float GetMaxValue ()
virtual float GetMinValue ()
virtual float GetTickValue ()
 Returns the tick value of this scroll bar.
virtual bool OnButtonPressed (int button, int keyModifier, pawsWidget *widget)
 Called whenever a button is pressed.
virtual bool OnButtonReleased (int button, int keyModifier, pawsWidget *widget)
 Called whenever a button is released.
virtual bool OnGainFocus (bool=true)
 Changes hasFocus to TRUE and reports status to parent.
virtual bool OnMouseDown (int button, int modifiers, int x, int y)
 Manage mouse down event to test for and apply window changes.
virtual bool OnMouseExit ()
 Called whenever the mouse leaves this widget.
virtual bool OnMouseUp (int button, int modifiers, int x, int y)
 Manage mouse up event.
virtual void OnResize ()
 Sets the new position of the close button.
virtual void OnUpdateData (const char *dataname, PAWSData &data)
 pawsScrollBar (const pawsScrollBar &origin)
 pawsScrollBar ()
virtual bool PostSetup ()
 This is called after the widget and all of it's children have been created.
bool ScrollDown ()
 Scrolls one step down.
bool ScrollUp ()
 Scrolls one step up.
virtual void SetCurrentValue (float value, bool triggerEvent=true, bool publish=true)
 Set the current value that this scroll bar should have.
virtual void SetHorizontal (bool value)
virtual void SetMaxValue (float value)
 Set the max value that this scroll bar should have.
virtual void SetMinValue (float value)
 Set the min value that this scroll bar should have.
virtual void SetReversed (bool reversed)
 Sets if scrollbar should return reversed scroll value: left/top=maxValue, right/bottom=minValue.
virtual void SetTickValue (float tick)
 Set the amount that this scroll bar should change by.
virtual bool Setup (iDocumentNode *node)
 Setup this widget.
virtual ~pawsScrollBar ()

Protected Member Functions

int GetScrollBarSize ()
int GetThumbScaleLength ()
void LimitCurrentValue ()
 Adjusts currentValue so that 0<=currentValue<=maxValue.
void MoveThumbToMouse ()
 Sets position of thumb on screen and currentValue according to mouse position.
void SetButtonLayout ()
 Sets positions and sizes of up and down buttons.
void SetThumbLayout ()
 Sets position and size of thumb on screen according to currentValue.
void SetThumbVisibility ()

Protected Attributes

csRef< iVirtualClock > clock
float currentValue
pawsButtondownButton
csString downGrey
int downHeight
int downOffsetx
int downOffsety
csString downPressed
csString downUnpressed
int downWidth
bool horizontal
int lastButton
int lastModifiers
pawsWidgetlastWidget
bool limited
float maxValue
float minValue
bool mouseDown
bool mouseIsDraggingThumb
bool reversed
csTicks scrollTicks
 Keep track of ticks for scrolling.
pawsWidgetthumb
int thumbDragPoint
csString thumbMoving
csString thumbStopped
float tickValue
 This is how much value should change on a scroll.
pawsButtonupButton
csString upGrey
int upHeight
int upOffsetx
int upOffsety
csString upPressed
csString upUnpressed
int upWidth

Detailed Description

A simple scroll bar widget.

Definition at line 64 of file pawscrollbar.h.


Constructor & Destructor Documentation

pawsScrollBar::pawsScrollBar ( )
pawsScrollBar::pawsScrollBar ( const pawsScrollBar origin)
virtual pawsScrollBar::~pawsScrollBar ( ) [virtual]

Member Function Documentation

virtual void pawsScrollBar::Draw ( ) [virtual]

Draws the widget and all of it's children.

Remarks:
Uses clipping rect of it's parent to define drawing area. If the drawing area defined is empty it returns.

Reimplemented from pawsWidget.

virtual void pawsScrollBar::EnableValueLimit ( bool  limited) [virtual]

Sets if the constraint of current scrollbar value should be used.

Parameters:
limitedShould the value be limited ?
virtual float pawsScrollBar::GetCurrentValue ( ) [virtual]

Get the current value of the scroll bar.

Returns:
The current value.
virtual float pawsScrollBar::GetMaxValue ( ) [inline, virtual]

Definition at line 90 of file pawscrollbar.h.

virtual float pawsScrollBar::GetMinValue ( ) [inline, virtual]

Definition at line 99 of file pawscrollbar.h.

int pawsScrollBar::GetScrollBarSize ( ) [protected]
int pawsScrollBar::GetThumbScaleLength ( ) [protected]
virtual float pawsScrollBar::GetTickValue ( ) [inline, virtual]

Returns the tick value of this scroll bar.

Returns:
the tick value of this scroll bar.

Definition at line 132 of file pawscrollbar.h.

void pawsScrollBar::LimitCurrentValue ( ) [protected]

Adjusts currentValue so that 0<=currentValue<=maxValue.

void pawsScrollBar::MoveThumbToMouse ( ) [protected]

Sets position of thumb on screen and currentValue according to mouse position.

virtual bool pawsScrollBar::OnButtonPressed ( int  button,
int  keyModifier,
pawsWidget widget 
) [virtual]

Called whenever a button is pressed.

Parameters:
buttonThe button pressed.
keyModifierModifier key in effect.
widgetThe widget the button belongs to.
Returns:
bool Parent's result or FALSE if no parent.

Reimplemented from pawsWidget.

virtual bool pawsScrollBar::OnButtonReleased ( int  button,
int  keyModifier,
pawsWidget widget 
) [virtual]

Called whenever a button is released.

Parameters:
buttonThe button released.
keyModifierModifier key in effect.
widgetThe widget the button belongs to.
Returns:
bool Parent's result or FALSE if no parent.

Reimplemented from pawsWidget.

virtual bool pawsScrollBar::OnGainFocus ( bool  = true) [inline, virtual]

Changes hasFocus to TRUE and reports status to parent.

Returns:
bool
Remarks:
Acts recursively on it's parents. If the widget cannot be focused, this function needs be overridden.

Reimplemented from pawsWidget.

Definition at line 150 of file pawscrollbar.h.

virtual bool pawsScrollBar::OnMouseDown ( int  button,
int  modifiers,
int  x,
int  y 
) [virtual]

Manage mouse down event to test for and apply window changes.

Parameters:
buttonType of button: 1 resizable or movable, 2 context menu or config window.
modifiersUsed with PAWS_CONSTRUCTION.
xUsed to test for resize.
yUsed to test for resize.
Returns:
bool TRUE if movable or resizable.
Remarks:
calls OnMouseDown on it's parent.

Reimplemented from pawsWidget.

virtual bool pawsScrollBar::OnMouseExit ( ) [virtual]

Called whenever the mouse leaves this widget.

Returns:
bool Parent's result or TRUE if no parent.

Reimplemented from pawsWidget.

virtual bool pawsScrollBar::OnMouseUp ( int  button,
int  modifiers,
int  x,
int  y 
) [virtual]

Manage mouse up event.

Returns:
bool Parent's result or FALSE if no parent.
Remarks:
Acts recursively on it's parents.

Reimplemented from pawsWidget.

virtual void pawsScrollBar::OnResize ( ) [virtual]

Sets the new position of the close button.

Reimplemented from pawsWidget.

virtual void pawsScrollBar::OnUpdateData ( const char *  dataname,
PAWSData data 
) [virtual]

Reimplemented from pawsWidget.

virtual bool pawsScrollBar::PostSetup ( ) [virtual]

This is called after the widget and all of it's children have been created.

Remarks:
This can be useful for widgets that want to get pointers to some of it's children for quick access.

Reimplemented from pawsWidget.

bool pawsScrollBar::ScrollDown ( )

Scrolls one step down.

Returns:
true if the scrollbar was scrolled
bool pawsScrollBar::ScrollUp ( )

Scrolls one step up.

Returns:
true if the scrollbar was scrolled
void pawsScrollBar::SetButtonLayout ( ) [protected]

Sets positions and sizes of up and down buttons.

virtual void pawsScrollBar::SetCurrentValue ( float  value,
bool  triggerEvent = true,
bool  publish = true 
) [virtual]

Set the current value that this scroll bar should have.

Parameters:
valueThe current value of this bar.
triggerEvent
publish
virtual void pawsScrollBar::SetHorizontal ( bool  value) [virtual]
virtual void pawsScrollBar::SetMaxValue ( float  value) [virtual]

Set the max value that this scroll bar should have.

Parameters:
valueThe max value that this bar can have.
virtual void pawsScrollBar::SetMinValue ( float  value) [virtual]

Set the min value that this scroll bar should have.

Parameters:
valueThe min value that this bar can have.
virtual void pawsScrollBar::SetReversed ( bool  reversed) [inline, virtual]

Sets if scrollbar should return reversed scroll value: left/top=maxValue, right/bottom=minValue.

Definition at line 144 of file pawscrollbar.h.

void pawsScrollBar::SetThumbLayout ( ) [protected]

Sets position and size of thumb on screen according to currentValue.

void pawsScrollBar::SetThumbVisibility ( ) [protected]
virtual void pawsScrollBar::SetTickValue ( float  tick) [virtual]

Set the amount that this scroll bar should change by.

Parameters:
tickThe tick value to change by.
virtual bool pawsScrollBar::Setup ( iDocumentNode *  ) [virtual]

Setup this widget.

Reimplemented from pawsWidget.


Member Data Documentation

csRef<iVirtualClock> pawsScrollBar::clock [protected]

Definition at line 195 of file pawscrollbar.h.

Definition at line 188 of file pawscrollbar.h.

Definition at line 206 of file pawscrollbar.h.

csString pawsScrollBar::downGrey [protected]

Definition at line 221 of file pawscrollbar.h.

Definition at line 227 of file pawscrollbar.h.

Definition at line 224 of file pawscrollbar.h.

Definition at line 225 of file pawscrollbar.h.

csString pawsScrollBar::downPressed [protected]

Definition at line 223 of file pawscrollbar.h.

csString pawsScrollBar::downUnpressed [protected]

Definition at line 222 of file pawscrollbar.h.

Definition at line 226 of file pawscrollbar.h.

bool pawsScrollBar::horizontal [protected]

Definition at line 232 of file pawscrollbar.h.

Definition at line 202 of file pawscrollbar.h.

Definition at line 203 of file pawscrollbar.h.

Definition at line 204 of file pawscrollbar.h.

bool pawsScrollBar::limited [protected]

Definition at line 233 of file pawscrollbar.h.

Definition at line 189 of file pawscrollbar.h.

Definition at line 190 of file pawscrollbar.h.

bool pawsScrollBar::mouseDown [protected]

Definition at line 199 of file pawscrollbar.h.

Definition at line 209 of file pawscrollbar.h.

bool pawsScrollBar::reversed [protected]

Definition at line 200 of file pawscrollbar.h.

csTicks pawsScrollBar::scrollTicks [protected]

Keep track of ticks for scrolling.

Definition at line 198 of file pawscrollbar.h.

Definition at line 208 of file pawscrollbar.h.

Definition at line 210 of file pawscrollbar.h.

csString pawsScrollBar::thumbMoving [protected]

Definition at line 230 of file pawscrollbar.h.

csString pawsScrollBar::thumbStopped [protected]

Definition at line 229 of file pawscrollbar.h.

This is how much value should change on a scroll.

Definition at line 193 of file pawscrollbar.h.

Definition at line 206 of file pawscrollbar.h.

csString pawsScrollBar::upGrey [protected]

Definition at line 213 of file pawscrollbar.h.

Definition at line 219 of file pawscrollbar.h.

Definition at line 216 of file pawscrollbar.h.

Definition at line 217 of file pawscrollbar.h.

csString pawsScrollBar::upPressed [protected]

Definition at line 215 of file pawscrollbar.h.

csString pawsScrollBar::upUnpressed [protected]

Definition at line 214 of file pawscrollbar.h.

Definition at line 218 of file pawscrollbar.h.


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