[Previous] [Contents] [Index] [Next]

PtSlider

A widget for choosing a value from a range

Class hierarchy:

PtWidget --> PtBasic --> PtGauge --> PtSlider

For more information, see the diagram of the widget hierarchy.

PhAB icon:

PtSlider button in PhAB

Public header:

<photon/PtSlider.h>

Description:

A PtSlider widget serves as a numerical input mechanism that allows the user to choose values within a specified range from minimum to maximum.


PtSlider


A PtSlider widget.


A slider consists of a narrow trough (representing the total range), a movable handle, and optional tick marks. The handle - which appears on top of the trough - represents the current position within the range. The size of the handle is determined by Pt_ARG_SLIDER_HANDLE_WIDTH and Pt_ARG_SLIDER_HANDLE_HEIGHT or by the size of Pt_ARG_SLIDER_IMAGE.

Mouse actions

When the user presses the mouse button, the result depends on the location of the pointer.

If the pointer is: Then:
In the trough The handle will move up or down one slider multiple
On the handle A drag is started

Keyboard actions

If the user presses: The handle will:
/\ Move up one increment
\/ Move down one increment
--> Move right one increment
<-- Move left one increment
Pg Up Move up/right one "page"
Pg Down Move down/left one "page"
Home Move to the minimum value
End Move to the maximum value

where:

New resources:

Resource C type Pt type Default
Pt_ARG_SLIDER_FLAGS short int Flag See below
Pt_ARG_SLIDER_HANDLE_HEIGHT short int Scalar 40
Pt_ARG_SLIDER_HANDLE_WIDTH short int Scalar 15
Pt_ARG_SLIDER_IMAGE void * Alloc NULL
Pt_ARG_SLIDER_INCREMENT ushort_t Scalar 1
Pt_ARG_SLIDER_LABEL_BR char * Alloc NULL
Pt_ARG_SLIDER_LABEL_BR_COL PgColor_t Scalar Pg_BLACK
Pt_ARG_SLIDER_LABEL_TL char * Alloc NULL
Pt_ARG_SLIDER_LABEL_TL_COL PgColor_t Scalar Pg_BLACK
Pt_ARG_SLIDER_MULTIPLE ushort_t Scalar 0
Pt_ARG_SLIDER_ORIENTATION short Scalar Pt_SLIDER_MIN_ON_TOP
Pt_ARG_SLIDER_TICK_MAJOR_COL PgColor_t Scalar Pg_BLACK
Pt_ARG_SLIDER_TICK_MAJOR_DIV short int Scalar 10
Pt_ARG_SLIDER_TICK_MAJOR_LEN short int Scalar 10
Pt_ARG_SLIDER_TICK_MINOR_COL PgColor_t Scalar Pg_BLACK
Pt_ARG_SLIDER_TICK_MINOR_DIV short int Scalar 0
Pt_ARG_SLIDER_TICK_MINOR_LEN short int Scalar 0
Pt_ARG_SLIDER_TROUGH_COL PgColor_t Scalar Pg_GRAY
Pt_ARG_SLIDER_TROUGH_SIZE short int Scalar 4
Pt_CB_SLIDER_MOVE PtCallback_t * Link NULL

Pt_ARG_SLIDER_FLAGS

C type Pt type Default
short int Flag Pt_TICKS_ON_BOTTOM | Pt_SLIDER_POINT_DOWN

Valid flags:

Pt_TICKS_ON_TOP, Pt_TICKS_ON_LEFT
Ticks are placed on the top or left of the slider, depending on the orientation.
Pt_TICKS_ON_BOTTOM, Pt_TICKS_ON_RIGHT
Ticks are placed on the bottom or right of the slider, depending on the orientation.
Pt_TICKS_TOUCH_TROUGH
Ticks touch the trough.
Pt_TICKS_ETCHED_OUT
Ticks are etched out.
Pt_TICKS_ETCHED_IN
Ticks are etched in.
Pt_SLIDER_POINT_LEFT, Pt_SLIDER_POINT_UP
The slider handle will point up or left, depending on the orientation.
Pt_SLIDER_POINT_RIGHT, Pt_SLIDER_POINT_DOWN
The slider handle will point down or right, depending on the orientation.
Pt_SLIDER_IMAGE
The slider handle will be the image specified by the Pt_ARG_SLIDER_IMAGE resource.

Pt_ARG_SLIDER_HANDLE_HEIGHT

C type Pt type Default
short int Scalar 40

The height of the slider handle.

Pt_ARG_SLIDER_HANDLE_WIDTH

C type Pt type Default
short int Scalar 15

The width of the slider handle.

Pt_ARG_SLIDER_IMAGE

C type Pt type Default
void * Alloc NULL

The image that will be displayed as the handle if the Pt_ARG_SLIDER_FLAGS resource has the Pt_SLIDER_IMAGE flag set.

Pt_ARG_SLIDER_INCREMENT

C type Pt type Default
ushort_t Scalar 1

The slider increment when the cursor keys are pressed.

Pt_ARG_SLIDER_LABEL_BR

C type Pt type Default
char * Alloc NULL

The label string that's placed at the bottom or right of the slider, depending on the orientation.

Pt_ARG_SLIDER_LABEL_BR_COL

C type Pt type Default
PgColor_t Scalar Pg_BLACK

The color of the bottom or right label.

Pt_ARG_SLIDER_LABEL_TL

C type Pt type Default
char * Alloc NULL

The label string that's placed at the top or left of the slider, depending on the orientation.

