Toc Gallery Index Tree Gtk.Button_Box

Screenshot

No screeshot

Hierarchy

Description

A Gtk_Button_Box is a special type of Gtk_Box specially tailored to contain buttons.

This is only a base class for Gtk_Hbutton_Box and Gtk_Vbutton_Box which provide a way to arrange their children horizontally (resp. vertically). You can not instantiate a Gtk_Button_Box directly, and have to use one the above two instead.

Types

  • type Gtk_Button_Box is access all Gtk_Button_Box_Record'Class;
  • type Gtk_Button_Box_Record is new Gtk.Box.Gtk_Box_Record with private;

Subprograms

  • function Get_Type return Gtk.Gtk_Type;
    Return the internal value associated with a Gtk_Button_Box.
  • procedure Set_Layout (Button_Box : access Gtk_Button_Box_Record; Layout_Style : Enums.Gtk_Button_Box_Style);
    function Get_Layout (Button_Box : access Gtk_Button_Box_Record) return Enums.Gtk_Button_Box_Style;
    Set the layout to use for the box. There are four such styles:

    - Buttonbox_Spread: The children are spread regularly across the box

    - Buttonbox_Edge : Same as Spread, except that the first and last children are aligned on the border of the box.

    - Buttonbox_Start : The children are put as much to the left (resp. top) as possible in the box.

    - Buttonbox_End : The children are put as much to the right (resp. bottom) as possible in the box.

  • procedure Set_Child_Secondary (Button_Box : access Gtk_Button_Box_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class; Is_Secondary : Boolean);
    function Get_Child_Secondary (Widget : access Gtk_Button_Box_Record; Child : access Gtk.Widget.Gtk_Widget_Record'Class) return Boolean;
    Set whether Child should appear in a secondary group of children. A typical use of a secondary child is the help button in a dialog.

    This group appears after the other children if the style is Buttonbox_Start, Buttonbox_Spread or Buttonbox_Edge, and before the other children if the style is Buttonbox_End. For horizontal button boxes, the definition of before/after depends on direction of the widget. (See Gtk.Widget.Set_Direction) If the style is Buttonbox_Start, or Buttonbox_End, then the secondary children are aligned at the other end of the button box from the main children. For the other styles, they appear immediately next to the main children.

    Is_Secondary: if True, the Child appears in a secondary group of the button box.

Signals

Properties

  • Child_Secondary_Property
    Boolean
    If True, the child appears in a secondary group of children,
  • Layout_Style_Property
    Gtk_Button_Box_Style
    How to layout the buttons in the box.
    See: Same as calling Set_Layout.

Child Properties

  • Secondary_Property
    Boolean
    If TRUE, the child appears in a secondary group of children,

Style Properties

  • Child_Internal_Pad_X_Property
    Int
    Amount to increase child's size on either side
  • Child_Internal_Pad_Y_Property
    Int
    Amount to increase child's size on the top and bottom
  • Child_Min_Height_Property
    Int
    Minimum height of buttons inside the box
  • Child_Min_Width_Property
    Int
    Minimum width of buttons inside the box

Testgtk source code

This code is part of testgtk, a demo application packaged with GtkAda. Testgtk demonstrates the various widgets of GtkAda
----------------------------------------------------------------------- -- GtkAda - Ada95 binding for the Gimp Toolkit -- -- -- -- Copyright (C) 1998-1999 -- -- Emmanuel Briot, Joel Brobecker and Arnaud Charlet -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public -- -- License as published by the Free Software Foundation; either -- -- version 2 of the License, or (at your option) any later version. -- -- -- -- This library is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. -- -- -- -- You should have received a copy of the GNU General Public -- -- License along with this library; if not, write to the -- -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- -- Boston, MA 02111-1307, USA. -- -- -- -- -- -- -- -- -- -- ----------------------------------------------------------------------- with Glib; use Glib; with Gtk.Box; use Gtk.Box; with Gtk.Button; use Gtk.Button; with Gtk.Button_Box; use Gtk.Button_Box; with Gtk.Enums; use Gtk.Enums; with Gtk.Frame; use Gtk.Frame; with Gtk.Hbutton_Box; use Gtk.Hbutton_Box; with Gtk.Vbutton_Box; use Gtk.Vbutton_Box; with Gtk; use Gtk; package body Create_Button_Box is function Create_Bbox (Horizontal : in Boolean; Title : in String; Spacing : in Gint; Child_W : in Gint; Child_H : in Gint; Layout : in Gtk_Button_Box_Style) return Gtk_Frame; -- Create one of the sample button box ---------- -- Help -- ---------- function Help return String is begin return "This demo demonstrates the possible @bLayout@B that can be used" & " with a @bGtk_Button_Box@B widget." & ASCII.LF & "A @bGtk_Button_Box@B is a special kind of @bGtk_Box@B, homogeneous," & " which can organize its children according to a special layout." & ASCII.LF & "All the boxes here are created exactly the same way, and only the" & " layout differs."; end Help; ----------------- -- Create_Bbox -- ----------------- function Create_Bbox (Horizontal : in Boolean; Title : in String; Spacing : in Gint; Child_W : in Gint; Child_H : in Gint; Layout : in Gtk_Button_Box_Style) return Gtk_Frame is Bbox : Gtk_Button_Box; Button : Gtk_Button; Frame : Gtk_Frame; begin Gtk_New (Frame, Label => Title); if Horizontal then declare B : Gtk_Hbutton_Box; begin Gtk_New (B); Bbox := Gtk_Button_Box (B); end; else declare B : Gtk_Vbutton_Box; begin Gtk_New (B); Bbox := Gtk_Button_Box (B); end; end if; Set_Border_Width (Bbox, Border_Width => 5); Add (Frame, Bbox); Set_Layout (Bbox, Layout); Set_Spacing (Bbox, Spacing); Set_Child_Size (Bbox, Child_W, Child_H); Gtk_New (Button, Label => "OK"); Add (Bbox, Button); Gtk_New (Button, Label => "Cancel"); Add (Bbox, Button); Gtk_New (Button, Label => "Help"); Add (Bbox, Button); return Frame; end Create_Bbox; --------- -- Run -- --------- procedure Run (Frame : access Gtk.Frame.Gtk_Frame_Record'Class) is Vbox : Gtk_Box; Hbox : Gtk_Box; Main_Vbox : Gtk_Box; Frame_Horz : Gtk_Frame; Frame_Vert : Gtk_Frame; begin Set_Label (Frame, "Button Box"); Gtk_New_Vbox (Main_Vbox, Homogeneous => False, Spacing => 0); Add (Frame, Main_Vbox); Gtk_New (Frame_Horz, "Horizontal Button Boxes"); Pack_Start (Main_Vbox, Child => Frame_Horz, Expand => True, Fill => True, Padding => 10); Gtk_New_Vbox (Vbox, Homogeneous => False, Spacing => 0); Set_Border_Width (Vbox, Border_Width => 10); Add (Frame_Horz, Vbox); Pack_Start (Vbox, Create_Bbox (True, "Spread", 40, 85, 20, Buttonbox_Spread), True, True, 0); Pack_Start (Vbox, Create_Bbox (True, "Edge", 40, 85, 20, Buttonbox_Edge), True, True, 5); Pack_Start (Vbox, Create_Bbox (True, "Start", 40, 85, 20, Buttonbox_Start), True, True, 5); Pack_Start (Vbox, Create_Bbox (True, "End", 40, 85, 20, Buttonbox_End), True, True, 5); Gtk_New (Frame_Vert, "Vertical Button Boxes"); Pack_Start (Main_Vbox, Frame_Vert, Expand => True, Fill => True, Padding => 10); Gtk_New_Hbox (Hbox, Homogeneous => False, Spacing => 0); Set_Border_Width (Hbox, Border_Width => 10); Add (Frame_Vert, Hbox); Pack_Start (Hbox, Create_Bbox (False, "Spread", 30, 85, 20, Buttonbox_Spread), True, True, 0); Pack_Start (Hbox, Create_Bbox (False, "Edge", 30, 85, 20, Buttonbox_Edge), True, True, 5); Pack_Start (Hbox, Create_Bbox (False, "Start", 30, 85, 20, Buttonbox_Start), True, True, 5); Pack_Start (Hbox, Create_Bbox (False, "End", 30, 85, 20, Buttonbox_End), True, True, 5); Show_All (Main_Vbox); end Run; end Create_Button_Box;

Alphabetical Index