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