PtCalendar

Gamma/Photon: Using Gamma™ with the Photon microGUIŽ, Version 4.0
Prev |  | Next

# `PtCalendar`

`PtCalendar` -- A month-based calendar.

## Synopsis

    class PtCalendar PtBasic
    {
        calendar_color1;             // color  (Pt_ARG_CALENDAR_COLOR1)
        calendar_color2;             // color  (Pt_ARG_CALENDAR_COLOR2)
        calendar_color3;             // color  (Pt_ARG_CALENDAR_COLOR3)
        calendar_color4;             // color  (Pt_ARG_CALENDAR_COLOR4)
        calendar_color5;             // color  (Pt_ARG_CALENDAR_COLOR5)
        calendar_date;               // long  (Pt_ARG_CALENDAR_DATE)
        calendar_flags;              // flag  (Pt_ARG_CALENDAR_FLAGS)
        calendar_font1;              // string  (Pt_ARG_CALENDAR_FONT1)
        calendar_font2;              // string  (Pt_ARG_CALENDAR_FONT2)
        calendar_font3;              // string  (Pt_ARG_CALENDAR_FONT3)
        calendar_font4;              // string  (Pt_ARG_CALENDAR_FONT4)
        calendar_font5;              // string  (Pt_ARG_CALENDAR_FONT5)
        calendar_highlight;          // long  (Pt_ARG_CALENDAR_HIGHLIGHT)
        calendar_month_btn_color;    // color  (Pt_ARG_CALENDAR_MONTH_BTN_COLOR)
        calendar_month_names;        // string array  (Pt_ARG_CALENDAR_MONTH_NAMES)
        calendar_sel_color;          // color  (Pt_ARG_CALENDAR_SEL_COLOR)
        calendar_time_t;             // long  (Pt_ARG_CALENDAR_TIME_T)
        calendar_wday_names;         // string array  (Pt_ARG_CALENDAR_WDAY_NAMES)
        calendar_year_btn_color;     // color  (Pt_ARG_CALENDAR_YEAR_BTN_COLOR)
    }

## Base Classes

`PtWidget` <-- `PtBasic` <-- `PtCalendar`

## Description

This widget is a 6-line calendar that displays the days of the week for one month, and the year. You can control various aspects of the display, such as date colors, button colors, fonts, and name displays.

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

## Instance Variables

calendar_color1

  A number specifying the display color for the numerals of the days of the current month. Default is `0x000000` (black).

calendar_color2

  A number specifying the display color for the numerals of the days of the next and previous months. Default is `0x606060` (dark grey).

calendar_color3

  A number specifying the display color for the year and month name characters. Default is `0x000000` (black).

calendar_color4

  A number specifying the display color for highlighted days. Default is `0x000000` (black).

calendar_color5

  A number specifying the display color of the characters in the names of the days of the week. Default is `0x0000ff` (blue).

calendar_date

  A `PtCalendarDate` date designated as the current date.

calendar_flags

  Flags specifying display options, such as buttons for accessing previous and next years, months, and days, and a grid that separates the days and weeks.

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

  Constant | Description
  --- | ---
  `Pt_CALENDAR_YEAR_BTNS` | Show the buttons for the next and previous years. Default is ON.
  `Pt_CALENDAR_MONTH_BTNS` | Show the buttons for the next and previous months. Default is ON.
  `Pt_CALENDAR_SHOW_PREV` | Show the final days of the previous month. Default is ON.
  `Pt_CALENDAR_SHOW_NEXT` | Show the first days of the next month. Default is ON.
  `Pt_CALENDAR_SHOW_GRID` | Show the calendar as a grid, one block per day. Default is ON.

calendar_font1

  A string specifying the font to use for the days of the current month. The default is "lu12".

calendar_font2

  A string specifying the font to use for the days of the next and previous month. The default is "lu12i".

calendar_font3

  A string specifying the font to use for the year, and for the month names. The default is "lu12b".

calendar_font4

  A string specifying the font to use for highlighted days. The default is "lu12b".

calendar_font5

  A string specifying the font to use for the names of the days of the week. The default is "helv12b".

calendar_highlight

  An integer specifying highlighted days. Default is `0`.

calendar_month_btn_color

  An integer specifying the color of the previous/next month buttons. Default is `0xc0c0c0` (grey).

calendar_month_names

  A write-only array of exactly 12 elements (strings) that are the names of the months. Assigning a new array will replace the existing values. If the new array has fewer than 12 elements, missing elements will be supplied by the existing array. If the new array has more than 12 elements, the extra elements will not be used.

calendar_sel_color

  An integer specifying the color of the selected date. Default is `0xffff00` (yellow).

calendar_time_t

  A number specifying the current date on the calendar.

calendar_wday_names

  A write-only array of exactly 7 elements:

  [Su Mo Tu We Th Fr Sa]

  that abbreviate the names of the days of the week. Assigning a new array will replace the existing values. If the new array has fewer than 7 elements, the missing elements will be supplied by the existing array. If the new array has more than 7 elements, the extra elements will not be used.

calendar_year_btn_color

  An integer specifying the color of the previous/next year buttons. Default is `0xc0c0c0` (grey).

## Callbacks

The following callback is associated with this widget:

Callback | Description
--- | ---
`Pt_CB_CALENDAR_SELECT` | This callback is generated when a date is selected.

## Associated Classes

`PtCalendarDate`, `PtCalendarSelectCallback`, `PtCallbackInfo`

## Example

This example, `ex_PtCalendar.g`, is included in the `gamma_ph_`#`_examples_1_QNX4.tgz` file available on the Cogent Web Site.

    #!/usr/cogent/bin/phgamma

    /*
     * This example demonstrates a customized PtCalendar.
     */

    require_lisp("PhotonWidgets.lsp");
    PtInit(nil);

    win = new(PtWindow);
    cal = new(PtCalendar);

    cal.SetDim(350,200);
    cal.fill_color = 0xffddcc;
    cal.calendar_font1 = "lu12b";
    cal.calendar_color3 = 0x0000ff;
    cal.calendar_color5 = 0xbb00bb;
    cal.calendar_flags = cons(Pt_CALENDAR_SHOW_GRID,nil);
    cal.calendar_month_btn_color = 0xff0000;
    cal.calendar_sel_color = 0xffff00;
    cal.calendar_wday_names = array("Sun","Mon","Tues","Wed","Thurs","Fri","Sat");

    PtRealizeWidget(win);
    PtMainLoop();

Prev | Home | Next
`PtButton` | Up | `PtClock`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.