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