1-----------------------------------------------------------------------
2--          GtkAda - Ada95 binding for the Gimp Toolkit              --
3--                                                                   --
4--                     Copyright (C) 1998-1999                       --
5--        Emmanuel Briot, Joel Brobecker and Arnaud Charlet          --
6--                     Copyright (C) 2000-2013, AdaCore              --
7--                                                                   --
8-- This library is free software; you can redistribute it and/or     --
9-- modify it under the terms of the GNU General Public               --
10-- License as published by the Free Software Foundation; either      --
11-- version 2 of the License, or (at your option) any later version.  --
12--                                                                   --
13-- This library is distributed in the hope that it will be useful,   --
14-- but WITHOUT ANY WARRANTY; without even the implied warranty of    --
15-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --
16-- General Public License for more details.                          --
17--                                                                   --
18-- You should have received a copy of the GNU General Public         --
19-- License along with this library; if not, write to the             --
20-- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --
21-- Boston, MA 02111-1307, USA.                                       --
22--                                                                   --
23-- As a special exception, if other files instantiate generics from  --
24-- this unit, or you link this unit with other files to produce an   --
25-- executable, this  unit  does not  by itself cause  the resulting  --
26-- executable to be covered by the GNU General Public License. This  --
27-- exception does not however invalidate any other reasons why the   --
28-- executable file  might be covered by the  GNU Public License.     --
29-----------------------------------------------------------------------
30
31with Glib;              use Glib;
32with Gtk;               use Gtk;
33with Gtk.Box;           use Gtk.Box;
34with Gtk.Check_Button;  use Gtk.Check_Button;
35with Gtk.Label;         use Gtk.Label;
36
37package body Create_Check_Buttons is
38
39   ----------
40   -- Help --
41   ----------
42
43   function Help return String is
44   begin
45      return "A @bGtk_Check_Button@B has two possible states, either activated"
46        & " or desactivated. A callback can be set each time the state is"
47        & " modified.";
48   end Help;
49
50   ---------
51   -- Run --
52   ---------
53
54   procedure Run (Frame : access Gtk.Frame.Gtk_Frame_Record'Class) is
55      Box1, Box2 : Box.Gtk_Box;
56      A_Check_Button : Check_Button.Gtk_Check_Button;
57      Label : Gtk_Label;
58   begin
59      Set_Label (Frame, "Check Buttons");
60
61      Box.Gtk_New_Vbox (Box1, Homogeneous => False, Spacing => 0);
62      Add (Container => Frame, Widget => Box1);
63
64      Box.Gtk_New_Vbox (Box2, Homogeneous => False, Spacing => 10);
65      Set_Border_Width (Container => Box2, Border_Width => 10);
66      Box.Pack_Start (In_Box => Box1, Child => Box2,
67                      Expand => False,
68                      Fill   => False);
69
70      Check_Button.Gtk_New (A_Check_Button, "button1");
71      Box.Pack_Start (In_Box => Box2, Child => A_Check_Button);
72
73      Check_Button.Gtk_New (A_Check_Button, "button2");
74      Box.Pack_Start (In_Box => Box2, Child => A_Check_Button);
75
76      Check_Button.Gtk_New (A_Check_Button); --  Empty initially
77      Gtk_New (Label, "button3");
78      Add (A_Check_Button, Label);  --  Manually set the label
79      Box.Pack_Start (In_Box => Box2, Child => A_Check_Button);
80
81      Show_All (Box1);
82   end Run;
83
84end Create_Check_Buttons;
85