This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
An analog, digital, or LED clock
PtWidget --> PtBasic --> PtClock
For more information, see the diagram of the widget hierarchy.
<photon/PtClock.h>
A PtClock draws a clock and can optionally update its display periodically (about once a second) to reflect the current time.
Analog, digital, and LED clocks created by PtClock.
PtClock follows the system time, but don't rely on it to be accurate all the time.
The widget may flicker excessively, particularly if you use a transparent fill
color.
To reduce flicker, use a nontransparent fill color or
disable the display of seconds.
Alternatively, you can place the clock in a PtOSContainer, but you must use a transparent fill for the clock, or it won't be refreshed properly. |
Resource | C type | Pt type | Default |
---|---|---|---|
Pt_ARG_CLOCK_FACE_COLOR | PgColor_t | Scalar | Pg_WHITE |
Pt_ARG_CLOCK_FACE_OUTLINE_COLOR | PgColor_t | Scalar | Pg_BLACK |
Pt_ARG_CLOCK_FLAGS | long | Flag | See below. |
Pt_ARG_CLOCK_FONT | char * | String | "TextFont09" |
Pt_ARG_CLOCK_HOUR | short | Scalar | Pt_CLOCK_CURRENT |
Pt_ARG_CLOCK_HOUR_COLOR | PgColor_t | Scalar | Pg_BLACK |
Pt_ARG_CLOCK_HOUR_OFFSET | short | Scalar | 0 |
Pt_ARG_CLOCK_MINUTE | short | Scalar | Pt_CLOCK_CURRENT |
Pt_ARG_CLOCK_MINUTE_COLOR | PgColor_t | Scalar | Pg_BLACK |
Pt_ARG_CLOCK_MINUTE_OFFSET | short | Scalar | 0 |
Pt_ARG_CLOCK_SECOND | short | Scalar | Pt_CLOCK_CURRENT |
Pt_ARG_CLOCK_SECOND_COLOR | PgColor_t | Scalar | Pg_RED |
Pt_ARG_CLOCK_SECOND_OFFSET | short | Scalar | 0 |
Pt_ARG_CLOCK_SEP1 | char * | String | ":" |
Pt_ARG_CLOCK_SEP1_COLOR | PgColor_t | Scalar | Pg_BLACK |
Pt_ARG_CLOCK_SEP2 | char * | String | ":" |
Pt_ARG_CLOCK_SEP2_COLOR | PgColor_t | Scalar | Pg_BLACK |
Pt_ARG_CLOCK_TYPE | short | Scalar | Pt_CLOCK_ANALOG |
Pt_CB_CLOCK_TIME_CHANGED | PtCallback_t * | Link | NULL |
C type | Pt type | Default |
---|---|---|
PgColor_t | Scalar | Pg_WHITE |
The fill color of the clock's face (applicable only for analog clocks). See PgColor_t in the Photon Library Reference.
C type | Pt type | Default |
---|---|---|
PgColor_t | Scalar | Pg_BLACK |
The color of the line drawn around the clock face (applicable only for analog clocks). See PgColor_t in the Photon Library Reference.
C type | Pt type | Default |
---|---|---|
long | Flag | Pt_CLOCK_TRACK_TIME | Pt_CLOCK_SHOW_SECONDS | Pt_CLOCK_SHOW_NUMBERS |
Defines the clock's behavior. Possible values are:
C type | Pt type | Default |
---|---|---|
char * | String | "TextFont09" |
The font to use. For analog clocks, this applies to the numbers on the face (if displayed). For digital clocks, this applies to the entire display.
C type | Pt type | Default |
---|---|---|
short | Scalar | Pt_CLOCK_CURRENT |
The current hour setting for the clock (reflecting the current system clock setting if Pt_CLOCK_TRACK_TIME is set). This value is in 24-hour format.
If you set this resource to Pt_CLOCK_CURRENT, the clock is set to the current system time.
C type | Pt type | Default |
---|---|---|
PgColor_t | Scalar | Pg_BLACK |
The color to use when drawing the hours component. See PgColor_t in the Photon Library Reference.
C type | Pt type | Default |
---|---|---|
short | Scalar | 0 |
Offset the clock setting by this amount when displaying the hours field.
C type | Pt type | Default |
---|---|---|
short | Scalar | Pt_CLOCK_CURRENT |
The current minute setting for the clock (reflecting the current system clock setting if Pt_CLOCK_TRACK_TIME is set). If you set this resource to Pt_CLOCK_CURRENT, the clock is set to the current system time.
C type | Pt type | Default |
---|---|---|
PgColor_t | Scalar | Pg_BLACK |
The color to use when drawing the minutes component. See PgColor_t in the Photon Library Reference.
C type | Pt type | Default |
---|---|---|
short | Scalar | 0 |
Offset the clock setting by this amount when displaying the minutes field.
C type | Pt type | Default |
---|---|---|
short | Scalar | Pt_CLOCK_CURRENT |
The current second setting for the clock (reflecting the current system clock setting if Pt_CLOCK_TRACK_TIME is set). If you set this resource to Pt_CLOCK_CURRENT, the clock is set to the current system time.
C type | Pt type | Default |
---|---|---|
PgColor_t | Scalar | Pg_RED |
The color to use when drawing the seconds component. See PgColor_t in the Photon Library Reference.
C type | Pt type | Default |
---|---|---|
short | Scalar | 0 |
Offset the clock setting by this amount when displaying the seconds field.
C type | Pt type | Default |
---|---|---|
char * | String | ":" |
The separator to use between the hours and minutes field (applicable only for digital clocks; LED clocks always use a colon). Only the first character of the string is used.
C type | Pt type | Default |
---|---|---|
PgColor_t | Scalar | Pg_BLACK |
The color to use when drawing the separator character between hours and minutes. See PgColor_t in the Photon Library Reference.
C type | Pt type | Default |
---|---|---|
char * | String | ":" |
The separator to use between the minutes and seconds field (applicable only for digital clocks with Pt_CLOCK_SHOW_SECONDS set; LED clocks always use a colon). Only the first character of the string is used.
C type | Pt type | Default |
---|---|---|
PgColor_t | Scalar | Pg_BLACK |
The color to use when drawing the separator character between minutes and seconds. See PgColor_t in the Photon Library Reference.
C type | Pt type | Default |
---|---|---|
short | Scalar | Pt_CLOCK_ANALOG |
The clock type:
C type | Pt type | Default |
---|---|---|
PtCallback_t * | Link | NULL |
A list of PtCallback_t structures that define the callbacks invoked when the time on the clock changes. This occurs once a second if Pt_CLOCK_SHOW_SECONDS is set, otherwise once every minute when the minute changes.
If the widget has the Pt_CALLBACKS_ACTIVE bit set in its Pt_ARG_FLAGS resource, these callbacks are also invoked when your application changes the time by calling PtSetResource() or PtSetResources().
Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
These callbacks should return Pt_CONTINUE.
If the widget modifies an inherited resource, the "Default override" column indicates the new value. This modification affects any subclasses of the widget.