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. --  Gdk_Screen objects are the GDK representation of a physical screen. It is 
  31. --  used throughout GDK and GTK+ to specify which screen the top level windows 
  32. --  are to be displayed on. It is also used to query the screen specification 
  33. --  and default settings such as the default colormap (Get_Default_Colormap), 
  34. --  the screen width (Get_Width), etc. 
  35. -- 
  36. --  Note that a screen may consist of multiple monitors which are merged to 
  37. --  form a large screen area. 
  38. --  </description> 
  39. --  <c_version>2.8.17</c_version> 
  40. --  <c_version>2.12</c_version> for some of the functions 
  41. --  <group>Gdk, the low-level API</group> 
  42. --  <see>Gdk_Display</see> 
  43.  
  44. with Gdk.Display; 
  45. with Gdk.Rectangle; 
  46. with Gdk.Types; 
  47. with Glib.Object; 
  48. with Glib.Values; 
  49.  
  50. package Gdk.Screen is 
  51.  
  52.    type Gdk_Screen_Record is new Glib.Object.GObject_Record with null record; 
  53.    type Gdk_Screen is access all Gdk_Screen_Record'Class; 
  54.  
  55.    function Get_Type return Glib.GType; 
  56.    --  Return the internal type used for screens 
  57.  
  58.    ------------- 
  59.    -- Display -- 
  60.    ------------- 
  61.    --  These subprograms should really be in gdk-display.ads to match what is 
  62.    --  done for gtk+ itself, but that would create dependency circularities. 
  63.    --  Ada 2005 has support for these, but we want GtkAda to build with Ada95 
  64.    --  compilers. 
  65.  
  66.    function Get_Screen 
  67.      (Display    : access Gdk.Display.Gdk_Display_Record'Class; 
  68.       Screen_Num : Glib.Gint) 
  69.       return Gdk_Screen; 
  70.    --  Returns a screen object for one of the screens of the display. 
  71.  
  72.    function Get_Default_Screen 
  73.      (Display : access Gdk.Display.Gdk_Display_Record'Class) return Gdk_Screen; 
  74.    --  Get the default Gdk_Screen for display. 
  75.  
  76.    procedure Get_Pointer 
  77.      (Display : access Gdk.Display.Gdk_Display_Record'Class; 
  78.       Screen  : out Gdk_Screen; 
  79.       X       : out Glib.Gint; 
  80.       Y       : out Glib.Gint; 
  81.       Mask    : out Gdk.Types.Gdk_Modifier_Type); 
  82.    --  Gets the current location of the pointer and the current modifier 
  83.    --  mask for a given display. 
  84.    --  (X, Y) are coordinates relative to the root window on the display 
  85.  
  86.    procedure Warp_Pointer 
  87.      (Display : access Gdk.Display.Gdk_Display_Record'Class; 
  88.       Screen  : access Gdk_Screen_Record; 
  89.       X       : Glib.Gint; 
  90.       Y       : Glib.Gint); 
  91.    --  Warps the pointer of display to the point x,y on the screen screen, 
  92.    --  unless the pointer is confined to a window by a grab, in which case it 
  93.    --  will be moved as far as allowed by the grab. Warping the pointer creates 
  94.    --  events as if the user had moved the mouse instantaneously to the 
  95.    --  destination. 
  96.    -- 
  97.    --  Note that the pointer should normally be under the control of the user. 
  98.    --  This function was added to cover some rare use cases like keyboard 
  99.    --  navigation support for the color picker in the GtkColorSelectionDialog. 
  100.  
  101.    ------------- 
  102.    -- Screens -- 
  103.    ------------- 
  104.  
  105.    function Get_Default return Gdk_Screen; 
  106.    --  Gets the default screen for the default display 
  107.  
  108.    function Get_Display 
  109.      (Screen : access Gdk_Screen_Record) return Gdk.Display.Gdk_Display; 
  110.    --  Gets the display to which the screen belongs. 
  111.  
  112.    procedure Set_Default_Colormap 
  113.      (Screen   : access Gdk_Screen_Record; 
  114.       Colormap : Gdk.Gdk_Colormap); 
  115.    function Get_Default_Colormap 
  116.      (Screen : access Gdk_Screen_Record) return Gdk.Gdk_Colormap; 
  117.    --  Gets the default colormap for screen. 
  118.  
  119.    function Get_System_Colormap 
  120.      (Screen : access Gdk_Screen_Record) return Gdk.Gdk_Colormap; 
  121.    --  Gets the system's colormap for screen 
  122.  
  123.    function Get_System_Visual 
  124.      (Screen : access Gdk_Screen_Record) return Gdk.Gdk_Visual; 
  125.    --  Get the system's default visual for screen. This is the visual for the 
  126.    --  root window of the display. The return value should not be freed. 
  127.  
  128.    function Get_Rgb_Colormap 
  129.      (Screen : access Gdk_Screen_Record) return Gdk.Gdk_Colormap; 
  130.    --  Gets the preferred colormap for rendering image data on screen. Not a 
  131.    --  very useful function; historically, GDK could only render RGB image data 
  132.    --  to one colormap and visual, but in the current version it can render to 
  133.    --  any colormap and visual. So there's no need to call this function. 
  134.  
  135.    function Get_Rgb_Visual 
  136.      (Screen : access Gdk_Screen_Record) return Gdk.Gdk_Visual; 
  137.    --  Gets a "preferred visual" chosen by GdkRGB for rendering image data on 
  138.    --  screen. In previous versions of GDK, this was the only visual GdkRGB 
  139.    --  could use for rendering. In current versions, it's simply the visual 
  140.    --  GdkRGB would have chosen as the optimal one in those previous versions. 
  141.    --  GdkRGB can now render to drawables with any visual. 
  142.  
  143.    function Get_Rgba_Colormap 
  144.      (Screen : access Gdk_Screen_Record) return Gdk.Gdk_Colormap; 
  145.    --  Gets a colormap to use for creating windows or pixmaps with an alpha 
  146.    --  channel. The windowing system on which GTK+ is running may not support 
  147.    --  this capability, in which case NULL will be returned. Even if a non-NULL 
  148.    --  value is returned, its possible that the window's alpha channel won't be 
  149.    --  honored when displaying the window on the screen: in particular, for X 
  150.    --  an appropriate windowing manager and compositing manager must be running 
  151.    --  to provide appropriate display. 
  152.  
  153.    function Get_Rgba_Visual 
  154.      (Screen : access Gdk_Screen_Record) return Gdk.Gdk_Visual; 
  155.    --  Gets a visual to use for creating windows or pixmaps with an alpha 
  156.    --  channel. See the docs for Get_Rgba_Colormap for caveats. 
  157.  
  158.    function Get_Root_Window 
  159.      (Screen : access Gdk_Screen_Record) return Gdk.Gdk_Window; 
  160.    --  Gets the root window of screen. 
  161.  
  162.    function Get_Number (Screen : access Gdk_Screen_Record) return Glib.Gint; 
  163.    --  Gets the index of screen among the screens in the display to which it 
  164.    --  belongs. 
  165.  
  166.    function Get_Width  (Screen : access Gdk_Screen_Record) return Glib.Gint; 
  167.    function Get_Height (Screen : access Gdk_Screen_Record) return Glib.Gint; 
  168.    --  Gets the size of screen in pixels 
  169.  
  170.    function Get_Width_Mm  (Screen : access Gdk_Screen_Record) return Glib.Gint; 
  171.    function Get_Height_Mm (Screen : access Gdk_Screen_Record) return Glib.Gint; 
  172.    --  Gets the width of screen in millimeters. Note that on some X servers 
  173.    --  this value will not be correct. 
  174.  
  175.    function Make_Display_Name 
  176.      (Screen : access Gdk_Screen_Record) return String; 
  177.    --  Determines the name to pass to Gdk.Display.Open to get a GdkDisplay with 
  178.    --  this screen as the default screen. 
  179.  
  180.    function Get_N_Monitors 
  181.      (Screen : access Gdk_Screen_Record) return Glib.Gint; 
  182.    --  Returns the number of monitors which screen consists of. 
  183.  
  184.    function Is_Composited (Screen : access Gdk_Screen_Record) return Boolean; 
  185.    --  Returns whether windows with an RGBA visual can reasonably be expected 
  186.    --  to have their alpha channel drawn correctly on the screen. 
  187.    -- 
  188.    --  On X11 this function returns whether a compositing manager is 
  189.    --  compositing Screen. 
  190.    -- 
  191.    --  Since: 2.10 
  192.  
  193.    -------------- 
  194.    -- Monitors -- 
  195.    -------------- 
  196.  
  197.    procedure Get_Monitor_Geometry 
  198.      (Screen      : access Gdk_Screen_Record; 
  199.       Monitor_Num : Glib.Gint; 
  200.       Dest        : out Gdk.Rectangle.Gdk_Rectangle); 
  201.    --  Retrieves the Gdk_Rectangle representing the size and position of the 
  202.    --  individual monitor within the entire screen area. 
  203.    --  Note that the size of the entire screen area can be retrieved via 
  204.    --  Get_Width and Get_Height. 
  205.  
  206.    function Get_Monitor_At_Point 
  207.      (Screen : access Gdk_Screen_Record; 
  208.       X      : Glib.Gint; 
  209.       Y      : Glib.Gint) 
  210.       return Glib.Gint; 
  211.    --  Returns the monitor number in which the point (X,Y) is located. 
  212.    --  These are coordinates within the virtual screen. The closest monitor is 
  213.    --  returned when (X, Y) is not in any monitor 
  214.  
  215.    function Get_Monitor_At_Window 
  216.      (Screen : access Gdk_Screen_Record; 
  217.       Window : Gdk.Gdk_Window) return Glib.Gint; 
  218.    --  Returns the number of the monitor in which the largest area of the 
  219.    --  bounding rectangle of Window resides. 
  220.  
  221.    procedure Get_Setting 
  222.      (Screen : access Gdk_Screen_Record; 
  223.       Name   : String; 
  224.       Value  : out Glib.Values.GValue; 
  225.       Found  : out Boolean); 
  226.    --  Retrieves a desktop-wide setting such as double-click time for the 
  227.    --  Gdk_Screen screen. 
  228.  
  229.    ------------- 
  230.    -- Signals -- 
  231.    ------------- 
  232.  
  233.    --  <signals> 
  234.    -- 
  235.    --  - "size_changed" 
  236.    --    procedure Handler (Screen : access Gdk_Screen_Record'Class); 
  237.    --    Emitted when the pixel width or height of a screen changes. 
  238.    --  </signals> 
  239.  
  240.    Signal_Size_Changed : constant Glib.Signal_Name := "size_changed"; 
  241.  
  242. private 
  243.    pragma Import (C, Get_Type, "gdk_screen_get_type"); 
  244. end Gdk.Screen; 
  245.  
  246. --  Reserved for internal use by gtk+: 
  247. --  No binding: gdk_screen_set_font_options_libgtk_only 
  248. --  No binding: gdk_screen_set_resolution_libgtk_only 
  249. --  No binding: gdk_screen_get_resolution_libgtk_only 
  250. --  No binding: gdk_screen_get_font_options_libgtk_only 
  251.  
  252. --  Low-level: 
  253. --  No binding: gdk_screen_broadcast_client_message 
  254.  
  255. --  Binding would be nice, requires a list of C_Proxy: 
  256. --  No binding: gdk_screen_get_toplevel_windows 
  257. --  No binding: gdk_screen_list_visuals