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