1 /* $Id: display.hg,v 1.22 2006/04/12 11:11:24 murrayc Exp $ */
5 * Copyright (C) 1998-2002 The gtkmm Development Team
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library 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.
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 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <gdkmm/screen.h>
23 #include <gdkmm/device.h>
24 #include <gdkmm/types.h> //For ModifierType
26 _PINCLUDE(glibmm/private/object_p.h)
32 _CC_INCLUDE(gdk/gdkenumtypes.h)
36 /** Gdk::Display object's purpose is two fold:
37 * To grab/ungrab keyboard focus and mouse pointer
38 * To manage and provide information about the Gdk::Screen(s) available for this Gdk::Display
40 * Gdk::Display objects are the GDK representation of the X Display which can be described as a workstation consisting
41 * of a keyboard a pointing device (such as a mouse) and one or more screens. It is used to open and keep track of
42 * various Gdk::Screen objects currently instantiated by the application. It is also used to grab and release the keyboard
43 * and the mouse pointer.
45 class Display : public Glib::Object
47 _CLASS_GOBJECT(Display,GdkDisplay,GDK_DISPLAY,Glib::Object,GObject)
52 _WRAP_METHOD(static Glib::RefPtr<Display> open(const Glib::ustring& display_name), gdk_display_open, refreturn)
54 _WRAP_METHOD(Glib::ustring get_name() const, gdk_display_get_name)
56 _WRAP_METHOD(int get_n_screens() const, gdk_display_get_n_screens)
57 _WRAP_METHOD(Glib::RefPtr<Screen> get_screen(int screen_num), gdk_display_get_screen, refreturn)
58 _WRAP_METHOD(Glib::RefPtr<const Screen> get_screen(int screen_num) const, gdk_display_get_screen, refreturn, constversion)
60 _WRAP_METHOD(Glib::RefPtr<Screen> get_default_screen(), gdk_display_get_default_screen, refreturn)
61 _WRAP_METHOD(Glib::RefPtr<const Screen> get_default_screen() const, gdk_display_get_default_screen, refreturn, constversion)
63 _WRAP_METHOD(void pointer_ungrab(guint32 timestamp), gdk_display_pointer_ungrab)
64 _WRAP_METHOD(void keyboard_ungrab(guint32 timestamp), gdk_display_keyboard_ungrab)
65 _WRAP_METHOD(bool pointer_is_grabbed() const, gdk_display_pointer_is_grabbed)
66 _WRAP_METHOD(void beep(), gdk_display_beep)
67 _WRAP_METHOD(void sync(), gdk_display_sync)
68 _WRAP_METHOD(void close(), gdk_display_close)
70 _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Device> > list_devices(), gdk_display_list_devices)
71 _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const Device> > list_devices() const, gdk_display_list_devices)
73 //TODO: Use C++ Gdk::Event:
74 //TODO: get_event() might remove the event - if so, then there should not be a const version:
75 _WRAP_METHOD(GdkEvent* get_event(), gdk_display_get_event)
76 _WRAP_METHOD(const GdkEvent* get_event() const, gdk_display_get_event, constversion)
78 _WRAP_METHOD(GdkEvent* peek_event(), gdk_display_peek_event)
79 _WRAP_METHOD(GdkEvent* peek_event() const, gdk_display_peek_event, constversion)
80 _WRAP_METHOD(void put_event(GdkEvent* event), gdk_display_put_event)
82 //TODO: Use a slot here, though this is probably never used anyway:
83 //Find out whether we can use a string representation for the atom - look for examples of this function's use.
84 _WRAP_METHOD(void add_client_message_filter(Glib::ustring& message_type, GdkFilterFunc func, gpointer data), gdk_display_add_client_message_filter)
86 _WRAP_METHOD(void set_double_click_time(guint msec), gdk_display_set_double_click_time)
87 _WRAP_METHOD(void set_double_click_distance(guint distance), gdk_display_set_double_click_distance)
90 _WRAP_METHOD(static Glib::RefPtr<Display> get_default(), gdk_display_get_default, refreturn)
92 _WRAP_METHOD(Glib::RefPtr<Device> get_core_pointer(), gdk_display_get_core_pointer, refreturn)
93 _WRAP_METHOD(Glib::RefPtr<const Device> get_core_pointer() const, gdk_display_get_core_pointer, refreturn)
95 /** Gets the current location of the pointer and the current modifier
96 * mask for a given display.
98 * @param screen location to store the screen that the cursor is on.
99 * @param x location to store root window X coordinate of pointer.
100 * @param y location to store root window Y coordinate of pointer.
101 * @param mask location to store current modifier mask.
104 void get_pointer(Glib::RefPtr<Screen>& screen, int& x, int& y, ModifierType& mask);
106 // In fact, any one of these gdk_display_get_pointer() args can be NULL, but we don't need so many overloads.
108 * Gets the current location of the pointer and the current modifier
109 * mask for a given display.
111 * @param x location to store root window X coordinate of pointer.
112 * @param y location to store root window Y coordinate of pointer.
113 * @param mask location to store current modifier mask.
116 void get_pointer(int& x, int& y, ModifierType& mask);
117 _IGNORE(gdk_display_get_pointer)
119 _WRAP_METHOD(Glib::RefPtr<Window> get_window_at_pointer(int& win_x, int& win_y), gdk_display_get_window_at_pointer, refreturn)
120 _WRAP_METHOD(Glib::RefPtr<const Window> get_window_at_pointer(int& win_x, int& win_y) const, gdk_display_get_window_at_pointer, refreturn, constversion)
122 /** Obtains the window underneath the mouse pointer. Returns a null RefPtr if the window
123 * under the mouse pointer is not known to GDK (for example, belongs to
124 * another application).
125 * @result The window underneath the mouse pointer.
127 Glib::RefPtr<Window> get_window_at_pointer();
129 /** Obtains the window underneath the mouse pointer. Returns a null RefPtr if the window
130 * under the mouse pointer is not known to GDK (for example, belongs to
131 * another application).
132 * @result The window underneath the mouse pointer.
134 Glib::RefPtr<const Window> get_window_at_pointer() const;
136 _WRAP_METHOD(void warp_pointer(const Glib::RefPtr<Screen>& screen, int x, int y), gdk_display_warp_pointer)
138 _WRAP_METHOD(GdkDisplayPointerHooks* set_pointer_hooks(const GdkDisplayPointerHooks* new_hooks), gdk_display_set_pointer_hooks)
139 GdkDisplayPointerHooks* unset_pointer_hooks();
141 _WRAP_METHOD(static Glib::RefPtr<Display> open_default_libgtk_only(), gdk_display_open_default_libgtk_only, refreturn)
143 _WRAP_METHOD(guint32 get_drag_protocol(guint32 xid, GdkDragProtocol& protocol), gdk_drag_get_protocol_for_display)
145 _WRAP_METHOD(GdkKeymap* get_keymap(), gdk_keymap_get_for_display)
146 _WRAP_METHOD(const GdkKeymap* get_keymap() const, gdk_keymap_get_for_display, constversion)
148 bool set_selection_owner(const Glib::RefPtr<Window>& owner, Glib::ustring& selection, guint32 time_, bool send_event);
149 Glib::RefPtr<Window> get_selection_owner(const Glib::ustring& selection);
150 void selection_send_notify(guint32 requestor, Glib::ustring& selection, Glib::ustring& target, Glib::ustring& property, guint32 time_);
152 _WRAP_METHOD(Glib::RefPtr<Pixmap> lookup_pixmap(NativeWindow anid), gdk_pixmap_lookup_for_display)
153 _WRAP_METHOD(Glib::RefPtr<const Pixmap> lookup_pixmap(NativeWindow anid) const, gdk_pixmap_lookup_for_display, constversion)
155 _WRAP_METHOD(void flush(), gdk_display_flush)
156 _WRAP_METHOD(bool supports_cursor_alpha() const, gdk_display_supports_cursor_alpha)
157 _WRAP_METHOD(bool supports_cursor_color() const, gdk_display_supports_cursor_color)
158 _WRAP_METHOD(guint get_default_cursor_size() const, gdk_display_get_default_cursor_size)
159 _WRAP_METHOD(void get_maximal_cursor_size(guint& width, guint& height), gdk_display_get_maximal_cursor_size)
161 _WRAP_METHOD(Glib::RefPtr<Window> get_default_group(), gdk_display_get_default_group, refreturn)
162 _WRAP_METHOD(Glib::RefPtr<const Window> get_default_group() const, gdk_display_get_default_group, refreturn, constversion)
164 //TODO: wrap the vfuncs, though they are not very useful because people will not derive from this class? murrayc.
167 _WRAP_METHOD(bool supports_selection_notification() const, gdk_display_supports_selection_notification)
168 _WRAP_METHOD(bool request_selection_notification(const Glib::ustring& selection), gdk_display_request_selection_notification)
170 _WRAP_METHOD(bool supports_clipboard_persistence() const, gdk_display_supports_clipboard_persistence)
172 /** Issues a request to the clipboard manager to store the clipboard data,
173 * saving all available targets.
174 * On X11, this is a special program that works according to the freedesktop clipboard specification,
175 * available at http://www.freedesktop.org/Standards/clipboard-manager-spec.
178 * @param clipboard_window A Gdk::Window belonging to the clipboard owner.
179 * @param time_ A timestamp.
181 void store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window, guint32 time_);
183 void store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window, guint32 time_, const Glib::StringArrayHandle& targets);
184 _IGNORE(gdk_display_store_clipboard)
186 _WRAP_METHOD(bool supports_shapes() const, gdk_display_supports_shapes)
187 _WRAP_METHOD(bool supports_input_shapes() const, gdk_display_supports_input_shapes)
188 _WRAP_METHOD(bool supports_composite() const, gdk_display_supports_composite)
191 /** The closed signal is emitted when the connection to the windowing
192 * system for this display is closed.
194 * @param is_error true if the display was closed due to an error
196 _WRAP_SIGNAL(void closed(bool is_error), closed)
199 } /* namespace Gdk */