1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   -- 
  5. --                Copyright (C) 2000-2007 AdaCore                    -- 
  6. --                                                                   -- 
  7. -- This library is free software; you can redistribute it and/or     -- 
  8. -- modify it under the terms of the GNU General Public               -- 
  9. -- License as published by the Free Software Foundation; either      -- 
  10. -- version 2 of the License, or (at your option) any later version.  -- 
  11. --                                                                   -- 
  12. -- This library is distributed in the hope that it will be useful,   -- 
  13. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  14. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  15. -- General Public License for more details.                          -- 
  16. --                                                                   -- 
  17. -- You should have received a copy of the GNU General Public         -- 
  18. -- License along with this library; if not, write to the             -- 
  19. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  20. -- Boston, MA 02111-1307, USA.                                       -- 
  21. --                                                                   -- 
  22. -- -- -- -- -- -- -- -- -- -- -- --
  23. ----------------------------------------------------------------------- 
  24.  
  25. --  <description> 
  26. --  A status bar is a special widget in which you can display messages. 
  27. --  This type of widget is generally found at the bottom of application 
  28. --  windows, and is used to display help or error messages. 
  29. -- 
  30. --  This widget works as a stack of messages, ie all older messages are 
  31. --  kept when a new one is inserted. It is of course possible to remove the 
  32. --  most recent message from the stack. 
  33. --  This stack behavior is especially useful when messages can be displayed 
  34. --  from several places in your application. Thus, each one subprogram that 
  35. --  needs to print a message can simply push it on the stack, and does not 
  36. --  need to make sure that the user has had enough time to read the previous 
  37. --  message (a timeout can be set to automatically remove the message after 
  38. --  a specific delay) 
  39. -- 
  40. --  Each message is associated with a specific Context_Id. Each of this context 
  41. --  can have a special name, and these context can be used to organize the 
  42. --  messages into categories (for instance one for help messages and one for 
  43. --  error messages). You can then selectively remove the most recent message 
  44. --  of each category. 
  45. --  </description> 
  46. --  <c_version>2.8.17</c_version> 
  47. --  <group>Display widgets</group> 
  48. --  <testgtk>create_status.adb</testgtk> 
  49. --  <screenshot>gtk-status_bar</screenshot> 
  50.  
  51. with Gtk.Box; 
  52. with Interfaces.C.Strings; 
  53. with Glib.Properties; 
  54. with Glib.GSlist; 
  55. pragma Elaborate_All (Glib.GSlist); 
  56. with System; 
  57. with Gtk.Enums; 
  58.  
  59. package Gtk.Status_Bar is 
  60.  
  61.    type Gtk_Status_Bar_Record is new Gtk.Box.Gtk_Box_Record with private; 
  62.    type Gtk_Status_Bar is access all Gtk_Status_Bar_Record'Class; 
  63.  
  64.    subtype Gtk_Statusbar is Gtk_Status_Bar; 
  65.    --  This is needed by Gate since the C name is GtkStatusbar 
  66.  
  67.    type Context_Id is new Guint; 
  68.    type Message_Id is new Guint; 
  69.  
  70.    type Status_Bar_Msg is record 
  71.       Text    : Interfaces.C.Strings.chars_ptr; 
  72.       Context : Context_Id; 
  73.       Message : Message_Id; 
  74.    end record; 
  75.    --  A message from the queue. Each of this message is associated with a 
  76.    --  specific context, and has a specific number. 
  77.  
  78.    --  <no_doc> 
  79.    function Convert (Msg : Status_Bar_Msg) return System.Address; 
  80.    function Convert (Msg : System.Address) return Status_Bar_Msg; 
  81.    package Messages_List is new Glib.GSlist.Generic_SList (Status_Bar_Msg); 
  82.    --  </no_doc> 
  83.  
  84.    procedure Gtk_New (Statusbar : out Gtk_Status_Bar); 
  85.    --  Create a new status bar, in which messages will be displayed. 
  86.  
  87.    procedure Initialize (Statusbar : access Gtk_Status_Bar_Record'Class); 
  88.    --  Internal initialization function. 
  89.  
  90.    function Get_Type return Gtk.Gtk_Type; 
  91.    --  Return the internal value associated with a Gtk_Status_Bar. 
  92.  
  93.    function Get_Context_Id 
  94.      (Statusbar           : access Gtk_Status_Bar_Record; 
  95.       Context_Description : String) return Context_Id; 
  96.    --  Create the context id associated with a special name. 
  97.    --  If no context is currently associated with Context_Description, then 
  98.    --  a new context is created. 
  99.  
  100.    function Get_Messages 
  101.      (Statusbar : access Gtk_Status_Bar_Record) return Messages_List.GSlist; 
  102.    --  Return a list of all the messages currently stored in the queue. 
  103.    --  The first item in the list is the most recent message. 
  104.  
  105.    function Push 
  106.      (Statusbar : access Gtk_Status_Bar_Record; 
  107.       Context   : Context_Id; 
  108.       Text      : UTF8_String) return Message_Id; 
  109.    --  Push a new message on the queue, associated with a specific context. 
  110.    --  This message is directly displayed in the status bar. 
  111.    --  A new unique message id is associated with this message. 
  112.  
  113.    procedure Pop 
  114.      (Statusbar : access Gtk_Status_Bar_Record; 
  115.       Context   : Context_Id); 
  116.    --  Remove the most recent message from a specific context. All other 
  117.    --  contexts are ignored, and no error is raised if there is no message in 
  118.    --  Context. 
  119.  
  120.    procedure Remove 
  121.      (Statusbar  : access Gtk_Status_Bar_Record; 
  122.       Context    : Context_Id; 
  123.       Message    : Message_Id); 
  124.    --  Remove a message from the list. 
  125.    --  The message is only removed if it is in a specific context. 
  126.    --  Nothing happens if no matching message is found. 
  127.  
  128.    procedure Set_Has_Resize_Grip 
  129.      (Statusbar  : access Gtk_Status_Bar_Record; 
  130.       Setting    : Boolean); 
  131.    function Get_Has_Resize_Grip 
  132.      (Statusbar : access Gtk_Status_Bar_Record) return Boolean; 
  133.    --  Set or gets the value of the resize_grip attribute for a given status 
  134.    --  bar. This indicates whether the status bar has a handle that, when 
  135.    --  dragged, will resize the toplevel window that contains the status bar. 
  136.  
  137.    ---------------- 
  138.    -- Properties -- 
  139.    ---------------- 
  140.    --  The following properties are defined for this widget. See 
  141.    --  Glib.Properties for more information on properties. 
  142.  
  143.    --  <properties> 
  144.    --  Name:  Has_Resize_Grip_Property 
  145.    --  Type:  Boolean 
  146.    --  Descr: Whether the statusbar has a grip for resizing the toplevel 
  147.    --  </properties> 
  148.  
  149.    Has_Resize_Grip_Property : constant Glib.Properties.Property_Boolean; 
  150.  
  151.    ---------------------- 
  152.    -- Style Properties -- 
  153.    ---------------------- 
  154.    --  The following properties can be changed through the gtk theme and 
  155.    --  configuration files, and retrieved through Gtk.Widget.Style_Get_Property 
  156.  
  157.    --  <style_properties> 
  158.    --  Name:  Shadow_Type_Property 
  159.    --  Type:  Enum 
  160.    --  Descr: Style of bevel around the statusbar text 
  161.    --  </style_properties> 
  162.  
  163.    Shadow_Type_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type; 
  164.  
  165.    ------------- 
  166.    -- Signals -- 
  167.    ------------- 
  168.  
  169.    --  <signals> 
  170.    --  The following new signals are defined for this widget: 
  171.    -- 
  172.    --  - "text_pushed" 
  173.    --    procedure Handler 
  174.    --      (Status_Bar : access Gtk_Status_Bar_Record'Class; 
  175.    --       Context    : Context_Id; 
  176.    --       Text       : Interfaces.C.Strings.chars_ptr); 
  177.    --    Emitted when a new message has been in the queue. 
  178.    -- 
  179.    --  - "text_popped" 
  180.    --    procedure Handler 
  181.    --      (Status_Bar : access Gtk_Status_Bar_Record'Class; 
  182.    --       Context    : Context_Id; 
  183.    --       Text       : Interfaces.C.Strings.chars_ptr); 
  184.    --    Emitted when a message has been removed from the queue. 
  185.    -- 
  186.    --  </signals> 
  187.  
  188.    Signal_Text_Popped : constant Glib.Signal_Name := "text_popped"; 
  189.    Signal_Text_Pushed : constant Glib.Signal_Name := "text_pushed"; 
  190.  
  191. private 
  192.    type Gtk_Status_Bar_Record is new Gtk.Box.Gtk_Box_Record with null record; 
  193.  
  194.    Has_Resize_Grip_Property : constant Glib.Properties.Property_Boolean := 
  195.      Glib.Properties.Build ("has-resize-grip"); 
  196.  
  197.    Shadow_Type_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type := 
  198.      Gtk.Enums.Build ("shadow-type"); 
  199.  
  200.    pragma Import (C, Get_Type, "gtk_statusbar_get_type"); 
  201. end Gtk.Status_Bar;