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