1----------------------------------------------------------------------- 2-- GtkAda - Ada95 binding for the Gimp Toolkit -- 3-- -- 4-- Copyright (C) 2000-2002 ACT-Europe -- 5-- -- 6-- This library is free software; you can redistribute it and/or -- 7-- modify it under the terms of the GNU General Public -- 8-- License as published by the Free Software Foundation; either -- 9-- version 2 of the License, or (at your option) any later version. -- 10-- -- 11-- This library is distributed in the hope that it will be useful, -- 12-- but WITHOUT ANY WARRANTY; without even the implied warranty of -- 13-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- 14-- General Public License for more details. -- 15-- -- 16-- You should have received a copy of the GNU General Public -- 17-- License along with this library; if not, write to the -- 18-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- 19-- Boston, MA 02111-1307, USA. -- 20-- -- 21-- As a special exception, if other files instantiate generics from -- 22-- this unit, or you link this unit with other files to produce an -- 23-- executable, this unit does not by itself cause the resulting -- 24-- executable to be covered by the GNU General Public License. This -- 25-- exception does not however invalidate any other reasons why the -- 26-- executable file might be covered by the GNU Public License. -- 27----------------------------------------------------------------------- 28 29with System; 30with Gtk; use Gtk; 31 32package body Gnome.Date_Edit is 33 34 --------------- 35 -- Gnome_New -- 36 --------------- 37 38 procedure Gnome_New 39 (Date_Edit : out Gnome_Date_Edit; 40 The_Time : Time_T; 41 Show_Time : Boolean; 42 Use_24hr_Format : Boolean) 43 is 44 Flags : Gnome_Date_Edit_Flags := 0; 45 begin 46 Date_Edit := new Gnome_Date_Edit_Record; 47 48 if Show_Time then 49 Flags := Flags or Gnome.Date_Edit.Show_Time; 50 end if; 51 52 if Use_24hr_Format then 53 Flags := Flags or Twentyfour_Hour; 54 end if; 55 56 Initialize (Date_Edit, The_Time, Flags); 57 end Gnome_New; 58 59 procedure Gnome_New 60 (Date_Edit : out Gnome_Date_Edit; 61 The_Time : Time_T; 62 Flags : Gnome_Date_Edit_Flags) is 63 begin 64 Date_Edit := new Gnome_Date_Edit_Record; 65 Initialize (Date_Edit, The_Time, Flags); 66 end Gnome_New; 67 68 ---------------- 69 -- Initialize -- 70 ---------------- 71 72 procedure Initialize 73 (Date_Edit : access Gnome_Date_Edit_Record'Class; 74 The_Time : Time_T; 75 Flags : Gnome_Date_Edit_Flags) 76 is 77 function Internal 78 (The_Time : Time_T; 79 Flags : Gnome_Date_Edit_Flags) return System.Address; 80 pragma Import (C, Internal, "gnome_date_edit_new_flags"); 81 82 begin 83 Set_Object (Date_Edit, Internal (The_Time, Flags)); 84 end Initialize; 85 86 -------------- 87 -- Get_Time -- 88 -------------- 89 90 function Get_Time (Date_Edit : Gnome_Date_Edit) return Time_T is 91 function Internal (Date_Edit : System.Address) return Time_T; 92 pragma Import (C, Internal, "gnome_date_edit_get_time"); 93 94 begin 95 return Internal (Get_Object (Date_Edit)); 96 end Get_Time; 97 98 --------------- 99 -- Get_Flags -- 100 --------------- 101 102 function Get_Flags 103 (Date_Edit : Gnome_Date_Edit) return Gnome_Date_Edit_Flags 104 is 105 function Internal 106 (Date_Edit : System.Address) return Gnome_Date_Edit_Flags; 107 pragma Import (C, Internal, "gnome_date_edit_get_flags"); 108 109 begin 110 return Internal (Get_Object (Date_Edit)); 111 end Get_Flags; 112 113 --------------- 114 -- Set_Flags -- 115 --------------- 116 117 procedure Set_Flags 118 (Date_Edit : Gnome_Date_Edit; 119 Flags : Gnome_Date_Edit_Flags) 120 is 121 procedure Internal 122 (Date_Edit : System.Address; 123 Flags : Gnome_Date_Edit_Flags); 124 pragma Import (C, Internal, "gnome_date_edit_set_flags"); 125 126 begin 127 Internal (Get_Object (Date_Edit), Flags); 128 end Set_Flags; 129 130 --------------------- 131 -- Set_Popup_Range -- 132 --------------------- 133 134 procedure Set_Popup_Range 135 (Date_Edit : Gnome_Date_Edit; 136 Low_Hour : Integer; 137 Up_Hour : Integer) 138 is 139 procedure Internal 140 (Date_Edit : System.Address; 141 Low_Hour : Integer; 142 Up_Hour : Integer); 143 pragma Import (C, Internal, "gnome_date_edit_set_popup_range"); 144 145 begin 146 Internal (Get_Object (Date_Edit), Low_Hour, Up_Hour); 147 end Set_Popup_Range; 148 149 -------------- 150 -- Set_Time -- 151 -------------- 152 153 procedure Set_Time 154 (Date_Edit : Gnome_Date_Edit; 155 The_Time : Time_T) 156 is 157 procedure Internal (Date_Edit : System.Address; The_Time : Time_T); 158 pragma Import (C, Internal, "gnome_date_edit_set_time"); 159 160 begin 161 Internal (Get_Object (Date_Edit), The_Time); 162 end Set_Time; 163 164end Gnome.Date_Edit; 165