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-2007 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 package provides the capability to create predefined mouse cursors 
  27. --  as well as user defined ones. 
  28. --  </description> 
  29. --  <c_version>1.3.6</c_version> 
  30. --  <group>Gdk, the low-level API</group> 
  31. --  <testgtk>create_cursors.adb</testgtk> 
  32.  
  33. with Glib; 
  34. with Gdk.Color; 
  35.  
  36. package Gdk.Cursor is 
  37.  
  38.    type Gdk_Cursor is new Gdk.C_Proxy; 
  39.    Null_Cursor : constant Gdk_Cursor; 
  40.  
  41.    type Gdk_Cursor_Type is 
  42.      (X_Cursor, 
  43.       Arrow, 
  44.       Based_Arrow_Down, 
  45.       Based_Arrow_Up, 
  46.       Boat, 
  47.       Bogosity, 
  48.       Bottom_Left_Corner, 
  49.       Bottom_Right_Corner, 
  50.       Bottom_Side, 
  51.       Bottom_Tee, 
  52.       Box_Spiral, 
  53.       Center_Ptr, 
  54.       Circle, 
  55.       Clock, 
  56.       Coffee_Mug, 
  57.       Cross, 
  58.       Cross_Reverse, 
  59.       Crosshair, 
  60.       Diamond_Cross, 
  61.       Dot, 
  62.       Dotbox, 
  63.       Double_Arrow, 
  64.       Draft_Large, 
  65.       Draft_Small, 
  66.       Draped_Box, 
  67.       Exchange, 
  68.       Fleur, 
  69.       Gobbler, 
  70.       Gumby, 
  71.       Hand1, 
  72.       Hand2, 
  73.       Heart, 
  74.       Icon, 
  75.       Iron_Cross, 
  76.       Left_Ptr, 
  77.       Left_Side, 
  78.       Left_Tee, 
  79.       Leftbutton, 
  80.       Ll_Angle, 
  81.       Lr_Angle, 
  82.       Man, 
  83.       Middlebutton, 
  84.       Mouse, 
  85.       Pencil, 
  86.       Pirate, 
  87.       Plus, 
  88.       Question_Arrow, 
  89.       Right_Ptr, 
  90.       Right_Side, 
  91.       Right_Tee, 
  92.       Rightbutton, 
  93.       Rtl_Logo, 
  94.       Sailboat, 
  95.       Sb_Down_Arrow, 
  96.       Sb_H_Double_Arrow, 
  97.       Sb_Left_Arrow, 
  98.       Sb_Right_Arrow, 
  99.       Sb_Up_Arrow, 
  100.       Sb_V_Double_Arrow, 
  101.       Shuttle, 
  102.       Sizing, 
  103.       Spider, 
  104.       Spraycan, 
  105.       Star, 
  106.       Target, 
  107.       Tcross, 
  108.       Top_Left_Arrow, 
  109.       Top_Left_Corner, 
  110.       Top_Right_Corner, 
  111.       Top_Side, 
  112.       Top_Tee, 
  113.       Trek, 
  114.       Ul_Angle, 
  115.       Umbrella, 
  116.       Ur_Angle, 
  117.       Watch, 
  118.       Xterm); 
  119.  
  120.    procedure Gdk_New 
  121.      (Widget      : out Gdk_Cursor; 
  122.       Cursor_Type : Gdk_Cursor_Type); 
  123.    --  Create a new standard cursor. 
  124.  
  125.    procedure Gdk_New 
  126.      (Widget : out Gdk_Cursor; 
  127.       Source : Gdk.Gdk_Pixmap; 
  128.       Mask   : Gdk.Gdk_Pixmap; 
  129.       Fg     : Gdk.Color.Gdk_Color; 
  130.       Bg     : Gdk.Color.Gdk_Color; 
  131.       X      : Glib.Gint; 
  132.       Y      : Glib.Gint); 
  133.    --  Create a new cursor from a given pixmap and mask. 
  134.    --  See also Gdk.Pixbuf.Gdk_New_From_Pixbuf. 
  135.    --  Both the pixmap and mask must have a depth of 1 (i.e. each pixel has 
  136.    --  only 2 values - on or off). The standard cursor size is 16 by 16 pixels. 
  137.    --   - Source is the pixmap specifying the cursor. 
  138.    --   - Mask is the pixmap specifying the mask, which must be the same size 
  139.    --   as source. 
  140.    --   - Fg is the foreground color, used for the bits in the source which are 
  141.    --   enabled. The color does not have to be allocated first. 
  142.    --   - Bg is the background color, used for the bits in the source which are 
  143.    --   disabled. The color does not have to be allocated first. 
  144.    --   - X is the horizontal offset of the 'hotspot' of the cursor. 
  145.    --   - Y is the vertical offset of the 'hotspot' of the cursor. 
  146.  
  147.    --  procedure Gdk_New_From_Pixbuf (...) 
  148.    --  This function is declared in Gdk.Pixbuf, for dependency circularity 
  149.    --  reasons. It can be used to create a cursor directly from a pixbuf. 
  150.  
  151.    procedure Gdk_New 
  152.      (Cursor  : out Gdk_Cursor; 
  153.       Name    : String); 
  154.    --  Create a cursor from a name 
  155.  
  156.    procedure Destroy (Cursor : Gdk_Cursor); 
  157.    pragma Obsolescent;  --  Destroy 
  158.    --  Destroy a cursor, freeing any resources allocated for it. 
  159.    --  Deprecated, use Unref instead. 
  160.  
  161.    procedure Ref (Cursor : Gdk_Cursor); 
  162.    --  Increment the reference counting for the cursor. 
  163.  
  164.    procedure Unref (Cursor : Gdk_Cursor); 
  165.    --  Decrement the reference counting for the cursor. 
  166.    --  When this reaches 0, the cursor is destroyed. 
  167.  
  168. private 
  169.    Null_Cursor : constant Gdk_Cursor := null; 
  170.    pragma Import (C, Destroy, "gdk_cursor_unref"); 
  171.    pragma Import (C, Ref, "gdk_cursor_ref"); 
  172.    pragma Import (C, Unref, "gdk_cursor_unref"); 
  173.  
  174.    for Gdk_Cursor_Type'Size use Glib.Gint'Size; 
  175.    for Gdk_Cursor_Type use 
  176.      (X_Cursor => 0, 
  177.       Arrow    => 2, 
  178.       Based_Arrow_Down => 4, 
  179.       Based_Arrow_Up => 6, 
  180.       Boat => 8, 
  181.       Bogosity => 10, 
  182.       Bottom_Left_Corner => 12, 
  183.       Bottom_Right_Corner => 14, 
  184.       Bottom_Side => 16, 
  185.       Bottom_Tee => 18, 
  186.       Box_Spiral => 20, 
  187.       Center_Ptr => 22, 
  188.       Circle => 24, 
  189.       Clock => 26, 
  190.       Coffee_Mug => 28, 
  191.       Cross => 30, 
  192.       Cross_Reverse => 32, 
  193.       Crosshair => 34, 
  194.       Diamond_Cross => 36, 
  195.       Dot => 38, 
  196.       Dotbox => 40, 
  197.       Double_Arrow => 42, 
  198.       Draft_Large => 44, 
  199.       Draft_Small => 46, 
  200.       Draped_Box => 48, 
  201.       Exchange => 50, 
  202.       Fleur => 52, 
  203.       Gobbler => 54, 
  204.       Gumby => 56, 
  205.       Hand1 => 58, 
  206.       Hand2 => 60, 
  207.       Heart => 62, 
  208.       Icon => 64, 
  209.       Iron_Cross => 66, 
  210.       Left_Ptr => 68, 
  211.       Left_Side => 70, 
  212.       Left_Tee => 72, 
  213.       Leftbutton => 74, 
  214.       Ll_Angle => 76, 
  215.       Lr_Angle => 78, 
  216.       Man => 80, 
  217.       Middlebutton => 82, 
  218.       Mouse => 84, 
  219.       Pencil => 86, 
  220.       Pirate => 88, 
  221.       Plus => 90, 
  222.       Question_Arrow => 92, 
  223.       Right_Ptr => 94, 
  224.       Right_Side => 96, 
  225.       Right_Tee => 98, 
  226.       Rightbutton => 100, 
  227.       Rtl_Logo => 102, 
  228.       Sailboat => 104, 
  229.       Sb_Down_Arrow => 106, 
  230.       Sb_H_Double_Arrow => 108, 
  231.       Sb_Left_Arrow => 110, 
  232.       Sb_Right_Arrow => 112, 
  233.       Sb_Up_Arrow => 114, 
  234.       Sb_V_Double_Arrow => 116, 
  235.       Shuttle => 118, 
  236.       Sizing => 120, 
  237.       Spider => 122, 
  238.       Spraycan => 124, 
  239.       Star => 126, 
  240.       Target => 128, 
  241.       Tcross => 130, 
  242.       Top_Left_Arrow => 132, 
  243.       Top_Left_Corner => 134, 
  244.       Top_Right_Corner => 136, 
  245.       Top_Side => 138, 
  246.       Top_Tee => 140, 
  247.       Trek => 142, 
  248.       Ul_Angle => 144, 
  249.       Umbrella => 146, 
  250.       Ur_Angle => 148, 
  251.       Watch => 150, 
  252.       Xterm => 152); 
  253.  
  254. end Gdk.Cursor;