## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

1.     -----------------------------------------------------------------------

2.     --               GtkAda - Ada95 binding for Gtk+/Gnome               --

3.     --                                                                   --

4.     --   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   --

5.     --                Copyright (C) 2000-2011, AdaCore                   --

6.     --                                                                   --

7.     -- This library is free software; you can redistribute it and/or     --

8.     -- modify it under the terms of the GNU General Public               --

9.     -- License as published by the Free Software Foundation; either      --

10.     -- version 2 of the License, or (at your option) any later version.  --

11.     --                                                                   --

12.     -- This library is distributed in the hope that it will be useful,   --

13.     -- but WITHOUT ANY WARRANTY; without even the implied warranty of    --

14.     -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --

15.     -- General Public License for more details.                          --

16.     --                                                                   --

17.     -- You should have received a copy of the GNU General Public         --

18.     -- License along with this library; if not, write to the             --

19.     -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --

20.     -- Boston, MA 02111-1307, USA.                                       --

21.     --                                                                   --

22.     -- As a special exception, if other files instantiate generics from  --

23.     -- this unit, or you link this unit with other files to produce an   --

24.     -- executable, this  unit  does not  by itself cause  the resulting  --

25.     -- executable to be covered by the GNU General Public License. This  --

26.     -- exception does not however invalidate any other reasons why the   --

27.     -- executable file  might be covered by the  GNU Public License.     --

28.     -----------------------------------------------------------------------

30.     --  <description>

31.     --  Gtk_Calendar is a widget that displays a calendar, one month at a time. It

32.     --  can be created with Gtk_New.

33.     --

34.     --  The month and year currently displayed can be altered with Select_Month.

35.     --  The exact day can be selected from the displayed month using Select_Day.

36.     --

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

38.     --  Display_Options.

39.     --

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

41.     --

42.     --  If performing many 'mark' operations, the calendar can be frozen to

43.     --  prevent flicker, using Freeze, and 'thawed' again using Thaw.

44.     --

45.     --  </description>

46.     --  <screenshot>gtk-calendar</screenshot>

47.     --  <group>Selectors</group>

48.     --  <testgtk>create_calendar.adb</testgtk>

50.     pragma Warnings (Off, "*is already use-visible*");

51.     with GlibTo API docTo specTo body;            use GlibTo API docTo specTo body;

52.     with Glib.PropertiesTo API docTo specTo body; use Glib.PropertiesTo API docTo specTo body;

53.     with Glib.TypesTo API docTo specTo body;      use Glib.TypesTo API docTo specTo body;

54.     with Gtk.BuildableTo API docTo specTo body;   use Gtk.BuildableTo API docTo specTo body;

55.     with Gtk.WidgetTo API docTo specTo body;      use Gtk.WidgetTo API docTo specTo body;

57.     package Gtk.CalendarTo API docTo specTo body is

59.        type Gtk_Calendar_Record is new Gtk_Widget_RecordTo API docTo specTo body with null record;

60.        type Gtk_Calendar is access all Gtk_Calendar_RecordTo API docTo spec'Class;

62.        type Gtk_Calendar_Display_Options is mod 2 ** 8;

64.        Show_Heading : constant Gtk_Calendar_Display_OptionsTo API docTo spec := 2 ** 0;

65.        --  Specify that the month and year should be displayed.

67.        Show_Day_Names : constant Gtk_Calendar_Display_OptionsTo API docTo spec := 2 ** 1;

68.        --  Specify that three letter day descriptions should be present.

70.        No_Month_Change : constant Gtk_Calendar_Display_OptionsTo API docTo spec := 2 ** 2;

71.        --  Prevent the user from switching months with the calendar.

73.        Show_Week_Numbers : constant Gtk_Calendar_Display_OptionsTo API docTo spec := 2 ** 3;

74.        --  Display each week numbers of the current year, down the left side of

75.        --  the calendar.

