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. --  This widget is generally put on the sides of a drawing area to help the 
  32. --  user measure distances. It indicates the current position of the mouse 
  33. --  cursor within the drawing area, and can be graduated in multiple units. 
  34. --  </description> 
  35. --  <c_version>2.8.17</c_version> 
  36. --  <group>Drawing</group> 
  37. --  <testgtk>create_rulers.adb</testgtk> 
  38. --  <screenshot>gtk-rulers</screenshot> 
  39.  
  40. with Glib.Properties; 
  41. with Gtk.Enums;       use Gtk.Enums; 
  42. with Gtk.Widget; 
  43.  
  44. package Gtk.Ruler is 
  45.  
  46.    type Gtk_Ruler_Record is new Gtk.Widget.Gtk_Widget_Record with private; 
  47.    subtype Gtk_Hruler_Record is Gtk_Ruler_Record; 
  48.    subtype Gtk_Vruler_Record is Gtk_Ruler_Record; 
  49.  
  50.    type Gtk_Ruler is access all Gtk_Ruler_Record'Class; 
  51.    subtype Gtk_Hruler is Gtk_Ruler; 
  52.    subtype Gtk_Vruler is Gtk_Ruler; 
  53.  
  54.    procedure Gtk_New_Hruler (Ruler : out Gtk_Ruler); 
  55.    procedure Initialize_Hruler (Ruler : access Gtk_Ruler_Record'Class); 
  56.    --  Creates or initializes a new horizontal ruler 
  57.  
  58.    procedure Gtk_New_Vruler (Ruler : out Gtk_Ruler); 
  59.    procedure Initialize_Vruler (Ruler : access Gtk_Ruler_Record'Class); 
  60.    --  Creates or initializes a new vertical ruler 
  61.  
  62.    function Get_Type        return Gtk.Gtk_Type; 
  63.    function Hruler_Get_Type return Gtk.Gtk_Type; 
  64.    function Vruler_Get_Type return Gtk.Gtk_Type; 
  65.    --  Return the internal value associated with a Gtk_Ruler. 
  66.  
  67.    procedure Set_Metric 
  68.      (Ruler  : access Gtk_Ruler_Record; 
  69.       Metric : Gtk_Metric_Type); 
  70.    function Get_Metric 
  71.      (Ruler  : access Gtk_Ruler_Record) return Gtk_Metric_Type; 
  72.    --  Set or get the units used for a Gtk_Ruler. See Set_Metric. 
  73.  
  74.    procedure Set_Range 
  75.      (Ruler    : access Gtk_Ruler_Record; 
  76.       Lower    : Gdouble; 
  77.       Upper    : Gdouble; 
  78.       Position : Gdouble; 
  79.       Max_Size : Gdouble); 
  80.    procedure Get_Range 
  81.      (Ruler    : access Gtk_Ruler_Record; 
  82.       Lower    : out Gdouble; 
  83.       Upper    : out Gdouble; 
  84.       Position : out Gdouble; 
  85.       Max_Size : out Gdouble); 
  86.    --  Retrieve values indicating the range and current position of a Ruler. 
  87.    --  See Set_Range. 
  88.    --  Lower: Lower limit of the ruler. 
  89.    --  Upper: Upper limit of the ruler. 
  90.    --  Position: Current position of the mark on the ruler. 
  91.    --  Max_Size: Maximum size of the ruler used when calculating the space to 
  92.    --            leave for the text. 
  93.  
  94.    procedure Draw_Ticks (Ruler : access Gtk_Ruler_Record); 
  95.    procedure Draw_Pos (Ruler : access Gtk_Ruler_Record); 
  96.    --  ??? 
  97.  
  98.    ---------------- 
  99.    -- Properties -- 
  100.    ---------------- 
  101.  
  102.    --  <properties> 
  103.    --  The following properties are defined for this widget. See 
  104.    --  Glib.Properties for more information on properties. 
  105.    -- 
  106.    --  Name:  Lower_Property 
  107.    --  Type:  Double 
  108.    --  Descr: Lower limit of ruler 
  109.    -- 
  110.    --  Name:  Max_Size_Property 
  111.    --  Type:  Double 
  112.    --  Descr: Maximum size of the ruler 
  113.    -- 
  114.    --  Name:  Metric_Property 
  115.    --  Type:  Enum 
  116.    --  Descr: The metric used for the ruler 
  117.    -- 
  118.    --  Name:  Position_Property 
  119.    --  Type:  Double 
  120.    --  Descr: Position of mark on the ruler 
  121.    -- 
  122.    --  Name:  Upper_Property 
  123.    --  Type:  Double 
  124.    --  Descr: Upper limit of ruler 
  125.    -- 
  126.    --  </properties> 
  127.  
  128.    Lower_Property    : constant Glib.Properties.Property_Double; 
  129.    Max_Size_Property : constant Glib.Properties.Property_Double; 
  130.    Metric_Property   : constant Gtk.Enums.Property_Metric_Type; 
  131.    Position_Property : constant Glib.Properties.Property_Double; 
  132.    Upper_Property    : constant Glib.Properties.Property_Double; 
  133.  
  134. private 
  135.    type Gtk_Ruler_Record is new Gtk.Widget.Gtk_Widget_Record with null record; 
  136.  
  137.    Lower_Property : constant Glib.Properties.Property_Double := 
  138.      Glib.Properties.Build ("lower"); 
  139.    Max_Size_Property : constant Glib.Properties.Property_Double := 
  140.      Glib.Properties.Build ("max-size"); 
  141.    Metric_Property   : constant Gtk.Enums.Property_Metric_Type := 
  142.      Gtk.Enums.Build ("metric"); 
  143.    Position_Property : constant Glib.Properties.Property_Double := 
  144.      Glib.Properties.Build ("position"); 
  145.    Upper_Property : constant Glib.Properties.Property_Double := 
  146.      Glib.Properties.Build ("upper"); 
  147.  
  148.    pragma Import (C, Get_Type, "gtk_ruler_get_type"); 
  149.    pragma Import (C, Vruler_Get_Type, "gtk_vruler_get_type"); 
  150.    pragma Import (C, Hruler_Get_Type, "gtk_hruler_get_type"); 
  151. end Gtk.Ruler;