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-2011, 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 provides an empty canvas on which the application can draw 
  27. --  anything. 
  28. -- 
  29. --  Note that this widget is simply an empty space, and that you need to 
  30. --  connect it to events to make it useful. For instance, you might want to do 
  31. --  one of the following : 
  32. -- 
  33. --  * Connect it to "expose_event": The handlers are called every time the 
  34. --  widget needs to be redrawn. You can then draw anything you want on the 
  35. --  canvas, after getting its associated window with a call to 
  36. --  Gtk.Widget.Get_Window. Note that the event mask is automatically set up to 
  37. --  accept expose_events. 
  38. -- 
  39. --  * Connect it to "button_press_event" and "button_release_event" events, 
  40. --  when you want it to react to user input. Note that you need to set up the 
  41. --  event mask with a call to Gtk.Widget.Set_Events. 
  42. -- 
  43. --  See also the Double_Buffer widget provided in the GtkAda examples for an 
  44. --  advanced example that demonstrates how to use double buffering, to avoid 
  45. --  flickering in your drawings. 
  46. -- 
  47. --  </description> 
  48. --  <group>Drawing</group> 
  49. --  <testgtk>libart_demo.adb</testgtk> 
  50.  
  51. pragma Warnings (Off, "*is already use-visible*"); 
  52. with Glib;          use Glib; 
  53. with Glib.Types;    use Glib.Types; 
  54. with Gtk.Buildable; use Gtk.Buildable; 
  55. with Gtk.Widget;    use Gtk.Widget; 
  56.  
  57. package Gtk.Drawing_Area is 
  58.  
  59.    type Gtk_Drawing_Area_Record is new Gtk_Widget_Record with null record; 
  60.    type Gtk_Drawing_Area is access all Gtk_Drawing_Area_Record'Class; 
  61.  
  62.    ------------------ 
  63.    -- Constructors -- 
  64.    ------------------ 
  65.  
  66.    procedure Gtk_New (Drawing_Area : out Gtk_Drawing_Area); 
  67.    procedure Initialize 
  68.       (Drawing_Area : access Gtk_Drawing_Area_Record'Class); 
  69.  
  70.    function Get_Type return Glib.GType; 
  71.    pragma Import (C, Get_Type, "gtk_drawing_area_get_type"); 
  72.  
  73.    ------------- 
  74.    -- Methods -- 
  75.    ------------- 
  76.  
  77.    procedure Size 
  78.       (Drawing_Area : access Gtk_Drawing_Area_Record; 
  79.        Width        : Gint; 
  80.        Height       : Gint); 
  81.    pragma Obsolescent (Size); 
  82.    --  Request a new size for the area. This queues a resize request for the 
  83.    --  area. 
  84.    --  Deprecated 
  85.  
  86.    ---------------- 
  87.    -- Interfaces -- 
  88.    ---------------- 
  89.    --  This class implements several interfaces. See Glib.Types 
  90.    -- 
  91.    --  - "Buildable" 
  92.  
  93.    package Implements_Buildable is new Glib.Types.Implements 
  94.      (Gtk.Buildable.Gtk_Buildable, Gtk_Drawing_Area_Record, Gtk_Drawing_Area); 
  95.    function "+" 
  96.      (Widget : access Gtk_Drawing_Area_Record'Class) 
  97.    return Gtk.Buildable.Gtk_Buildable 
  98.    renames Implements_Buildable.To_Interface; 
  99.    function "-" 
  100.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  101.    return Gtk_Drawing_Area 
  102.    renames Implements_Buildable.To_Object; 
  103.  
  104. end Gtk.Drawing_Area;