Vertical or horizontal increment/decrement buttons
For more information, see the diagram of the widget hierarchy.
<photon/PtUpDown.h>
The PtUpDown widget creates vertical or horizontal increment/decrement buttons. It lets you increase or decrease a value.
By default, the buttons display images of arrows, but you can use other images if necessary. You can also specify the armed data, the image displayed when the user presses one of the buttons.
The Pt_CB_ACTIVATE,Pt_CB_ARM, Pt_CB_DISARM, and Pt_CB_REPEAT callbacks for the buttons have a subtype that indicates which button was pressed.
Resource | C type | Pt type | Default |
---|---|---|---|
Pt_ARG_ARM_COLOR | PgColor_t | Scalar | PgGray(170) |
Pt_ARG_ORIENTATION | int | Boolean | Pt_VERTICAL |
Pt_ARG_SPACING | unsigned short | Scalar | 0 |
Pt_ARG_UPDOWN_ARM_DATA_DECREMENT | PhImage_t * | Image | NULL |
Pt_ARG_UPDOWN_ARM_DATA_INCREMENT | PhImage_t * | Image | NULL |
Pt_ARG_UPDOWN_BORDER_WIDTH | unsigned short | Scalar | 1 |
Pt_ARG_UPDOWN_DATA_DECREMENT | PhImage_t * | Image | NULL |
Pt_ARG_UPDOWN_DATA_INCREMENT | PhImage_t * | Image | NULL |
Pt_ARG_UPDOWN_FLAGS | signed short | Flag | See below |
Pt_ARG_UPDOWN_INDICATOR_MARGIN | unsigned short | Scalar | 0 |
C type | Pt type | Default |
---|---|---|
PgColor_t | Scalar | Pg_GRAY |
The background color used when the button is armed (pressed in). See PgColor_t in the Photon Library Reference.
This resource is used only if Pt_ARG_UPDOWN_FLAGS has Pt_UPDOWN_FILL_ON_ARM set.
C type | Pt type | Default |
---|---|---|
int | Boolean | Pt_VERTICAL |
The direction the arrows are pointing:
C type | Pt type | Default |
---|---|---|
unsigned short | Scalar | 0 |
The spacing between the increment and decrement buttons, in pixels.
C type | Pt type | Default |
---|---|---|
PhImage_t * | Image | NULL |
The image for the armed decrement button. This resource is used only if Pt_UPDOWN_ARM_DECREMENT is set in Pt_ARG_UPDOWN_FLAGS.
C type | Pt type | Default |
---|---|---|
PhImage_t * | Image | NULL |
The image for the armed increment button. This resource is used only if Pt_UPDOWN_ARM_INCREMENT is set in Pt_ARG_UPDOWN_FLAGS.
C type | Pt type | Default |
---|---|---|
unsigned short | Scalar | 1 |
The width of the widget's border, in pixels.
C type | Pt type | Default |
---|---|---|
PhImage_t * | Image | NULL |
The image for the unarmed decrement button. This resource is used only if Pt_UPDOWN_DECREMENT is set in Pt_ARG_UPDOWN_FLAGS.
C type | Pt type | Default |
---|---|---|
PhImage_t * | Image | NULL |
The image for the unarmed increment button. This resource is used only if Pt_UPDOWN_INCREMENT is set in Pt_ARG_UPDOWN_FLAGS.
C type | Pt type | Default |
---|---|---|
signed short | Flag | Pt_FILL_ON_ARM |
C type | Pt type | Default |
---|---|---|
unsigned | Scalar | 0 |
The distance, in pixels, around the button image.
If the widget modifies an inherited resource, the “Default override” column indicates the new value. This modification affects any subclasses of the widget.
These callbacks are passed a PtCallbackInfo_t structure that contains at least the following members:
unsigned long reason; unsigned long reason_subtype; PhEvent_t *event; void *cbdata;
The callbacks are similar to those for PtButton, except the reason_subtype indicates which button was pressed: