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

PtCalendar

A calendar

Class hierarchy:

PtWidget --> PtBasic --> PtCalendar

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. The user 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 ulong_t Flag See below.
Pt_ARG_CALENDAR_FONT1 char * String "lu12"
Pt_ARG_CALENDAR_FONT2 char * String "lu12i"
Pt_ARG_CALENDAR_FONT3 char * String "helv12"
Pt_ARG_CALENDAR_FONT4 char * String "lu12b"
Pt_ARG_CALENDAR_FONT5 char * String "helv12b"
Pt_ARG_CALENDAR_HIGHLIGHT ulong_t Scalar 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 Struct 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.

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.

Pt_ARG_CALENDAR_COLOR3

C type Pt type Default
PgColor_t Scalar Pg_BLACK

The color used for the year and month name.

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).

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
ulong_t 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 "lu12"

The font used for the current month's days.

Pt_ARG_CALENDAR_FONT2

C type Pt type Default
char * String "lu12i"

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

Pt_ARG_CALENDAR_FONT3

C type Pt type Default
char * String "helv12"

The font used for the year and month name.

Pt_ARG_CALENDAR_FONT4

C type Pt type Default
char * String "lu12b"

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 "helv12b"

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
ulong_t Scalar 0

A long used to set bits that represent 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 used for moving to the next and previous months.

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.

Pt_ARG_CALENDAR_TIME_T

C type Pt type Default
time_t Struct 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 used for moving to next and previous years.

Pt_CB_CALENDAR_SELECT

C type Pt type Default
PtCallback_t * Link NULL

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

reason
The name of the callback resource (Pt_CB_CALENDAR_SELECT) that caused this callback to be invoked.
reason_subtype
0 (not used).
event
The event that caused the callback.
cbdata
A pointer to a PtCalenderSelectCallback_t structure.

The PtCalenderSelectCallback_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_AREA PtWidget
Pt_ARG_BANDWIDTH_THRESHOLD PtBasic Not used by this class.
Pt_ARG_BITMAP_CURSOR PtWidget
Pt_ARG_BORDER_WIDTH PtWidget
Pt_ARG_BOT_BORDER_COLOR PtBasic
Pt_ARG_COLOR PtBasic
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 Pg_TRANSPARENT
Pt_ARG_FILL_PATTERN PtBasic
Pt_ARG_FLAGS PtWidget
Pt_ARG_HELP_TOPIC PtWidget
Pt_ARG_HIGHLIGHT_ROUNDNESS PtBasic
Pt_ARG_MARGIN_HEIGHT PtBasic 2
Pt_ARG_MARGIN_WIDTH PtBasic 2
Pt_ARG_POS PtWidget
Pt_ARG_RESIZE_FLAGS PtWidget Pt_RESIZE_XY_AS_REQUIRED
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]