#include <views.h>
Inheritance diagram for TScrollBar::
Public Methods | |
TScrollBar (const TRect &bounds) | |
virtual void | draw () |
virtual TPalette& | getPalette () const |
virtual void | handleEvent (TEvent &event) |
virtual void | scrollDraw () |
virtual int | scrollStep (int part) |
void | setParams (int aValue, int aMin, int aMax, int aPgStep, int aArStep) |
void | setRange (int aMin, int aMax) |
void | setStep (int aPgStep, int aArStep) |
void | setValue (int aValue) |
void | drawPos (int pos) |
int | getPos () |
int | getSize () |
Static Public Methods | |
TStreamable* | build () |
Public Attributes | |
int | value |
TScrollChars | chars |
int | minVal |
int | maxVal |
int | pgStep |
int | arStep |
Static Public Attributes | |
TScrollChars | vChars |
TScrollChars | hChars |
const char* const | name |
Protected Methods | |
TScrollBar (StreamableInit) | |
virtual void | write (opstream &os) |
virtual void* | read (ipstream &is) |
|
Creates and initializes a scroll bar with the given bounds by calling the TView constructor. Sets value, maxVal and minVal to zero. Sets pgStep and arStep to 1. The shapes of the scroll bar parts are set to the defaults in chars data member. If `bounds' produces size.x = 1, scroll bar is vertical; otherwise, it is horizontal. Vertical scroll bars have the growMode data member set to gfGrowLoX | gfGrowHiX | gfGrowHiY; horizontal scroll bars have the growMode data member set to gfGrowLoY | gfGrowHiX | gfGrowHiY. |
|
Each streamable class needs a "builder" to allocate the correct memory for its objects together with the initialized virtual table pointers. This is achieved by calling this constructor with an argument of type StreamableInit. |
|
Called to create an object in certain stream-reading situations. Reimplemented from TView. |
|
Draws the scroll bar depending on the current bounds, value, and palette. Reimplemented from TView. |
|
Undocumented. |
|
Returns the default palette. Reimplemented from TView. |
|
Undocumented. |
|
Undocumented. |
|
Handles scroll bar events by calling TView::handleEvent(). Mouse events are broadcast to the scroll bar's owner, which must handle the implications of the scroll bar changes. handleEvent() also determines which scroll bar part has received a mouse click (or equivalent keystroke). Data member value is adjusted according to the current arStep or pgStep values. The scroll bar indicator is redrawn. Reimplemented from TView. |
|
Reads from the input stream `is'. Reimplemented from TView. |
|
Is called whenever value data member changes. This virtual member function defaults by sending a cmScrollBarChanged message to the scroll bar's owner:
message(owner, evBroadcast, cmScrollBarChanged, this);
|
|
By default, scrollStep() returns a positive or negative step value, depending on the scroll bar part given by `part', and the current values of arStep and pgStep. Parameter `part' should be one of the following constants:
Constant Value Meaning sbLeftArrow 0 Left arrow of horizontal scroll bar sbRightArrow 1 Right arrow of horizontal scroll bar sbPageLeft 2 Left paging area of horizontal scroll bar sbPageRight 3 Right paging area of horizontal scroll bar sbUpArrow 4 Top arrow of vertical scroll bar sbDownArrow 5 Bottom arrow of vertical scroll bar sbPageUp 6 Upper paging area of vertical scroll bar sbPageDown 7 Lower paging area of vertical scroll bar sbIndicator 8 Position indicator on scroll bar These constants define the different areas of a TScrollBar in which the mouse can be clicked. The scrollStep() function converts these constants into actual scroll step values. Although defined, the sbIndicator constant is never passed to scrollStep(). |
|
Sets the value, minVal, maxVal, pgStep and arStep with the given argument values. Some adjustments are made if your arguments conflict. The scroll bar is redrawn by calling drawView(). If value is changed, scrollDraw() is also called. |
|
Sets the legal range for value by setting minVal and maxVal to the given arguments `aMin' and `aMax'. Calls setParams(), so drawView() and scrollDraw() will be called if the changes require the scroll bar to be redrawn. |
|
Sets pgStep and arStep to the given arguments `aPgStep' and `aArStep'. Calls setParams() with the other arguments set to their current values. |
|
Sets value to `aValue' by calling setParams() with the other arguments set to their current values. Note: drawView() and scrollDraw() will be called if this call changes value. |
|
Writes to the output stream `os'. Reimplemented from TView. |
|
Variable arStep is the amount added or subtracted to the scroll bar's value data member when an arrow area is clicked (sbLeftArrow, sbRightArrow, sbUpArrow, or sbDownArrow) or the equivalent keystroke made. The TScrollBar constructor sets arStep to 1 by default. |
|
TScrollChars is defined as:
typedef char TScrollChars[5]; Variable chars is set with the five basic character patterns used to draw the scroll bar parts. |
|
Undocumented. |
|
Variable maxVal represents the maximum value for the value data member. The TScrollBar constructor sets maxVal to zero by default. |
|
Variable minVal represents the minimum value for the value data member. The TScrollBar constructor sets minVal to zero by default. |
|
Undocumented. Reimplemented from TView. |
|
Variable pgStep is the amount added or subtracted to the scroll bar's value data member when a mouse click event occurs in any of the page areas (sbPageLeft, sbPageRight, sbPageUp, or sbPageDown) or an equivalent keystroke is detected (Ctrl-Left, Ctrl-Right, PgUp, or PgDn). The TScrollBar constructor sets pgStep to 1 by default. You can change pgStep using setParams(), setStep() or TScroller::setLimit(). |
|
Undocumented. |
|
This variable represents the current position of the scroll bar indicator. This marker moves along the scroll bar strip to indicate the relative position of the scrollable text being viewed relative to the total text available for scrolling. The TScrollBar constructor sets value to zero by default. |