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