1------------------------------------------------------------------------------
2--               GtkAda - Ada95 binding for the Gimp Toolkit                --
3--                                                                          --
4--                     Copyright (C) 1998-2015, AdaCore                     --
5--                                                                          --
6-- This library is free software;  you can redistribute it and/or modify it --
7-- under terms of the  GNU General Public License  as published by the Free --
8-- Software  Foundation;  either version 3,  or (at your  option) any later --
9-- version. This library is distributed in the hope that it will be useful, --
10-- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- --
11-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            --
12--                                                                          --
13-- As a special exception under Section 7 of GPL version 3, you are granted --
14-- additional permissions described in the GCC Runtime Library Exception,   --
15-- version 3.1, as published by the Free Software Foundation.               --
16--                                                                          --
17-- You should have received a copy of the GNU General Public License and    --
18-- a copy of the GCC Runtime Library Exception along with this program;     --
19-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
20-- <http://www.gnu.org/licenses/>.                                          --
21--                                                                          --
22------------------------------------------------------------------------------
23
24with Glib;              use Glib;
25with Gtk;               use Gtk;
26with Gtk.Box;           use Gtk.Box;
27with Gtk.Check_Button;  use Gtk.Check_Button;
28with Gtk.Label;         use Gtk.Label;
29
30package body Create_Check_Buttons is
31
32   ----------
33   -- Help --
34   ----------
35
36   function Help return String is
37   begin
38      return "A @bGtk_Check_Button@B has two possible states, either activated"
39        & " or desactivated. A callback can be set each time the state is"
40        & " modified.";
41   end Help;
42
43   ---------
44   -- Run --
45   ---------
46
47   procedure Run (Frame : access Gtk.Frame.Gtk_Frame_Record'Class) is
48      Box1, Box2 : Box.Gtk_Box;
49      A_Check_Button : Check_Button.Gtk_Check_Button;
50      Label : Gtk_Label;
51   begin
52      Set_Label (Frame, "Check Buttons");
53
54      Box.Gtk_New_Vbox (Box1, Homogeneous => False, Spacing => 0);
55      Add (Container => Frame, Widget => Box1);
56
57      Box.Gtk_New_Vbox (Box2, Homogeneous => False, Spacing => 10);
58      Set_Border_Width (Container => Box2, Border_Width => 10);
59      Box.Pack_Start (In_Box => Box1, Child => Box2,
60                      Expand => False,
61                      Fill   => False);
62
63      Check_Button.Gtk_New (A_Check_Button, "button1");
64      Box.Pack_Start (In_Box => Box2, Child => A_Check_Button);
65
66      Check_Button.Gtk_New (A_Check_Button, "button2");
67      Box.Pack_Start (In_Box => Box2, Child => A_Check_Button);
68
69      Check_Button.Gtk_New (A_Check_Button); --  Empty initially
70      Gtk_New (Label, "button3");
71      Add (A_Check_Button, Label);  --  Manually set the label
72      Box.Pack_Start (In_Box => Box2, Child => A_Check_Button);
73
74      Show_All (Box1);
75   end Run;
76
77end Create_Check_Buttons;
78