2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GdkScreen.html
44 * - gtkc.cairoLibtypes
58 * - GdkColormap* -> Colormap
59 * - GdkDisplay* -> Display
60 * - GdkEvent* -> Event
61 * - GdkRectangle* -> Rectangle
62 * - GdkScreen* -> Screen
63 * - GdkVisual* -> Visual
64 * - GdkWindow* -> Window
75 import tango
.io
.Stdout
; // use the tango loging?
79 private import gtkc
.gdktypes
;
81 private import gtkc
.gdk
;
84 private import gtkc
.cairoLibtypes
;
85 private import glib
.Str
;
86 private import gdk
.Screen
;
87 private import gdk
.Colormap
;
88 private import gdk
.Visual
;
89 private import gdk
.Window
;
90 private import gdk
.Display
;
91 private import glib
.ListG
;
92 private import gdk
.Rectangle
;
93 private import gdk
.Event
;
94 private import gobject
.Value
;
101 * GdkScreen objects are the GDK representation of a physical screen. It is used
102 * throughout GDK and GTK+ to specify which screen the top level windows
103 * are to be displayed on.
104 * It is also used to query the screen specification and default settings such as
105 * the default colormap (gdk_screen_get_default_colormap()),
106 * the screen width (gdk_screen_get_width()), etc.
107 * Note that a screen may consist of multiple monitors which are merged to
108 * form a large screen area.
110 private import gobject
.ObjectG
;
111 public class Screen
: ObjectG
114 /** the main Gtk struct */
115 protected GdkScreen
* gdkScreen
;
118 public GdkScreen
* getScreenStruct()
124 /** the main Gtk struct as a void* */
125 protected void* getStruct()
127 return cast(void*)gdkScreen
;
131 * Sets our main struct and passes it to the parent class
133 public this (GdkScreen
* gdkScreen
)
137 if ( gdkScreen
is null )
142 Stdout("struct gdkScreen is null on constructor").newline
;
146 printf("struct gdkScreen is null on constructor");
153 assert(gdkScreen
!is null, "struct gdkScreen is null on constructor");
155 super(cast(GObject
*)gdkScreen
);
156 this.gdkScreen
= gdkScreen
;
162 // imports for the signal processing
163 private import gobject
.Signals
;
164 private import gtkc
.gdktypes
;
165 int[char[]] connectedSignals
;
167 void delegate(Screen
)[] onCompositedChangedListeners
;
168 void addOnCompositedChanged(void delegate(Screen
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
170 if ( !("composited-changed" in connectedSignals
) )
174 "composited-changed",
175 cast(GCallback
)&callBackCompositedChanged
,
179 connectedSignals
["composited-changed"] = 1;
181 onCompositedChangedListeners
~= dlg
;
183 extern(C
) static void callBackCompositedChanged(GdkScreen
* screenStruct
, Screen screen
)
185 bool consumed
= false;
187 foreach ( void delegate(Screen
) dlg
; screen
.onCompositedChangedListeners
)
195 void delegate(Screen
)[] onSizeChangedListeners
;
196 void addOnSizeChanged(void delegate(Screen
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
198 if ( !("size-changed" in connectedSignals
) )
203 cast(GCallback
)&callBackSizeChanged
,
207 connectedSignals
["size-changed"] = 1;
209 onSizeChangedListeners
~= dlg
;
211 extern(C
) static void callBackSizeChanged(GdkScreen
* screenStruct
, Screen screen
)
213 bool consumed
= false;
215 foreach ( void delegate(Screen
) dlg
; screen
.onSizeChangedListeners
)
226 * Gets the default screen for the default display. (See
227 * gdk_display_get_default()).
229 * a GdkScreen, or NULL if there is no default display.
232 public static Screen
getDefault()
234 // GdkScreen* gdk_screen_get_default (void);
235 return new Screen( gdk_screen_get_default() );
239 * Gets the default colormap for screen.
243 * the default GdkColormap.
246 public Colormap
getDefaultColormap()
248 // GdkColormap* gdk_screen_get_default_colormap (GdkScreen *screen);
249 return new Colormap( gdk_screen_get_default_colormap(gdkScreen
) );
253 * Sets the default colormap for screen.
260 public void setDefaultColormap(Colormap colormap
)
262 // void gdk_screen_set_default_colormap (GdkScreen *screen, GdkColormap *colormap);
263 gdk_screen_set_default_colormap(gdkScreen
, (colormap
is null) ?
null : colormap
.getColormapStruct());
267 * Gets the system's default colormap for screen
271 * the default colormap for screen.
274 public Colormap
getSystemColormap()
276 // GdkColormap* gdk_screen_get_system_colormap (GdkScreen *screen);
277 return new Colormap( gdk_screen_get_system_colormap(gdkScreen
) );
281 * Get the system's default visual for screen.
282 * This is the visual for the root window of the display.
283 * The return value should not be freed.
290 public Visual
getSystemVisual()
292 // GdkVisual* gdk_screen_get_system_visual (GdkScreen *screen);
293 return new Visual( gdk_screen_get_system_visual(gdkScreen
) );
297 * Gets the preferred colormap for rendering image data on screen.
298 * Not a very useful function; historically, GDK could only render RGB
299 * image data to one colormap and visual, but in the current version
300 * it can render to any colormap and visual. So there's no need to
301 * call this function.
305 * the preferred colormap
308 public Colormap
getRgbColormap()
310 // GdkColormap* gdk_screen_get_rgb_colormap (GdkScreen *screen);
311 return new Colormap( gdk_screen_get_rgb_colormap(gdkScreen
) );
315 * Gets a "preferred visual" chosen by GdkRGB for rendering image data
316 * on screen. In previous versions of
317 * GDK, this was the only visual GdkRGB could use for rendering. In
318 * current versions, it's simply the visual GdkRGB would have chosen as
319 * the optimal one in those previous versions. GdkRGB can now render to
320 * drawables with any visual.
324 * The GdkVisual chosen by GdkRGB.
327 public Visual
getRgbVisual()
329 // GdkVisual* gdk_screen_get_rgb_visual (GdkScreen *screen);
330 return new Visual( gdk_screen_get_rgb_visual(gdkScreen
) );
334 * Gets a colormap to use for creating windows or pixmaps with an
335 * alpha channel. The windowing system on which GTK+ is running
336 * may not support this capability, in which case NULL will
337 * be returned. Even if a non-NULL value is returned, its
338 * possible that the window's alpha channel won't be honored
339 * when displaying the window on the screen: in particular, for
340 * X an appropriate windowing manager and compositing manager
341 * must be running to provide appropriate display.
345 * a colormap to use for windows with an alpha channel
346 * or NULL if the capability is not available.
349 public Colormap
getRgbaColormap()
351 // GdkColormap* gdk_screen_get_rgba_colormap (GdkScreen *screen);
352 return new Colormap( gdk_screen_get_rgba_colormap(gdkScreen
) );
356 * Gets a visual to use for creating windows or pixmaps with an
357 * alpha channel. See the docs for gdk_screen_get_rgba_colormap()
362 * a visual to use for windows with an alpha channel
363 * or NULL if the capability is not available.
366 public Visual
getRgbaVisual()
368 // GdkVisual* gdk_screen_get_rgba_visual (GdkScreen *screen);
369 return new Visual( gdk_screen_get_rgba_visual(gdkScreen
) );
373 * Returns whether windows with an RGBA visual can reasonably
374 * be expected to have their alpha channel drawn correctly on
376 * On X11 this function returns whether a compositing manager is
377 * compositing screen.
381 * Whether windows with RGBA visuals can reasonably be
382 * expected to have their alpha channels drawn correctly on the screen.
385 public int isComposited()
387 // gboolean gdk_screen_is_composited (GdkScreen *screen);
388 return gdk_screen_is_composited(gdkScreen
);
392 * Gets the root window of screen.
399 public Window
getRootWindow()
401 // GdkWindow* gdk_screen_get_root_window (GdkScreen *screen);
402 return new Window( gdk_screen_get_root_window(gdkScreen
) );
406 * Gets the display to which the screen belongs.
410 * the display to which screen belongs
413 public Display
getDisplay()
415 // GdkDisplay* gdk_screen_get_display (GdkScreen *screen);
416 return new Display( gdk_screen_get_display(gdkScreen
) );
420 * Gets the index of screen among the screens in the display
421 * to which it belongs. (See gdk_screen_get_display())
428 public int getNumber()
430 // gint gdk_screen_get_number (GdkScreen *screen);
431 return gdk_screen_get_number(gdkScreen
);
435 * Gets the width of screen in pixels
439 * the width of screen in pixels.
442 public int getWidth()
444 // gint gdk_screen_get_width (GdkScreen *screen);
445 return gdk_screen_get_width(gdkScreen
);
449 * Gets the height of screen in pixels
453 * the height of screen in pixels.
456 public int getHeight()
458 // gint gdk_screen_get_height (GdkScreen *screen);
459 return gdk_screen_get_height(gdkScreen
);
463 * Gets the width of screen in millimeters.
464 * Note that on some X servers this value will not be correct.
468 * the width of screen in millimeters.
471 public int getWidthMm()
473 // gint gdk_screen_get_width_mm (GdkScreen *screen);
474 return gdk_screen_get_width_mm(gdkScreen
);
478 * Returns the height of screen in millimeters.
479 * Note that on some X servers this value will not be correct.
483 * the heigth of screen in millimeters.
486 public int getHeightMm()
488 // gint gdk_screen_get_height_mm (GdkScreen *screen);
489 return gdk_screen_get_height_mm(gdkScreen
);
493 * Lists the available visuals for the specified screen.
494 * A visual describes a hardware image data format.
495 * For example, a visual might support 24-bit color, or 8-bit color,
496 * and might expect pixels to be in a certain format.
497 * Call g_list_free() on the return value when you're finished with it.
499 * the relevant GdkScreen.
501 * a list of visuals; the list must be freed, but not its
505 public ListG
listVisuals()
507 // GList* gdk_screen_list_visuals (GdkScreen *screen);
508 return new ListG( gdk_screen_list_visuals(gdkScreen
) );
512 * Obtains a list of all toplevel windows known to GDK on the screen screen.
513 * A toplevel window is a child of the root window (see
514 * gdk_get_default_root_window()).
515 * The returned list should be freed with g_list_free(), but
516 * its elements need not be freed.
518 * The GdkScreen where the toplevels are located.
520 * list of toplevel windows, free with g_list_free()
523 public ListG
getToplevelWindows()
525 // GList* gdk_screen_get_toplevel_windows (GdkScreen *screen);
526 return new ListG( gdk_screen_get_toplevel_windows(gdkScreen
) );
530 * Determines the name to pass to gdk_display_open() to get
531 * a GdkDisplay with this screen as the default screen.
535 * a newly allocated string, free with g_free()
538 public char[] makeDisplayName()
540 // gchar* gdk_screen_make_display_name (GdkScreen *screen);
541 return Str
.toString(gdk_screen_make_display_name(gdkScreen
) );
545 * Returns the number of monitors which screen consists of.
549 * number of monitors which screen consists of.
552 public int getNMonitors()
554 // gint gdk_screen_get_n_monitors (GdkScreen *screen);
555 return gdk_screen_get_n_monitors(gdkScreen
);
559 * Retrieves the GdkRectangle representing the size and position of
560 * the individual monitor within the entire screen area.
561 * Note that the size of the entire screen area can be retrieved via
562 * gdk_screen_get_width() and gdk_screen_get_height().
566 * the monitor number.
568 * a GdkRectangle to be filled with the monitor geometry
571 public void getMonitorGeometry(int monitorNum
, Rectangle dest
)
573 // void gdk_screen_get_monitor_geometry (GdkScreen *screen, gint monitor_num, GdkRectangle *dest);
574 gdk_screen_get_monitor_geometry(gdkScreen
, monitorNum
, (dest
is null) ?
null : dest
.getRectangleStruct());
578 * Returns the monitor number in which the point (x,y) is located.
582 * the x coordinate in the virtual screen.
584 * the y coordinate in the virtual screen.
586 * the monitor number in which the point (x,y) lies, or
587 * a monitor close to (x,y) if the point is not in any monitor.
590 public int getMonitorAtPoint(int x
, int y
)
592 // gint gdk_screen_get_monitor_at_point (GdkScreen *screen, gint x, gint y);
593 return gdk_screen_get_monitor_at_point(gdkScreen
, x
, y
);
597 * Returns the number of the monitor in which the largest area of the
598 * bounding rectangle of window resides.
604 * the monitor number in which most of window is located,
605 * or if window does not intersect any monitors, a monitor,
609 public int getMonitorAtWindow(Window window
)
611 // gint gdk_screen_get_monitor_at_window (GdkScreen *screen, GdkWindow *window);
612 return gdk_screen_get_monitor_at_window(gdkScreen
, (window
is null) ?
null : window
.getWindowStruct());
616 * On X11, sends an X ClientMessage event to all toplevel windows on
618 * Toplevel windows are determined by checking for the WM_STATE property,
619 * as described in the Inter-Client Communication Conventions Manual (ICCCM).
620 * If no windows are found with the WM_STATE property set, the message is
621 * sent to all children of the root window.
622 * On Windows, broadcasts a message registered with the name
623 * GDK_WIN32_CLIENT_MESSAGE to all top-level windows. The amount of
624 * data is limited to one long, i.e. four bytes.
626 * the GdkScreen where the event will be broadcasted.
631 public void broadcastClientMessage(Event event
)
633 // void gdk_screen_broadcast_client_message (GdkScreen *screen, GdkEvent *event);
634 gdk_screen_broadcast_client_message(gdkScreen
, (event
is null) ?
null : event
.getEventStruct());
638 * Retrieves a desktop-wide setting such as double-click time
639 * for the GdkScreen screen.
640 * FIXME needs a list of valid settings here, or a link to
643 * the GdkScreen where the setting is located
645 * the name of the setting
647 * location to store the value of the setting
649 * TRUE if the setting existed and a value was stored
650 * in value, FALSE otherwise.
653 public int getSetting(char[] name
, Value value
)
655 // gboolean gdk_screen_get_setting (GdkScreen *screen, const gchar *name, GValue *value);
656 return gdk_screen_get_setting(gdkScreen
, Str
.toStringz(name
), (value
is null) ?
null : value
.getValueStruct());
660 * Gets any options previously set with gdk_screen_set_font_options().
664 * the current font options, or NULL if no default
665 * font options have been set.
668 public cairo_font_options_t
* getFontOptions()
670 // const cairo_font_options_t* gdk_screen_get_font_options (GdkScreen *screen);
671 return gdk_screen_get_font_options(gdkScreen
);
675 * Sets the default font options for the screen. These
676 * options will be set on any PangoContext's newly created
677 * with gdk_pango_context_get_for_screen(). Changing the
678 * default set of font options does not affect contexts that
679 * have already been created.
683 * a cairo_font_options_t, or NULL to unset any
684 * previously set default font options.
687 public void setFontOptions(cairo_font_options_t
* options
)
689 // void gdk_screen_set_font_options (GdkScreen *screen, const cairo_font_options_t *options);
690 gdk_screen_set_font_options(gdkScreen
, options
);
694 * Gets the resolution for font handling on the screen; see
695 * gdk_screen_set_resolution() for full details.
699 * the current resolution, or -1 if no resolution
703 public double getResolution()
705 // gdouble gdk_screen_get_resolution (GdkScreen *screen);
706 return gdk_screen_get_resolution(gdkScreen
);
710 * Sets the resolution for font handling on the screen. This is a
711 * scale factor between points specified in a PangoFontDescription
712 * and cairo units. The default value is 96, meaning that a 10 point
713 * font will be 13 units high. (10 * 96. / 72. = 13.3).
717 * the resolution in "dots per inch". (Physical inches aren't actually
718 * involved; the terminology is conventional.)
721 public void setResolution(double dpi
)
723 // void gdk_screen_set_resolution (GdkScreen *screen, gdouble dpi);
724 gdk_screen_set_resolution(gdkScreen
, dpi
);
728 * Returns the screen's currently active window.
729 * On X11, this is done by inspecting the _NET_ACTIVE_WINDOW property
730 * on the root window, as described in the Extended Window
731 * Manager Hints. If there is no currently currently active
732 * window, or the window manager does not support the
733 * _NET_ACTIVE_WINDOW hint, this function returns NULL.
734 * On other platforms, this function may return NULL, depending on whether
735 * it is implementable on that platform.
736 * The returned window should be unrefed using g_object_unref() when
741 * the currently active window, or NULL.
744 public Window
getActiveWindow()
746 // GdkWindow* gdk_screen_get_active_window (GdkScreen *screen);
747 return new Window( gdk_screen_get_active_window(gdkScreen
) );
751 * Returns a GList of GdkWindows representing the current
753 * On X11, this is done by inspecting the _NET_CLIENT_LIST_STACKING
754 * property on the root window, as described in the Extended Window
755 * Manager Hints. If the window manager does not support the
756 * _NET_CLIENT_LIST_STACKING hint, this function returns NULL.
757 * On other platforms, this function may return NULL, depending on whether
758 * it is implementable on that platform.
759 * The returned list is newly allocated and owns references to the
760 * windows it contains, so it should be freed using g_list_free() and
761 * its windows unrefed using g_object_unref() when no longer needed.
765 * a list of GdkWindows for the current window stack,
769 public ListG
getWindowStack()
771 // GList* gdk_screen_get_window_stack (GdkScreen *screen);
772 return new ListG( gdk_screen_get_window_stack(gdkScreen
) );
776 * Like g_spawn_async(), except the child process is spawned in such
777 * an environment that on calling gdk_display_open() it would be
778 * returned a GdkDisplay with screen as the default screen.
779 * This is useful for applications which wish to launch an application
780 * on a specific screen.
784 * child's current working directory, or NULL to
787 * child's argument vector
789 * child's environment, or NULL to inherit parent's
791 * flags from GSpawnFlags
793 * function to run in the child just before exec()
795 * user data for child_setup
797 * return location for child process ID, or NULL
799 * return location for error
801 * TRUE on success, FALSE if error is set
804 public int gdkSpawnOnScreen(char[] workingDirectory
, char** argv
, char** envp
, GSpawnFlags flags
, GSpawnChildSetupFunc childSetup
, void* userData
, int* childPid
, GError
** error
)
806 // gboolean gdk_spawn_on_screen (GdkScreen *screen, const gchar *working_directory, gchar **argv, gchar **envp, GSpawnFlags flags, GSpawnChildSetupFunc child_setup, gpointer user_data, gint *child_pid, GError **error);
807 return gdk_spawn_on_screen(gdkScreen
, Str
.toStringz(workingDirectory
), argv
, envp
, flags
, childSetup
, userData
, childPid
, error
);
811 * Like g_spawn_async_with_pipes(), except the child process is
812 * spawned in such an environment that on calling gdk_display_open()
813 * it would be returned a GdkDisplay with screen as the default
815 * This is useful for applications which wish to launch an application
816 * on a specific screen.
820 * child's current working directory, or NULL to
823 * child's argument vector
825 * child's environment, or NULL to inherit parent's
827 * flags from GSpawnFlags
829 * function to run in the child just before exec()
831 * user data for child_setup
833 * return location for child process ID, or NULL
835 * return location for file descriptor to write to
836 * child's stdin, or NULL
838 * return location for file descriptor to read child's
841 * return location for file descriptor to read child's
844 * return location for error
846 * TRUE on success, FALSE if an error was set
849 public int gdkSpawnOnScreenWithPipes(char[] workingDirectory
, char** argv
, char** envp
, GSpawnFlags flags
, GSpawnChildSetupFunc childSetup
, void* userData
, int* childPid
, int* standardInput
, int* standardOutput
, int* standardError
, GError
** error
)
851 // gboolean gdk_spawn_on_screen_with_pipes (GdkScreen *screen, const gchar *working_directory, gchar **argv, gchar **envp, GSpawnFlags flags, GSpawnChildSetupFunc child_setup, gpointer user_data, gint *child_pid, gint *standard_input, gint *standard_output, gint *standard_error, GError **error);
852 return gdk_spawn_on_screen_with_pipes(gdkScreen
, Str
.toStringz(workingDirectory
), argv
, envp
, flags
, childSetup
, userData
, childPid
, standardInput
, standardOutput
, standardError
, error
);
856 * Like g_spawn_command_line_async(), except the child process is
857 * spawned in such an environment that on calling gdk_display_open()
858 * it would be returned a GdkDisplay with screen as the default
860 * This is useful for applications which wish to launch an application
861 * on a specific screen.
867 * return location for errors
869 * TRUE on success, FALSE if error is set.
872 * The "font-options" property
873 * "font-options" gpointer : Read / Write
874 * The default font options for the screen.
876 public int gdkSpawnCommandLineOnScreen(char[] commandLine
, GError
** error
)
878 // gboolean gdk_spawn_command_line_on_screen (GdkScreen *screen, const gchar *command_line, GError **error);
879 return gdk_spawn_command_line_on_screen(gdkScreen
, Str
.toStringz(commandLine
), error
);