1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/dialog.h>
4 #include <gtkmm/private/dialog_p.h>
6 #include <gtk/gtktypebuiltins.h>
10 /* Copyright 1998-2002 The gtkmm Development Team
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include <gtk/gtkdialog.h>
32 Dialog::Dialog(const Glib::ustring& title, Gtk::Window& parent, bool modal, bool use_separator)
34 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
35 Gtk::Window(Glib::ConstructParams(dialog_class_.init(), "title",title.c_str(), (char*) 0))
37 construct_(modal, use_separator);
38 set_transient_for(parent);
41 Dialog::Dialog(const Glib::ustring& title, bool modal, bool use_separator)
43 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
44 Gtk::Window(Glib::ConstructParams(dialog_class_.init(), "title",title.c_str(), (char*) 0))
46 construct_(modal, use_separator);
49 void Dialog::construct_(bool modal, bool use_separator)
52 set_has_separator(use_separator);
55 void Dialog::set_alternative_button_order_from_array(const Glib::ArrayHandle<int>& new_order)
57 gtk_dialog_set_alternative_button_order_from_array(gobj(), new_order.size(), const_cast<int*>(new_order.data()));
66 void Dialog_signal_response_callback(GtkDialog* self, gint p0,void* data)
69 typedef sigc::slot< void,int > SlotType;
71 // Do not try to call a signal on a disassociated wrapper.
72 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
76 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
77 (*static_cast<SlotType*>(slot))(p0
82 Glib::exception_handlers_invoke();
87 const Glib::SignalProxyInfo Dialog_signal_response_info =
90 (GCallback) &Dialog_signal_response_callback,
91 (GCallback) &Dialog_signal_response_callback
94 } // anonymous namespace
97 GType Glib::Value<Gtk::ResponseType>::value_type()
99 return gtk_response_type_get_type();
106 Gtk::Dialog* wrap(GtkDialog* object, bool take_copy)
108 return dynamic_cast<Gtk::Dialog *> (Glib::wrap_auto ((GObject*)(object), take_copy));
111 } /* namespace Glib */
117 /* The *_Class implementation: */
119 const Glib::Class& Dialog_Class::init()
121 if(!gtype_) // create the GType if necessary
123 // Glib::Class has to know the class init function to clone custom types.
124 class_init_func_ = &Dialog_Class::class_init_function;
126 // This is actually just optimized away, apparently with no harm.
127 // Make sure that the parent type has been created.
128 //CppClassParent::CppObjectType::get_type();
130 // Create the wrapper type, with the same class/instance size as the base type.
131 register_derived_type(gtk_dialog_get_type());
133 // Add derived versions of interfaces, if the C type implements any interfaces:
139 void Dialog_Class::class_init_function(void* g_class, void* class_data)
141 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
142 CppClassParent::class_init_function(klass, class_data);
144 klass->response = &response_callback;
148 void Dialog_Class::response_callback(GtkDialog* self, gint p0)
150 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
151 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
153 // Non-gtkmmproc-generated custom classes implicitly call the default
154 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
155 // generated classes can use this optimisation, which avoids the unnecessary
156 // parameter conversions if there is no possibility of the virtual function
158 if(obj && obj->is_derived_())
160 try // Trap C++ exceptions which would normally be lost because this is a C callback.
162 // Call the virtual member method, which derived classes might override.
168 Glib::exception_handlers_invoke();
173 BaseClassType *const base = static_cast<BaseClassType*>(
174 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
177 // Call the original underlying C function:
178 if(base && base->response)
179 (*base->response)(self, p0);
184 Glib::ObjectBase* Dialog_Class::wrap_new(GObject* o)
186 return new Dialog((GtkDialog*)(o)); //top-level windows can not be manage()ed.
191 /* The implementation: */
193 Dialog::Dialog(const Glib::ConstructParams& construct_params)
195 Gtk::Window(construct_params)
199 Dialog::Dialog(GtkDialog* castitem)
201 Gtk::Window((GtkWindow*)(castitem))
210 Dialog::CppClassType Dialog::dialog_class_; // initialize static member
212 GType Dialog::get_type()
214 return dialog_class_.init().get_type();
217 GType Dialog::get_base_type()
219 return gtk_dialog_get_type();
225 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
226 Gtk::Window(Glib::ConstructParams(dialog_class_.init()))
230 void Dialog::add_action_widget(Widget& child, int response_id)
232 gtk_dialog_add_action_widget(gobj(), (child).gobj(), response_id);
235 Button* Dialog::add_button(const Glib::ustring& button_text, int response_id)
237 return Glib::wrap((GtkButton*)(gtk_dialog_add_button(gobj(), button_text.c_str(), response_id)));
240 Button* Dialog::add_button(const Gtk::StockID& stock_id, int response_id)
242 return Glib::wrap((GtkButton*)(gtk_dialog_add_button(gobj(), (stock_id).get_c_str(), response_id)));
245 void Dialog::set_response_sensitive(int response_id, bool setting)
247 gtk_dialog_set_response_sensitive(gobj(), response_id, static_cast<int>(setting));
250 void Dialog::set_default_response(int response_id)
252 gtk_dialog_set_default_response(gobj(), response_id);
255 void Dialog::set_has_separator(bool setting)
257 gtk_dialog_set_has_separator(gobj(), static_cast<int>(setting));
260 bool Dialog::get_has_separator() const
262 return gtk_dialog_get_has_separator(const_cast<GtkDialog*>(gobj()));
265 bool Dialog::alternative_button_order(const Glib::RefPtr<const Gdk::Screen>& screen)
267 return gtk_alternative_dialog_button_order(const_cast<GdkScreen*>(Glib::unwrap<Gdk::Screen>(screen)));
270 void Dialog::response(int response_id)
272 gtk_dialog_response(gobj(), response_id);
277 return gtk_dialog_run(gobj());
280 VBox* Dialog::get_vbox()
282 return Glib::wrap((GtkVBox*)(gobj()->vbox));
285 const VBox* Dialog::get_vbox() const
287 return Glib::wrap((GtkVBox*)(gobj()->vbox));
290 HButtonBox* Dialog::get_action_area()
292 return Glib::wrap((GtkHButtonBox*)(gobj()->action_area));
295 const HButtonBox* Dialog::get_action_area() const
297 return Glib::wrap((GtkHButtonBox*)(gobj()->action_area));
301 Glib::SignalProxy1< void,int > Dialog::signal_response()
303 return Glib::SignalProxy1< void,int >(this, &Dialog_signal_response_info);
307 Glib::PropertyProxy<bool> Dialog::property_has_separator()
309 return Glib::PropertyProxy<bool>(this, "has-separator");
312 Glib::PropertyProxy_ReadOnly<bool> Dialog::property_has_separator() const
314 return Glib::PropertyProxy_ReadOnly<bool>(this, "has-separator");
318 void Gtk::Dialog::on_response(int response_id)
320 BaseClassType *const base = static_cast<BaseClassType*>(
321 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
324 if(base && base->response)
325 (*base->response)(gobj(),response_id);