PtCalendar

A calendar

Class hierarchy:

PtWidgetPtBasicPtCalendar

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

PhAB icon:

PtCalendar button in PhAB

Public header:

<photon/PtCalendar.h>

Description:

PtCalendar draws a calendar showing the day of the week, month and year. You can interactively change the date and browse other months and years. The calendar is drawn on a per-month basis and can be drawn with or without a grid.


PtCalendar


A PtCalendar widget.

New resources:

Resource C type Pt type Default
Pt_ARG_CALENDAR_COLOR1 PgColor_t Scalar Pg_BLACK
Pt_ARG_CALENDAR_COLOR2 PgColor_t Scalar Pg_DGREY
Pt_ARG_CALENDAR_COLOR3 PgColor_t Scalar Pg_BLACK
Pt_ARG_CALENDAR_COLOR4 PgColor_t Scalar Pg_BLACK
Pt_ARG_CALENDAR_COLOR5 PgColor_t Scalar Pg_BLUE
Pt_ARG_CALENDAR_DATE PtCalendarDate_t Struct Current date
Pt_ARG_CALENDAR_FLAGS unsigned long Flag See below.
Pt_ARG_CALENDAR_FONT1 char * String "TextFont09"
Pt_ARG_CALENDAR_FONT2 char * String "TextFont09i"
Pt_ARG_CALENDAR_FONT3 char * String "TextFont09"
Pt_ARG_CALENDAR_FONT4 char * String "TextFont09b"
Pt_ARG_CALENDAR_FONT5 char * String "TextFont09b"
Pt_ARG_CALENDAR_HIGHLIGHT unsigned long Flag 0
Pt_ARG_CALENDAR_MONTH_BTN_COLOR PgColor_t Scalar Pg_GREY
Pt_ARG_CALENDAR_MONTH_NAMES char *, short Array See below.
Pt_ARG_CALENDAR_SEL_COLOR PgColor_t Scalar Pg_YELLOW
Pt_ARG_CALENDAR_TIME_T time_t Scalar Current date
Pt_ARG_CALENDAR_WDAY_NAMES char *, short Array See below.
Pt_ARG_CALENDAR_YEAR_BTN_COLOR PgColor_t Scalar Pg_GREY
Pt_CB_CALENDAR_SELECT PtCallback_t * Link NULL

Pt_ARG_CALENDAR_COLOR1

C type Pt type Default
PgColor_t Scalar Pg_BLACK

The color used to display the current month's days. See PgColor_t in the Photon Library Reference.

Pt_ARG_CALENDAR_COLOR2

C type Pt type Default
PgColor_t Scalar Pg_DGREY

The color used to display the next and previous month's days. See PgColor_t in the Photon Library Reference.

Pt_ARG_CALENDAR_COLOR3

C type Pt type Default
PgColor_t Scalar Pg_BLACK

The color used for the year and month name. See PgColor_t in the Photon Library Reference.

Pt_ARG_CALENDAR_COLOR4

C type Pt type Default
PgColor_t Scalar Pg_BLACK

The color used for any highlighted days in the calendar (see Pt_ARG_CALENDAR_HIGHLIGHT).

Pt_ARG_CALENDAR_COLOR5

C type Pt type Default
PgColor_t Scalar Pg_BLUE

The color used for the names of the days of the week (see Pt_ARG_CALENDAR_WDAY_NAMES). See PgColor_t in the Photon Library Reference.

Pt_ARG_CALENDAR_DATE

C type Pt type Default
PtCalendarDate_t Struct Current date

The current date shown on the calendar.


Note: You might find it easier to use Pt_ARG_CALENDAR_TIME_T instead of Pt_ARG_CALENDAR_DATE. They both specify the date, but Pt_ARG_CALENDAR_DATE uses a custom data structure.

You can't set either of these resources in PhAB.


This date is stored in a PtCalendarDate_t structure that contains:

Pt_ARG_CALENDAR_FLAGS

