|
OWLNext 6.32
|
#include <slider.h>
Public Member Functions | |
| TSlider (TWindow *parent, int id, int x, int y, int w, int h, TResId thumbResId, TModule *module=0) | |
| TSlider (TWindow *parent, int resId, TResId thumbResId, TModule *module=0) | |
| TSlider (THandle hWnd, TModule *module=0) | |
| ~TSlider () | |
Overload TScrollBar virtual functions | |
| void | GetRange (int &min, int &max) const |
| int | GetPosition () const |
| void | SetRange (int min, int max, bool redraw=true) |
| void | SetPosition (int thumbPos) |
| void | SetPosition (int thumbPos, bool redraw) |
New settings introduced by sliders | |
| void | SetRuler (int ticGap, bool snap=false) |
| void | SetRuler (int tics[], int ticCount, bool snap=false) |
| void | SetSel (int start, int end, bool redraw=true) |
| void | GetSel (int &start, int &end) |
New messages (version 4.70) | |
| HWND | GetBuddy (bool loc=true) const |
| void | SetBuddy (HWND buddy, bool loc=true) |
| HWND | GetTooltips () const |
| void | SetTooltips (HWND tooltip) |
| void | SetTipSide (int loc) |
Protected Member Functions | |
| virtual TGetClassNameReturnType | GetClassName () |
| virtual void | SetupWindow () |
| int | SnapPos (int pos) |
An abstract base class derived from TScrollBar, TSlider defines the basic behavior of sliders (controls that are used for providing nonscrolling, position information). Like scroll bars, sliders have minimum and maximum positions as well as line and page magnitude. Sliders can be moved using either the mouse or the keyboard. If you use a mouse to move the slider, you can drag the thumb position, click on the slot on either side of the thumb position to move the thumb by a specified amount (PageMagnitude), or click on the ruler to position the thumb at a specific spot on the slider. The keyboard's Home and End keys move the thumb position to the minimum (Min) and maximum (Max) positions on the slider.
You can use TSlider 's member functions to cause the thumb positions to automatically align with the nearest tick positions. (This is referred to as snapping.) You can also specify the tick gaps (the space between the lines that separate the major divisions of the X- or Y-axis).
The sample program SLIDER.CPP on BC5.0x distribution disk displays a thermostat that uses sliders:
| owl::TSlider::TSlider | ( | TWindow * | parent, |
| int | id, | ||
| int | x, | ||
| int | y, | ||
| int | w, | ||
| int | h, | ||
| TResId | thumbResId, | ||
| TModule * | module = 0 |
||
| ) |
Constructs a slider object setting Pos and ThumbRgn to 0, TicGap to Range divided by 10, SlotThick to 17, Snap to true, and Sliding to false. Sets Attr.W and Attr.H to the values in X and Y. ThumbResId is set to thumbResId.
Constructor for a TSlider object created from resource.
References SetRange().
Constructs a slider object to encapsulate (alias) an existing control.
References GetClassName(), owl::TWindow::SendMessage(), and SetRange().
| owl::TSlider::~TSlider | ( | ) |
Destructs a TSlider object and deletes ThumbRgn.
| TWindow::TGetClassNameReturnType owl::TSlider::GetClassName | ( | ) | [protected, virtual] |
Returns the windows system class name that this slider is basing itself on.
Reimplemented from owl::TScrollBar.
| int owl::TSlider::GetPosition | ( | ) | const [inline, virtual] |
Returns the slider's current thumb position. Overloads TScrollBar's virtual function.
Reimplemented from owl::TScrollBar.
| void owl::TSlider::GetRange | ( | int & | min, |
| int & | max | ||
| ) | const [inline, virtual] |
Returns the end values of the present range of slider thumb positions in min and max. Overloads TScrollBar's virtual function.
Reimplemented from owl::TScrollBar.
| void owl::TSlider::SetPosition | ( | int | pos | ) |
Sets the position of the thumb and always redraws. Moves the thumb to the position specified in thumbPos. If thumbPos is outside the present range of the slider, the thumb is moved to the closest position within the specified range. Overloads TScrollBar's virtual function.
Always redraws.
| void owl::TSlider::SetPosition | ( | int | pos, |
| bool | redraw | ||
| ) | [virtual] |
Sets the position of the thumb and always redraws. Moves the thumb to the position specified in thumbPos. If thumbPos is outside the present range of the slider, the thumb is moved to the closest position within the specified range. Overloads TScrollBar's virtual function.
Redraw is optional.
Reimplemented from owl::TScrollBar.
References owl::TWindow::GetHandle(), owl::TWindow::SendMessage(), and SnapPos().
| void owl::TSlider::SetRange | ( | int | min, |
| int | max, | ||
| bool | redraw = true |
||
| ) | [virtual] |
Checks and sets the slider range. Sets the slider to the range between min and max. Overloads TScrollBar's virtual function.
Reimplemented from owl::TScrollBar.
References owl::TWindow::GetHandle(), and owl::TWindow::SendMessage().
| void owl::TSlider::SetRuler | ( | int | ticGap, |
| bool | snap = false |
||
| ) |
Sets the slider's ruler. Each slider has a built-in ruler that is drawn with the slider. The ruler, which can be blank or have tick marks on it, can be created so that it forces the thumb to snap to the tick positions automatically.
References owl::TWindow::GetHandle(), and owl::TWindow::SendMessage().
| void owl::TSlider::SetRuler | ( | int | tics[], |
| int | ticCount, | ||
| bool | snap = false |
||
| ) |
Sets the ruler's custom tics and snap. Snapping is not currently supported in native.
References owl::TWindow::GetHandle(), and owl::TWindow::SendMessage().
| void owl::TSlider::SetSel | ( | int | start, |
| int | end, | ||
| bool | redraw = true |
||
| ) |
Set a selection range for the slider. Requires that TBS_ENABLESELRANGE style attribute be set.
References owl::TWindow::GetHandle(), and owl::TWindow::SendMessage().
| void owl::TSlider::SetupWindow | ( | ) | [protected, virtual] |
Calls TScrollBar::SetupWindow and SetupThumbRgn to set up the slider window.
Reimplemented from owl::TScrollBar.
References SetPosition(), SetRange(), SetRuler(), and SetSel().
| int owl::TSlider::SnapPos | ( | int | pos | ) | [protected] |
Constrains pos so it is in the range from Min to Max and (if snapping is enabled) performs snapping by rounding pos to the nearest TicGap.
1.7.4