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. -- As a special exception, if other files instantiate generics from  -- 
  22. -- this unit, or you link this unit with other files to produce an   -- 
  23. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  24. -- executable to be covered by the GNU General Public License. This  -- 
  25. -- exception does not however invalidate any other reasons why the   -- 
  26. -- executable file  might be covered by the  GNU Public License.     -- 
  27. ----------------------------------------------------------------------- 
  28.  
  29. --  <description> 
  30. --  This package defines a special kind of Gtk.Toolbar child that embeds a 
  31. --  button. 
  32. --  See also gtk-toggle_tool_button.ads, gtk-radio_tool_button.ads and 
  33. --  gtk-menu_tool_button.ads 
  34. --  </description> 
  35. --  <c_version>2.8.17</c_version> 
  36. --  <group>Menus and Toolbars</group> 
  37.  
  38. with Glib.Properties; 
  39. with Gtk.Tool_Item; 
  40. with Gtk.Widget; 
  41.  
  42. package Gtk.Tool_Button is 
  43.  
  44.    type Gtk_Tool_Button_Record is new Gtk.Tool_Item.Gtk_Tool_Item_Record 
  45.       with null record; 
  46.    type Gtk_Tool_Button is access all Gtk_Tool_Button_Record'Class; 
  47.  
  48.    ---------------------- 
  49.    -- Creating buttons -- 
  50.    ---------------------- 
  51.  
  52.    procedure Gtk_New 
  53.      (Button      : out Gtk_Tool_Button; 
  54.       Icon_Widget : Gtk.Widget.Gtk_Widget := null; 
  55.       Label       : String := ""); 
  56.    procedure Initialize 
  57.      (Button      : access Gtk_Tool_Button_Record'Class; 
  58.       Icon_Widget : Gtk.Widget.Gtk_Widget := null; 
  59.       Label       : String := ""); 
  60.    --  Create or initialize a button, given its icon and label. Any of the 
  61.    --  parameters can be left unspecified if the button has none of these. 
  62.  
  63.    procedure Gtk_New_From_Stock 
  64.      (Button   : out Gtk_Tool_Button; 
  65.       Stock_Id : String); 
  66.    procedure Initialize_From_Stock 
  67.      (Button   : access Gtk_Tool_Button_Record'Class; 
  68.       Stock_Id : String); 
  69.    --  Create or initialize a button from a stock icon (see gtk-stock.ads) 
  70.  
  71.    function Get_Type return GType; 
  72.    --  Return the internal type used for this widget class 
  73.  
  74.    procedure Set_Icon_Name 
  75.      (Button    : access Gtk_Tool_Button_Record; 
  76.       Icon_Name : String); 
  77.    function Get_Icon_Name 
  78.      (Button : access Gtk_Tool_Button_Record)  return String; 
  79.    --  Sets the icon for the tool button from a named themed icon. 
  80.    --  See the docs for Gtk.Icon_them for more details. 
  81.    --  The "icon_name" property only has an effect if not overriden by non-null 
  82.    --  "label", "icon_widget" or "stock_id" properties 
  83.  
  84.    procedure Set_Icon_Widget 
  85.      (Button      : access Gtk_Tool_Button_Record; 
  86.       Icon_Widget : Gtk.Widget.Gtk_Widget := null); 
  87.    function Get_Icon_Widget 
  88.      (Button : access Gtk_Tool_Button_Record) 
  89.       return Gtk.Widget.Gtk_Widget; 
  90.    --  Sets or gets the widget used as icon on Button. 
  91.    --  If Icon_Widget is null, the icon used for the button is determined by 
  92.    --  the "stock_id" property. If the latter is also null, the button has no 
  93.    --  icon 
  94.  
  95.    procedure Set_Label 
  96.      (Button : access Gtk_Tool_Button_Record; 
  97.       Label  : String); 
  98.    function Get_Label 
  99.      (Button : access Gtk_Tool_Button_Record) return String; 
  100.    --  Sets or gets the label used for the button. The "label" property only 
  101.    --  has an effect if not overridden by a non-null "label_widget" property. 
  102.    --  If both are null, the label comes from the "stock_id" properties. If 
  103.    --  also null, the button has no label. Get_Label only returns the value of 
  104.    --  the "labeL" property. 
  105.  
  106.    procedure Set_Label_Widget 
  107.      (Button       : access Gtk_Tool_Button_Record; 
  108.       Label_Widget : Gtk.Widget.Gtk_Widget := null); 
  109.    function Get_Label_Widget 
  110.      (Button : access Gtk_Tool_Button_Record) 
  111.       return Gtk.Widget.Gtk_Widget; 
  112.    --  Sets Label_Widget as the widget that will be used as the label for the 
  113.    --  button. If this is null, the "label" property is used as label. 
  114.  
  115.    procedure Set_Stock_Id 
  116.      (Button   : access Gtk_Tool_Button_Record; 
  117.       Stock_Id : String); 
  118.    function Get_Stock_Id 
  119.      (Button : access Gtk_Tool_Button_Record) return String; 
  120.    --  Sets the name of the stock item. This property has no effect if 
  121.    --  overriden by non-null "label" or "icon_widget" properties. 
  122.  
  123.    procedure Set_Use_Underline 
  124.      (Button        : access Gtk_Tool_Button_Record; 
  125.       Use_Underline : Boolean := True); 
  126.    function Get_Use_Underline 
  127.      (Button : access Gtk_Tool_Button_Record) 
  128.       return Boolean; 
  129.    --  If Use_Underline is true, an underline in the label property indicates 
  130.    --  that the next character should be used a mnemonic accelerator key in the 
  131.    --  overflow menu of the toolbar. For instance, if the label is "_Open", 
  132.    --  the item in the overflow menu can be activated with alt-O. 
  133.    --  Labels shown on tool buttons never have mnemonics on them. 
  134.  
  135.    ------------- 
  136.    -- Signals -- 
  137.    ------------- 
  138.  
  139.    --  <signals> 
  140.    --  The following new signals are defined for this widget: 
  141.    -- 
  142.    --  - "clicked" 
  143.    --    procedure Handler 
  144.    --       (Button : access Gtk_Tool_Button_Record'Class); 
  145.    --    Emitted when the button is clicked with the mouse or activated with 
  146.    --    the keyboard. 
  147.    -- 
  148.    --  </signals> 
  149.  
  150.    Signal_Clicked : constant Glib.Signal_Name := "clicked"; 
  151.  
  152.    ---------------- 
  153.    -- Properties -- 
  154.    ---------------- 
  155.  
  156.    --  <properties> 
  157.    --  The following properties are defined for this widget. See 
  158.    --  Glib.Properties for more information on properties. 
  159.    -- 
  160.    --  Name: Label_Property 
  161.    --  Type: String 
  162.    --  See : Set_Label / Get_Label 
  163.    -- 
  164.    --  Name: Use_Underline_Property 
  165.    --  Type: Boolean 
  166.    --  See : Set_Use_Underline / Get_Use_Underline 
  167.    -- 
  168.    --  Name: Label_Widget_Property 
  169.    --  Type: Object 
  170.    --  See : Set_Label_Widget / Get_Label_Widget 
  171.    -- 
  172.    --  Name: Stock_Id_Property 
  173.    --  Type: String 
  174.    --  See : Set_Stock_Id / Get_Stock_Id 
  175.    -- 
  176.    --  Name: Icon_Name_Property 
  177.    --  Type: String 
  178.    --  See : Set_Icon_Name / Get_Icon_Name 
  179.    -- 
  180.    --  Name: Icon_Widget_Property 
  181.    --  Type: Object 
  182.    --  See : Set_Icon_Widget / Get_Icon_Widget 
  183.    -- 
  184.    --  </properties> 
  185.  
  186.    Label_Property         : constant Glib.Properties.Property_String; 
  187.    Use_Underline_Property : constant Glib.Properties.Property_Boolean; 
  188.    Label_Widget_Property  : constant Glib.Properties.Property_Object; 
  189.    Stock_Id_Property      : constant Glib.Properties.Property_String; 
  190.    Icon_Name_Property     : constant Glib.Properties.Property_String; 
  191.    Icon_Widget_Property   : constant Glib.Properties.Property_Object; 
  192.  
  193. private 
  194.    Label_Property         : constant Glib.Properties.Property_String := 
  195.      Glib.Properties.Build ("label"); 
  196.    Use_Underline_Property : constant Glib.Properties.Property_Boolean := 
  197.      Glib.Properties.Build ("use-underline"); 
  198.    Label_Widget_Property  : constant Glib.Properties.Property_Object := 
  199.      Glib.Properties.Build ("label-widget"); 
  200.    Stock_Id_Property      : constant Glib.Properties.Property_String := 
  201.      Glib.Properties.Build ("stock-id"); 
  202.    Icon_Name_Property     : constant Glib.Properties.Property_String := 
  203.      Glib.Properties.Build ("icon-name"); 
  204.    Icon_Widget_Property   : constant Glib.Properties.Property_Object := 
  205.      Glib.Properties.Build ("icon-widget"); 
  206.  
  207.    pragma Import (C, Get_Type, "gtk_tool_button_get_type"); 
  208. end Gtk.Tool_Button;