1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. --  <description> 
  25. --  A Gtk.Status_Bar.Gtk_Status_Bar is usually placed along the bottom of an 
  26. --  application's main Gtk.Window.Gtk_Window. It may provide a regular 
  27. --  commentary of the application's status (as is usually the case in a web 
  28. --  browser, for example), or may be used to simply output a message when the 
  29. --  status changes, (when an upload is complete in an FTP client, for example). 
  30. -- 
  31. --  Status bars in GTK+ maintain a stack of messages. The message at the top 
  32. --  of the each bar's stack is the one that will currently be displayed. 
  33. -- 
  34. --  Any messages added to a statusbar's stack must specify a *context id* that 
  35. --  is used to uniquely identify the source of a message. This context id can 
  36. --  be generated by Gtk.Status_Bar.Get_Context_Id, given a message and the 
  37. --  statusbar that it will be added to. Note that messages are stored in a 
  38. --  stack, and when choosing which message to display, the stack structure is 
  39. --  adhered to, regardless of the context identifier of a message. 
  40. -- 
  41. --  One could say that a statusbar maintains one stack of messages for display 
  42. --  purposes, but allows multiple message producers to maintain sub-stacks of 
  43. --  the messages they produced (via context ids). 
  44. -- 
  45. --  Status bars are created using Gtk.Status_Bar.Gtk_New. 
  46. -- 
  47. --  Messages are added to the bar's stack with Gtk.Status_Bar.Push. 
  48. -- 
  49. --  The message at the top of the stack can be removed using 
  50. --  Gtk.Status_Bar.Pop. A message can be removed from anywhere in the stack if 
  51. --  its message id was recorded at the time it was added. This is done using 
  52. --  Gtk.Status_Bar.Remove. 
  53. -- 
  54. --  </description> 
  55. --  <screenshot>gtk-status_bar</screenshot> 
  56. --  <group>Display widgets</group> 
  57. --  <testgtk>create_status.adb</testgtk> 
  58. pragma Ada_2005; 
  59.  
  60. pragma Warnings (Off, "*is already use-visible*"); 
  61. with Glib;           use Glib; 
  62. with Glib.Object;    use Glib.Object; 
  63. with Glib.Types;     use Glib.Types; 
  64. with Gtk.Box;        use Gtk.Box; 
  65. with Gtk.Buildable;  use Gtk.Buildable; 
  66. with Gtk.Enums;      use Gtk.Enums; 
  67. with Gtk.Orientable; use Gtk.Orientable; 
  68. with Gtk.Widget;     use Gtk.Widget; 
  69.  
  70. package Gtk.Status_Bar is 
  71.  
  72.    type Gtk_Status_Bar_Record is new Gtk_Box_Record with null record; 
  73.    type Gtk_Status_Bar is access all Gtk_Status_Bar_Record'Class; 
  74.  
  75.    type Context_Id is new Guint; 
  76.    type Message_Id is new Guint; 
  77.  
  78.    ------------------ 
  79.    -- Constructors -- 
  80.    ------------------ 
  81.  
  82.    procedure Gtk_New (Statusbar : out Gtk_Status_Bar); 
  83.    procedure Initialize 
  84.       (Statusbar : not null access Gtk_Status_Bar_Record'Class); 
  85.    --  Creates a new Gtk.Status_Bar.Gtk_Status_Bar ready for messages. 
  86.  
  87.    function Gtk_Status_Bar_New return Gtk_Status_Bar; 
  88.    --  Creates a new Gtk.Status_Bar.Gtk_Status_Bar ready for messages. 
  89.  
  90.    function Get_Type return Glib.GType; 
  91.    pragma Import (C, Get_Type, "gtk_statusbar_get_type"); 
  92.  
  93.    ------------- 
  94.    -- Methods -- 
  95.    ------------- 
  96.  
  97.    function Get_Context_Id 
  98.       (Statusbar           : not null access Gtk_Status_Bar_Record; 
  99.        Context_Description : UTF8_String) return Context_Id; 
  100.    --  Returns a new context identifier, given a description of the actual 
  101.    --  context. Note that the description is *not* shown in the UI. 
  102.    --  "context_description": textual description of what context the new 
  103.    --  message is being used in 
  104.  
  105.    function Get_Message_Area 
  106.       (Statusbar : not null access Gtk_Status_Bar_Record) 
  107.        return Gtk.Widget.Gtk_Widget; 
  108.    --  Retrieves the box containing the label widget. 
  109.    --  Since: gtk+ 2.20 
  110.  
  111.    procedure Pop 
  112.       (Statusbar : not null access Gtk_Status_Bar_Record; 
  113.        Context   : Context_Id); 
  114.    --  Removes the first message in the Gtk.Status_Bar.Gtk_Status_Bar's stack 
  115.    --  with the given context id. 
  116.    --  Note that this may not change the displayed message, if the message at 
  117.    --  the top of the stack has a different context id. 
  118.    --  "context": a context identifier 
  119.  
  120.    function Push 
  121.       (Statusbar : not null access Gtk_Status_Bar_Record; 
  122.        Context   : Context_Id; 
  123.        Text      : UTF8_String) return Message_Id; 
  124.    --  Pushes a new message onto a statusbar's stack. 
  125.    --  "context": the message's context id, as returned by 
  126.    --  Gtk.Status_Bar.Get_Context_Id 
  127.    --  "text": the message to add to the statusbar 
  128.  
  129.    procedure Remove 
  130.       (Statusbar : not null access Gtk_Status_Bar_Record; 
  131.        Context   : Context_Id; 
  132.        Message   : Message_Id); 
  133.    --  Forces the removal of a message from a statusbar's stack. The exact 
  134.    --  Context_Id and Message_Id must be specified. 
  135.    --  "context": a context identifier 
  136.    --  "Message": a message identifier, as returned by Gtk.Status_Bar.Push 
  137.  
  138.    procedure Remove_All 
  139.       (Statusbar : not null access Gtk_Status_Bar_Record; 
  140.        Context   : Context_Id); 
  141.    --  Forces the removal of all messages from a statusbar's stack with the 
  142.    --  exact Context_Id. 
  143.    --  Since: gtk+ 2.22 
  144.    --  "context": a context identifier 
  145.  
  146.    --------------------------------------------- 
  147.    -- Inherited subprograms (from interfaces) -- 
  148.    --------------------------------------------- 
  149.    --  Methods inherited from the Buildable interface are not duplicated here 
  150.    --  since they are meant to be used by tools, mostly. If you need to call 
  151.    --  them, use an explicit cast through the "-" operator below. 
  152.  
  153.    function Get_Orientation 
  154.       (Self : not null access Gtk_Status_Bar_Record) 
  155.        return Gtk.Enums.Gtk_Orientation; 
  156.  
  157.    procedure Set_Orientation 
  158.       (Self        : not null access Gtk_Status_Bar_Record; 
  159.        Orientation : Gtk.Enums.Gtk_Orientation); 
  160.  
  161.    ------------- 
  162.    -- Signals -- 
  163.    ------------- 
  164.  
  165.    type Cb_Gtk_Status_Bar_Context_Id_UTF8_String_Void is not null access procedure 
  166.      (Self    : access Gtk_Status_Bar_Record'Class; 
  167.       Context : Context_Id; 
  168.       Text    : UTF8_String); 
  169.  
  170.    type Cb_GObject_Context_Id_UTF8_String_Void is not null access procedure 
  171.      (Self    : access Glib.Object.GObject_Record'Class; 
  172.       Context : Context_Id; 
  173.       Text    : UTF8_String); 
  174.  
  175.    Signal_Text_Popped : constant Glib.Signal_Name := "text-popped"; 
  176.    procedure On_Text_Popped 
  177.       (Self  : not null access Gtk_Status_Bar_Record; 
  178.        Call  : Cb_Gtk_Status_Bar_Context_Id_UTF8_String_Void; 
  179.        After : Boolean := False); 
  180.    procedure On_Text_Popped 
  181.       (Self  : not null access Gtk_Status_Bar_Record; 
  182.        Call  : Cb_GObject_Context_Id_UTF8_String_Void; 
  183.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  184.        After : Boolean := False); 
  185.    --  Is emitted whenever a new message is popped off a statusbar's stack. 
  186.    --  
  187.    --  Callback parameters: 
  188.    --    --  "context": the context id of the relevant message/statusbar 
  189.    --    --  "text": the message that was just popped 
  190.  
  191.    Signal_Text_Pushed : constant Glib.Signal_Name := "text-pushed"; 
  192.    procedure On_Text_Pushed 
  193.       (Self  : not null access Gtk_Status_Bar_Record; 
  194.        Call  : Cb_Gtk_Status_Bar_Context_Id_UTF8_String_Void; 
  195.        After : Boolean := False); 
  196.    procedure On_Text_Pushed 
  197.       (Self  : not null access Gtk_Status_Bar_Record; 
  198.        Call  : Cb_GObject_Context_Id_UTF8_String_Void; 
  199.        Slot  : not null access Glib.Object.GObject_Record'Class; 
  200.        After : Boolean := False); 
  201.    --  Is emitted whenever a new message gets pushed onto a statusbar's stack. 
  202.    --  
  203.    --  Callback parameters: 
  204.    --    --  "context": the context id of the relevant message/statusbar 
  205.    --    --  "text": the message that was pushed 
  206.  
  207.    ---------------- 
  208.    -- Interfaces -- 
  209.    ---------------- 
  210.    --  This class implements several interfaces. See Glib.Types 
  211.    -- 
  212.    --  - "Buildable" 
  213.    -- 
  214.    --  - "Orientable" 
  215.  
  216.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  217.      (Gtk.Buildable.Gtk_Buildable, Gtk_Status_Bar_Record, Gtk_Status_Bar); 
  218.    function "+" 
  219.      (Widget : access Gtk_Status_Bar_Record'Class) 
  220.    return Gtk.Buildable.Gtk_Buildable 
  221.    renames Implements_Gtk_Buildable.To_Interface; 
  222.    function "-" 
  223.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  224.    return Gtk_Status_Bar 
  225.    renames Implements_Gtk_Buildable.To_Object; 
  226.  
  227.    package Implements_Gtk_Orientable is new Glib.Types.Implements 
  228.      (Gtk.Orientable.Gtk_Orientable, Gtk_Status_Bar_Record, Gtk_Status_Bar); 
  229.    function "+" 
  230.      (Widget : access Gtk_Status_Bar_Record'Class) 
  231.    return Gtk.Orientable.Gtk_Orientable 
  232.    renames Implements_Gtk_Orientable.To_Interface; 
  233.    function "-" 
  234.      (Interf : Gtk.Orientable.Gtk_Orientable) 
  235.    return Gtk_Status_Bar 
  236.    renames Implements_Gtk_Orientable.To_Object; 
  237.  
  238. end Gtk.Status_Bar;