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