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-2006 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. --  The progress bar provides a convenient way of displaying a state of 
  27. --  completion for typically lengthy tasks. 
  28. --  </description> 
  29. --  <c_version>2.8.17</c_version> 
  30. --  <group>Display widgets</group> 
  31. --  <testgtk>create_progress.adb</testgtk> 
  32. --  <screenshot>gtk-progress_bar</screenshot> 
  33.  
  34. with Glib.Properties; 
  35. with Gtk.Enums;    use Gtk.Enums; 
  36. with Pango.Layout; 
  37.  
  38. pragma Warnings (Off);  --  Gtk.Progress is obsolete 
  39. with Gtk.Progress; 
  40. pragma Warnings (On); 
  41.  
  42. package Gtk.Progress_Bar is 
  43.  
  44.    type Gtk_Progress_Bar_Orientation is 
  45.      (Progress_Left_To_Right, 
  46.       Progress_Right_To_Left, 
  47.       Progress_Bottom_To_Top, 
  48.       Progress_Top_To_Bottom); 
  49.    pragma Convention (C, Gtk_Progress_Bar_Orientation); 
  50.  
  51.    pragma Warnings (Off);  --  Gtk.Progress is obsolete 
  52.    type Gtk_Progress_Bar_Record is new 
  53.      Gtk.Progress.Gtk_Progress_Record with private; 
  54.    pragma Warnings (On); 
  55.  
  56.    type Gtk_Progress_Bar is access all Gtk_Progress_Bar_Record'Class; 
  57.  
  58.    procedure Gtk_New (Progress_Bar : out Gtk_Progress_Bar); 
  59.    procedure Initialize (Progress_Bar : access Gtk_Progress_Bar_Record'Class); 
  60.    --  Creates or initializes a new progress bar. 
  61.  
  62.    function Get_Type return Gtk.Gtk_Type; 
  63.    --  Return the internal value associated with a Gtk_Progress_Bar. 
  64.  
  65.    procedure Pulse (Progress_Bar : access Gtk_Progress_Bar_Record); 
  66.    --  Indicate that some progress is made, but you don't know how much. 
  67.    --  Causes the progress bar to enter "activity mode," where a block 
  68.    --  bounces back and forth. Each call to Pulse causes the block to move by 
  69.    --  a little bit (the amount of movement per pulse is determined by 
  70.    --  Set_Pulse_Step). 
  71.  
  72.    procedure Set_Text 
  73.      (Progress_Bar : access Gtk_Progress_Bar_Record; Text : UTF8_String); 
  74.    function Get_Text 
  75.      (Progress_Bar : access Gtk_Progress_Bar_Record) return UTF8_String; 
  76.    --  Causes the given Text to appear superimposed on the progress bar. 
  77.    --  Text: a UTF-8 string. 
  78.  
  79.    procedure Set_Fraction 
  80.      (Progress_Bar : access Gtk_Progress_Bar_Record; 
  81.       Fraction     : Gdouble); 
  82.    function Get_Fraction 
  83.      (Progress_Bar : access Gtk_Progress_Bar_Record) return Gdouble; 
  84.    --  Cause the progress bar to "fill in" the given fraction of the bar. 
  85.    --  The fraction should be between 0.0 and 1.0, inclusive. 
  86.  
  87.    procedure Set_Pulse_Step 
  88.      (Progress_Bar : access Gtk_Progress_Bar_Record; 
  89.       Step         : Gdouble); 
  90.    function Get_Pulse_Step 
  91.      (Progress_Bar : access Gtk_Progress_Bar_Record) return Gdouble; 
  92.    --  Set the fraction of total progress bar length to move the 
  93.    --  bouncing block for each call to Pulse. 
  94.  
  95.    procedure Set_Orientation 
  96.      (Progress_Bar : access Gtk_Progress_Bar_Record; 
  97.       Orientation  : Gtk_Progress_Bar_Orientation); 
  98.    function Get_Orientation 
  99.      (Progress_Bar : access Gtk_Progress_Bar_Record) 
  100.       return Gtk_Progress_Bar_Orientation; 
  101.    --  Cause the progress bar to switch to a different orientation 
  102.    --  (left-to-right, right-to-left, top-to-bottom, or bottom-to-top). 
  103.  
  104.    procedure Set_Ellipsize 
  105.      (Pbar : access Gtk_Progress_Bar_Record; 
  106.       Mode : Pango.Layout.Pango_Ellipsize_Mode); 
  107.    function Get_Ellipsize 
  108.      (Pbar : access Gtk_Progress_Bar_Record) 
  109.       return Pango.Layout.Pango_Ellipsize_Mode; 
  110.    --  Sets the mode used to ellipsize (add an ellipsis: "...") the text 
  111.    --  if there is not enough space to render the entire string. 
  112.  
  113.    ----------------- 
  114.    -- Obsolescent -- 
  115.    ----------------- 
  116.    --  All subprograms below are now obsolescent in gtk+. They might be removed 
  117.    --  from future versions of gtk+ (and therefore GtkAda). 
  118.    --  To find out whether your code uses any of these, we recommend compiling 
  119.    --  with the -gnatwj switch 
  120.    --  <doc_ignore> 
  121.  
  122.    --  </doc_ignore> 
  123.  
  124.    ---------------- 
  125.    -- Properties -- 
  126.    ---------------- 
  127.  
  128.    --  <properties> 
  129.    --  The following properties are defined for this widget. See 
  130.    --  Glib.Properties for more information on properties. 
  131.    -- 
  132.    --  Name:  Orientation_Property 
  133.    --  Type:  Gtk_Orientation 
  134.    --  Flags: read-write 
  135.    --  Descr: Orientation and growth of the progress bar 
  136.    --  See also: Set_Orientation and Get_Orientation 
  137.    -- 
  138.    --  Name:  Discrete_Blocks_Property 
  139.    --  Type:  Guint 
  140.    --  Flags: read-write 
  141.    --  Descr: The number of discrete blocks in a progress bar (when shown 
  142.    --         in the discrete Style) 
  143.    -- 
  144.    --  Name:  Fraction_Property 
  145.    --  Type:  Gdouble 
  146.    --  Flags: read-write 
  147.    --  Descr: The fraction of total work that has been completed 
  148.    --  See also: Set_Fraction and Get_Fraction 
  149.    -- 
  150.    --  Name:  Pulse_Step_Property 
  151.    --  Type:  Gdouble 
  152.    --  Flags: read-write 
  153.    --  Descr: The fraction of total progress to move the bouncing block when 
  154.    --         pulsed 
  155.    --  See also: Set_Pulse_Step and Get_Pulse_Step 
  156.    -- 
  157.    --  Name:  Text_Property 
  158.    --  Type:  UTF8_String 
  159.    --  Flags: read-write 
  160.    --  Descr: Text to be displayed in the progress bar 
  161.    --  See also: Set_Text and Get_Text 
  162.    -- 
  163.    --  Name:  Activity_Blocks_Property 
  164.    --  Type:  Uint 
  165.    --  Descr: The number of blocks which can fit in the progress bar area in 
  166.    --         activity mode (Deprecated) 
  167.    -- 
  168.    --  Name:  Activity_Step_Property 
  169.    --  Type:  Uint 
  170.    --  Descr: The increment used for each iteration in activity mode 
  171.    --        (Deprecated) 
  172.    -- 
  173.    --  Name:  Adjustment_Property 
  174.    --  Type:  Object 
  175.    --  Descr: The GtkAdjustment connected to the progress bar (Deprecated) 
  176.    -- 
  177.    --  Name:  Bar_Style_Property 
  178.    --  Type:  Enum 
  179.    --  Descr: Specifies the visual style of the bar in percentage mode 
  180.    --         (Deprecated) 
  181.    -- 
  182.    --  Name:  Ellipsize_Property 
  183.    --  Type:  Enum 
  184.    --  Descr: The preferred place to ellipsize the string, if the progressbar 
  185.    --         does not have enough room to display the entire string, if at all 
  186.    -- 
  187.    --  </properties> 
  188.  
  189.    Orientation_Property     : constant Gtk.Enums.Property_Gtk_Orientation; 
  190.    Discrete_Blocks_Property : constant Glib.Properties.Property_Uint; 
  191.    Fraction_Property        : constant Glib.Properties.Property_Double; 
  192.    Pulse_Step_Property      : constant Glib.Properties.Property_Double; 
  193.    Text_Property            : constant Glib.Properties.Property_String; 
  194.  
  195.    --  This requires a new type in Pango.Layout.Ellipsize_Mode 
  196.    --  Ellipsize_Property       : constant Glib.Properties.Property_Enum; 
  197.  
  198.    --  These are deprecated, and never had a binding, no need to add them 
  199.    --  Activity_Blocks_Property : constant Glib.Properties.Property_Uint; 
  200.    --  Activity_Step_Property   : constant Glib.Properties.Property_Uint; 
  201.    --  Adjustment_Property      : constant Glib.Properties.Property_Object; 
  202.    --  Bar_Style_Property       : constant Glib.Properties.Property_Enum; 
  203.  
  204. private 
  205.    pragma Warnings (Off); 
  206.    type Gtk_Progress_Bar_Record is new Gtk.Progress.Gtk_Progress_Record 
  207.      with null record; 
  208.    pragma Warnings (On); 
  209.    --  Gtk.Progress is obsolete 
  210.  
  211.    Orientation_Property     : constant Gtk.Enums.Property_Gtk_Orientation := 
  212.      Gtk.Enums.Build ("orientation"); 
  213.    Discrete_Blocks_Property : constant Glib.Properties.Property_Uint := 
  214.      Glib.Properties.Build ("discrete_blocks"); 
  215.    Fraction_Property        : constant Glib.Properties.Property_Double := 
  216.      Glib.Properties.Build ("fraction"); 
  217.    Pulse_Step_Property      : constant Glib.Properties.Property_Double := 
  218.      Glib.Properties.Build ("pulse_step"); 
  219.    Text_Property            : constant Glib.Properties.Property_String := 
  220.      Glib.Properties.Build ("text"); 
  221.  
  222.    pragma Import (C, Get_Type, "gtk_progress_bar_get_type"); 
  223. end Gtk.Progress_Bar; 
  224.  
  225. --  The following subprograms are now obsolescent, and never had a binding 
  226. --  No binding: gtk_progress_bar_set_activity_blocks 
  227. --  No binding: gtk_progress_bar_set_activity_step 
  228. --  No binding: gtk_progress_bar_set_bar_style 
  229. --  No binding: gtk_progress_bar_set_discrete_blocks 
  230. --  No binding: gtk_progress_bar_update 
  231. --  No binding: gtk_progress_bar_new_with_adjustment