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-2006 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 routines to handle initialization and set up of the 
  32. --  Gdk library. 
  33. --  </description> 
  34. --  <c_version>1.3.6</c_version> 
  35. --  <group>Gdk, the low-level API</group> 
  36.  
  37. with Glib; use Glib; 
  38.  
  39. with Gdk.Cursor; 
  40. with Gdk.Event; 
  41. with Gdk.Window; 
  42.  
  43. package Gdk.Main is 
  44.  
  45.    procedure Init; 
  46.    --  Initialize the library for use. 
  47.    --  The command line arguments are modified to reflect any arguments 
  48.    --  which were not handled. (Such arguments should either 
  49.    --  be handled by the application or dismissed). 
  50.  
  51.    procedure Gdk_Exit (Error_Code : Gint); 
  52.    --  Restore the library to an un-itialized state and exits 
  53.    --  the program using the "exit" system call. 
  54.    --  Error_Code is the error value to pass to "exit". 
  55.    --  Allocated structures are freed and the program exits cleanly. 
  56.    --  This function is deprecated. 
  57.  
  58.    function Set_Locale return String; 
  59.    --  Initialize handling of internationalization of strings. 
  60.    --  See Gtkada.Intl for more details. 
  61.  
  62.    procedure Set_Locale; 
  63.    --  Drops the string returned by the Set_Locale function; 
  64.  
  65.    procedure Set_Use_Xshm (Use_Xshm : Boolean := True); 
  66.    --  Set whether shared memory (when supported by the graphic server) should 
  67.    --  be used. 
  68.  
  69.    function Get_Use_Xshm return Boolean; 
  70.    --  Return whether shared memory on the graphic server is used. 
  71.  
  72.    function Get_Display return String; 
  73.    --  Return the name of the display. 
  74.  
  75.    type Gdk_Grab_Status is 
  76.      (Grab_Success, 
  77.       Grab_Already_Grabbed, 
  78.       Gdk_Grab_Invalid_Time, 
  79.       Gdk_Grab_Not_Viewable, 
  80.       Gdk_Grab_Frozen); 
  81.  
  82.    function Pointer_Grab 
  83.      (Window       : Gdk.Window.Gdk_Window; 
  84.       Owner_Events : Boolean := True; 
  85.       Event_Mask   : Gdk.Event.Gdk_Event_Mask; 
  86.       Confine_To   : Gdk.Window.Gdk_Window := Gdk.Window.Null_Window; 
  87.       Cursor       : Gdk.Cursor.Gdk_Cursor := Gdk.Cursor.Null_Cursor; 
  88.       Time         : Guint32 := 0) return Gdk_Grab_Status; 
  89.    --  Grab the pointer to a specific window. 
  90.    --    - Window is the window which will receive the grab 
  91.    --    - Owner_Events specifies whether events will be reported as is, 
  92.    --      or relative to Window 
  93.    --    - Event_Mask masks only interesting events 
  94.    --    - Confine_To limits the cursor movement to the specified window 
  95.    --    - Cursor changes the cursor for the duration of the grab 
  96.    --    - Time specifies the time 
  97.    --  Requires a corresponding call to Pointer_Ungrab 
  98.  
  99.    procedure Pointer_Ungrab (Time : Guint32 := 0); 
  100.    --  Release any pointer grab. 
  101.  
  102.    function Pointer_Is_Grabbed return Boolean; 
  103.    --  Tell wether there is an active pointer grab in effect. 
  104.  
  105.    function Keyboard_Grab 
  106.      (Window       : Gdk.Window.Gdk_Window; 
  107.       Owner_Events : Boolean := True; 
  108.       Time         : Guint32 := 0) return Gdk_Grab_Status; 
  109.    --  Grab the keyboard to a specific window. 
  110.    --    - Window is the window which will receive the grab 
  111.    --    - Owner_Events specifies whether events will be reported as is, 
  112.    --      or relative to Window 
  113.    --    - Time specifies the time 
  114.    --  Requires a corresponding call to Keyboard_Ungrab 
  115.  
  116.    procedure Keyboard_Ungrab (Time : Guint32 := 0); 
  117.    --  Release any keyboard grab. 
  118.  
  119.    function Screen_Width return Gint; 
  120.    --  Return the width of the screen. 
  121.  
  122.    function Screen_Height return Gint; 
  123.    --  Return the height of the screen. 
  124.  
  125.    function Screen_Width_MM return Gint; 
  126.    --  Return the width of the screen in millimeters. 
  127.  
  128.    function Screen_Height_MM return Gint; 
  129.    --  Return the height of the screen in millimeters. 
  130.  
  131.    procedure Flush; 
  132.    --  Flush the queue of graphic events and then wait 
  133.    --  until all requests have been received and processed. 
  134.  
  135.    procedure Beep; 
  136.    --  Emit a beep. 
  137.  
  138.    procedure Set_Double_Click_Time (Msec : Guint); 
  139.  
  140. private 
  141.    pragma Import (C, Gdk_Exit, "gdk_exit"); 
  142.    pragma Import (C, Screen_Width, "gdk_screen_width"); 
  143.    pragma Import (C, Screen_Height, "gdk_screen_height"); 
  144.    pragma Import (C, Screen_Width_MM, "gdk_screen_width_mm"); 
  145.    pragma Import (C, Screen_Height_MM, "gdk_screen_height_mm"); 
  146.    pragma Import (C, Set_Double_Click_Time, "gdk_set_double_click_time"); 
  147.    pragma Import (C, Flush, "gdk_flush"); 
  148.    pragma Import (C, Beep, "gdk_beep"); 
  149.  
  150. end Gdk.Main; 
  151.  
  152. --  missing: 
  153. --  gdk_wcstombs 
  154. --  gdk_mbstowcs