Toc Gallery Index Tree Gtk.Calendar

Screenshot

No screeshot

Hierarchy

Description

Gtk_Calendar is a widget that displays a calendar, one month at a time. It can be created with Gtk_New.

The month and year currently displayed can be altered with Select_Month. The exact day can be selected from the displayed month using Select_Day.

The way in which the calendar itself is displayed can be altered using Display_Options.

The selected date can be retrieved from a Gtk_Calendar using Get_Date.

If performing many 'mark' operations, the calendar can be frozen to prevent flicker, using Freeze, and 'thawed' again using Thaw.

Types

  • type Gtk_Calendar is access all Gtk_Calendar_Record'Class;
  • type Gtk_Calendar_Display_Options is mod 2 ** 8;
  • type Gtk_Calendar_Record is new Gtk.Widget.Gtk_Widget_Record with private;

Subprograms

  • procedure Gtk_New (Widget : out Gtk_Calendar);
    Create a new Calendar that points to the current date.
  • procedure Initialize (Widget : access Gtk_Calendar_Record'Class);
    Internal initialization function. See the section "Creating your own widgets" in the documentation.
  • function Get_Type return Gtk.Gtk_Type;
    Return the internal value associated with a Gtk_Calendar.
  • function Select_Month (Calendar : access Gtk_Calendar_Record; Month : Guint; Year : Guint) return Boolean;
    Shift the calendar to a different month/year. Return True if sucessful.
  • procedure Select_Day (Calendar : access Gtk_Calendar_Record; Day : Guint);
    Select a day from the current month. Only one day can be selected at a time.
  • function Mark_Day (Calendar : access Gtk_Calendar_Record; Day : Guint) return Boolean;
    Set a specified Day as marked in the Calendar. This is shown visually as a painted box around the Day. Note that several days can be marked. Return True if successful.
  • function Unmark_Day (Calendar : access Gtk_Calendar_Record; Day : Guint) return Boolean;
    Undo the marking of Day. Return True if sucessful.
  • procedure Clear_Marks (Calendar : access Gtk_Calendar_Record);
    Clear all the marks set by Mark_Day.
  • procedure Get_Date (Calendar : access Gtk_Calendar_Record; Year : out Guint; Month : out Guint; Day : out Guint);
    Return the date currently selected.
  • procedure Set_Display_Options (Calendar : access Gtk_Calendar_Record; Flags : Gtk_Calendar_Display_Options);
    function Get_Display_Options (Calendar : access Gtk_Calendar_Record) return Gtk_Calendar_Display_Options;
    Sets display options (whether to display the heading and the month headings).

Signals

  • day_selected
    procedure Handler (Calendar : access Gtk_Calendar_Record'Class);
    Emitted when the user selects a day on a calendar.
  • day_selected_double_click
    procedure Handler (Calendar : access Gtk_Calendar_Record'Class);
    Emitted when the user double clicks a day on a calendar.
  • month_changed
    procedure Handler (Calendar : access Gtk_Calendar_Record'Class);
    Emitted when the user clicks a button to change the selected month on calendar.
  • next_month
    procedure Handler (Calendar : access Gtk_Calendar_Record'Class);
    Emitted when the user selects the next month on a calendar.
  • next_year
    procedure Handler (Calendar : access Gtk_Calendar_Record'Class);
    Emitted when the user selects the next year on a calendar.
  • prev_month
    procedure Handler (Calendar : access Gtk_Calendar_Record'Class);
    Emitted when the user selects the previous month on a calendar.
  • prev_year
    procedure Handler (Calendar : access Gtk_Calendar_Record'Class);
    Emitted when the user selects the previous year on a calendar.

Properties

  • Day_Property
    Int
    The selected day (as a number between 1 and 31, or 0 to unselect
  • Month_Property
    Int
    The selected month (as a number between 0 and 11)
  • No_Month_Change_Property
    Boolean
    If TRUE, the selected month cannot be changed
  • Show_Day_Names_Property
    Boolean
    If TRUE, day names are displayed
  • Show_Heading_Property
    Boolean
    If TRUE, a heading is displayed
  • Show_Week_Numbers_Property
    Boolean
    If TRUE, week numbers are displayed
  • Year_Property
    Int
    The selected year

Testgtk source code

This code is part of testgtk, a demo application packaged with GtkAda. Testgtk demonstrates the various widgets of GtkAda
----------------------------------------------------------------------- -- GtkAda - Ada95 binding for the Gimp Toolkit -- -- -- -- Copyright (C) 1998-1999 -- -- Emmanuel Briot, Joel Brobecker and Arnaud Charlet -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public -- -- License as published by the Free Software Foundation; either -- -- version 2 of the License, or (at your option) any later version. -- -- -- -- This library is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. -- -- -- -- You should have received a copy of the GNU General Public -- -- License along with this library; if not, write to the -- -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- -- Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- ----------------------------------------------------------------------- with Glib; use Glib; with Gtk.Box; use Gtk.Box; with Gtk.Calendar; use Gtk.Calendar; with Gtk.Frame; use Gtk.Frame; with Gtk; use Gtk; package body Create_Calendar is ---------- -- Help -- ---------- function Help return String is begin return "A @bGtk_Calendar@B is a simple way to interactively select" & " a date. A callback can be set for every change to the date," & " for instance the date, the month,..."; end Help; --------- -- Run -- --------- procedure Run (Frame : access Gtk.Frame.Gtk_Frame_Record'Class) is Box1 : Gtk_Box; Calendar : Gtk_Calendar; begin Set_Label (Frame, "Calendar"); Gtk_New_Vbox (Box1, Homogeneous => False, Spacing => 0); Add (Frame, Box1); Show (Box1); Gtk_New (Calendar); Pack_Start (Box1, Calendar, False, False, 0); Show (Calendar); end Run; end Create_Calendar;

Alphabetical Index