Pt_ARG_SLIDER_LABEL_TL_COL

C type Pt type Default
PgColor_t Scalar Pg_BLACK

The color of the top or left label.

Pt_ARG_SLIDER_MULTIPLE

C type Pt type Default
ushort_t Scalar 0

The slider increment when the pointer is pressed in the trough, or Pg Up or Pg Down is pressed.

Pt_ARG_SLIDER_ORIENTATION

C type Pt type Default
short Scalar Pt_SLIDER_MIN_ON_TOP

The location of the minimum value for the slider: on the top or bottom if the slider is vertical; on the left or right if the slider is horizontal. The possible values are:

Pt_ARG_SLIDER_TICK_MAJOR_COL

C type Pt type Default
PgColor_t Scalar Pg_BLACK

The color of the major ticks.

Pt_ARG_SLIDER_TICK_MAJOR_DIV

C type Pt type Default
short int Scalar 10

The number of major divisions.

Pt_ARG_SLIDER_TICK_MAJOR_LEN

C type Pt type Default
short int Scalar 10

The length of the major ticks.

Pt_ARG_SLIDER_TICK_MINOR_COL

C type Pt type Default
PgColor_t Scalar Pg_BLACK

The color of the minor ticks.

Pt_ARG_SLIDER_TICK_MINOR_DIV

C type Pt type Default
short int Scalar 0

The number of minor divisions per major division.

Pt_ARG_SLIDER_TICK_MINOR_LEN

C type Pt type Default
short int Scalar 0

The length of the minor ticks.

Pt_ARG_SLIDER_TROUGH_COL

C type Pt type Default
PgColor_t Scalar Pg_GRAY

The color of the trough.

Pt_ARG_SLIDER_TROUGH_SIZE

C type Pt type Default
short int Scalar 4

The height or width of the trough, depending on the orientation. The other dimension is obtained from the Pt_ARG_DIM resource, which is inherited from PtWidget.

Pt_CB_SLIDER_MOVE

C type Pt type Default
PtCallback_t * Link NULL

A list of callbacks that the slider invokes when the handle position changes.

If the widget has the Pt_CALLBACKS_ACTIVE bit set in its Pt_ARG_FLAGS resource, these callbacks are also invoked when the handle position is changed by a call to PtSetResources().

Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:

reason
Pt_CB_SLIDER_MOVE
reason_subtype
0 (not used).
cbdata
A pointer to a PtSliderCallback_t structure that contains at least the following member:
int position;
A value corresponding to the slider handles location.

These callbacks should return Pt_CONTINUE.

Inherited resources:

If the widget modifies an inherited resource, the "Default override" column indicates the new value. This modification affects any subclasses of the widget.

Resource Inherited from Default override
Pt_ARG_AREA PtWidget
Pt_ARG_BANDWIDTH_THRESHOLD PtBasic Not used by this class.
Pt_ARG_BITMAP_CURSOR PtWidget
Pt_ARG_BORDER_WIDTH PtWidget 1
Pt_ARG_BOT_BORDER_COLOR PtBasic
Pt_ARG_COLOR PtBasic Pg_GRAY
Pt_ARG_CURSOR_COLOR PtWidget
Pt_ARG_CURSOR_TYPE PtWidget
Pt_ARG_DATA PtWidget
Pt_ARG_DIM PtWidget
Pt_ARG_EFLAGS PtWidget
Pt_ARG_FILL_COLOR PtBasic
Pt_ARG_FILL_PATTERN PtBasic
Pt_ARG_FLAGS PtWidget |=Pt_GETS_FOCUS
Pt_ARG_GAUGE_FLAGS PtGauge
Pt_ARG_GAUGE_FONT PtGauge
Pt_ARG_GAUGE_H_ALIGN PtGauge Not used by this class.
Pt_ARG_GAUGE_MAXIMUM PtGauge
Pt_ARG_GAUGE_MINIMUM PtGauge
Pt_ARG_GAUGE_ORIENTATION PtGauge Pt_HORIZONTAL
Pt_ARG_GAUGE_V_ALIGN PtGauge Not used by this class.
Pt_ARG_GAUGE_VALUE PtGauge
Pt_ARG_GAUGE_VALUE_PREFIX PtGauge Not used by this class.
Pt_ARG_GAUGE_VALUE_SUFFIX PtGauge Not used by this class.
Pt_ARG_HELP_TOPIC PtWidget
Pt_ARG_HIGHLIGHT_ROUNDNESS PtBasic
Pt_ARG_MARGIN_HEIGHT PtBasic 0
Pt_ARG_MARGIN_WIDTH PtBasic 0
Pt_ARG_POS PtWidget
Pt_ARG_RESIZE_FLAGS PtWidget
Pt_ARG_TOP_BORDER_COLOR PtBasic
Pt_ARG_TRANS_PATTERN PtBasic
Pt_ARG_USER_DATA PtWidget
Pt_CB_ACTIVATE PtBasic
Pt_CB_ARM PtBasic
Pt_CB_BLOCKED PtWidget
Pt_CB_DESTROYED PtWidget
Pt_CB_DISARM PtBasic
Pt_CB_GOT_FOCUS PtBasic
Pt_CB_HOTKEY PtWidget
Pt_CB_LOST_FOCUS PtBasic
Pt_CB_MENU PtBasic
Pt_CB_RAW PtWidget
Pt_CB_REALIZED PtWidget
Pt_CB_REPEAT PtBasic
Pt_CB_UNREALIZED PtWidget

[Previous] [Contents] [Index] [Next]