C type Pt type Default
unsigned long Flag Pt_CALENDAR_YEAR_BTNS | Pt_CALENDAR_MONTH_BTNS | Pt_CALENDAR_SHOW_PREV | Pt_CALENDAR_SHOW_NEXT | Pt_CALENDAR_SHOW_GRID

Calendar-specific flags. This can be a combination of:

Pt_CALENDAR_YEAR_BTNS
Show the next/previous year buttons.
Pt_CALENDAR_MONTH_BTNS
Show the next/previous month buttons.
Pt_CALENDAR_SHOW_PREV
Show the last few days of the previous month.
Pt_CALENDAR_SHOW_NEXT
Show the first few days of the following month.
Pt_CALENDAR_SHOW_GRID
Show the calendar in a grid format with lines separating the days.

Pt_ARG_CALENDAR_FONT1

C type Pt type Default
char * String "TextFont09"

The font used for the current month's days.

Pt_ARG_CALENDAR_FONT2

C type Pt type Default
char * String "TextFont09i"

The font used for the next and previous month's days.

Pt_ARG_CALENDAR_FONT3

C type Pt type Default
char * String "TextFont09"

The font used for the year and month name.

Pt_ARG_CALENDAR_FONT4

C type Pt type Default
char * String "TextFont09b"

The font used for any highlighted days in the calendar (see Pt_ARG_CALENDAR_HIGHLIGHT).

Pt_ARG_CALENDAR_FONT5

C type Pt type Default
char * String "TextFont09b"

The font used for the names of the days of the week (see Pt_ARG_CALENDAR_WDAY_NAMES).

Pt_ARG_CALENDAR_HIGHLIGHT

C type Pt type Default
unsigned long Flag 0

A set of up to 32 bits that specify the days of the current month to highlight. For example, 0x1 means that day 1 is highlighted and 0x3 means that days 1 and 2 are highlighted.

The highlighted days are displayed using the values of Pt_ARG_CALENDAR_COLOR4 and Pt_ARG_CALENDAR_FONT4.


Note: You can't edit Pt_ARG_CALENDAR_HIGHLIGHT in PhAB.

Pt_ARG_CALENDAR_MONTH_BTN_COLOR

C type Pt type Default
PgColor_t Scalar Pg_GREY

The color used for the buttons for moving to the next and previous months. See PgColor_t in the Photon Library Reference.

Pt_ARG_CALENDAR_MONTH_NAMES

C type Pt type Default
char *, short Array See below

An array of names to be used for the months of the year. By default these values are:

Element Value
0 January
1 February
2 March
3 April
4 May
5 June
6 July
7 August
8 September
9 October
10 November
11 December

The array should contain 12 elements. If you set more, the extras are discarded. If you set fewer, the above elements are used for the missing ones.


Note: You can't edit Pt_ARG_CALENDAR_MONTH_NAMES in PhAB.

Pt_ARG_CALENDAR_SEL_COLOR

C type Pt type Default
PgColor_t Scalar Pg_YELLOW

The color of the currently selected day of the month. See PgColor_t in the Photon Library Reference.

Pt_ARG_CALENDAR_TIME_T

C type Pt type Default
time_t Scalar Current date

The current date shown on the calendar. This date is stored in a time_t structure.


Note: You can't edit Pt_ARG_CALENDAR_TIME_T in PhAB.

Pt_ARG_CALENDAR_WDAY_NAMES

C type Pt type Default
char *, short Array See below.

An array of names to be used for the days of the week. By default these values are:

Element Value
0 Su
1 Mo
2 Tu
3 We
4 Th
5 Fr
6 Sa

The array should contain 7 elements. If you set more, the extras are discarded. If you set fewer, the above elements are used for the missing ones.


Note: You can't edit Pt_ARG_CALENDAR_WDAY_NAMES in PhAB.

Pt_ARG_CALENDAR_YEAR_BTN_COLOR

C type Pt type Default
PgColor_t Scalar Pg_GREY

The color used for the buttons for moving to next and previous years. See PgColor_t in the Photon Library Reference.

Pt_CB_CALENDAR_SELECT

