1. ----------------------------------------------------------------------- 
  2. --              GtkAda - Ada95 binding for Gtk+/Gnome                -- 
  3. --                                                                   -- 
  4. --                Copyright (C) 2006-2007, 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. -- -- -- -- -- -- -- -- -- -- -- --
  22. ----------------------------------------------------------------------- 
  23.  
  24. --  <description> 
  25. --  Gdk_Display objects purpose are two fold: 
  26. --     - To grab/ungrab keyboard focus and mouse pointer 
  27. --     - To manage and provide information about the Gdk_Screen(s) available 
  28. --       for this Gdk_Display 
  29. --  Gdk_Display objects are the GDK representation of the X Display which can 
  30. --  be described as a workstation consisting of a keyboard a pointing device 
  31. --  (such as a mouse) and one or more screens. It is used to open and keep 
  32. --  track of various Gdk_Screen objects currently instanciated by the 
  33. --  application. It is also used to grab and release the keyboard and the mouse 
  34. --  pointer. 
  35. --  </description> 
  36. --  <c_version>2.8.17</c_version> 
  37. --  <group>Gdk, the low-level API</group> 
  38. --  <see>Gdk_Screen</see> 
  39.  
  40. with Gdk.Event; 
  41. with Gdk.Types; 
  42. with Glib.Object; 
  43.  
  44. package Gdk.Display is 
  45.  
  46.    type Gdk_Display_Record is new Glib.Object.GObject_Record with null record; 
  47.    type Gdk_Display is access all Gdk_Display_Record'Class; 
  48.  
  49.    function Get_Type return Glib.GType; 
  50.    --  Return the internal type associated with a Gdk_Display 
  51.  
  52.    function Open (Display_Name : String) return Gdk_Display; 
  53.    --  Open a new display. Display_Name follows the unix convention, and should 
  54.    --  have the format host:screen, for instance "foo.com:0". 
  55.  
  56.    function Get_Default return Gdk_Display; 
  57.    --  Gets the default Gdk_Display 
  58.  
  59.    function Get_Name (Display : access Gdk_Display_Record) return String; 
  60.    --  Return the name of the screen 
  61.  
  62.    function Get_N_Screens 
  63.      (Display : access Gdk_Display_Record) return Glib.Gint; 
  64.    --  Return the number of screens managed by the display. 
  65.    --  See the function Gdk.Screen.Get_Screen or Gdk.Screen.Get_Default_Screen 
  66.  
  67.    procedure Pointer_Ungrab 
  68.      (Display : access Gdk_Display_Record; 
  69.       Time    : Glib.Guint32 := Gdk.Types.Current_Time); 
  70.    --  Release any pointer grab. 
  71.  
  72.    procedure Keyboard_Ungrab 
  73.      (Display : access Gdk_Display_Record; 
  74.       Time    : Glib.Guint32 := Gdk.Types.Current_Time); 
  75.    --  Release any keyboard grab 
  76.  
  77.    function Pointer_Is_Grabbed 
  78.      (Display : access Gdk_Display_Record) return Boolean; 
  79.    --  Test if the pointer is grabbed. 
  80.  
  81.    procedure Beep (Display : access Gdk_Display_Record); 
  82.    --  Emits a short beep on display 
  83.  
  84.    procedure Sync (Display : access Gdk_Display_Record); 
  85.    --  Flushes any requests queued for the windowing system and waits until all 
  86.    --  requests have been handled. This is often used for making sure that the 
  87.    --  display is synchronized with the current state of the program. Calling 
  88.    --  Sync before Gdk.Error.Trap_Pop makes sure that any errors generated from 
  89.    --  earlier requests are handled before the error trap is removed. 
  90.    -- 
  91.    --  This is most useful for X11. On windowing systems where requests are 
  92.    --  handled synchronously, this function will do nothing. 
  93.  
  94.    procedure Flush (Display : access Gdk_Display_Record); 
  95.    --  Flushes any requests queued for the windowing system; this happens 
  96.    --  automatically when the main loop blocks waiting for new events, but if 
  97.    --  your application is drawing without returning control to the main loop, 
  98.    --  you may need to call this function explicitely. A common case where this 
  99.    --  function needs to be called is when an application is executing drawing 
  100.    --  commands from a thread other than the thread where the main loop is 
  101.    --  running. 
  102.    -- 
  103.    --  This is most useful for X11. On windowing systems where requests are 
  104.    --  handled synchronously, this function will do nothing. 
  105.  
  106.    procedure Close (Display : access Gdk_Display_Record); 
  107.    --  Closes the connection to the windowing system for the given display, 
  108.    --  and cleans up associated resources. 
  109.  
  110.    function Get_Event 
  111.      (Display : access Gdk_Display_Record) return Gdk.Event.Gdk_Event; 
  112.    --  Gets the next Gdk_Event to be processed for Display, fetching events 
  113.    --  from the windowing system if necessary. 
  114.    --  null is returned if no events are pending. 
  115.    --  The returned Gdk_Event must be freed with Gdk.Event.Free 
  116.  
  117.    function Peek_Event 
  118.      (Display : access Gdk_Display_Record) return Gdk.Event.Gdk_Event; 
  119.    --  Gets a copy of the first Gdk_Event in the Display's event queue, without 
  120.    --  removing the event from the queue. (Note that this function will not get 
  121.    --  more events from the windowing system. It only checks the events that 
  122.    --  have already been moved to the GDK event queue.) 
  123.    --  null is returned if there are no events in the queue. The returned event 
  124.    --  should be freed with Gdk.Event.Free. 
  125.  
  126.    procedure Put_Event 
  127.      (Display : access Gdk_Display_Record; 
  128.       Event   : Gdk.Event.Gdk_Event); 
  129.    --  Appends a copy of the given event onto the front of the event 
  130.    --  queue for Display. 
  131.  
  132.    procedure Set_Double_Click_Time 
  133.      (Display : access Gdk_Display_Record; 
  134.       Msec    : Glib.Guint); 
  135.    --  Sets the double click time (two clicks within this time interval count 
  136.    --  as a double click and result in a GDK_2BUTTON_PRESS event). Applications 
  137.    --  should not set this, it is a global user-configured setting. 
  138.  
  139.    procedure Set_Double_Click_Distance 
  140.      (Display  : access Gdk_Display_Record; 
  141.       Distance : Glib.Guint); 
  142.    --  Sets the double click distance (two clicks within this distance count as 
  143.    --  a double click and result in a GDK_2BUTTON_PRESS event). See also 
  144.    --  Set_Double_Click_Time. Applications should not set this, it is a global 
  145.    --  user-configured setting. 
  146.  
  147.    procedure Get_Window_At_Pointer 
  148.      (Display : access Gdk_Display_Record; 
  149.       Win_X   : out Glib.Gint; 
  150.       Win_Y   : out Glib.Gint; 
  151.       Win     : out Gdk.Gdk_Window); 
  152.    --  Obtains the window underneath the mouse pointer, returning the location 
  153.    --  of that window in Win_X, Win_Y. Returns nullif the window 
  154.    --  under the mouse pointer is not known to GDK (for example, belongs to 
  155.    --  another application). 
  156.    --  (Win_X, Win_Y) are relative to the origin of the window under the 
  157.    --  pointer. 
  158.  
  159.    function Supports_Cursor_Color 
  160.      (Display : access Gdk_Display_Record) return Boolean; 
  161.    --  Returns TRUE if multicolored cursors are supported on display. 
  162.    --  Otherwise, cursors have only a forground and a background color. 
  163.  
  164.    function Supports_Cursor_Alpha 
  165.      (Display : access Gdk_Display_Record) return Boolean; 
  166.    --  Returns TRUE if cursors can use an 8bit alpha channel on display. 
  167.    --  Otherwise, cursors are restricted to bilevel alpha (i.e. a mask). 
  168.  
  169.    function Get_Default_Cursor_Size 
  170.      (Display : access Gdk_Display_Record) return Glib.Guint; 
  171.    --  Returns the default size to use for cursors on display. 
  172.  
  173.    procedure Get_Maximal_Cursor_Size 
  174.      (Display : access Gdk_Display_Record; 
  175.       Width   : out Glib.Guint; 
  176.       Height  : out Glib.Guint); 
  177.    --  Gets the maximal size to use for cursors on display 
  178.  
  179.    function Get_Default_Group 
  180.      (Display : access Gdk_Display_Record) return Gdk.Gdk_Window; 
  181.    --  Returns the default group leader window for all toplevel windows on 
  182.    --  display. This window is implicitly created by GDK. See 
  183.    --  Gdk.Window.Set_Group. 
  184.  
  185.    function Supports_Selection_Notification 
  186.      (Display : access Gdk_Display_Record) return Boolean; 
  187.    --  Returns whether Gdk.Event.Owner_Change events will be sent when the 
  188.    --  owner of a selection changes. 
  189.  
  190.    function Request_Selection_Notification 
  191.      (Display   : access Gdk_Display_Record; 
  192.       Selection : Gdk.Types.Gdk_Atom) return Boolean; 
  193.    --  Request Gdk.Event.Owner_Change events for ownership changes of the 
  194.    --  selection named by the given atom. 
  195.  
  196.    function Supports_Clipboard_Persistence 
  197.      (Display : access Gdk_Display_Record) return Boolean; 
  198.    --  Returns whether the specifed display supports clipboard persistance; 
  199.    --  i.e. if it's possible to store the clipboard data after an application 
  200.    --  has quit. On X11 this checks if a clipboard daemon is running. 
  201.  
  202.    procedure Store_Clipboard 
  203.      (Display          : access Gdk_Display_Record; 
  204.       Clipboard_Window : Gdk.Gdk_Window; 
  205.       Time             : Glib.Guint32; 
  206.       Targets          : Gdk.Types.Gdk_Atom_Array); 
  207.    --  Issues a request to the clipboard manager to store the clipboard data. 
  208.    --  On X11, this is a special program that works according to the 
  209.    --  freedesktop clipboard specification, available at 
  210.    --  http://www.freedesktop.org/Standards/clipboard-manager-spec. 
  211.    --  See also Gtk.Clipboard.Store. 
  212.  
  213.    ------------- 
  214.    -- Signals -- 
  215.    ------------- 
  216.  
  217.    --  <signals> 
  218.    --  The following new signals are defined for this object: 
  219.    -- 
  220.    --  - "closed" 
  221.    --    procedure Handler 
  222.    --      (Display  : access Gdk_Display_Record'Class; 
  223.    --       Is_Error : Boolean); 
  224.    --    The ::closed signal is emitted when the connection to the windowing 
  225.    --    system for display is closed. Is_Error is set to true if the 
  226.    --    connection is closed due to an error. 
  227.    --  </signals> 
  228.  
  229.    Signal_Closed : constant Glib.Signal_Name := "closed"; 
  230.  
  231. private 
  232.    pragma Import (C, Get_Type, "gdk_display_get_type"); 
  233. end Gdk.Display; 
  234.  
  235. --  Binding provided in gdk-screen.ads for circularity dependencies reasons: 
  236. --  No binding: gdk_display_get_default_screen 
  237. --  No binding: gdk_display_get_pointer 
  238. --  No binding: gdk_display_get_screen 
  239. --  No binding: gdk_display_warp_pointer 
  240.  
  241. --  Binding might be nice later: 
  242. --  No binding: gdk_display_set_pointer_hooks 
  243.  
  244. --  No binding needed (too low-level): 
  245. --  No binding: gdk_display_get_core_pointer 
  246. --  No binding: gdk_display_list_devices 
  247. --  No binding: gdk_display_add_client_message_filter 
  248.  
  249. --  Function has no implementation 
  250. --  No binding: gdk_display_open_default_libgtk_only