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.Alignment; use Gtk.Alignment; 27with Gtk.Box; use Gtk.Box; 28with Gtk.Button; use Gtk.Button; 29with Gtk.Frame; use Gtk.Frame; 30 31package body Create_Alignment is 32 33 ---------- 34 -- Help -- 35 ---------- 36 37 function Help return String is 38 begin 39 return "This demo shows how a @bGtk_Alignment@B widget can be used to" 40 & " align and resize your widgets exactly the way you want." 41 & ASCII.LF 42 & "With this container, you can specify the amount of expansion the" 43 & " child will have, as well as its alignment in case it isn't fully" 44 & " expanded."; 45 end Help; 46 47 --------- 48 -- Run -- 49 --------- 50 51 procedure Run (Frame : access Gtk.Frame.Gtk_Frame_Record'Class) is 52 Box1 : Gtk_Box; 53 Align : Gtk_Alignment; 54 Button : Gtk_Button; 55 Frame2 : Gtk_Frame; 56 57 begin 58 Gtk.Frame.Set_Label (Frame, "Alignment"); 59 60 Gtk_New_Vbox (Box1, Homogeneous => True, Spacing => 0); 61 Add (Frame, Box1); 62 63 Gtk_New (Frame2, "Xalign=0.0 Yalign=0.0 Xscale=0.2 Yscale=0.2"); 64 Gtk_New (Align, 65 Xalign => 0.0, 66 Yalign => 0.0, 67 Xscale => 0.2, 68 Yscale => 0.2); 69 Gtk_New (Button, "Button"); 70 Add (Align, Button); 71 Add (Frame2, Align); 72 Pack_Start (Box1, Frame2); 73 74 Gtk_New (Frame2, "Xalign=0.5 Yalign=0.5 Xscale=0.2 Yscale=0.2"); 75 Gtk_New (Align, 76 Xalign => 0.5, 77 Yalign => 0.5, 78 Xscale => 0.2, 79 Yscale => 0.2); 80 Gtk_New (Button, "Button"); 81 Add (Align, Button); 82 Add (Frame2, Align); 83 Pack_Start (Box1, Frame2); 84 85 Gtk_New (Frame2, "Xalign=1.0 Yalign=1.0 Xscale=0.2 Yscale=0.2"); 86 Gtk_New (Align, 87 Xalign => 1.0, 88 Yalign => 1.0, 89 Xscale => 0.2, 90 Yscale => 0.2); 91 Gtk_New (Button, "Button"); 92 Add (Align, Button); 93 Add (Frame2, Align); 94 Pack_Start (Box1, Frame2); 95 96 Gtk_New (Frame2, "Xalign=0.0 Yalign=0.0 Xscale=0.9 Yscale=0.9"); 97 Gtk_New (Align, 98 Xalign => 0.0, 99 Yalign => 0.0, 100 Xscale => 0.9, 101 Yscale => 0.9); 102 Gtk_New (Button, "Button"); 103 Add (Align, Button); 104 Add (Frame2, Align); 105 Pack_Start (Box1, Frame2); 106 107 Gtk_New (Frame2, "Xalign=0.2 Yalign=0.9 Xscale=0.5 Yscale=0.5"); 108 Gtk_New (Align, 109 Xalign => 0.2, 110 Yalign => 0.9, 111 Xscale => 0.5, 112 Yscale => 0.5); 113 Gtk_New (Button, "Button"); 114 Add (Align, Button); 115 Add (Frame2, Align); 116 Pack_Start (Box1, Frame2); 117 118 Show_All (Frame); 119 end Run; 120 121end Create_Alignment; 122