PtClock

PtClock — A clock with analog, digital or LED-style format.

Synopsis

class PtClock PtBasic
{
    clock_face_color;            // color  (Pt_ARG_CLOCK_FACE_COLOR)    
    clock_face_outline_color;    // color  (Pt_ARG_CLOCK_FACE_OUTLINE_COLOR)    
    clock_flags;                 // flag  (Pt_ARG_CLOCK_FLAGS)    
    clock_font;                  // string  (Pt_ARG_CLOCK_FONT)    
    clock_hour;                  // short  (Pt_ARG_CLOCK_HOUR)    
    clock_hour_color;            // color  (Pt_ARG_CLOCK_HOUR_COLOR)    
    clock_hour_offset;           // short  (Pt_ARG_CLOCK_HOUR_OFFSET)    
    clock_minute;                // short  (Pt_ARG_CLOCK_MINUTE)    
    clock_minute_color;          // color  (Pt_ARG_CLOCK_MINUTE_COLOR)    
    clock_minute_offset;         // short  (Pt_ARG_CLOCK_MINUTE_OFFSET)    
    clock_second;                // short  (Pt_ARG_CLOCK_SECOND)    
    clock_second_color;          // color  (Pt_ARG_CLOCK_SECOND_COLOR)    
    clock_second_offset;         // short  (Pt_ARG_CLOCK_SECOND_OFFSET)    
    clock_sep1;                  // string  (Pt_ARG_CLOCK_SEP1)    
    clock_sep1_color;            // color  (Pt_ARG_CLOCK_SEP1_COLOR)    
    clock_sep2;                  // string  (Pt_ARG_CLOCK_SEP2)    
    clock_sep2_color;            // color  (Pt_ARG_CLOCK_SEP2_COLOR)    
    clock_type;                  // short  (Pt_ARG_CLOCK_TYPE)    
}
		

Base Classes

PtWidget <-- PtBasic <-- PtClock

Description

This widget displays a clock in one of three types: analog (with a dial and hands), digital, or LED format. The display is good for general time-keeping but is not very precise. It is updated about every second, and is prone to flickering. You can minimize this annoyance by not using a transparent fill color, by disabling the seconds, and/or by putting the clock in a PtContainer widget.

[Note]

For detailed information, please refer to PtClock in the Photon documentation.

Instance Variables

clock_face_color

An integer specifying the color of an analog clock face. Default is 0xffffff (white).

clock_face_outline_color

An integer specifying the color of the line around an analog clock face. Default is 0x0 (black).

clock_flags

Flags that define the clock's appearance and behavior. The default is PtCLOCK_TRACK_TIME | Pt_CLOCK_SHOW_SECONDS | Pt_CLOCK_SHOW_NUMBERS.

This instance variable may be a combination of zero or more of the following flags:

ConstantDescription
Pt_CLOCK_TRACK_TIMEUpdates the clock to current time, by the second.
Pt_CLOCK_SHOW_SECONDSShows the seconds of the time.
Pt_CLOCK_24_HOURMakes a 24-hour display, instead of 12-hour.
Pt_CLOCK_SHOW_NUMBERSSets an analog clock to display numbers instead of hands.
Pt_CLOCK_SHOW_AMPMAdds an AM/PM display to digital and LED clocks.
Pt_CLOCK_PAD_HOURSAdds a leading zero to one-digit hour displays in digital and LED clocks.

clock_font

A string specifying the font for numbers on analog clocks, and for the whole display for digital clocks.

clock_hour, clock_minute, clock_second

An integer indicating the current hour, minute, or second setting of the clock, in 24-hour format. The default for each of these is Pt_CLOCK_CURRENT, which sets to system time when the widget is realized.

clock_hour_color, clock_minute_color, clock_second_color

An integer specifying the color for the hour, minute, or second display. The defaults are 0x0 (black), 0x0 , and 0xff0000 (red) respectively.

clock_hour_offset, clock_minute_offset, clock_second_offset

An integer specifying the number of hours, minutes, or seconds to offset the respective field in the display, if desired.

clock_sep1, clock_sep1_color

A string and a number specifying the character and color of the separator between the hours and the minutes on a digital clock. The defaults are 0x0 (black) and ":".

clock_sep2, clock_sep2_color

A string and a number specifying the character and color of the separator between the minutes and the seconds on a digital clock. The defaults are 0x0 (black) and ":".

clock_type

This instance variable specifies the type of clock, and may have one of the following values:

ConstantDescription
Pt_CLOCK_DIGITALThe clock has a digital display that uses system fonts.
Pt_CLOCK_ANALOGThe clock has an analog display: a dial with hands.
Pt_CLOCK_LEDThe clock has a display similar to an LED or LCD clock, which can be scaled.

Callbacks

The following callback is associated with this widget:

CallbackDescription
Pt_CB_CLOCK_TIME_CHANGEDThis callback is generated when the time on the clock changes.

Associated Classes

PtClockTimeCallback, PtCallbackInfo