| 1 |
/* Copyright (C) 1998-2013 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#include <vector> |
| 18 |
|
| 19 |
#include <glibmm/object.h> |
| 20 |
#include <gtkmm/bin.h> |
| 21 |
#include <gtkmm/application.h> |
| 22 |
#include <gtkmm/windowgroup.h> |
| 23 |
|
| 24 |
_DEFS(gtkmm,gtk) |
| 25 |
_PINCLUDE(gtkmm/private/bin_p.h) |
| 26 |
|
| 27 |
namespace Gtk |
| 28 |
{ |
| 29 |
|
| 30 |
class GTKMM_API AccelGroup; |
| 31 |
class GTKMM_API WindowGroup; |
| 32 |
|
| 33 |
/** Toplevel Window. |
| 34 |
* This represents all widgets which are physical windows controlled |
| 35 |
* by the window manager. |
| 36 |
* |
| 37 |
* The window will be hidden when the window manager's close button is clicked. Override on_delete_event() to stop this. |
| 38 |
* |
| 39 |
* Gtk::manage() has no effect on Windows because they have no parent Containers. |
| 40 |
* |
| 41 |
* Key values are the codes which are sent whenever a key is pressed or released. |
| 42 |
* The complete list of key values can be found in the |
| 43 |
* <a href="https://gitlab.gnome.org/GNOME/gtk/tree/gtk-3-24/gdk/gdkkeysyms.h">gdk/gdkkeysyms.h</a> |
| 44 |
* header file. They are prefixed with <tt>GDK_KEY_</tt>. |
| 45 |
* |
| 46 |
* @ingroup Widgets |
| 47 |
*/ |
| 48 |
class GTKMM_API Window : public Bin |
| 49 |
{ |
| 50 |
_CLASS_GTKOBJECT(Window,GtkWindow,GTK_WINDOW,Gtk::Bin,GtkBin, , , GTKMM_API) |
| 51 |
_UNMANAGEABLE |
| 52 |
_IGNORE(gtk_window_set_has_user_ref_count, gtk_window_set_destroy_with_parent) |
| 53 |
|
| 54 |
//TODO: Use gtk_window_set_destroy_with_parent() to allow use of Gtk::manage() with top-level windows, using the transient-parent? |
| 55 |
|
| 56 |
public: |
| 57 |
_WRAP_CTOR(Window(WindowType type = WINDOW_TOPLEVEL), gtk_window_new) |
| 58 |
|
| 59 |
_WRAP_PROPERTY("type", WindowType) |
| 60 |
_WRAP_PROPERTY("title", Glib::ustring) |
| 61 |
_WRAP_PROPERTY("startup-id", Glib::ustring) |
| 62 |
_WRAP_PROPERTY("resizable", bool) |
| 63 |
_WRAP_PROPERTY("modal", bool) |
| 64 |
_WRAP_PROPERTY("window_position", WindowPosition) |
| 65 |
_WRAP_PROPERTY("default_width", int) |
| 66 |
_WRAP_PROPERTY("default_height", int) |
| 67 |
_WRAP_PROPERTY("destroy_with_parent", bool) |
| 68 |
_WRAP_PROPERTY("hide-titlebar-when-maximized", bool) |
| 69 |
_WRAP_PROPERTY("icon", Glib::RefPtr<Gdk::Pixbuf>) |
| 70 |
_WRAP_PROPERTY("mnemonics-visible", bool) |
| 71 |
_WRAP_PROPERTY("icon-name", Glib::ustring) |
| 72 |
_WRAP_PROPERTY("screen", Glib::RefPtr<Gdk::Screen>) |
| 73 |
_WRAP_PROPERTY("is_active", bool) |
| 74 |
_WRAP_PROPERTY("has_toplevel_focus", bool) |
| 75 |
_WRAP_PROPERTY("type_hint", GdkWindowTypeHint) |
| 76 |
_WRAP_PROPERTY("skip_taskbar_hint", bool) |
| 77 |
_WRAP_PROPERTY("skip_pager_hint", bool) |
| 78 |
_WRAP_PROPERTY("role", Glib::ustring) |
| 79 |
_WRAP_PROPERTY("decorated", bool) |
| 80 |
_WRAP_PROPERTY("gravity", Gdk::Gravity) |
| 81 |
_WRAP_PROPERTY("transient_for", Window*) |
| 82 |
|
| 83 |
#ifndef GTKMM_DISABLE_DEPRECATED |
| 84 |
// _WRAP_PROPERTY("opacity", double, deprecated "Use the opacity property in the Widget base class instead.") |
| 85 |
// The GtkWindow::opacity property does not exist in gtk+ 3.7.10 and later. Must hand-code to avoid an ABI break. |
| 86 |
/** The opacity of the window, from 0 to 1. |
| 87 |
* @deprecated Use the opacity property in the Widget base class instead. |
| 88 |
* |
| 89 |
* You rarely need to use properties because there are get_ and set_ methods for almost all of them. |
| 90 |
* @return A PropertyProxy that allows you to get or set the value of the property, |
| 91 |
* or receive notification when the value of the property changes. |
| 92 |
*/ |
| 93 |
Glib::PropertyProxy< double > property_opacity() ; |
| 94 |
|
| 95 |
/** The opacity of the window, from 0 to 1. |
| 96 |
* @deprecated Use the opacity property in the Widget base class instead. |
| 97 |
* |
| 98 |
* You rarely need to use properties because there are get_ and set_ methods for almost all of them. |
| 99 |
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 100 |
* or receive notification when the value of the property changes. |
| 101 |
*/ |
| 102 |
Glib::PropertyProxy_ReadOnly< double > property_opacity() const; |
| 103 |
#endif // GTKMM_DISABLE_DEPRECATED |
| 104 |
|
| 105 |
_WRAP_PROPERTY("has-resize-grip", bool, deprecated "Resize grips have been removed.") |
| 106 |
_WRAP_PROPERTY("resize-grip-visible", bool, deprecated "Resize grips have been removed.") |
| 107 |
_WRAP_PROPERTY("urgency_hint", bool) |
| 108 |
_WRAP_PROPERTY("accept-focus", bool) |
| 109 |
_WRAP_PROPERTY("focus-on-map", bool) |
| 110 |
_WRAP_PROPERTY("deletable", bool) |
| 111 |
_WRAP_PROPERTY("application", Glib::RefPtr<Application>) |
| 112 |
_WRAP_PROPERTY("focus-visible", bool) |
| 113 |
_WRAP_PROPERTY("attached-to", Widget*) |
| 114 |
_WRAP_PROPERTY("is-maximized", bool) |
| 115 |
|
| 116 |
_WRAP_SIGNAL(void set_focus(Widget* focus), "set_focus") |
| 117 |
|
| 118 |
//TODO: Remove no_default_handler when we can break ABI: |
| 119 |
_WRAP_SIGNAL(void keys_changed(), "keys_changed", no_default_handler) |
| 120 |
|
| 121 |
//Keybinding signals: |
| 122 |
_IGNORE_SIGNAL("activate_focus") |
| 123 |
_IGNORE_SIGNAL("activate_default") |
| 124 |
_IGNORE_SIGNAL("enable-debugging") |
| 125 |
|
| 126 |
#m4begin |
| 127 |
dnl// Hook in special code to catch explicit uses of gtk_object_destroy() by |
| 128 |
dnl// GTK+ code, e.g. when receiving the GDK_DELETE event. For details, look |
| 129 |
dnl// at Gtk::Window_Class::dispose_vfunc_callback() in window.ccg. |
| 130 |
dnl |
| 131 |
_PUSH(SECTION_PCC_CLASS_INIT_VFUNCS) |
| 132 |
reinterpret_cast<GObjectClass*>(klass)->dispose = &dispose_vfunc_callback; |
| 133 |
_SECTION(SECTION_PH_VFUNCS) |
| 134 |
static void dispose_vfunc_callback(GObject* self); |
| 135 |
_POP() |
| 136 |
#m4end |
| 137 |
|
| 138 |
|
| 139 |
_WRAP_METHOD(void set_title(const Glib::ustring& title), |
| 140 |
gtk_window_set_title) |
| 141 |
|
| 142 |
_WRAP_METHOD(Glib::ustring get_title() const, gtk_window_get_title) |
| 143 |
|
| 144 |
_WRAP_METHOD(void set_wmclass(const Glib::ustring& wmclass_name, |
| 145 |
const Glib::ustring& wmclass_class), |
| 146 |
gtk_window_set_wmclass, deprecated "Don’t use this function.") |
| 147 |
|
| 148 |
_WRAP_METHOD(void set_role(const Glib::ustring& role), gtk_window_set_role) |
| 149 |
|
| 150 |
_WRAP_METHOD(void set_startup_id(const Glib::ustring& startup_id), gtk_window_set_startup_id) |
| 151 |
|
| 152 |
_WRAP_METHOD(Glib::ustring get_role() const, gtk_window_get_role) |
| 153 |
|
| 154 |
|
| 155 |
_WRAP_METHOD(void add_accel_group(const Glib::RefPtr<AccelGroup>& accel_group), |
| 156 |
gtk_window_add_accel_group) |
| 157 |
|
| 158 |
_WRAP_METHOD(void remove_accel_group(const Glib::RefPtr<AccelGroup>& accel_group), |
| 159 |
gtk_window_remove_accel_group) |
| 160 |
|
| 161 |
_WRAP_METHOD(void set_position(WindowPosition position), |
| 162 |
gtk_window_set_position) |
| 163 |
|
| 164 |
_WRAP_METHOD(bool activate_focus(), gtk_window_activate_focus) |
| 165 |
|
| 166 |
_WRAP_METHOD(void set_focus(Gtk::Widget& focus), gtk_window_set_focus) |
| 167 |
void unset_focus(); |
| 168 |
|
| 169 |
_WRAP_METHOD(Widget* get_focus(), gtk_window_get_focus) |
| 170 |
_WRAP_METHOD(const Widget* get_focus() const, gtk_window_get_focus, constversion) |
| 171 |
_WRAP_METHOD(void set_default(Gtk::Widget& default_widget), gtk_window_set_default) |
| 172 |
void unset_default(); |
| 173 |
|
| 174 |
_WRAP_METHOD(Widget* get_default_widget(), gtk_window_get_default_widget) |
| 175 |
_WRAP_METHOD(const Widget* get_default_widget() const, gtk_window_get_default_widget, constversion) |
| 176 |
|
| 177 |
_WRAP_METHOD(bool activate_default(), gtk_window_activate_default) |
| 178 |
|
| 179 |
_WRAP_METHOD(void set_transient_for(Window& parent), gtk_window_set_transient_for) |
| 180 |
|
| 181 |
/** Unsets the current transient window. |
| 182 |
* @see set_transient_for(). |
| 183 |
* @newin{2,20} |
| 184 |
*/ |
| 185 |
void unset_transient_for(); |
| 186 |
|
| 187 |
_WRAP_METHOD(Window* get_transient_for(), gtk_window_get_transient_for) |
| 188 |
_WRAP_METHOD(const Window* get_transient_for() const, gtk_window_get_transient_for, constversion) |
| 189 |
|
| 190 |
/** Unsets the attached-to widget. |
| 191 |
* @see set_attached_to(). |
| 192 |
* @newin{3,4} |
| 193 |
*/ |
| 194 |
void unset_attached_to(); |
| 195 |
|
| 196 |
_WRAP_METHOD(void set_attached_to(Widget& attach_widget), gtk_window_set_attached_to) |
| 197 |
|
| 198 |
_WRAP_METHOD(Widget* get_attached_to(), gtk_window_get_attached_to) |
| 199 |
_WRAP_METHOD(const Widget* get_attached_to() const, gtk_window_get_attached_to, constversion) |
| 200 |
|
| 201 |
_WRAP_METHOD(void set_opacity(double opacity), gtk_window_set_opacity, deprecated "Use Widget::set_opacity() instead.") |
| 202 |
_WRAP_METHOD(double get_opacity() const, gtk_window_get_opacity, deprecated "Use Widget::get_opacity() instead.") |
| 203 |
|
| 204 |
_WRAP_METHOD(void set_type_hint(Gdk::WindowTypeHint hint), gtk_window_set_type_hint) |
| 205 |
_WRAP_METHOD(Gdk::WindowTypeHint get_type_hint() const, gtk_window_get_type_hint) |
| 206 |
|
| 207 |
_WRAP_METHOD(void set_skip_taskbar_hint(bool setting = true), gtk_window_set_skip_taskbar_hint) |
| 208 |
_WRAP_METHOD(bool get_skip_taskbar_hint() const, gtk_window_get_skip_taskbar_hint) |
| 209 |
|
| 210 |
_WRAP_METHOD(void set_skip_pager_hint(bool setting = true), gtk_window_set_skip_pager_hint) |
| 211 |
_WRAP_METHOD(bool get_skip_pager_hint() const, gtk_window_get_skip_pager_hint) |
| 212 |
|
| 213 |
_WRAP_METHOD(void set_urgency_hint(bool setting = true), gtk_window_set_urgency_hint) |
| 214 |
_WRAP_METHOD(bool get_urgency_hint() const, gtk_window_get_urgency_hint) |
| 215 |
|
| 216 |
_WRAP_METHOD(void set_accept_focus(bool setting = true), gtk_window_set_accept_focus) |
| 217 |
_WRAP_METHOD(bool get_accept_focus() const, gtk_window_get_accept_focus) |
| 218 |
_WRAP_METHOD(void set_focus_on_map(bool setting = true), gtk_window_set_focus_on_map) |
| 219 |
_WRAP_METHOD(bool get_focus_on_map() const, gtk_window_get_focus_on_map) |
| 220 |
|
| 221 |
//_WRAP_METHOD(void set_destroy_with_parent(bool setting = true), gtk_window_set_destroy_with_parent) |
| 222 |
// I don't that that this is ever a good thing for C++.murrayc. |
| 223 |
|
| 224 |
//TODO: Remove? |
| 225 |
_WRAP_METHOD(bool get_destroy_with_parent() const, gtk_window_get_destroy_with_parent) |
| 226 |
// I don't that that this is ever a good thing for C++.murrayc. |
| 227 |
|
| 228 |
_WRAP_METHOD(void set_hide_titlebar_when_maximized(bool setting = true), gtk_window_set_hide_titlebar_when_maximized) |
| 229 |
_WRAP_METHOD(bool get_hide_titlebar_when_maximized() const, gtk_window_get_hide_titlebar_when_maximized) |
| 230 |
|
| 231 |
_WRAP_METHOD(void set_mnemonics_visible(bool setting = true), gtk_window_set_mnemonics_visible) |
| 232 |
_WRAP_METHOD(bool get_mnemonics_visible() const, gtk_window_get_mnemonics_visible) |
| 233 |
|
| 234 |
_WRAP_METHOD(void set_focus_visible(bool setting = true), gtk_window_set_focus_visible) |
| 235 |
_WRAP_METHOD(bool get_focus_visible() const, gtk_window_get_focus_visible) |
| 236 |
|
| 237 |
_WRAP_METHOD(void set_resizable(bool resizable = true), gtk_window_set_resizable) |
| 238 |
|
| 239 |
_WRAP_METHOD(bool get_resizable() const, gtk_window_get_resizable) |
| 240 |
|
| 241 |
_WRAP_METHOD(void set_gravity(Gdk::Gravity gravity), gtk_window_set_gravity) |
| 242 |
|
| 243 |
_WRAP_METHOD(Gdk::Gravity get_gravity() const, gtk_window_get_gravity) |
| 244 |
|
| 245 |
_WRAP_METHOD(void set_geometry_hints(Widget& geometry_widget, |
| 246 |
const Gdk::Geometry& geometry, |
| 247 |
Gdk::WindowHints geom_mask), |
| 248 |
gtk_window_set_geometry_hints) |
| 249 |
|
| 250 |
_WRAP_METHOD(void set_screen(const Glib::RefPtr<Gdk::Screen>& screen), gtk_window_set_screen) |
| 251 |
|
| 252 |
_WRAP_METHOD(Glib::RefPtr<Gdk::Screen> get_screen(), gtk_window_get_screen, refreturn) |
| 253 |
_WRAP_METHOD(Glib::RefPtr<const Gdk::Screen> get_screen() const, gtk_window_get_screen, refreturn, constversion) |
| 254 |
|
| 255 |
_WRAP_METHOD(bool is_active() const, gtk_window_is_active) |
| 256 |
_WRAP_METHOD(bool has_toplevel_focus() const, gtk_window_has_toplevel_focus) |
| 257 |
|
| 258 |
_WRAP_METHOD(void set_decorated(bool setting = true), gtk_window_set_decorated) |
| 259 |
_WRAP_METHOD(bool get_decorated() const, gtk_window_get_decorated) |
| 260 |
|
| 261 |
_WRAP_METHOD(void set_deletable(bool setting = true), gtk_window_set_deletable) |
| 262 |
_WRAP_METHOD(bool get_deletable() const, gtk_window_get_deletable) |
| 263 |
|
| 264 |
#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Gdk::Pixbuf> >',`Glib::ListHandler< Glib::RefPtr<Gdk::Pixbuf> >::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)') |
| 265 |
_WRAP_METHOD(std::vector< Glib::RefPtr<Gdk::Pixbuf> > get_icon_list(), gtk_window_get_icon_list) |
| 266 |
#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<const Gdk::Pixbuf> >',`Glib::ListHandler< Glib::RefPtr<const Gdk::Pixbuf> >::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)') |
| 267 |
_WRAP_METHOD(std::vector< Glib::RefPtr<const Gdk::Pixbuf> > get_icon_list() const, gtk_window_get_icon_list) |
| 268 |
|
| 269 |
#m4 _CONVERSION(`const std::vector< Glib::RefPtr<Gdk::Pixbuf> >&',`GList*',`Glib::ListHandler< Glib::RefPtr<Gdk::Pixbuf> >::vector_to_list($3).data ()') |
| 270 |
_WRAP_METHOD(void set_icon_list(const std::vector< Glib::RefPtr<Gdk::Pixbuf> >& list), |
| 271 |
gtk_window_set_icon_list) |
| 272 |
|
| 273 |
_WRAP_METHOD(void set_icon(const Glib::RefPtr<Gdk::Pixbuf>& icon), |
| 274 |
gtk_window_set_icon) |
| 275 |
|
| 276 |
_WRAP_METHOD(void set_icon_name(const Glib::ustring& name), gtk_window_set_icon_name, newin "2,18") |
| 277 |
_WRAP_METHOD(bool set_icon_from_file(const std::string& filename), gtk_window_set_icon_from_file, errthrow) |
| 278 |
|
| 279 |
_WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_icon(), gtk_window_get_icon, refreturn) |
| 280 |
_WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_icon() const, gtk_window_get_icon, refreturn, constversion) |
| 281 |
|
| 282 |
_WRAP_METHOD(Glib::ustring get_icon_name() const, gtk_window_get_icon_name) |
| 283 |
|
| 284 |
_WRAP_METHOD(static void set_default_icon_list( |
| 285 |
const std::vector< Glib::RefPtr<Gdk::Pixbuf> >& list), |
| 286 |
gtk_window_set_default_icon_list) |
| 287 |
|
| 288 |
_WRAP_METHOD(static std::vector< Glib::RefPtr<Gdk::Pixbuf> > get_default_icon_list(), gtk_window_get_default_icon_list) |
| 289 |
|
| 290 |
_WRAP_METHOD(static void set_default_icon(const Glib::RefPtr<Gdk::Pixbuf>& icon), gtk_window_set_default_icon) |
| 291 |
_WRAP_METHOD(static void set_default_icon_name(const Glib::ustring& name), gtk_window_set_default_icon_name) |
| 292 |
_WRAP_METHOD(static bool set_default_icon_from_file(const std::string& filename), gtk_window_set_default_icon_from_file, errthrow) |
| 293 |
_WRAP_METHOD(static void set_auto_startup_notification(bool setting = true), gtk_window_set_auto_startup_notification) |
| 294 |
|
| 295 |
_WRAP_METHOD(void set_modal(bool modal = true), gtk_window_set_modal) |
| 296 |
|
| 297 |
_WRAP_METHOD(bool get_modal() const, gtk_window_get_modal) |
| 298 |
|
| 299 |
#m4 _CONVERSION(`GList*',`std::vector<Window*>',`Glib::ListHandler<Window*>::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)') |
| 300 |
_WRAP_METHOD(static std::vector<Window*> list_toplevels(), gtk_window_list_toplevels) |
| 301 |
|
| 302 |
_WRAP_METHOD(void add_mnemonic(guint keyval, Widget& target), |
| 303 |
gtk_window_add_mnemonic) |
| 304 |
|
| 305 |
_WRAP_METHOD(void remove_mnemonic(guint keyval, Widget& target), |
| 306 |
gtk_window_remove_mnemonic) |
| 307 |
|
| 308 |
_WRAP_METHOD(bool mnemonic_activate(guint keyval, Gdk::ModifierType modifier), |
| 309 |
gtk_window_mnemonic_activate) |
| 310 |
|
| 311 |
_WRAP_METHOD(void set_mnemonic_modifier(Gdk::ModifierType modifier), |
| 312 |
gtk_window_set_mnemonic_modifier) |
| 313 |
|
| 314 |
_WRAP_METHOD(Gdk::ModifierType get_mnemonic_modifier(), |
| 315 |
gtk_window_get_mnemonic_modifier) |
| 316 |
|
| 317 |
|
| 318 |
_WRAP_METHOD(void present(), gtk_window_present) |
| 319 |
_WRAP_METHOD(void present(guint32 timestamp), gtk_window_present_with_time) |
| 320 |
|
| 321 |
_WRAP_METHOD(void iconify(), gtk_window_iconify) |
| 322 |
_WRAP_METHOD(void deiconify(), gtk_window_deiconify) |
| 323 |
|
| 324 |
_WRAP_METHOD(void stick(), gtk_window_stick) |
| 325 |
_WRAP_METHOD(void unstick(), gtk_window_unstick) |
| 326 |
|
| 327 |
_WRAP_METHOD(void maximize(), gtk_window_maximize) |
| 328 |
_WRAP_METHOD(void unmaximize(), gtk_window_unmaximize) |
| 329 |
|
| 330 |
_WRAP_METHOD(void fullscreen(), gtk_window_fullscreen) |
| 331 |
_WRAP_METHOD(void unfullscreen(), gtk_window_unfullscreen) |
| 332 |
_WRAP_METHOD(void fullscreen_on_monitor(const Glib::RefPtr<Gdk::Screen>& screen, int monitor), gtk_window_fullscreen_on_monitor) |
| 333 |
_WRAP_METHOD(void close(), gtk_window_close) |
| 334 |
|
| 335 |
_WRAP_METHOD(void begin_resize_drag(Gdk::WindowEdge edge, |
| 336 |
int button, int root_x, int root_y, guint32 timestamp), |
| 337 |
gtk_window_begin_resize_drag) |
| 338 |
|
| 339 |
_WRAP_METHOD(void begin_move_drag( |
| 340 |
int button, int root_x, int root_y, guint32 timestamp), |
| 341 |
gtk_window_begin_move_drag) |
| 342 |
|
| 343 |
_WRAP_METHOD(void set_default_size(int width, int height), |
| 344 |
gtk_window_set_default_size) |
| 345 |
|
| 346 |
_WRAP_METHOD(void get_default_size(int& width, int& height) const, |
| 347 |
gtk_window_get_default_size) |
| 348 |
|
| 349 |
_WRAP_METHOD(void resize(int width, int height), gtk_window_resize) |
| 350 |
|
| 351 |
_WRAP_METHOD(void get_size(int& width, int& height) const, |
| 352 |
gtk_window_get_size) |
| 353 |
|
| 354 |
|
| 355 |
_WRAP_METHOD(void move(int x, int y), gtk_window_move) |
| 356 |
|
| 357 |
_WRAP_METHOD(void get_position(int& root_x, int& root_y) const, |
| 358 |
gtk_window_get_position) |
| 359 |
|
| 360 |
_WRAP_METHOD(bool parse_geometry(const Glib::ustring& geometry), gtk_window_parse_geometry, |
| 361 |
deprecated "Geometry handling in GTK is deprecated.") |
| 362 |
_WRAP_METHOD(void set_default_geometry(int width, int height), gtk_window_set_default_geometry, |
| 363 |
deprecated "This function does nothing. If you want to set a default size, use set_default_size() instead.") |
| 364 |
_WRAP_METHOD(void resize_to_geometry(int width, int height), gtk_window_resize_to_geometry, |
| 365 |
deprecated "This function does nothing. Use resize() and compute the geometry yourself.") |
| 366 |
|
| 367 |
_WRAP_METHOD(Glib::RefPtr<WindowGroup> get_group(), gtk_window_get_group, refreturn) |
| 368 |
_WRAP_METHOD(Glib::RefPtr<const WindowGroup> get_group() const, gtk_window_get_group, refreturn, constversion) |
| 369 |
|
| 370 |
_WRAP_METHOD(bool has_group() const, gtk_window_has_group) |
| 371 |
|
| 372 |
_WRAP_METHOD(WindowType get_window_type() const, gtk_window_get_window_type) |
| 373 |
|
| 374 |
_WRAP_METHOD(void reshow_with_initial_size(), gtk_window_reshow_with_initial_size, |
| 375 |
deprecated "GUI builders can call Widget::hide(), Widget::unrealize() and then Widget::show() themselves, if they still need this functionality.") |
| 376 |
|
| 377 |
_WRAP_METHOD(Glib::RefPtr<Application> get_application(), gtk_window_get_application, refreturn) |
| 378 |
_WRAP_METHOD(Glib::RefPtr<const Application> get_application() const, gtk_window_get_application, refreturn) |
| 379 |
|
| 380 |
/** Sets the Gtk::Application associated with the window. |
| 381 |
* |
| 382 |
* The application will be kept alive for at least as long as it has any windows |
| 383 |
* associated with it. (See Gio::Application::hold() for a way to keep it alive |
| 384 |
* without windows.) |
| 385 |
* |
| 386 |
* Normally, the connection between the application and the window will remain |
| 387 |
* until the window is destroyed, but you can explicitly remove it by |
| 388 |
* calling unset_application(). |
| 389 |
* |
| 390 |
* This is equivalent to calling Gtk::Application::remove_window() and/or |
| 391 |
* Gtk::Application::add_window() on the old/new applications as relevant, |
| 392 |
* except that the connection between the application and a window added with |
| 393 |
* Gtk::Application::add_window() is removed when the window is closed (hidden). |
| 394 |
* |
| 395 |
* @param application A Gtk::Application. |
| 396 |
*/ |
| 397 |
_WRAP_METHOD(void set_application(const Glib::RefPtr<Application>& application), gtk_window_set_application) |
| 398 |
|
| 399 |
/** Unsets the Application associated with the window. |
| 400 |
* This could cause the application to exit if it is the application's last window. |
| 401 |
*/ |
| 402 |
void unset_application(); |
| 403 |
|
| 404 |
_WRAP_METHOD(void set_has_resize_grip(bool value = true), gtk_window_set_has_resize_grip, deprecated "Resize grips have been removed.") |
| 405 |
_WRAP_METHOD(bool get_has_resize_grip() const, gtk_window_get_has_resize_grip, deprecated "Resize grips have been removed.") |
| 406 |
|
| 407 |
_WRAP_METHOD(bool get_resize_grip_is_visible() const, gtk_window_resize_grip_is_visible, deprecated "Resize grips have been removed.") |
| 408 |
_WRAP_METHOD(bool get_resize_grip_area(Gdk::Rectangle& rect) const, gtk_window_get_resize_grip_area, deprecated "Resize grips have been removed.") |
| 409 |
|
| 410 |
_WRAP_METHOD(void set_keep_above(bool setting = true), gtk_window_set_keep_above) |
| 411 |
_WRAP_METHOD(void set_keep_below(bool setting = true), gtk_window_set_keep_below) |
| 412 |
|
| 413 |
_WRAP_METHOD(void set_titlebar(Widget& titlebar), gtk_window_set_titlebar) |
| 414 |
|
| 415 |
_WRAP_METHOD(Widget* get_titlebar(), gtk_window_get_titlebar) |
| 416 |
_WRAP_METHOD(const Widget* get_titlebar() const, gtk_window_get_titlebar, constversion) |
| 417 |
|
| 418 |
_WRAP_METHOD(bool is_maximized() const, gtk_window_is_maximized) |
| 419 |
|
| 420 |
// from gtk/gtkshow.h: |
| 421 |
_WRAP_METHOD(void show_uri(const Glib::ustring& uri, guint32 timestamp), |
| 422 |
gtk_show_uri_on_window, errthrow, newin "3,24") |
| 423 |
|
| 424 |
_DEPRECATE_IFDEF_START |
| 425 |
/** Returns a default accel group for this window. |
| 426 |
* This is a gtkmm-specific function. |
| 427 |
* |
| 428 |
* @deprecated This returns a group specific to this window, created on the |
| 429 |
* first call. That’s no use if you need groups that were added by other |
| 430 |
* sources, e.g. by Gtk::Builder. Use get_accel_groups(), which correctly |
| 431 |
* returns all groups that have been added to the window regardless of origin. |
| 432 |
* If you just used get_accel_group() as a shortcut to create and add a group, |
| 433 |
* you should instead create it yourself and add it with add_accel_group(). |
| 434 |
*/ |
| 435 |
Glib::RefPtr<AccelGroup> get_accel_group(); |
| 436 |
_DEPRECATE_IFDEF_END |
| 437 |
|
| 438 |
/** Gets a vector containing each Gtk::AccelGroup associated with the window. |
| 439 |
* @newin{3,24} |
| 440 |
* @return A vector of Gtk::AccelGroup. |
| 441 |
*/ |
| 442 |
std::vector< Glib::RefPtr<AccelGroup> > get_accel_groups(); |
| 443 |
|
| 444 |
//TODO: Remove the virtual from this when we can break ABI. |
| 445 |
/** Brings the window to the front. |
| 446 |
* This is just a more obvious convenience wrapper for get_window()->raise(). |
| 447 |
*/ |
| 448 |
virtual void raise(); |
| 449 |
|
| 450 |
///Overriden to warn that it doesn't make sense to use Gtk::manage() on this class because it has no parent container. |
| 451 |
void set_manage() override; |
| 452 |
|
| 453 |
protected: |
| 454 |
|
| 455 |
//See comments in the implementations: |
| 456 |
void destroy_(); |
| 457 |
void _release_c_instance(); |
| 458 |
|
| 459 |
private: |
| 460 |
Glib::RefPtr<AccelGroup> accel_group_; |
| 461 |
}; |
| 462 |
|
| 463 |
} // namespace Gtk |