1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <gtkmm/window.h>
5 #include <gtkmm/private/window_p.h>
12 * Copyright 1998-2002 The gtkmm Development Team
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Library General Public
16 * License as published by the Free Software Foundation; either
17 * version 2 of the License, or (at your option) any later version.
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with this library; if not, write to the Free
26 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include <gtkmm/accelgroup.h>
30 #include <gdkmm/cursor.h>
31 #include <gtk/gtkwindow.h>
37 Glib::RefPtr<AccelGroup> Window::get_accel_group()
39 //There doesn't seem to be any gtk_window_get_accel_group().
40 //I think that you're supposed to remember what you added yourself.
41 //And that's what we do here.
45 accel_group_ = AccelGroup::create();
46 add_accel_group(accel_group_);
52 bool Window::is_toplevel() const
54 return gobj()->type == GTK_WINDOW_TOPLEVEL;
57 bool Window::is_popup() const
59 return gobj()->type == GTK_WINDOW_POPUP;
64 get_window()->raise();
67 void Window::set_manage()
69 g_warning("gtkmm: Attempt to call Gtk::manage() on a Gtk::Window, but a Gtk::Window has no parent container to manage its lifetime.\n");
72 void Window::destroy_()
74 //Called from destructors.
75 //overridden so that the correct _destroy_c_instance() ends up being called by the destructor.
79 #ifdef GLIBMM_DEBUG_REFCOUNTING
80 g_warning("Gtk::Window::destroy_(): gobject_: %10X\n", gobject_);
82 g_warning(" gtypename: %s\n", G_OBJECT_TYPE_NAME(gobject_));
85 if ( !cpp_destruction_in_progress_ ) //see comment below.
87 //Prevent destroy_notify_() from running as a possible side-effect of gtk_object_destroy.
88 //We can't predict whether destroy_notify_() will really be run, so we'll disconnect the C++ instance here.
89 cpp_destruction_in_progress_ = true;
91 //destroy the C instance:
92 _destroy_c_instance();
95 //The C++ destructor will be reached later. This function was called by a destructor.
98 void Window::_destroy_c_instance()
101 //because though top-level windows can only be destroyed with gtk_widget_destroy, according to Owen Taylor. murrayc.
102 #ifdef GLIBMM_DEBUG_REFCOUNTING
103 g_warning("Gtk::Window::_destroy_c_instance() gobject_=%10X\n", gobject_);
106 cpp_destruction_in_progress_ = true;
109 GtkObject* object = (GtkObject*)gobj();
112 disconnect_cpp_wrapper();
113 //If we are killing the C++ instance before the C instance, then this might lead to strange behaviour.
114 //If this is a problem, then you'll have to use a managed() object, which will die only upon GTK+'s request.
116 //We can't do anything with the gobject_ if it's already been disposed.
117 //This prevents us from unref-ing it again, or destroying it again after GTK+ has told us that it has been disposed.
118 if (!gobject_disposed_)
120 //Windows can not be unrefed. They are "self-owning".
121 gtk_object_destroy(object);
124 //Glib::Object::~Object() will not g_object_unref() it too. because gobject_ is now 0.
128 void Window_Class::dispose_vfunc_callback(GObject* self)
130 //Avoid disposal of Windows on delete_event (window close) signal.
132 #ifdef GLIBMM_DEBUG_REFCOUNTING
133 g_warning("Window_Class::dispose_vfunc_callback(): gobject_: %p\n", (void*)self);
136 Widget *const obj = dynamic_cast<Widget*>(
137 Glib::ObjectBase::_get_current_wrapper(self));
139 // This function might be invoked recursively because we're triggering
140 // several signal emissions, particularly signal_hide(). Therefore we
141 // have to test for cpp_destruction_in_progress_ at this point.
143 if(obj && !obj->_cpp_destruction_is_in_progress()) //When it should really be destroyed, we zero gobj_.
145 GtkWidget* const pWidget = obj->gobj();
146 g_return_if_fail(pWidget == GTK_WIDGET(self));
148 // Abort dispose if the widget isn't managed, in order to prevent
149 // the nasty self-destroying behaviour of GTK+. This applies to:
151 // - GtkWindow, if it received "delete_event"
152 // - GtkDialog, which destroys on "response" by default
154 #ifdef GLIBMM_DEBUG_REFCOUNTING
155 g_warning("Window_Class::dispose_vfunc_callback(): before gtk_widget_hide().");
158 // Now hide the widget. The C++ object must _not_ be accessed anymore
159 // after this call, because a signal_hide() handler might delete it.
160 gtk_widget_hide(pWidget);
162 #ifdef GLIBMM_DEBUG_REFCOUNTING
163 g_warning("Window_Class::dispose_vfunc_callback(): after gtk_widget_hide().");
167 return; // Prevent calling of normal C dispose vfunc (see below)
171 #ifdef GLIBMM_DEBUG_REFCOUNTING
172 //g_warning("Window_Class::dispose_vfunc_callback(): unreferenced: before gtk_widget_hide().");
175 // Always hide widgets on gtk_object_destroy(), regardless of whether
176 // the widget is managed or not. This is done for consistency so that
177 // connecting to signal_hide() is guaranteed to work.
178 //gtk_widget_hide(pWidget);
180 #ifdef GLIBMM_DEBUG_REFCOUNTING
181 //g_warning("Window_Class::dispose_vfunc_callback(): unreferenced: after gtk_widget_hide().");
184 GObjectClass *const base = static_cast<GObjectClass*>(
185 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)));
187 #ifdef GLIBMM_DEBUG_REFCOUNTING
188 g_warning("Window_Class::dispose_vfunc_callback(): before calling base->dispose.");
192 (*base->dispose)(self);
194 #ifdef GLIBMM_DEBUG_REFCOUNTING
195 g_warning("Window_Class::dispose_vfunc_callback(): after calling base->dispose.");
200 void Window::unset_focus()
202 gtk_window_set_focus(gobj(), 0 /* See GTK+ docs */);
205 void Window::unset_default()
207 gtk_window_set_default(gobj(), 0 /* See GTK+ docs */);
217 static void Window_signal_set_focus_callback(GtkWindow* self, GtkWidget* p0,void* data)
220 typedef sigc::slot< void,Widget* > SlotType;
222 // Do not try to call a signal on a disassociated wrapper.
223 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
225 #ifdef GLIBMM_EXCEPTIONS_ENABLED
228 #endif //GLIBMM_EXCEPTIONS_ENABLED
229 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
230 (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
232 #ifdef GLIBMM_EXCEPTIONS_ENABLED
236 Glib::exception_handlers_invoke();
238 #endif //GLIBMM_EXCEPTIONS_ENABLED
242 static const Glib::SignalProxyInfo Window_signal_set_focus_info =
245 (GCallback) &Window_signal_set_focus_callback,
246 (GCallback) &Window_signal_set_focus_callback
250 static gboolean Window_signal_frame_event_callback(GtkWindow* self, GdkEvent* p0,void* data)
253 typedef sigc::slot< bool,GdkEvent* > SlotType;
255 // Do not try to call a signal on a disassociated wrapper.
256 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
258 #ifdef GLIBMM_EXCEPTIONS_ENABLED
261 #endif //GLIBMM_EXCEPTIONS_ENABLED
262 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
263 return static_cast<int>((*static_cast<SlotType*>(slot))(p0));
264 #ifdef GLIBMM_EXCEPTIONS_ENABLED
268 Glib::exception_handlers_invoke();
270 #endif //GLIBMM_EXCEPTIONS_ENABLED
273 typedef gboolean RType;
277 static gboolean Window_signal_frame_event_notify_callback(GtkWindow* self, GdkEvent* p0, void* data)
280 typedef sigc::slot< void,GdkEvent* > SlotType;
282 // Do not try to call a signal on a disassociated wrapper.
283 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
285 #ifdef GLIBMM_EXCEPTIONS_ENABLED
288 #endif //GLIBMM_EXCEPTIONS_ENABLED
289 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
290 (*static_cast<SlotType*>(slot))(p0);
291 #ifdef GLIBMM_EXCEPTIONS_ENABLED
295 Glib::exception_handlers_invoke();
297 #endif //GLIBMM_EXCEPTIONS_ENABLED
300 typedef gboolean RType;
304 static const Glib::SignalProxyInfo Window_signal_frame_event_info =
307 (GCallback) &Window_signal_frame_event_callback,
308 (GCallback) &Window_signal_frame_event_notify_callback
312 } // anonymous namespace
318 Glib::RefPtr<Gtk::WindowGroup> wrap(GtkWindowGroup* object, bool take_copy)
320 return Glib::RefPtr<Gtk::WindowGroup>( dynamic_cast<Gtk::WindowGroup*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
321 //We use dynamic_cast<> in case of multiple inheritance.
324 } /* namespace Glib */
331 /* The *_Class implementation: */
333 const Glib::Class& WindowGroup_Class::init()
335 if(!gtype_) // create the GType if necessary
337 // Glib::Class has to know the class init function to clone custom types.
338 class_init_func_ = &WindowGroup_Class::class_init_function;
340 // This is actually just optimized away, apparently with no harm.
341 // Make sure that the parent type has been created.
342 //CppClassParent::CppObjectType::get_type();
344 // Create the wrapper type, with the same class/instance size as the base type.
345 register_derived_type(gtk_window_group_get_type());
347 // Add derived versions of interfaces, if the C type implements any interfaces:
353 void WindowGroup_Class::class_init_function(void* g_class, void* class_data)
355 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
356 CppClassParent::class_init_function(klass, class_data);
358 #ifdef GLIBMM_VFUNCS_ENABLED
359 #endif //GLIBMM_VFUNCS_ENABLED
361 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
362 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
365 #ifdef GLIBMM_VFUNCS_ENABLED
366 #endif //GLIBMM_VFUNCS_ENABLED
368 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
369 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
372 Glib::ObjectBase* WindowGroup_Class::wrap_new(GObject* object)
374 return new WindowGroup((GtkWindowGroup*)object);
378 /* The implementation: */
380 GtkWindowGroup* WindowGroup::gobj_copy()
386 WindowGroup::WindowGroup(const Glib::ConstructParams& construct_params)
388 Glib::Object(construct_params)
391 WindowGroup::WindowGroup(GtkWindowGroup* castitem)
393 Glib::Object((GObject*)(castitem))
396 WindowGroup::~WindowGroup()
400 WindowGroup::CppClassType WindowGroup::windowgroup_class_; // initialize static member
402 GType WindowGroup::get_type()
404 return windowgroup_class_.init().get_type();
407 GType WindowGroup::get_base_type()
409 return gtk_window_group_get_type();
413 WindowGroup::WindowGroup()
415 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
417 Glib::Object(Glib::ConstructParams(windowgroup_class_.init()))
421 Glib::RefPtr<WindowGroup> WindowGroup::create()
423 return Glib::RefPtr<WindowGroup>( new WindowGroup() );
425 void WindowGroup::add_window(Window& window)
427 gtk_window_group_add_window(gobj(), (window).gobj());
430 void WindowGroup::remove_window(Window& window)
432 gtk_window_group_remove_window(gobj(), (window).gobj());
436 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
437 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
439 #ifdef GLIBMM_VFUNCS_ENABLED
440 #endif //GLIBMM_VFUNCS_ENABLED
449 Gtk::Window* wrap(GtkWindow* object, bool take_copy)
451 return dynamic_cast<Gtk::Window *> (Glib::wrap_auto ((GObject*)(object), take_copy));
454 } /* namespace Glib */
460 /* The *_Class implementation: */
462 const Glib::Class& Window_Class::init()
464 if(!gtype_) // create the GType if necessary
466 // Glib::Class has to know the class init function to clone custom types.
467 class_init_func_ = &Window_Class::class_init_function;
469 // This is actually just optimized away, apparently with no harm.
470 // Make sure that the parent type has been created.
471 //CppClassParent::CppObjectType::get_type();
473 // Create the wrapper type, with the same class/instance size as the base type.
474 register_derived_type(gtk_window_get_type());
476 // Add derived versions of interfaces, if the C type implements any interfaces:
482 void Window_Class::class_init_function(void* g_class, void* class_data)
484 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
485 CppClassParent::class_init_function(klass, class_data);
487 #ifdef GLIBMM_VFUNCS_ENABLED
488 #endif //GLIBMM_VFUNCS_ENABLED //We always need dispose_vfunc_callback
489 reinterpret_cast<GObjectClass*>(klass)->dispose = &dispose_vfunc_callback;
490 #ifdef GLIBMM_VFUNCS_ENABLED
491 #endif //GLIBMM_VFUNCS_ENABLED
493 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
494 klass->set_focus = &set_focus_callback;
495 klass->frame_event = &frame_event_callback;
496 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
499 #ifdef GLIBMM_VFUNCS_ENABLED
500 #endif //GLIBMM_VFUNCS_ENABLED
502 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
503 void Window_Class::set_focus_callback(GtkWindow* self, GtkWidget* p0)
505 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
506 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
508 // Non-gtkmmproc-generated custom classes implicitly call the default
509 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
510 // generated classes can use this optimisation, which avoids the unnecessary
511 // parameter conversions if there is no possibility of the virtual function
513 if(obj_base && obj_base->is_derived_())
515 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
516 if(obj) // This can be NULL during destruction.
518 #ifdef GLIBMM_EXCEPTIONS_ENABLED
519 try // Trap C++ exceptions which would normally be lost because this is a C callback.
521 #endif //GLIBMM_EXCEPTIONS_ENABLED
522 // Call the virtual member method, which derived classes might override.
523 obj->on_set_focus(Glib::wrap(p0)
526 #ifdef GLIBMM_EXCEPTIONS_ENABLED
530 Glib::exception_handlers_invoke();
532 #endif //GLIBMM_EXCEPTIONS_ENABLED
536 BaseClassType *const base = static_cast<BaseClassType*>(
537 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
540 // Call the original underlying C function:
541 if(base && base->set_focus)
542 (*base->set_focus)(self, p0);
544 gboolean Window_Class::frame_event_callback(GtkWindow* self, GdkEvent* p0)
546 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
547 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
549 // Non-gtkmmproc-generated custom classes implicitly call the default
550 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
551 // generated classes can use this optimisation, which avoids the unnecessary
552 // parameter conversions if there is no possibility of the virtual function
554 if(obj_base && obj_base->is_derived_())
556 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
557 if(obj) // This can be NULL during destruction.
559 #ifdef GLIBMM_EXCEPTIONS_ENABLED
560 try // Trap C++ exceptions which would normally be lost because this is a C callback.
562 #endif //GLIBMM_EXCEPTIONS_ENABLED
563 // Call the virtual member method, which derived classes might override.
564 return static_cast<int>(obj->on_frame_event(p0));
565 #ifdef GLIBMM_EXCEPTIONS_ENABLED
569 Glib::exception_handlers_invoke();
571 #endif //GLIBMM_EXCEPTIONS_ENABLED
575 BaseClassType *const base = static_cast<BaseClassType*>(
576 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
579 // Call the original underlying C function:
580 if(base && base->frame_event)
581 return (*base->frame_event)(self, p0);
583 typedef gboolean RType;
586 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
589 Glib::ObjectBase* Window_Class::wrap_new(GObject* o)
591 return new Window((GtkWindow*)(o)); //top-level windows can not be manage()ed.
596 /* The implementation: */
598 Window::Window(const Glib::ConstructParams& construct_params)
600 Gtk::Bin(construct_params)
604 Window::Window(GtkWindow* castitem)
606 Gtk::Bin((GtkBin*)(castitem))
615 Window::CppClassType Window::window_class_; // initialize static member
617 GType Window::get_type()
619 return window_class_.init().get_type();
622 GType Window::get_base_type()
624 return gtk_window_get_type();
627 Window::Window(WindowType type)
629 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
631 Gtk::Bin(Glib::ConstructParams(window_class_.init(), "type", ((GtkWindowType)(type)), static_cast<char*>(0)))
635 WindowType Window::get_window_type() const
637 return static_cast<WindowType>(gobj()->type);
640 Glib::RefPtr<Gdk::Window> Window::get_frame()
642 Glib::RefPtr<Gdk::Window> ref_ptr(Glib::wrap((GdkWindowObject*)(gobj()->frame)));
645 ref_ptr->reference();
650 Glib::RefPtr<const Gdk::Window> Window::get_frame() const
652 Glib::RefPtr<const Gdk::Window> ref_ptr(Glib::wrap((GdkWindowObject*)(gobj()->frame)));
655 ref_ptr->reference();
660 void Window::set_title(const Glib::ustring& title)
662 gtk_window_set_title(gobj(), title.c_str());
665 Glib::ustring Window::get_title() const
667 return Glib::convert_const_gchar_ptr_to_ustring(gtk_window_get_title(const_cast<GtkWindow*>(gobj())));
670 void Window::set_wmclass(const Glib::ustring& wmclass_name, const Glib::ustring& wmclass_class)
672 gtk_window_set_wmclass(gobj(), wmclass_name.c_str(), wmclass_class.c_str());
675 void Window::set_role(const Glib::ustring& role)
677 gtk_window_set_role(gobj(), role.c_str());
680 Glib::ustring Window::get_role() const
682 return Glib::convert_const_gchar_ptr_to_ustring(gtk_window_get_role(const_cast<GtkWindow*>(gobj())));
685 void Window::add_accel_group(const Glib::RefPtr<AccelGroup>& accel_group)
687 gtk_window_add_accel_group(gobj(), Glib::unwrap(accel_group));
690 void Window::remove_accel_group(const Glib::RefPtr<AccelGroup>& accel_group)
692 gtk_window_remove_accel_group(gobj(), Glib::unwrap(accel_group));
695 void Window::set_position(WindowPosition position)
697 gtk_window_set_position(gobj(), ((GtkWindowPosition)(position)));
700 bool Window::activate_focus()
702 return gtk_window_activate_focus(gobj());
705 void Window::set_focus(Gtk::Widget& focus)
707 gtk_window_set_focus(gobj(), (focus).gobj());
710 Widget* Window::get_focus()
712 return Glib::wrap(gtk_window_get_focus(gobj()));
715 const Widget* Window::get_focus() const
717 return const_cast<Window*>(this)->get_focus();
720 void Window::set_default(Gtk::Widget& default_widget)
722 gtk_window_set_default(gobj(), (default_widget).gobj());
725 bool Window::activate_default()
727 return gtk_window_activate_default(gobj());
730 void Window::set_transient_for(Window& parent)
732 gtk_window_set_transient_for(gobj(), (parent).gobj());
735 Window* Window::get_transient_for()
737 return Glib::wrap(gtk_window_get_transient_for(gobj()));
740 const Window* Window::get_transient_for() const
742 return const_cast<Window*>(this)->get_transient_for();
745 void Window::set_opacity(double opacity)
747 gtk_window_set_opacity(gobj(), opacity);
750 double Window::get_opacity() const
752 return gtk_window_get_opacity(const_cast<GtkWindow*>(gobj()));
755 void Window::set_type_hint(Gdk::WindowTypeHint hint)
757 gtk_window_set_type_hint(gobj(), ((GdkWindowTypeHint)(hint)));
760 Gdk::WindowTypeHint Window::get_type_hint() const
762 return ((Gdk::WindowTypeHint)(gtk_window_get_type_hint(const_cast<GtkWindow*>(gobj()))));
765 void Window::set_skip_taskbar_hint(bool setting)
767 gtk_window_set_skip_taskbar_hint(gobj(), static_cast<int>(setting));
770 bool Window::get_skip_taskbar_hint() const
772 return gtk_window_get_skip_taskbar_hint(const_cast<GtkWindow*>(gobj()));
775 void Window::set_skip_pager_hint(bool setting)
777 gtk_window_set_skip_pager_hint(gobj(), static_cast<int>(setting));
780 bool Window::get_skip_pager_hint() const
782 return gtk_window_get_skip_pager_hint(const_cast<GtkWindow*>(gobj()));
785 void Window::set_urgency_hint(bool setting)
787 gtk_window_set_urgency_hint(gobj(), static_cast<int>(setting));
790 bool Window::get_urgency_hint() const
792 return gtk_window_get_urgency_hint(const_cast<GtkWindow*>(gobj()));
795 void Window::set_accept_focus(bool setting)
797 gtk_window_set_accept_focus(gobj(), static_cast<int>(setting));
800 bool Window::get_accept_focus() const
802 return gtk_window_get_accept_focus(const_cast<GtkWindow*>(gobj()));
805 void Window::set_focus_on_map(bool setting)
807 gtk_window_set_focus_on_map(gobj(), static_cast<int>(setting));
810 bool Window::get_focus_on_map() const
812 return gtk_window_get_focus_on_map(const_cast<GtkWindow*>(gobj()));
815 bool Window::get_destroy_with_parent() const
817 return gtk_window_get_destroy_with_parent(const_cast<GtkWindow*>(gobj()));
820 void Window::set_resizable(bool resizable)
822 gtk_window_set_resizable(gobj(), static_cast<int>(resizable));
825 bool Window::get_resizable() const
827 return gtk_window_get_resizable(const_cast<GtkWindow*>(gobj()));
830 void Window::set_gravity(Gdk::Gravity gravity)
832 gtk_window_set_gravity(gobj(), ((GdkGravity)(gravity)));
835 Gdk::Gravity Window::get_gravity() const
837 return ((Gdk::Gravity)(gtk_window_get_gravity(const_cast<GtkWindow*>(gobj()))));
840 void Window::set_geometry_hints(Widget& geometry_widget, const Gdk::Geometry& geometry, Gdk::WindowHints geom_mask)
842 gtk_window_set_geometry_hints(gobj(), (geometry_widget).gobj(), const_cast<GdkGeometry*>(&(geometry)), ((GdkWindowHints)(geom_mask)));
845 void Window::set_screen(const Glib::RefPtr<Gdk::Screen>& screen)
847 gtk_window_set_screen(gobj(), Glib::unwrap(screen));
850 Glib::RefPtr<Gdk::Screen> Window::get_screen()
853 Glib::RefPtr<Gdk::Screen> retvalue = Glib::wrap(gtk_window_get_screen(gobj()));
855 retvalue->reference(); //The function does not do a ref for us.
860 Glib::RefPtr<const Gdk::Screen> Window::get_screen() const
862 return const_cast<Window*>(this)->get_screen();
865 void Window::set_has_frame(bool setting)
867 gtk_window_set_has_frame(gobj(), static_cast<int>(setting));
870 bool Window::get_has_frame() const
872 return gtk_window_get_has_frame(const_cast<GtkWindow*>(gobj()));
875 void Window::set_frame_dimensions(int left, int top, int right, int bottom)
877 gtk_window_set_frame_dimensions(gobj(), left, top, right, bottom);
880 void Window::get_frame_dimensions(int& left, int& top, int& right, int& bottom) const
882 gtk_window_get_frame_dimensions(const_cast<GtkWindow*>(gobj()), &left, &top, &right, &bottom);
885 void Window::set_decorated(bool setting)
887 gtk_window_set_decorated(gobj(), static_cast<int>(setting));
890 bool Window::get_decorated() const
892 return gtk_window_get_decorated(const_cast<GtkWindow*>(gobj()));
895 void Window::set_deletable(bool setting)
897 gtk_window_set_deletable(gobj(), static_cast<int>(setting));
900 bool Window::get_deletable() const
902 return gtk_window_get_deletable(const_cast<GtkWindow*>(gobj()));
905 Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> > Window::get_icon_list()
907 return Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> >(gtk_window_get_icon_list(gobj()), Glib::OWNERSHIP_SHALLOW);
910 Glib::ListHandle< Glib::RefPtr<const Gdk::Pixbuf> > Window::get_icon_list() const
912 return Glib::ListHandle< Glib::RefPtr<const Gdk::Pixbuf> >(gtk_window_get_icon_list(const_cast<GtkWindow*>(gobj())), Glib::OWNERSHIP_SHALLOW);
915 void Window::set_icon_list(const Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> >& list)
917 gtk_window_set_icon_list(gobj(), list.data());
920 void Window::set_icon(const Glib::RefPtr<Gdk::Pixbuf>& icon)
922 gtk_window_set_icon(gobj(), Glib::unwrap(icon));
925 #ifdef GLIBMM_EXCEPTIONS_ENABLED
926 bool Window::set_icon_from_file(const std::string& filename)
928 bool Window::set_icon_from_file(const std::string& filename, std::auto_ptr<Glib::Error>& error)
929 #endif //GLIBMM_EXCEPTIONS_ENABLED
932 bool retvalue = gtk_window_set_icon_from_file(gobj(), filename.c_str(), &(gerror));
933 #ifdef GLIBMM_EXCEPTIONS_ENABLED
935 ::Glib::Error::throw_exception(gerror);
938 error = ::Glib::Error::throw_exception(gerror);
939 #endif //GLIBMM_EXCEPTIONS_ENABLED
945 Glib::RefPtr<Gdk::Pixbuf> Window::get_icon()
948 Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_window_get_icon(gobj()));
950 retvalue->reference(); //The function does not do a ref for us.
955 Glib::RefPtr<const Gdk::Pixbuf> Window::get_icon() const
957 return const_cast<Window*>(this)->get_icon();
960 void Window::set_default_icon_list(const Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> >& list)
962 gtk_window_set_default_icon_list(list.data());
966 Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> > Window::get_default_icon_list()
968 return Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> >(gtk_window_get_default_icon_list(), Glib::OWNERSHIP_SHALLOW);
972 void Window::set_default_icon(const Glib::RefPtr<Gdk::Pixbuf>& icon)
974 gtk_window_set_default_icon(Glib::unwrap(icon));
978 void Window::set_default_icon_name(const Glib::ustring& name)
980 gtk_window_set_default_icon_name(name.c_str());
984 #ifdef GLIBMM_EXCEPTIONS_ENABLED
985 bool Window::set_default_icon_from_file(const std::string& filename)
987 bool Window::set_default_icon_from_file(const std::string& filename, std::auto_ptr<Glib::Error>& error)
988 #endif //GLIBMM_EXCEPTIONS_ENABLED
991 bool retvalue = gtk_window_set_default_icon_from_file(filename.c_str(), &(gerror));
993 #ifdef GLIBMM_EXCEPTIONS_ENABLED
995 ::Glib::Error::throw_exception(gerror);
998 error = ::Glib::Error::throw_exception(gerror);
999 #endif //GLIBMM_EXCEPTIONS_ENABLED
1005 void Window::set_auto_startup_notification(bool setting)
1007 gtk_window_set_auto_startup_notification(static_cast<int>(setting));
1011 void Window::set_modal(bool modal)
1013 gtk_window_set_modal(gobj(), static_cast<int>(modal));
1016 bool Window::get_modal() const
1018 return gtk_window_get_modal(const_cast<GtkWindow*>(gobj()));
1021 Glib::ListHandle<Window*> Window::list_toplevels()
1023 return Glib::ListHandle<Window*>(gtk_window_list_toplevels(), Glib::OWNERSHIP_SHALLOW);
1027 void Window::add_mnemonic(guint keyval, Widget& target)
1029 gtk_window_add_mnemonic(gobj(), keyval, (target).gobj());
1032 void Window::remove_mnemonic(guint keyval, Widget& target)
1034 gtk_window_remove_mnemonic(gobj(), keyval, (target).gobj());
1037 bool Window::mnemonic_activate(guint keyval, Gdk::ModifierType modifier)
1039 return gtk_window_mnemonic_activate(gobj(), keyval, ((GdkModifierType)(modifier)));
1042 void Window::set_mnemonic_modifier(Gdk::ModifierType modifier)
1044 gtk_window_set_mnemonic_modifier(gobj(), ((GdkModifierType)(modifier)));
1047 Gdk::ModifierType Window::get_mnemonic_modifier()
1049 return ((Gdk::ModifierType)(gtk_window_get_mnemonic_modifier(gobj())));
1052 void Window::present()
1054 gtk_window_present(gobj());
1057 void Window::present(guint32 timestamp)
1059 gtk_window_present_with_time(gobj(), timestamp);
1062 void Window::iconify()
1064 gtk_window_iconify(gobj());
1067 void Window::deiconify()
1069 gtk_window_deiconify(gobj());
1072 void Window::stick()
1074 gtk_window_stick(gobj());
1077 void Window::unstick()
1079 gtk_window_unstick(gobj());
1082 void Window::maximize()
1084 gtk_window_maximize(gobj());
1087 void Window::unmaximize()
1089 gtk_window_unmaximize(gobj());
1092 void Window::fullscreen()
1094 gtk_window_fullscreen(gobj());
1097 void Window::unfullscreen()
1099 gtk_window_unfullscreen(gobj());
1102 void Window::begin_resize_drag(Gdk::WindowEdge edge, int button, int root_x, int root_y, guint32 timestamp)
1104 gtk_window_begin_resize_drag(gobj(), ((GdkWindowEdge)(edge)), button, root_x, root_y, timestamp);
1107 void Window::begin_move_drag(int button, int root_x, int root_y, guint32 timestamp)
1109 gtk_window_begin_move_drag(gobj(), button, root_x, root_y, timestamp);
1112 void Window::set_default_size(int width, int height)
1114 gtk_window_set_default_size(gobj(), width, height);
1117 void Window::get_default_size(int& width, int& height) const
1119 gtk_window_get_default_size(const_cast<GtkWindow*>(gobj()), &width, &height);
1122 void Window::resize(int width, int height)
1124 gtk_window_resize(gobj(), width, height);
1127 void Window::get_size(int& width, int& height) const
1129 gtk_window_get_size(const_cast<GtkWindow*>(gobj()), &width, &height);
1132 void Window::move(int x, int y)
1134 gtk_window_move(gobj(), x, y);
1137 void Window::get_position(int& root_x, int& root_y) const
1139 gtk_window_get_position(const_cast<GtkWindow*>(gobj()), &root_x, &root_y);
1142 bool Window::parse_geometry(const Glib::ustring& geometry)
1144 return gtk_window_parse_geometry(gobj(), geometry.c_str());
1147 Glib::RefPtr<WindowGroup> Window::get_group()
1150 Glib::RefPtr<WindowGroup> retvalue = Glib::wrap(gtk_window_get_group(gobj()));
1152 retvalue->reference(); //The function does not do a ref for us.
1157 Glib::RefPtr<const WindowGroup> Window::get_group() const
1159 return const_cast<Window*>(this)->get_group();
1162 void Window::reshow_with_initial_size()
1164 gtk_window_reshow_with_initial_size(gobj());
1167 void Window::set_keep_above(bool setting)
1169 gtk_window_set_keep_above(gobj(), static_cast<int>(setting));
1172 void Window::set_keep_below(bool setting)
1174 gtk_window_set_keep_below(gobj(), static_cast<int>(setting));
1178 Glib::SignalProxy1< void,Widget* > Window::signal_set_focus()
1180 return Glib::SignalProxy1< void,Widget* >(this, &Window_signal_set_focus_info);
1184 Glib::SignalProxy1< bool,GdkEvent* > Window::signal_frame_event()
1186 return Glib::SignalProxy1< bool,GdkEvent* >(this, &Window_signal_frame_event_info);
1190 #ifdef GLIBMM_PROPERTIES_ENABLED
1191 Glib::PropertyProxy<Glib::ustring> Window::property_title()
1193 return Glib::PropertyProxy<Glib::ustring>(this, "title");
1195 #endif //GLIBMM_PROPERTIES_ENABLED
1197 #ifdef GLIBMM_PROPERTIES_ENABLED
1198 Glib::PropertyProxy_ReadOnly<Glib::ustring> Window::property_title() const
1200 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "title");
1202 #endif //GLIBMM_PROPERTIES_ENABLED
1204 #ifdef GLIBMM_PROPERTIES_ENABLED
1205 Glib::PropertyProxy<bool> Window::property_allow_shrink()
1207 return Glib::PropertyProxy<bool>(this, "allow-shrink");
1209 #endif //GLIBMM_PROPERTIES_ENABLED
1211 #ifdef GLIBMM_PROPERTIES_ENABLED
1212 Glib::PropertyProxy_ReadOnly<bool> Window::property_allow_shrink() const
1214 return Glib::PropertyProxy_ReadOnly<bool>(this, "allow-shrink");
1216 #endif //GLIBMM_PROPERTIES_ENABLED
1218 #ifdef GLIBMM_PROPERTIES_ENABLED
1219 Glib::PropertyProxy<bool> Window::property_allow_grow()
1221 return Glib::PropertyProxy<bool>(this, "allow-grow");
1223 #endif //GLIBMM_PROPERTIES_ENABLED
1225 #ifdef GLIBMM_PROPERTIES_ENABLED
1226 Glib::PropertyProxy_ReadOnly<bool> Window::property_allow_grow() const
1228 return Glib::PropertyProxy_ReadOnly<bool>(this, "allow-grow");
1230 #endif //GLIBMM_PROPERTIES_ENABLED
1232 #ifdef GLIBMM_PROPERTIES_ENABLED
1233 Glib::PropertyProxy<bool> Window::property_resizable()
1235 return Glib::PropertyProxy<bool>(this, "resizable");
1237 #endif //GLIBMM_PROPERTIES_ENABLED
1239 #ifdef GLIBMM_PROPERTIES_ENABLED
1240 Glib::PropertyProxy_ReadOnly<bool> Window::property_resizable() const
1242 return Glib::PropertyProxy_ReadOnly<bool>(this, "resizable");
1244 #endif //GLIBMM_PROPERTIES_ENABLED
1246 #ifdef GLIBMM_PROPERTIES_ENABLED
1247 Glib::PropertyProxy<bool> Window::property_modal()
1249 return Glib::PropertyProxy<bool>(this, "modal");
1251 #endif //GLIBMM_PROPERTIES_ENABLED
1253 #ifdef GLIBMM_PROPERTIES_ENABLED
1254 Glib::PropertyProxy_ReadOnly<bool> Window::property_modal() const
1256 return Glib::PropertyProxy_ReadOnly<bool>(this, "modal");
1258 #endif //GLIBMM_PROPERTIES_ENABLED
1260 #ifdef GLIBMM_PROPERTIES_ENABLED
1261 Glib::PropertyProxy<WindowPosition> Window::property_window_position()
1263 return Glib::PropertyProxy<WindowPosition>(this, "window-position");
1265 #endif //GLIBMM_PROPERTIES_ENABLED
1267 #ifdef GLIBMM_PROPERTIES_ENABLED
1268 Glib::PropertyProxy_ReadOnly<WindowPosition> Window::property_window_position() const
1270 return Glib::PropertyProxy_ReadOnly<WindowPosition>(this, "window-position");
1272 #endif //GLIBMM_PROPERTIES_ENABLED
1274 #ifdef GLIBMM_PROPERTIES_ENABLED
1275 Glib::PropertyProxy<int> Window::property_default_width()
1277 return Glib::PropertyProxy<int>(this, "default-width");
1279 #endif //GLIBMM_PROPERTIES_ENABLED
1281 #ifdef GLIBMM_PROPERTIES_ENABLED
1282 Glib::PropertyProxy_ReadOnly<int> Window::property_default_width() const
1284 return Glib::PropertyProxy_ReadOnly<int>(this, "default-width");
1286 #endif //GLIBMM_PROPERTIES_ENABLED
1288 #ifdef GLIBMM_PROPERTIES_ENABLED
1289 Glib::PropertyProxy<int> Window::property_default_height()
1291 return Glib::PropertyProxy<int>(this, "default-height");
1293 #endif //GLIBMM_PROPERTIES_ENABLED
1295 #ifdef GLIBMM_PROPERTIES_ENABLED
1296 Glib::PropertyProxy_ReadOnly<int> Window::property_default_height() const
1298 return Glib::PropertyProxy_ReadOnly<int>(this, "default-height");
1300 #endif //GLIBMM_PROPERTIES_ENABLED
1302 #ifdef GLIBMM_PROPERTIES_ENABLED
1303 Glib::PropertyProxy<bool> Window::property_destroy_with_parent()
1305 return Glib::PropertyProxy<bool>(this, "destroy-with-parent");
1307 #endif //GLIBMM_PROPERTIES_ENABLED
1309 #ifdef GLIBMM_PROPERTIES_ENABLED
1310 Glib::PropertyProxy_ReadOnly<bool> Window::property_destroy_with_parent() const
1312 return Glib::PropertyProxy_ReadOnly<bool>(this, "destroy-with-parent");
1314 #endif //GLIBMM_PROPERTIES_ENABLED
1316 #ifdef GLIBMM_PROPERTIES_ENABLED
1317 Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > Window::property_icon()
1319 return Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> >(this, "icon");
1321 #endif //GLIBMM_PROPERTIES_ENABLED
1323 #ifdef GLIBMM_PROPERTIES_ENABLED
1324 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixbuf> > Window::property_icon() const
1326 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixbuf> >(this, "icon");
1328 #endif //GLIBMM_PROPERTIES_ENABLED
1330 #ifdef GLIBMM_PROPERTIES_ENABLED
1331 Glib::PropertyProxy< Glib::RefPtr<Gdk::Screen> > Window::property_screen()
1333 return Glib::PropertyProxy< Glib::RefPtr<Gdk::Screen> >(this, "screen");
1335 #endif //GLIBMM_PROPERTIES_ENABLED
1337 #ifdef GLIBMM_PROPERTIES_ENABLED
1338 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Screen> > Window::property_screen() const
1340 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Screen> >(this, "screen");
1342 #endif //GLIBMM_PROPERTIES_ENABLED
1344 #ifdef GLIBMM_PROPERTIES_ENABLED
1345 Glib::PropertyProxy_ReadOnly<bool> Window::property_is_active() const
1347 return Glib::PropertyProxy_ReadOnly<bool>(this, "is-active");
1349 #endif //GLIBMM_PROPERTIES_ENABLED
1351 #ifdef GLIBMM_PROPERTIES_ENABLED
1352 Glib::PropertyProxy_ReadOnly<bool> Window::property_has_toplevel_focus() const
1354 return Glib::PropertyProxy_ReadOnly<bool>(this, "has-toplevel-focus");
1356 #endif //GLIBMM_PROPERTIES_ENABLED
1358 #ifdef GLIBMM_PROPERTIES_ENABLED
1359 Glib::PropertyProxy<GdkWindowTypeHint> Window::property_type_hint()
1361 return Glib::PropertyProxy<GdkWindowTypeHint>(this, "type-hint");
1363 #endif //GLIBMM_PROPERTIES_ENABLED
1365 #ifdef GLIBMM_PROPERTIES_ENABLED
1366 Glib::PropertyProxy_ReadOnly<GdkWindowTypeHint> Window::property_type_hint() const
1368 return Glib::PropertyProxy_ReadOnly<GdkWindowTypeHint>(this, "type-hint");
1370 #endif //GLIBMM_PROPERTIES_ENABLED
1372 #ifdef GLIBMM_PROPERTIES_ENABLED
1373 Glib::PropertyProxy<bool> Window::property_skip_taskbar_hint()
1375 return Glib::PropertyProxy<bool>(this, "skip-taskbar-hint");
1377 #endif //GLIBMM_PROPERTIES_ENABLED
1379 #ifdef GLIBMM_PROPERTIES_ENABLED
1380 Glib::PropertyProxy_ReadOnly<bool> Window::property_skip_taskbar_hint() const
1382 return Glib::PropertyProxy_ReadOnly<bool>(this, "skip-taskbar-hint");
1384 #endif //GLIBMM_PROPERTIES_ENABLED
1386 #ifdef GLIBMM_PROPERTIES_ENABLED
1387 Glib::PropertyProxy<bool> Window::property_skip_pager_hint()
1389 return Glib::PropertyProxy<bool>(this, "skip-pager-hint");
1391 #endif //GLIBMM_PROPERTIES_ENABLED
1393 #ifdef GLIBMM_PROPERTIES_ENABLED
1394 Glib::PropertyProxy_ReadOnly<bool> Window::property_skip_pager_hint() const
1396 return Glib::PropertyProxy_ReadOnly<bool>(this, "skip-pager-hint");
1398 #endif //GLIBMM_PROPERTIES_ENABLED
1400 #ifdef GLIBMM_PROPERTIES_ENABLED
1401 Glib::PropertyProxy<Glib::ustring> Window::property_role()
1403 return Glib::PropertyProxy<Glib::ustring>(this, "role");
1405 #endif //GLIBMM_PROPERTIES_ENABLED
1407 #ifdef GLIBMM_PROPERTIES_ENABLED
1408 Glib::PropertyProxy_ReadOnly<Glib::ustring> Window::property_role() const
1410 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "role");
1412 #endif //GLIBMM_PROPERTIES_ENABLED
1414 #ifdef GLIBMM_PROPERTIES_ENABLED
1415 Glib::PropertyProxy<bool> Window::property_decorated()
1417 return Glib::PropertyProxy<bool>(this, "decorated");
1419 #endif //GLIBMM_PROPERTIES_ENABLED
1421 #ifdef GLIBMM_PROPERTIES_ENABLED
1422 Glib::PropertyProxy_ReadOnly<bool> Window::property_decorated() const
1424 return Glib::PropertyProxy_ReadOnly<bool>(this, "decorated");
1426 #endif //GLIBMM_PROPERTIES_ENABLED
1428 #ifdef GLIBMM_PROPERTIES_ENABLED
1429 Glib::PropertyProxy<Gdk::Gravity> Window::property_gravity()
1431 return Glib::PropertyProxy<Gdk::Gravity>(this, "gravity");
1433 #endif //GLIBMM_PROPERTIES_ENABLED
1435 #ifdef GLIBMM_PROPERTIES_ENABLED
1436 Glib::PropertyProxy_ReadOnly<Gdk::Gravity> Window::property_gravity() const
1438 return Glib::PropertyProxy_ReadOnly<Gdk::Gravity>(this, "gravity");
1440 #endif //GLIBMM_PROPERTIES_ENABLED
1442 #ifdef GLIBMM_PROPERTIES_ENABLED
1443 Glib::PropertyProxy<Window*> Window::property_transient_for()
1445 return Glib::PropertyProxy<Window*>(this, "transient-for");
1447 #endif //GLIBMM_PROPERTIES_ENABLED
1449 #ifdef GLIBMM_PROPERTIES_ENABLED
1450 Glib::PropertyProxy_ReadOnly<Window*> Window::property_transient_for() const
1452 return Glib::PropertyProxy_ReadOnly<Window*>(this, "transient-for");
1454 #endif //GLIBMM_PROPERTIES_ENABLED
1456 #ifdef GLIBMM_PROPERTIES_ENABLED
1457 Glib::PropertyProxy<bool> Window::property_urgency_hint()
1459 return Glib::PropertyProxy<bool>(this, "urgency-hint");
1461 #endif //GLIBMM_PROPERTIES_ENABLED
1463 #ifdef GLIBMM_PROPERTIES_ENABLED
1464 Glib::PropertyProxy_ReadOnly<bool> Window::property_urgency_hint() const
1466 return Glib::PropertyProxy_ReadOnly<bool>(this, "urgency-hint");
1468 #endif //GLIBMM_PROPERTIES_ENABLED
1470 #ifdef GLIBMM_PROPERTIES_ENABLED
1471 Glib::PropertyProxy<bool> Window::property_deletable()
1473 return Glib::PropertyProxy<bool>(this, "deletable");
1475 #endif //GLIBMM_PROPERTIES_ENABLED
1477 #ifdef GLIBMM_PROPERTIES_ENABLED
1478 Glib::PropertyProxy_ReadOnly<bool> Window::property_deletable() const
1480 return Glib::PropertyProxy_ReadOnly<bool>(this, "deletable");
1482 #endif //GLIBMM_PROPERTIES_ENABLED
1484 #ifdef GLIBMM_PROPERTIES_ENABLED
1485 Glib::PropertyProxy<double> Window::property_opacity()
1487 return Glib::PropertyProxy<double>(this, "opacity");
1489 #endif //GLIBMM_PROPERTIES_ENABLED
1491 #ifdef GLIBMM_PROPERTIES_ENABLED
1492 Glib::PropertyProxy_ReadOnly<double> Window::property_opacity() const
1494 return Glib::PropertyProxy_ReadOnly<double>(this, "opacity");
1496 #endif //GLIBMM_PROPERTIES_ENABLED
1499 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
1500 void Gtk::Window::on_set_focus(Widget* focus)
1502 BaseClassType *const base = static_cast<BaseClassType*>(
1503 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1506 if(base && base->set_focus)
1507 (*base->set_focus)(gobj(),(GtkWidget*)Glib::unwrap(focus));
1509 bool Gtk::Window::on_frame_event(GdkEvent* event)
1511 BaseClassType *const base = static_cast<BaseClassType*>(
1512 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1515 if(base && base->frame_event)
1516 return (*base->frame_event)(gobj(),event);
1521 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
1523 #ifdef GLIBMM_VFUNCS_ENABLED
1524 #endif //GLIBMM_VFUNCS_ENABLED