77.        Week_Start_Monday : constant Gtk_Calendar_Display_OptionsTo API docTo spec := 2 ** 4;

78.        --  Start the calendar week on Monday, instead of the default Sunday.

80.        type Gtk_Calendar_Detail_Func is access function

81.          (Calendar  : access Gtk_Calendar_RecordTo API docTo spec'Class;

82.           Year      : GuintTo API docTo spec;

83.           Month     : GuintTo API docTo spec;

84.           Day       : GuintTo API docTo spec;

85.           User_Data : System.Address) return String;

86.        --  Return the details for the given day, or the empty string when there

87.        --  are no details.

89.        ------------------

90.        -- Constructors --

91.        ------------------

93.        procedure Gtk_NewTo API docTo body (Calendar : out Gtk_CalendarTo API docTo spec);

94.        procedure InitializeTo API docTo body (Calendar : access Gtk_Calendar_RecordTo API docTo spec'Class);

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

97.        function Get_TypeTo API docTo body return Glib.GTypeTo API docTo spec;

98.        pragma Import (C, Get_TypeTo API docTo spec, "gtk_calendar_get_type");

100.        -------------

101.        -- Methods --

102.        -------------

104.        procedure Clear_MarksTo API docTo body (Calendar : access Gtk_Calendar_RecordTo API docTo spec);

105.        --  Remove all visual markers.

107.        procedure Display_OptionsTo API docTo body

108.           (Calendar : access Gtk_Calendar_RecordTo API docTo spec;

109.            Flags    : Gtk_Calendar_Display_OptionsTo API docTo spec);

110.        pragma Obsolescent (Display_OptionsTo API docTo specTo body);

111.        function Get_Display_OptionsTo API docTo body

112.           (Calendar : access Gtk_Calendar_RecordTo API docTo spec)

113.            return Gtk_Calendar_Display_OptionsTo API docTo spec;

114.        procedure Set_Display_OptionsTo API docTo body

115.           (Calendar : access Gtk_Calendar_RecordTo API docTo spec;

116.            Flags    : Gtk_Calendar_Display_OptionsTo API docTo spec);

117.        --  Sets display options (whether to display the heading and the month

118.        --  headings).

119.        --  Since: gtk+ 2.4

120.        --  "flags": the display options to set

122.        procedure FreezeTo API docTo body (Calendar : access Gtk_Calendar_RecordTo API docTo spec);

123.        pragma Obsolescent (FreezeTo API docTo specTo body);

124.        --  Does nothing. Previously locked the display of the calendar until it

125.        --  was thawed with Gtk.Calendar.Thaw.

126.        --  Deprecated

128.        procedure Get_DateTo API docTo body

129.           (Calendar : access Gtk_Calendar_RecordTo API docTo spec;

130.            Year     : out GuintTo API docTo spec;

131.            Month    : out GuintTo API docTo spec;

132.            Day      : out GuintTo API docTo spec);

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

134.        --  "year": location to store the year as a decimal number (e.g. 2011), or

135.        --  null

136.        --  "month": location to store the month number (between 0 and 11), or null

137.        --  "day": location to store the day number (between 1 and 31), or null

139.        function Get_Detail_Height_RowsTo API docTo body

140.           (Calendar : access Gtk_Calendar_RecordTo API docTo spec) return GintTo API docTo spec;

141.        procedure Set_Detail_Height_RowsTo API docTo body

142.           (Calendar : access Gtk_Calendar_RecordTo API docTo spec;

143.            Rows     : GintTo API docTo spec);

144.        --  Updates the height of detail cells. See

145.        --  Gtk.Calendar.Gtk_Calendar:detail-height-rows.

146.        --  Since: gtk+ 2.14

147.        --  "rows": detail height in rows.

149.        function Get_Detail_Width_CharsTo API docTo body

150.           (Calendar : access Gtk_Calendar_RecordTo API docTo spec) return GintTo API docTo spec;

151.        procedure Set_Detail_Width_CharsTo API docTo body

152.           (Calendar : access Gtk_Calendar_RecordTo API docTo spec;

153.            Chars    : GintTo API docTo spec);

154.        --  Updates the width of detail cells. See

155.        --  Gtk.Calendar.Gtk_Calendar:detail-width-chars.

156.        --  Since: gtk+ 2.14

157.        --  "chars": detail width in characters.

159.        function Mark_DayTo API docTo body

160.           (Calendar : access Gtk_Calendar_RecordTo API docTo spec;

161.            Day      : GuintTo API docTo spec) return Boolean;

162.        --  Places a visual marker on a particular day. Note that this function

163.        --  always returns True, and you should ignore the return value. In GTK+ 3,

164.        --  this function will not return a value.

165.        --  "day": the day number to mark between 1 and 31.

167.        procedure Select_DayTo API docTo body (Calendar : access Gtk_Calendar_RecordTo API docTo spec; Day : GuintTo API docTo spec);

168.        --  Selects a day from the current month.

169.        --  "day": the day number between 1 and 31, or 0 to unselect the currently

170.        --  selected day.

172.        function Select_MonthTo API docTo body

173.           (Calendar : access Gtk_Calendar_RecordTo API docTo spec;

174.            Month    : GuintTo API docTo spec;

175.            Year     : GuintTo API docTo spec) return Boolean;

176.        --  Shifts the calendar to a different month. Note that this function

177.        --  always returns True, and you should ignore the return value. In GTK+ 3,

178.        --  this function will not return a value.

179.        --  "month": a month number between 0 and 11.

180.        --  "year": the year the month is in.

182.        procedure Set_Detail_FuncTo API docTo body

183.           (Calendar : access Gtk_Calendar_RecordTo API docTo spec;

184.            Func     : Gtk_Calendar_Detail_FuncTo API docTo spec;

185.            Data     : System.Address;

186.            Destroy  : Glib.G_Destroy_Notify_AddressTo API docTo spec);

187.        --  Installs a function which provides Pango markup with detail information

188.        --  for each day. Examples for such details are holidays or appointments.

189.        --  That information is shown below each day when

190.        --  Gtk.Calendar.Gtk_Calendar:show-details is set. A tooltip containing with

191.        --  full detail information is provided, if the entire text should not fit

192.        --  into the details area, or if Gtk.Calendar.Gtk_Calendar:show-details is

193.        --  not set. The size of the details area can be restricted by setting the

194.        --  Gtk.Calendar.Gtk_Calendar:detail-width-chars and

195.        --  Gtk.Calendar.Gtk_Calendar:detail-height-rows properties.

196.        --  Since: gtk+ 2.14

197.        --  "func": a function providing details for each day.

198.        --  "data": data to pass to Func invokations.

199.        --  "destroy": a function for releasing Data.

201.        procedure ThawTo API docTo body (Calendar : access Gtk_Calendar_RecordTo API docTo spec);

202.        pragma Obsolescent (ThawTo API docTo specTo body);

203.        --  Does nothing. Previously defrosted a calendar; all the changes made

204.        --  since the last Gtk.Calendar.Freeze were displayed.

205.        --  Deprecated

207.        function Unmark_DayTo API docTo body

208.           (Calendar : access Gtk_Calendar_RecordTo API docTo spec;

209.            Day      : GuintTo API docTo spec) return Boolean;

210.        --  Removes the visual marker from a particular day. Note that this

211.        --  function always returns True, and you should ignore the return value. In

212.        --  GTK+ 3, this function will not return a value.

213.        --  "day": the day number to unmark between 1 and 31.

215.        ----------------

216.        -- Interfaces --

217.        ----------------

218.        --  This class implements several interfaces. See Glib.Types

219.        --

220.        --  - "Buildable"

222.        package Implements_Buildable is new Glib.Types.ImplementsTo API docTo specTo body

223.          (Gtk.Buildable.Gtk_BuildableTo API docTo spec, Gtk_Calendar_RecordTo API docTo spec, Gtk_CalendarTo API docTo spec);

224.        function "+"

225.          (Widget : access Gtk_Calendar_RecordTo API docTo spec'Class)

226.        return Gtk.Buildable.Gtk_BuildableTo API docTo spec

227.        renames Implements_Buildable.To_InterfaceTo API docTo specTo body;

228.        function "-"

229.          (Interf : Gtk.Buildable.Gtk_BuildableTo API docTo spec)

230.        return Gtk_CalendarTo API docTo spec

231.        renames Implements_Buildable.To_ObjectTo API docTo specTo body;

233.        ----------------

234.        -- Properties --

235.        ----------------

236.        --  The following properties are defined for this widget. See

237.        --  Glib.Properties for more information on properties)

238.        --

239.        --  Name: Day_Property

240.        --  Type: Gint

241.        --  Flags: read-write

242.        --  The selected day (as a number between 1 and 31, or 0 to unselect the

243.        --  currently selected day). This property gets initially set to the current

244.        --  day.

245.        --

246.        --  Name: Detail_Height_Rows_Property

247.        --  Type: Gint

248.        --  Flags: read-write

249.        --  Height of a detail cell, in rows. A value of 0 allows any width. See

250.        --  Gtk.Calendar.Set_Detail_Func.

251.        --

252.        --  Name: Detail_Width_Chars_Property

253.        --  Type: Gint

254.        --  Flags: read-write

255.        --  Width of a detail cell, in characters. A value of 0 allows any width.

256.        --  See Gtk.Calendar.Set_Detail_Func.

257.        --

258.        --  Name: Month_Property

259.        --  Type: Gint

260.        --  Flags: read-write

261.        --  The selected month (as a number between 0 and 11). This property gets

262.        --  initially set to the current month.

263.        --

264.        --  Name: No_Month_Change_Property

265.        --  Type: Boolean

266.        --  Flags: read-write

267.        --  Determines whether the selected month can be changed.

268.        --

269.        --  Name: Show_Day_Names_Property

270.        --  Type: Boolean

271.        --  Flags: read-write

272.        --  Determines whether day names are displayed.

273.        --

274.        --  Name: Show_Details_Property

275.        --  Type: Boolean

276.        --  Flags: read-write

277.        --  Determines whether details are shown directly in the widget, or if they

278.        --  are available only as tooltip. When this property is set days with

279.        --  details are marked.

280.        --

281.        --  Name: Show_Heading_Property

282.        --  Type: Boolean

283.        --  Flags: read-write

284.        --  Determines whether a heading is displayed.

285.        --

286.        --  Name: Show_Week_Numbers_Property

287.        --  Type: Boolean

288.        --  Flags: read-write

289.        --  Determines whether week numbers are displayed.

290.        --

291.        --  Name: Year_Property

292.        --  Type: Gint

293.        --  Flags: read-write

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

295.        --  year.

297.        Day_Property : constant Glib.Properties.Property_IntTo API docTo spec;

298.        Detail_Height_Rows_Property : constant Glib.Properties.Property_IntTo API docTo spec;

299.        Detail_Width_Chars_Property : constant Glib.Properties.Property_IntTo API docTo spec;

300.        Month_Property : constant Glib.Properties.Property_IntTo API docTo spec;

301.        No_Month_Change_Property : constant Glib.Properties.Property_BooleanTo API docTo spec;

302.        Show_Day_Names_Property : constant Glib.Properties.Property_BooleanTo API docTo spec;

303.        Show_Details_Property : constant Glib.Properties.Property_BooleanTo API docTo spec;

304.        Show_Heading_Property : constant Glib.Properties.Property_BooleanTo API docTo spec;

305.        Show_Week_Numbers_Property : constant Glib.Properties.Property_BooleanTo API docTo spec;

306.        Year_Property : constant Glib.Properties.Property_IntTo API docTo spec;

308.        -------------

309.        -- Signals --

310.        -------------

311.        --  The following new signals are defined for this widget:

312.        --

313.        --  "day-selected"

314.        --     procedure Handler (Self : access Gtk_Calendar_Record'Class);

315.        --

316.        --  "day-selected-double-click"

317.        --     procedure Handler (Self : access Gtk_Calendar_Record'Class);

318.        --

319.        --  "month-changed"

320.        --     procedure Handler (Self : access Gtk_Calendar_Record'Class);

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

322.        --  calendar.

323.        --

324.        --  "next-month"

325.        --     procedure Handler (Self : access Gtk_Calendar_Record'Class);

326.        --

327.        --  "next-year"

328.        --     procedure Handler (Self : access Gtk_Calendar_Record'Class);

329.        --

330.        --  "prev-month"

331.        --     procedure Handler (Self : access Gtk_Calendar_Record'Class);

332.        --

333.        --  "prev-year"

334.        --     procedure Handler (Self : access Gtk_Calendar_Record'Class);

336.        Signal_Day_Selected : constant Glib.Signal_NameTo API docTo spec := "day-selected";

337.        Signal_Day_Selected_Double_Click : constant Glib.Signal_NameTo API docTo spec := "day-selected-double-click";

338.        Signal_Month_Changed : constant Glib.Signal_NameTo API docTo spec := "month-changed";

339.        Signal_Next_Month : constant Glib.Signal_NameTo API docTo spec := "next-month";

340.        Signal_Next_Year : constant Glib.Signal_NameTo API docTo spec := "next-year";

341.        Signal_Prev_Month : constant Glib.Signal_NameTo API docTo spec := "prev-month";

342.        Signal_Prev_Year : constant Glib.Signal_NameTo API docTo spec := "prev-year";

344.     private

345.        Day_PropertyTo API docTo spec : constant Glib.Properties.Property_IntTo API docTo spec :=

346.          Glib.Properties.BuildTo API docTo specTo body ("day");

347.        Detail_Height_Rows_PropertyTo API docTo spec : constant Glib.Properties.Property_IntTo API docTo spec :=

348.          Glib.Properties.BuildTo API docTo specTo body ("detail-height-rows");

349.        Detail_Width_Chars_PropertyTo API docTo spec : constant Glib.Properties.Property_IntTo API docTo spec :=

350.          Glib.Properties.BuildTo API docTo specTo body ("detail-width-chars");

351.        Month_PropertyTo API docTo spec : constant Glib.Properties.Property_IntTo API docTo spec :=

352.          Glib.Properties.BuildTo API docTo specTo body ("month");

353.        No_Month_Change_PropertyTo API docTo spec : constant Glib.Properties.Property_BooleanTo API docTo spec :=

354.          Glib.Properties.BuildTo API docTo specTo body ("no-month-change");

355.        Show_Day_Names_PropertyTo API docTo spec : constant Glib.Properties.Property_BooleanTo API docTo spec :=

356.          Glib.Properties.BuildTo API docTo specTo body ("show-day-names");

357.        Show_Details_PropertyTo API docTo spec : constant Glib.Properties.Property_BooleanTo API docTo spec :=

358.          Glib.Properties.BuildTo API docTo specTo body ("show-details");

359.        Show_Heading_PropertyTo API docTo spec : constant Glib.Properties.Property_BooleanTo API docTo spec :=

360.          Glib.Properties.BuildTo API docTo specTo body ("show-heading");

361.        Show_Week_Numbers_PropertyTo API docTo spec : constant Glib.Properties.Property_BooleanTo API docTo spec :=

362.          Glib.Properties.BuildTo API docTo specTo body ("show-week-numbers");

363.        Year_PropertyTo API docTo spec : constant Glib.Properties.Property_IntTo API docTo spec :=

364.          Glib.Properties.BuildTo API docTo specTo body ("year");

365.     end Gtk.CalendarTo API docTo specTo body;