1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2000-2009, 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. --  Tooltips are the small text windows that popup when the mouse rests over 
  26. --  a widget, and that provide a quick help for the user. 
  27. -- 
  28. --  In GtkAda, all tooltips belong to a group (a Gtk_Tooltips). All the 
  29. --  individual tooltips in a group can be disabled or enabled at the same 
  30. --  time. Likewise, the colors and style of a tooltip can be set on a group 
  31. --  basis. 
  32. -- 
  33. --  See the example at the end for how to change the default colors used 
  34. --  for tooltips. 
  35. --  </description> 
  36. --  <c_version>2.8.17</c_version> 
  37. --  <testgtk>create_tooltips.adb</testgtk> 
  38.  
  39. with Glib; 
  40. with Gtk.Enums; 
  41. with Gtk.Object; 
  42. with Gtk.Widget; 
  43.  
  44. package Gtk.Tooltips is 
  45.  
  46.    type Gtk_Tooltips_Record is new Gtk.Object.Gtk_Object_Record with private; 
  47.    type Gtk_Tooltips is access all Gtk_Tooltips_Record'Class; 
  48.  
  49.    --  <doc_ignore> 
  50.    type Tooltips_Data 
  51.      (Text_Length : Natural; Private_Length : Natural) is 
  52.    record 
  53.       Tooltips     : Gtk_Tooltips;    -- the group of the tooltip 
  54.       Widget       : Gtk.Widget.Gtk_Widget; -- the widget to which it applies 
  55.       Text         : UTF8_String (1 .. Text_Length); -- the text of the tooltip 
  56.       Text_Private : UTF8_String (1 .. Private_Length); -- the private text 
  57.    end record; 
  58.    --  </doc_ignore> 
  59.  
  60.    procedure Gtk_New (Widget : out Gtk_Tooltips); 
  61.    --  Create a new group of tooltips. 
  62.  
  63.    procedure Initialize (Widget : access Gtk_Tooltips_Record'Class); 
  64.    --  Internal initialization function. 
  65.    --  See the section "Creating your own widgets" in the documentation. 
  66.  
  67.    function Get_Type return Glib.GType; 
  68.    --  Return the internal value associated with a Gtk_Tooltips. 
  69.  
  70.    procedure Enable (Tooltips : access Gtk_Tooltips_Record); 
  71.    --  Enable all the tooltips in the group. 
  72.    --  From now on, when the mouse rests over a widget for a short period of 
  73.    --  time, the help text is automatically displayed. 
  74.  
  75.    procedure Disable (Tooltips : access Gtk_Tooltips_Record); 
  76.    --  Disable all the tooptips in the group. 
  77.    --  From now on, no tooltips in this group will appear, unless they are 
  78.    --  re-enabled. 
  79.  
  80.    procedure Set_Tip 
  81.      (Tooltips    : access Gtk_Tooltips_Record; 
  82.       Widget      : access Gtk.Widget.Gtk_Widget_Record'Class; 
  83.       Tip_Text    : UTF8_String; 
  84.       Tip_Private : UTF8_String := ""); 
  85.    --  Add a new tooltip to Widget. 
  86.    --  The message that appears in the tooltip is Tip_Text, and the tooltip 
  87.    --  belongs to the group Tooltips. 
  88.    --  Tip_Private contains more information, that can be displayed by a 
  89.    --  Gtk_Tips_Query widget through the "widget_selected" signal. 
  90.    --  In most cases, Tip_Private should simply keep its default empty value. 
  91.  
  92.    function Get_Data 
  93.      (Widget : access Gtk.Widget.Gtk_Widget_Record'Class) return Tooltips_Data; 
  94.    --  Return the tooltip data associated with the Widget. 
  95.    --  If there is none, the two text fields in the returned structure have 
  96.    --  a length 0. 
  97.  
  98.    procedure Force_Window (Widget : access Gtk_Tooltips_Record); 
  99.    --  Make sure the window in which the tooltips will be displayed is 
  100.    --  created. 
  101.    --  This is useful if you want to modify some characteristics of that 
  102.    --  window. 
  103.  
  104.    procedure Set_Markup 
  105.      (Tooltips : access Gtk_Tooltips_Record; 
  106.       Text     : UTF8_String); 
  107.    --  Sets the text of the tooltip to be markup, which is marked up with the 
  108.    --  Pango text markup language. If markup is empty string, the label will be 
  109.    --  hidden. 
  110.  
  111.    procedure Set_Icon_From_Stock 
  112.      (Tooltips : access Gtk_Tooltips_Record; 
  113.       Stock_Id : String; 
  114.       Size     : Gtk.Enums.Gtk_Icon_Size); 
  115.    --  Sets the icon of the tooltip (which is in front of the text) to be the 
  116.    --  stock item indicated by stock_id with the size indicated by size. If 
  117.    --  stock_id is emtry string, the image will be hidden. 
  118.  
  119.    ----------------- 
  120.    -- Obsolescent -- 
  121.    ----------------- 
  122.    --  All subprograms below are now obsolescent in gtk+. They might be removed 
  123.    --  from future versions of gtk+ (and therefore GtkAda). 
  124.    --  To find out whether your code uses any of these, we recommend compiling 
  125.    --  with the -gnatwj switch 
  126.    --  <doc_ignore> 
  127.  
  128.    procedure Set_Delay 
  129.      (Tooltips : access Gtk_Tooltips_Record; 
  130.       Duration : Guint := 500); 
  131.    pragma Obsolescent;  --  Set_Delay 
  132.    --  Set the delay between the user moving the mouse over a widget and the 
  133.    --  text appearing. Duration is in milli-seconds. 
  134.  
  135.    --  </doc_ignore> 
  136.  
  137.    ---------------- 
  138.    -- Properties -- 
  139.    ---------------- 
  140.  
  141.    --  <properties> 
  142.    --  The following properties are defined for this widget. See 
  143.    --  Glib.Properties for more information on properties. 
  144.    -- 
  145.    --  </properties> 
  146.  
  147.    ------------- 
  148.    -- Signals -- 
  149.    ------------- 
  150.  
  151.    --  <signals> 
  152.    --  The following new signals are defined for this widget: 
  153.    --  </signals> 
  154.  
  155. private 
  156.    type Gtk_Tooltips_Record is 
  157.      new Gtk.Object.Gtk_Object_Record with null record; 
  158.  
  159.    pragma Import (C, Get_Type, "gtk_tooltips_get_type"); 
  160. end Gtk.Tooltips; 
  161.  
  162. --  <example> 
  163. --  <include>../examples/documentation/tooltips.adb</include> 
  164. --  </example> 
  165.  
  166. --  No binding: gtk_tooltips_get_info_from_tip_window