1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2006-2007 AdaCore                    -- 
  5. --                                                                   -- 
  6. -- This library is free software; you can redistribute it and/or     -- 
  7. -- modify it under the terms of the GNU General Public               -- 
  8. -- License as published by the Free Software Foundation; either      -- 
  9. -- version 2 of the License, or (at your option) any later version.  -- 
  10. --                                                                   -- 
  11. -- This library is distributed in the hope that it will be useful,   -- 
  12. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  13. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  14. -- General Public License for more details.                          -- 
  15. --                                                                   -- 
  16. -- You should have received a copy of the GNU General Public         -- 
  17. -- License along with this library; if not, write to the             -- 
  18. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  19. -- Boston, MA 02111-1307, USA.                                       -- 
  20. --                                                                   -- 
  21. -- -- -- -- -- -- -- -- -- -- -- --
  22. ----------------------------------------------------------------------- 
  23.  
  24. --  <description> 
  25. --  This package defines a special kind of Gtk.Toolbar child that embeds a 
  26. --  button. 
  27. --  See also gtk-toggle_tool_button.ads, gtk-radio_tool_button.ads and 
  28. --  gtk-menu_tool_button.ads 
  29. --  </description> 
  30. --  <c_version>2.8.17</c_version> 
  31. --  <group>Menus and Toolbars</group> 
  32.  
  33. with Glib.Properties; 
  34. with Gtk.Tool_Item; 
  35. with Gtk.Widget; 
  36.  
  37. package Gtk.Tool_Button is 
  38.  
  39.    type Gtk_Tool_Button_Record is new Gtk.Tool_Item.Gtk_Tool_Item_Record 
  40.       with null record; 
  41.    type Gtk_Tool_Button is access all Gtk_Tool_Button_Record'Class; 
  42.  
  43.    ---------------------- 
  44.    -- Creating buttons -- 
  45.    ---------------------- 
  46.  
  47.    procedure Gtk_New 
  48.      (Button      : out Gtk_Tool_Button; 
  49.       Icon_Widget : Gtk.Widget.Gtk_Widget := null; 
  50.       Label       : String := ""); 
  51.    procedure Initialize 
  52.      (Button      : access Gtk_Tool_Button_Record'Class; 
  53.       Icon_Widget : Gtk.Widget.Gtk_Widget := null; 
  54.       Label       : String := ""); 
  55.    --  Create or initialize a button, given its icon and label. Any of the 
  56.    --  parameters can be left unspecified if the button has none of these. 
  57.  
  58.    procedure Gtk_New_From_Stock 
  59.      (Button   : out Gtk_Tool_Button; 
  60.       Stock_Id : String); 
  61.    procedure Initialize_From_Stock 
  62.      (Button   : access Gtk_Tool_Button_Record'Class; 
  63.       Stock_Id : String); 
  64.    --  Create or initialize a button from a stock icon (see gtk-stock.ads) 
  65.  
  66.    function Get_Type return GType; 
  67.    --  Return the internal type used for this widget class 
  68.  
  69.    procedure Set_Icon_Name 
  70.      (Button    : access Gtk_Tool_Button_Record; 
  71.       Icon_Name : String); 
  72.    function Get_Icon_Name 
  73.      (Button : access Gtk_Tool_Button_Record)  return String; 
  74.    --  Sets the icon for the tool button from a named themed icon. 
  75.    --  See the docs for Gtk.Icon_them for more details. 
  76.    --  The "icon_name" property only has an effect if not overriden by non-null 
  77.    --  "label", "icon_widget" or "stock_id" properties 
  78.  
  79.    procedure Set_Icon_Widget 
  80.      (Button      : access Gtk_Tool_Button_Record; 
  81.       Icon_Widget : Gtk.Widget.Gtk_Widget := null); 
  82.    function Get_Icon_Widget 
  83.      (Button : access Gtk_Tool_Button_Record) 
  84.       return Gtk.Widget.Gtk_Widget; 
  85.    --  Sets or gets the widget used as icon on Button. 
  86.    --  If Icon_Widget is null, the icon used for the button is determined by 
  87.    --  the "stock_id" property. If the latter is also null, the button has no 
  88.    --  icon 
  89.  
  90.    procedure Set_Label 
  91.      (Button : access Gtk_Tool_Button_Record; 
  92.       Label  : String); 
  93.    function Get_Label 
  94.      (Button : access Gtk_Tool_Button_Record) return String; 
  95.    --  Sets or gets the label used for the button. The "label" property only 
  96.    --  has an effect if not overridden by a non-null "label_widget" property. 
  97.    --  If both are null, the label comes from the "stock_id" properties. If 
  98.    --  also null, the button has no label. Get_Label only returns the value of 
  99.    --  the "labeL" property. 
  100.  
  101.    procedure Set_Label_Widget 
  102.      (Button       : access Gtk_Tool_Button_Record; 
  103.       Label_Widget : Gtk.Widget.Gtk_Widget := null); 
  104.    function Get_Label_Widget 
  105.      (Button : access Gtk_Tool_Button_Record) 
  106.       return Gtk.Widget.Gtk_Widget; 
  107.    --  Sets Label_Widget as the widget that will be used as the label for the 
  108.    --  button. If this is null, the "label" property is used as label. 
  109.  
  110.    procedure Set_Stock_Id 
  111.      (Button   : access Gtk_Tool_Button_Record; 
  112.       Stock_Id : String); 
  113.    function Get_Stock_Id 
  114.      (Button : access Gtk_Tool_Button_Record) return String; 
  115.    --  Sets the name of the stock item. This property has no effect if 
  116.    --  overriden by non-null "label" or "icon_widget" properties. 
  117.  
  118.    procedure Set_Use_Underline 
  119.      (Button        : access Gtk_Tool_Button_Record; 
  120.       Use_Underline : Boolean := True); 
  121.    function Get_Use_Underline 
  122.      (Button : access Gtk_Tool_Button_Record) 
  123.       return Boolean; 
  124.    --  If Use_Underline is true, an underline in the label property indicates 
  125.    --  that the next character should be used a mnemonic accelerator key in the 
  126.    --  overflow menu of the toolbar. For instance, if the label is "_Open", 
  127.    --  the item in the overflow menu can be activated with alt-O. 
  128.    --  Labels shown on tool buttons never have mnemonics on them. 
  129.  
  130.    ------------- 
  131.    -- Signals -- 
  132.    ------------- 
  133.  
  134.    --  <signals> 
  135.    --  The following new signals are defined for this widget: 
  136.    -- 
  137.    --  - "clicked" 
  138.    --    procedure Handler 
  139.    --       (Button : access Gtk_Tool_Button_Record'Class); 
  140.    --    Emitted when the button is clicked with the mouse or activated with 
  141.    --    the keyboard. 
  142.    -- 
  143.    --  </signals> 
  144.  
  145.    Signal_Clicked : constant Glib.Signal_Name := "clicked"; 
  146.  
  147.    ---------------- 
  148.    -- Properties -- 
  149.    ---------------- 
  150.  
  151.    --  <properties> 
  152.    --  The following properties are defined for this widget. See 
  153.    --  Glib.Properties for more information on properties. 
  154.    -- 
  155.    --  Name: Label_Property 
  156.    --  Type: String 
  157.    --  See : Set_Label / Get_Label 
  158.    -- 
  159.    --  Name: Use_Underline_Property 
  160.    --  Type: Boolean 
  161.    --  See : Set_Use_Underline / Get_Use_Underline 
  162.    -- 
  163.    --  Name: Label_Widget_Property 
  164.    --  Type: Object 
  165.    --  See : Set_Label_Widget / Get_Label_Widget 
  166.    -- 
  167.    --  Name: Stock_Id_Property 
  168.    --  Type: String 
  169.    --  See : Set_Stock_Id / Get_Stock_Id 
  170.    -- 
  171.    --  Name: Icon_Name_Property 
  172.    --  Type: String 
  173.    --  See : Set_Icon_Name / Get_Icon_Name 
  174.    -- 
  175.    --  Name: Icon_Widget_Property 
  176.    --  Type: Object 
  177.    --  See : Set_Icon_Widget / Get_Icon_Widget 
  178.    -- 
  179.    --  </properties> 
  180.  
  181.    Label_Property         : constant Glib.Properties.Property_String; 
  182.    Use_Underline_Property : constant Glib.Properties.Property_Boolean; 
  183.    Label_Widget_Property  : constant Glib.Properties.Property_Object; 
  184.    Stock_Id_Property      : constant Glib.Properties.Property_String; 
  185.    Icon_Name_Property     : constant Glib.Properties.Property_String; 
  186.    Icon_Widget_Property   : constant Glib.Properties.Property_Object; 
  187.  
  188. private 
  189.    Label_Property         : constant Glib.Properties.Property_String := 
  190.      Glib.Properties.Build ("label"); 
  191.    Use_Underline_Property : constant Glib.Properties.Property_Boolean := 
  192.      Glib.Properties.Build ("use-underline"); 
  193.    Label_Widget_Property  : constant Glib.Properties.Property_Object := 
  194.      Glib.Properties.Build ("label-widget"); 
  195.    Stock_Id_Property      : constant Glib.Properties.Property_String := 
  196.      Glib.Properties.Build ("stock-id"); 
  197.    Icon_Name_Property     : constant Glib.Properties.Property_String := 
  198.      Glib.Properties.Build ("icon-name"); 
  199.    Icon_Widget_Property   : constant Glib.Properties.Property_Object := 
  200.      Glib.Properties.Build ("icon-widget"); 
  201.  
  202.    pragma Import (C, Get_Type, "gtk_tool_button_get_type"); 
  203. end Gtk.Tool_Button;