Gtk.Calendar

Entities

Simple Types

Tagged Types

Access Types

Constants

Subprograms

Generic Instantiations

Description

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

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

To place a visual marker on a particular day, use Gtk.Calendar.Mark_Day and to remove the marker, Gtk.Calendar.Unmark_Day. Alternative, all marks can be cleared with Gtk.Calendar.Clear_Marks.

The way in which the calendar itself is displayed can be altered using Gtk.Calendar.Set_Display_Options.

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

Users should be aware that, although the Gregorian calendar is the legal calendar in most countries, it was adopted progressively between 1582 and 1929. Display before these dates is likely to be historically incorrect.

<screenshot>gtk-calendar</screenshot> <group>Selectors</group> <testgtk>create_calendar.adb</testgtk>

"+"

function "+"
  (Widget : access Gtk_Calendar_Record'Class)
return Gtk.Buildable.Gtk_Buildable
Parameters
Widget
Return Value

"-"

function "-"
  (Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Calendar
Parameters
Interf
Return Value

Cb_GObject_Void

type Cb_GObject_Void is not null access procedure
  (Self : access Glib.Object.GObject_Record'Class);
Parameters
Self

Cb_Gtk_Calendar_Void

type Cb_Gtk_Calendar_Void is not null access procedure (Self : access Gtk_Calendar_Record'Class);
Parameters
Self

Clear_Marks

procedure Clear_Marks (Calendar : not null access Gtk_Calendar_Record)

Remove all visual markers.

Parameters
Calendar

Day_Property

Day_Property : constant Glib.Properties.Property_Int;

The selected day (as a number between 1 and 31, or 0 to unselect the currently selected day). This property gets initially set to the current day.

Detail_Height_Rows_Property

Detail_Height_Rows_Property : constant Glib.Properties.Property_Int;

Height of a detail cell, in rows. A value of 0 allows any width. See Gtk.Calendar.Set_Detail_Func.

Detail_Width_Chars_Property

Detail_Width_Chars_Property : constant Glib.Properties.Property_Int;

Width of a detail cell, in characters. A value of 0 allows any width. See Gtk.Calendar.Set_Detail_Func.

Get_Date

procedure Get_Date
   (Calendar : not null access Gtk_Calendar_Record;
    Year     : out Guint;
    Month    : out Guint;
    Day      : out Guint)

Obtains the selected date from a Gtk.Calendar.Gtk_Calendar.

Parameters
Calendar
Year

location to store the year as a decimal number (e.g. 2011), or null

Month

location to store the month number (between 0 and 11), or null

Day

location to store the day number (between 1 and 31), or null

Get_Day_Is_Marked

function Get_Day_Is_Marked
   (Calendar : not null access Gtk_Calendar_Record;
    Day      : Guint) return Boolean

Returns if the Day of the Calendar is already marked. Since: gtk+ 3.0

Parameters
Calendar
Day

the day number between 1 and 31.

Return Value

whether the day is marked.

Get_Detail_Height_Rows

function Get_Detail_Height_Rows
   (Calendar : not null access Gtk_Calendar_Record) return Glib.Gint

Queries the height of detail cells, in rows. See Gtk.Calendar.Gtk_Calendar:detail-width-chars. Since: gtk+ 2.14

Parameters
Calendar
Return Value

The height of detail cells, in rows.

Get_Detail_Width_Chars

function Get_Detail_Width_Chars
   (Calendar : not null access Gtk_Calendar_Record) return Glib.Gint

Queries the width of detail cells, in characters. See Gtk.Calendar.Gtk_Calendar:detail-width-chars. Since: gtk+ 2.14

Parameters
Calendar
Return Value

The width of detail cells, in characters.

Get_Display_Options

function Get_Display_Options
   (Calendar : not null access Gtk_Calendar_Record)
    return Gtk_Calendar_Display_Options

Returns the current display options of Calendar. Since: gtk+ 2.4

Parameters
Calendar
Return Value

the display options.

Get_Type

function Get_Type return Glib.GType
Return Value

Gtk_Calendar

type Gtk_Calendar is access all Gtk_Calendar_Record'Class;

Gtk_Calendar_Detail_Func

type Gtk_Calendar_Detail_Func is access function
  (Calendar : not null access Gtk_Calendar_Record'Class;
   Year     : Guint;
   Month    : Guint;
   Day      : Guint) return UTF8_String;

This kind of functions provide Pango markup with detail information for the specified day. Examples for such details are holidays or appointments. The function returns null when no information is available. Since: gtk+ 2.14

Parameters
Calendar

a Gtk.Calendar.Gtk_Calendar.

Year

the year for which details are needed.

Month

the month for which details are needed.

Day

the day of Month for which details are needed.

Return Value

Newly allocated string with Pango markup with details for the specified day or null.

Gtk_Calendar_Display_Options

type Gtk_Calendar_Display_Options is mod 2 ** Integer'Size;

These options can be used to influence the display and behaviour of a Gtk.Calendar.Gtk_Calendar.

Gtk_Calendar_Display_Options_Properties

package Gtk_Calendar_Display_Options_Properties is
   new Generic_Internal_Discrete_Property (Gtk_Calendar_Display_Options);

Gtk_Calendar_New

function Gtk_Calendar_New return Gtk_Calendar

Creates a new calendar, with the current date being selected.

Return Value

Gtk_Calendar_Record

type Gtk_Calendar_Record is new Gtk_Widget_Record with null record;

Gtk_New

procedure Gtk_New (Calendar : out Gtk_Calendar)

Creates a new calendar, with the current date being selected. Initialize does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Calendar

Implements_Gtk_Buildable

package Implements_Gtk_Buildable is new Glib.Types.Implements
  (Gtk.Buildable.Gtk_Buildable, Gtk_Calendar_Record, Gtk_Calendar);

Initialize

procedure Initialize
   (Calendar : not null access Gtk_Calendar_Record'Class)

Creates a new calendar, with the current date being selected. Initialize does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Calendar

Mark_Day

procedure Mark_Day
   (Calendar : not null access Gtk_Calendar_Record;
    Day      : Guint)

Places a visual marker on a particular day.

Parameters
Calendar
Day

the day number to mark between 1 and 31.

Month_Property

Month_Property : constant Glib.Properties.Property_Int;

The selected month (as a number between 0 and 11). This property gets initially set to the current month.

No_Month_Change

No_Month_Change : constant Gtk_Calendar_Display_Options := 4;

No_Month_Change_Property

No_Month_Change_Property : constant Glib.Properties.Property_Boolean;

Determines whether the selected month can be changed.

On_Day_Selected

procedure On_Day_Selected
   (Self  : not null access Gtk_Calendar_Record;
    Call  : Cb_GObject_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

Emitted when the user selects a day.

Parameters
Self
Call
Slot
After

On_Day_Selected

procedure On_Day_Selected
   (Self  : not null access Gtk_Calendar_Record;
    Call  : Cb_Gtk_Calendar_Void;
    After : Boolean := False)

Emitted when the user selects a day.

Parameters
Self
Call
After

On_Day_Selected_Double_Click

procedure On_Day_Selected_Double_Click
   (Self  : not null access Gtk_Calendar_Record;
    Call  : Cb_GObject_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

Emitted when the user double-clicks a day.

Parameters
Self
Call
Slot
After

On_Day_Selected_Double_Click

procedure On_Day_Selected_Double_Click
   (Self  : not null access Gtk_Calendar_Record;
    Call  : Cb_Gtk_Calendar_Void;
    After : Boolean := False)

Emitted when the user double-clicks a day.

Parameters
Self
Call
After

On_Month_Changed

procedure On_Month_Changed
   (Self  : not null access Gtk_Calendar_Record;
    Call  : Cb_GObject_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

Emitted when the user clicks a button to change the selected month on a calendar.

Parameters
Self
Call
Slot
After

On_Month_Changed

procedure On_Month_Changed
   (Self  : not null access Gtk_Calendar_Record;
    Call  : Cb_Gtk_Calendar_Void;
    After : Boolean := False)

Emitted when the user clicks a button to change the selected month on a calendar.

Parameters
Self
Call
After

On_Next_Month

procedure On_Next_Month
   (Self  : not null access Gtk_Calendar_Record;
    Call  : Cb_GObject_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

Emitted when the user switched to the next month.

Parameters
Self
Call
Slot
After

On_Next_Month

procedure On_Next_Month
   (Self  : not null access Gtk_Calendar_Record;
    Call  : Cb_Gtk_Calendar_Void;
    After : Boolean := False)

Emitted when the user switched to the next month.

Parameters
Self
Call
After

On_Next_Year

procedure On_Next_Year
   (Self  : not null access Gtk_Calendar_Record;
    Call  : Cb_GObject_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

Emitted when user switched to the next year.

Parameters
Self
Call
Slot
After

On_Next_Year

procedure On_Next_Year
   (Self  : not null access Gtk_Calendar_Record;
    Call  : Cb_Gtk_Calendar_Void;
    After : Boolean := False)

Emitted when user switched to the next year.

Parameters
Self
Call
After

On_Prev_Month

procedure On_Prev_Month
   (Self  : not null access Gtk_Calendar_Record;
    Call  : Cb_GObject_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

Emitted when the user switched to the previous month.

Parameters
Self
Call
Slot
After

On_Prev_Month

procedure On_Prev_Month
   (Self  : not null access Gtk_Calendar_Record;
    Call  : Cb_Gtk_Calendar_Void;
    After : Boolean := False)

Emitted when the user switched to the previous month.

Parameters
Self
Call
After

On_Prev_Year

procedure On_Prev_Year
   (Self  : not null access Gtk_Calendar_Record;
    Call  : Cb_GObject_Void;
    Slot  : not null access Glib.Object.GObject_Record'Class;
    After : Boolean := False)

Emitted when user switched to the previous year.

Parameters
Self
Call
Slot
After

On_Prev_Year

procedure On_Prev_Year
   (Self  : not null access Gtk_Calendar_Record;
    Call  : Cb_Gtk_Calendar_Void;
    After : Boolean := False)

Emitted when user switched to the previous year.

Parameters
Self
Call
After

Property_Gtk_Calendar_Display_Options

type Property_Gtk_Calendar_Display_Options is new Gtk_Calendar_Display_Options_Properties.Property;

Select_Day

procedure Select_Day
   (Calendar : not null access Gtk_Calendar_Record;
    Day      : Guint)

Selects a day from the current month.

Parameters
Calendar
Day

the day number between 1 and 31, or 0 to unselect the currently selected day.

Select_Month

procedure Select_Month
   (Calendar : not null access Gtk_Calendar_Record;
    Month    : Guint;
    Year     : Guint)

Shifts the calendar to a different month.

Parameters
Calendar
Month

a month number between 0 and 11.

Year

the year the month is in.

Set_Detail_Func

procedure Set_Detail_Func
   (Calendar : not null access Gtk_Calendar_Record;
    Func     : Gtk_Calendar_Detail_Func)

Installs a function which provides Pango markup with detail information for each day. Examples for such details are holidays or appointments. That information is shown below each day when Gtk.Calendar.Gtk_Calendar:show-details is set. A tooltip containing with full detail information is provided, if the entire text should not fit into the details area, or if Gtk.Calendar.Gtk_Calendar:show-details is not set. The size of the details area can be restricted by setting the Gtk.Calendar.Gtk_Calendar:detail-width-chars and Gtk.Calendar.Gtk_Calendar:detail-height-rows properties. Since: gtk+ 2.14

Parameters
Calendar
Func

a function providing details for each day.

Set_Detail_Height_Rows

procedure Set_Detail_Height_Rows
   (Calendar : not null access Gtk_Calendar_Record;
    Rows     : Glib.Gint)

Updates the height of detail cells. See Gtk.Calendar.Gtk_Calendar:detail-height-rows. Since: gtk+ 2.14

Parameters
Calendar
Rows

detail height in rows.

Set_Detail_Width_Chars

procedure Set_Detail_Width_Chars
   (Calendar : not null access Gtk_Calendar_Record;
    Chars    : Glib.Gint)

Updates the width of detail cells. See Gtk.Calendar.Gtk_Calendar:detail-width-chars. Since: gtk+ 2.14

Parameters
Calendar
Chars

detail width in characters.

Set_Display_Options

procedure Set_Display_Options
   (Calendar : not null access Gtk_Calendar_Record;
    Flags    : Gtk_Calendar_Display_Options)

Sets display options (whether to display the heading and the month headings). Since: gtk+ 2.4

Parameters
Calendar
Flags

the display options to set

Show_Day_Names

Show_Day_Names : constant Gtk_Calendar_Display_Options := 2;

Show_Day_Names_Property

Show_Day_Names_Property : constant Glib.Properties.Property_Boolean;

Determines whether day names are displayed.

Show_Details

Show_Details : constant Gtk_Calendar_Display_Options := 32;

Show_Details_Property

Show_Details_Property : constant Glib.Properties.Property_Boolean;

Determines whether details are shown directly in the widget, or if they are available only as tooltip. When this property is set days with details are marked.

Show_Heading

Show_Heading : constant Gtk_Calendar_Display_Options := 1;

Show_Heading_Property

Show_Heading_Property : constant Glib.Properties.Property_Boolean;

Determines whether a heading is displayed.

Show_Week_Numbers

Show_Week_Numbers : constant Gtk_Calendar_Display_Options := 8;

Show_Week_Numbers_Property

Show_Week_Numbers_Property : constant Glib.Properties.Property_Boolean;

Determines whether week numbers are displayed.

Signal_Day_Selected

Signal_Day_Selected : constant Glib.Signal_Name := "day-selected";

Emitted when the user selects a day.

Signal_Day_Selected_Double_Click

Signal_Day_Selected_Double_Click : constant Glib.Signal_Name := "day-selected-double-click";

Emitted when the user double-clicks a day.

Signal_Month_Changed

Signal_Month_Changed : constant Glib.Signal_Name := "month-changed";

Emitted when the user clicks a button to change the selected month on a calendar.

Signal_Next_Month

Signal_Next_Month : constant Glib.Signal_Name := "next-month";

Emitted when the user switched to the next month.

Signal_Next_Year

Signal_Next_Year : constant Glib.Signal_Name := "next-year";

Emitted when user switched to the next year.

Signal_Prev_Month

Signal_Prev_Month : constant Glib.Signal_Name := "prev-month";

Emitted when the user switched to the previous month.

Signal_Prev_Year

Signal_Prev_Year : constant Glib.Signal_Name := "prev-year";

Emitted when user switched to the previous year.

Unmark_Day

procedure Unmark_Day
   (Calendar : not null access Gtk_Calendar_Record;
    Day      : Guint)

Removes the visual marker from a particular day.

Parameters
Calendar
Day

the day number to unmark between 1 and 31.

Year_Property

Year_Property : constant Glib.Properties.Property_Int;

The selected year. This property gets initially set to the current year.