C type Pt type Default
PtCallback_t * Link NULL

A list of PtCallback_t structures that define the callbacks invoked when a date is selected. Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:

reason
Pt_CB_CALENDAR_SELECT
reason_subtype
0 (not used).
event
A pointer to a PhEvent_t structure that describes the event that caused the callback to be invoked.
cbdata
A pointer to a PtCalendarSelectCallback_t structure.

The PtCalendarSelectCallback_t structure contains at least:

int type
The type of selection made:
PtCalendarDate_t date
The selected date. This structure contains at least:
time_t time
The selected date, represented as a time_t.

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_ANCHOR_FLAGS PtWidget
Pt_ARG_ANCHOR_OFFSETS PtWidget
Pt_ARG_AREA PtWidget
Pt_ARG_BANDWIDTH_THRESHOLD PtBasic Not used by this class.
Pt_ARG_BASIC_FLAGS PtBasic
Pt_ARG_BEVEL_WIDTH PtWidget
Pt_ARG_BITMAP_CURSOR PtWidget
Pt_ARG_BEVEL_COLOR PtBasic
Pt_ARG_BEVEL_CONTRAST PtBasic
Pt_ARG_COLOR PtBasic
Pt_ARG_CONTRAST PtBasic
Pt_ARG_CURSOR_COLOR PtWidget
Pt_ARG_CURSOR_TYPE PtWidget
Pt_ARG_DARK_BEVEL_COLOR PtBasic
Pt_ARG_DARK_FILL_COLOR PtBasic
Pt_ARG_DATA PtWidget
Pt_ARG_DIM PtWidget
Pt_ARG_EFLAGS PtWidget
Pt_ARG_EXTENT PtWidget
Pt_ARG_FILL_COLOR PtBasic Pg_TRANSPARENT
Pt_ARG_FILL_PATTERN PtBasic
Pt_ARG_FLAGS PtWidget
Pt_ARG_GRID_LAYOUT_DATA PtWidget
Pt_ARG_HEIGHT PtWidget
Pt_ARG_HELP_TOPIC PtWidget
Pt_ARG_HIGHLIGHT_ROUNDNESS PtBasic
Pt_ARG_INLINE_COLOR PtBasic
Pt_ARG_LAYOUT_DATA PtWidget
Pt_ARG_LIGHT_BEVEL_COLOR PtBasic
Pt_ARG_LIGHT_FILL_COLOR PtBasic
Pt_ARG_MARGIN_HEIGHT PtBasic 2
Pt_ARG_MARGIN_WIDTH PtBasic 2
Pt_ARG_MAXIMUM_DIM PtWidget
Pt_ARG_MINIMUM_DIM PtWidget
Pt_ARG_OUTLINE_COLOR PtBasic
Pt_ARG_POINTER PtWidget
Pt_ARG_POS PtWidget
Pt_ARG_RESIZE_FLAGS PtWidget Pt_RESIZE_XY_AS_REQUIRED
Pt_ARG_ROW_LAYOUT_DATA PtWidget
Pt_ARG_STYLE PtBasic
Pt_ARG_TRANS_PATTERN PtBasic
Pt_ARG_USER_DATA PtWidget
Pt_ARG_WIDTH PtWidget
Pt_CB_ACTIVATE PtBasic
Pt_CB_ARM PtBasic
Pt_CB_BLOCKED PtWidget
Pt_CB_DESTROYED PtWidget
Pt_CB_DISARM PtBasic
Pt_CB_DND PtWidget
Pt_CB_FILTER PtWidget
Pt_CB_GOT_FOCUS PtBasic
Pt_CB_HOTKEY PtWidget
Pt_CB_IS_DESTROYED PtWidget
Pt_CB_LOST_FOCUS PtBasic
Pt_CB_MENU PtBasic
Pt_CB_OUTBOUND PtWidget
Pt_CB_RAW PtWidget
Pt_CB_REALIZED PtWidget
Pt_CB_REPEAT PtBasic
Pt_CB_UNREALIZED PtWidget