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-2013, 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-----------------------------------------------------------------------
29
30pragma Style_Checks (Off);
31pragma Warnings (Off, "*is already use-visible*");
32with Glib.Type_Conversion_Hooks; use Glib.Type_Conversion_Hooks;
33with Interfaces.C.Strings;       use Interfaces.C.Strings;
34
35package body Gtk.Font_Selection_Dialog is
36   package Type_Conversion is new Glib.Type_Conversion_Hooks.Hook_Registrator
37     (Get_Type'Access, Gtk_Font_Selection_Dialog_Record);
38   pragma Unreferenced (Type_Conversion);
39
40   -------------
41   -- Gtk_New --
42   -------------
43
44   procedure Gtk_New
45      (Dialog : out Gtk_Font_Selection_Dialog;
46       Title  : UTF8_String)
47   is
48   begin
49      Dialog := new Gtk_Font_Selection_Dialog_Record;
50      Gtk.Font_Selection_Dialog.Initialize (Dialog, Title);
51   end Gtk_New;
52
53   ----------------
54   -- Initialize --
55   ----------------
56
57   procedure Initialize
58      (Dialog : access Gtk_Font_Selection_Dialog_Record'Class;
59       Title  : UTF8_String)
60   is
61      function Internal
62         (Title : Interfaces.C.Strings.chars_ptr) return System.Address;
63      pragma Import (C, Internal, "gtk_font_selection_dialog_new");
64      Tmp_Title  : Interfaces.C.Strings.chars_ptr := New_String (Title);
65      Tmp_Return : System.Address;
66   begin
67      Tmp_Return := Internal (Tmp_Title);
68      Free (Tmp_Title);
69      Set_Object (Dialog, Tmp_Return);
70   end Initialize;
71
72   ----------------------
73   -- Get_Apply_Button --
74   ----------------------
75
76   function Get_Apply_Button
77      (Dialog : access Gtk_Font_Selection_Dialog_Record)
78       return Gtk.Widget.Gtk_Widget
79   is
80      function Internal (Dialog : System.Address) return System.Address;
81      pragma Import (C, Internal, "gtk_font_selection_dialog_get_apply_button");
82      Stub : Gtk.Widget.Gtk_Widget_Record;
83   begin
84      return Gtk.Widget.Gtk_Widget (Get_User_Data (Internal (Get_Object (Dialog)), Stub));
85   end Get_Apply_Button;
86
87   -----------------------
88   -- Get_Cancel_Button --
89   -----------------------
90
91   function Get_Cancel_Button
92      (Dialog : access Gtk_Font_Selection_Dialog_Record)
93       return Gtk.Widget.Gtk_Widget
94   is
95      function Internal (Dialog : System.Address) return System.Address;
96      pragma Import (C, Internal, "gtk_font_selection_dialog_get_cancel_button");
97      Stub : Gtk.Widget.Gtk_Widget_Record;
98   begin
99      return Gtk.Widget.Gtk_Widget (Get_User_Data (Internal (Get_Object (Dialog)), Stub));
100   end Get_Cancel_Button;
101
102   --------------
103   -- Get_Font --
104   --------------
105
106   function Get_Font
107      (Dialog : access Gtk_Font_Selection_Dialog_Record)
108       return Gdk.Font.Gdk_Font
109   is
110      function Internal (Dialog : System.Address) return Gdk.Font.Gdk_Font;
111      pragma Import (C, Internal, "gtk_font_selection_dialog_get_font");
112   begin
113      return Internal (Get_Object (Dialog));
114   end Get_Font;
115
116   -------------------
117   -- Get_Font_Name --
118   -------------------
119
120   function Get_Font_Name
121      (Dialog : access Gtk_Font_Selection_Dialog_Record) return UTF8_String
122   is
123      function Internal
124         (Dialog : System.Address) return Interfaces.C.Strings.chars_ptr;
125      pragma Import (C, Internal, "gtk_font_selection_dialog_get_font_name");
126   begin
127      return Interfaces.C.Strings.Value (Internal (Get_Object (Dialog)));
128   end Get_Font_Name;
129
130   ------------------------
131   -- Get_Font_Selection --
132   ------------------------
133
134   function Get_Font_Selection
135      (Dialog : access Gtk_Font_Selection_Dialog_Record)
136       return Gtk.Widget.Gtk_Widget
137   is
138      function Internal (Dialog : System.Address) return System.Address;
139      pragma Import (C, Internal, "gtk_font_selection_dialog_get_font_selection");
140      Stub : Gtk.Widget.Gtk_Widget_Record;
141   begin
142      return Gtk.Widget.Gtk_Widget (Get_User_Data (Internal (Get_Object (Dialog)), Stub));
143   end Get_Font_Selection;
144
145   -------------------
146   -- Get_Ok_Button --
147   -------------------
148
149   function Get_Ok_Button
150      (Dialog : access Gtk_Font_Selection_Dialog_Record)
151       return Gtk.Widget.Gtk_Widget
152   is
153      function Internal (Dialog : System.Address) return System.Address;
154      pragma Import (C, Internal, "gtk_font_selection_dialog_get_ok_button");
155      Stub : Gtk.Widget.Gtk_Widget_Record;
156   begin
157      return Gtk.Widget.Gtk_Widget (Get_User_Data (Internal (Get_Object (Dialog)), Stub));
158   end Get_Ok_Button;
159
160   ----------------------
161   -- Get_Preview_Text --
162   ----------------------
163
164   function Get_Preview_Text
165      (Dialog : access Gtk_Font_Selection_Dialog_Record) return UTF8_String
166   is
167      function Internal
168         (Dialog : System.Address) return Interfaces.C.Strings.chars_ptr;
169      pragma Import (C, Internal, "gtk_font_selection_dialog_get_preview_text");
170   begin
171      return Interfaces.C.Strings.Value (Internal (Get_Object (Dialog)));
172   end Get_Preview_Text;
173
174   -------------------
175   -- Set_Font_Name --
176   -------------------
177
178   function Set_Font_Name
179      (Dialog   : access Gtk_Font_Selection_Dialog_Record;
180       Fontname : UTF8_String) return Boolean
181   is
182      function Internal
183         (Dialog   : System.Address;
184          Fontname : Interfaces.C.Strings.chars_ptr) return Integer;
185      pragma Import (C, Internal, "gtk_font_selection_dialog_set_font_name");
186      Tmp_Fontname : Interfaces.C.Strings.chars_ptr := New_String (Fontname);
187      Tmp_Return   : Integer;
188   begin
189      Tmp_Return := Internal (Get_Object (Dialog), Tmp_Fontname);
190      Free (Tmp_Fontname);
191      return Boolean'Val (Tmp_Return);
192   end Set_Font_Name;
193
194   ----------------------
195   -- Set_Preview_Text --
196   ----------------------
197
198   procedure Set_Preview_Text
199      (Dialog : access Gtk_Font_Selection_Dialog_Record;
200       Text   : UTF8_String)
201   is
202      procedure Internal
203         (Dialog : System.Address;
204          Text   : Interfaces.C.Strings.chars_ptr);
205      pragma Import (C, Internal, "gtk_font_selection_dialog_set_preview_text");
206      Tmp_Text : Interfaces.C.Strings.chars_ptr := New_String (Text);
207   begin
208      Internal (Get_Object (Dialog), Tmp_Text);
209      Free (Tmp_Text);
210   end Set_Preview_Text;
211
212end Gtk.Font_Selection_Dialog;
213