1. ----------------------------------------------------------------------- 
  2. --              GtkAda - Ada95 binding for Gtk+/Gnome                -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2006-2013, AdaCore                   -- 
  5. --                                                                   -- 
  6. -- This library is free software; you can redistribute it and/or     -- 
  7. -- modify it under the terms of the GNU General Public               -- 
  8. -- License as published by the Free Software Foundation; either      -- 
  9. -- version 2 of the License, or (at your option) any later version.  -- 
  10. --                                                                   -- 
  11. -- This library is distributed in the hope that it will be useful,   -- 
  12. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  13. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  14. -- General Public License for more details.                          -- 
  15. --                                                                   -- 
  16. -- You should have received a copy of the GNU General Public         -- 
  17. -- License along with this library; if not, write to the             -- 
  18. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  19. -- Boston, MA 02111-1307, USA.                                       -- 
  20. --                                                                   -- 
  21. -- As a special exception, if other files instantiate generics from  -- 
  22. -- this unit, or you link this unit with other files to produce an   -- 
  23. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  24. -- executable to be covered by the GNU General Public License. This  -- 
  25. -- exception does not however invalidate any other reasons why the   -- 
  26. -- executable file  might be covered by the  GNU Public License.     -- 
  27. ----------------------------------------------------------------------- 
  28.  
  29. --  <description> 
  30. --  This package provides a convenitn function to create a new graphic 
  31. --  context. Such contexts are needed in several places in GtkAda, in 
  32. --  particular for the drawing routines, and this function provides a 
  33. --  convenient way to create them. 
  34. --  </description> 
  35. --  <c_version>2.8.17</c_version> 
  36. --  <group>Miscellaneous</group> 
  37. --  <see>Gdk.GC</see> 
  38.  
  39. with Gdk.GC; 
  40.  
  41. package Gtk.GC is 
  42.  
  43.    function Get 
  44.      (Depth       : Gint; 
  45.       Colormap    : Gdk.Gdk_Colormap; 
  46.       Values      : Gdk.GC.Gdk_GC_Values; 
  47.       Values_Mask : Gdk.GC.Gdk_GC_Values_Mask) 
  48.       return Gdk_GC; 
  49.    --  Create a new GC with the matching attributes. 
  50.    --  If such a graphic context already exists, it is returned, which is much 
  51.    --  faster than creating a new one. Creating a new context requires a 
  52.    --  round-trip to the server (X11 for instance), and can be slow. 
  53.    --  You shouldn't modify the attributes of the returned context, since that 
  54.    --  might impact other parts of the code that have queried it. 
  55.  
  56.    procedure Release (Gc : Gdk_GC); 
  57.    --  Decrease the reference counting for the GC. If it reaches 0, then 
  58.    --  calling Get will create a new one the next time it is called with the 
  59.    --  same attributes. 
  60.  
  61. private 
  62.    pragma Import (C, Get, "gtk_gc_get"); 
  63.    pragma Import (C, Release, "gtk_gc_release"); 
  64. end Gtk.GC;