1 // Generated by gmmproc 2.60.0 -- DO NOT MODIFY!
2 
3 
4 #include <glibmm.h>
5 
6 #include <gtkmm/dialog.h>
7 #include <gtkmm/private/dialog_p.h>
8 
9 #include <gtk/gtk.h>
10 
11 /* Copyright 1998-2002 The gtkmm Development Team
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Lesser General Public
15  * License as published by the Free Software Foundation; either
16  * version 2.1 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21  * Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public
24  * License along with this library; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
26  */
27 
28 #include <gtk/gtk.h>
29 
30 namespace Gtk
31 {
32 
Dialog(const Glib::ustring & title,Gtk::Window & parent,bool modal)33 Dialog::Dialog(const Glib::ustring& title, Gtk::Window& parent, bool modal)
34 :
35   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
36   Glib::ObjectBase(nullptr),
37   Gtk::Window(Glib::ConstructParams(dialog_class_.init(), "title",title.c_str(), nullptr))
38 {
39   set_modal(modal);
40   set_transient_for(parent);
41 }
42 
Dialog(const Glib::ustring & title,bool modal)43 Dialog::Dialog(const Glib::ustring& title, bool modal)
44 :
45   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
46   Glib::ObjectBase(nullptr),
47   Gtk::Window(Glib::ConstructParams(dialog_class_.init(), "title",title.c_str(), nullptr))
48 {
49   set_modal(modal);
50 }
51 
Dialog(const Glib::ustring & title,DialogFlags flags)52 Dialog::Dialog(const Glib::ustring& title, DialogFlags flags)
53 :
54   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
55   Glib::ObjectBase(nullptr),
56   Gtk::Window(Glib::ConstructParams(dialog_class_.init(), "title",title.c_str(),"use-header-bar",(flags & DIALOG_USE_HEADER_BAR) != 0, nullptr))
57 {
58   set_modal((flags & DIALOG_MODAL) != 0);
59   property_destroy_with_parent() = (flags & DIALOG_DESTROY_WITH_PARENT) != 0;
60 }
61 
Dialog(const Glib::ustring & title,Gtk::Window & parent,DialogFlags flags)62 Dialog::Dialog(const Glib::ustring& title, Gtk::Window& parent, DialogFlags flags)
63 :
64   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
65   Glib::ObjectBase(nullptr),
66   Gtk::Window(Glib::ConstructParams(dialog_class_.init(), "title",title.c_str(),"use-header-bar",(flags & DIALOG_USE_HEADER_BAR) != 0, nullptr))
67 {
68   set_transient_for(parent);
69   set_modal((flags & DIALOG_MODAL) != 0);
70   property_destroy_with_parent() = (flags & DIALOG_DESTROY_WITH_PARENT) != 0;
71 }
72 
73 #ifndef GTKMM_DISABLE_DEPRECATED
74 
75 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
set_alternative_button_order_from_array(const std::vector<int> & new_order)76 void Dialog::set_alternative_button_order_from_array(const std::vector<int>& new_order)
77 {
78   gtk_dialog_set_alternative_button_order_from_array(gobj(), new_order.size(), const_cast<int*>(Glib::ArrayHandler<int>::vector_to_array(new_order).data()));
79 }
80 G_GNUC_END_IGNORE_DEPRECATIONS
81 #endif // GTKMM_DISABLE_DEPRECATED
82 
83 
84 } // namespace Gtk
85 
86 namespace
87 {
88 
89 
Dialog_signal_response_callback(GtkDialog * self,gint p0,void * data)90 static void Dialog_signal_response_callback(GtkDialog* self, gint p0,void* data)
91 {
92   using namespace Gtk;
93   using SlotType = sigc::slot< void,int >;
94 
95   auto obj = dynamic_cast<Dialog*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
96   // Do not try to call a signal on a disassociated wrapper.
97   if(obj)
98   {
99     try
100     {
101       if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
102         (*static_cast<SlotType*>(slot))(p0
103 );
104     }
105     catch(...)
106     {
107        Glib::exception_handlers_invoke();
108     }
109   }
110 }
111 
112 static const Glib::SignalProxyInfo Dialog_signal_response_info =
113 {
114   "response",
115   (GCallback) &Dialog_signal_response_callback,
116   (GCallback) &Dialog_signal_response_callback
117 };
118 
119 
120 } // anonymous namespace
121 
122 // static
value_type()123 GType Glib::Value<Gtk::DialogFlags>::value_type()
124 {
125   return gtk_dialog_flags_get_type();
126 }
127 
128 // static
value_type()129 GType Glib::Value<Gtk::ResponseType>::value_type()
130 {
131   return gtk_response_type_get_type();
132 }
133 
134 
135 namespace Glib
136 {
137 
wrap(GtkDialog * object,bool take_copy)138 Gtk::Dialog* wrap(GtkDialog* object, bool take_copy)
139 {
140   return dynamic_cast<Gtk::Dialog *> (Glib::wrap_auto ((GObject*)(object), take_copy));
141 }
142 
143 } /* namespace Glib */
144 
145 namespace Gtk
146 {
147 
148 
149 /* The *_Class implementation: */
150 
init()151 const Glib::Class& Dialog_Class::init()
152 {
153   if(!gtype_) // create the GType if necessary
154   {
155     // Glib::Class has to know the class init function to clone custom types.
156     class_init_func_ = &Dialog_Class::class_init_function;
157 
158     // This is actually just optimized away, apparently with no harm.
159     // Make sure that the parent type has been created.
160     //CppClassParent::CppObjectType::get_type();
161 
162     // Create the wrapper type, with the same class/instance size as the base type.
163     register_derived_type(gtk_dialog_get_type());
164 
165     // Add derived versions of interfaces, if the C type implements any interfaces:
166 
167   }
168 
169   return *this;
170 }
171 
172 
class_init_function(void * g_class,void * class_data)173 void Dialog_Class::class_init_function(void* g_class, void* class_data)
174 {
175   const auto klass = static_cast<BaseClassType*>(g_class);
176   CppClassParent::class_init_function(klass, class_data);
177 
178 
179   klass->response = &response_callback;
180 }
181 
182 
response_callback(GtkDialog * self,gint p0)183 void Dialog_Class::response_callback(GtkDialog* self, gint p0)
184 {
185   const auto obj_base = static_cast<Glib::ObjectBase*>(
186       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
187 
188   // Non-gtkmmproc-generated custom classes implicitly call the default
189   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
190   // generated classes can use this optimisation, which avoids the unnecessary
191   // parameter conversions if there is no possibility of the virtual function
192   // being overridden:
193   if(obj_base && obj_base->is_derived_())
194   {
195     const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
196     if(obj) // This can be NULL during destruction.
197     {
198       try // Trap C++ exceptions which would normally be lost because this is a C callback.
199       {
200         // Call the virtual member method, which derived classes might override.
201         obj->on_response(p0
202 );
203         return;
204       }
205       catch(...)
206       {
207         Glib::exception_handlers_invoke();
208       }
209     }
210   }
211 
212   const auto base = static_cast<BaseClassType*>(
213         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
214     );
215 
216   // Call the original underlying C function:
217   if(base && base->response)
218     (*base->response)(self, p0);
219 }
220 
221 
wrap_new(GObject * o)222 Glib::ObjectBase* Dialog_Class::wrap_new(GObject* o)
223 {
224   return new Dialog((GtkDialog*)(o)); //top-level windows can not be manage()ed.
225 
226 }
227 
228 
229 /* The implementation: */
230 
Dialog(const Glib::ConstructParams & construct_params)231 Dialog::Dialog(const Glib::ConstructParams& construct_params)
232 :
233   Gtk::Window(construct_params)
234 {
235   }
236 
Dialog(GtkDialog * castitem)237 Dialog::Dialog(GtkDialog* castitem)
238 :
239   Gtk::Window((GtkWindow*)(castitem))
240 {
241   }
242 
243 
Dialog(Dialog && src)244 Dialog::Dialog(Dialog&& src) noexcept
245 : Gtk::Window(std::move(src))
246 {}
247 
operator =(Dialog && src)248 Dialog& Dialog::operator=(Dialog&& src) noexcept
249 {
250   Gtk::Window::operator=(std::move(src));
251   return *this;
252 }
253 
~Dialog()254 Dialog::~Dialog() noexcept
255 {
256   destroy_();
257 }
258 
259 Dialog::CppClassType Dialog::dialog_class_; // initialize static member
260 
get_type()261 GType Dialog::get_type()
262 {
263   return dialog_class_.init().get_type();
264 }
265 
266 
get_base_type()267 GType Dialog::get_base_type()
268 {
269   return gtk_dialog_get_type();
270 }
271 
272 
Dialog()273 Dialog::Dialog()
274 :
275   // Mark this class as non-derived to allow C++ vfuncs to be skipped.
276   Glib::ObjectBase(nullptr),
277   Gtk::Window(Glib::ConstructParams(dialog_class_.init()))
278 {
279 
280 
281 }
282 
add_action_widget(Widget & child,int response_id)283 void Dialog::add_action_widget(Widget& child, int response_id)
284 {
285   gtk_dialog_add_action_widget(gobj(), (child).gobj(), response_id);
286 }
287 
add_button(const Glib::ustring & button_text,int response_id)288 Button* Dialog::add_button(const Glib::ustring& button_text, int response_id)
289 {
290   return Glib::wrap((GtkButton*)(gtk_dialog_add_button(gobj(), button_text.c_str(), response_id)));
291 }
292 
293 #ifndef GTKMM_DISABLE_DEPRECATED
294 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
add_button(const Gtk::StockID & stock_id,int response_id)295 Button* Dialog::add_button(const Gtk::StockID& stock_id, int response_id)
296 {
297   return Glib::wrap((GtkButton*)(gtk_dialog_add_button(gobj(), (stock_id).get_c_str(), response_id)));
298 }
299 G_GNUC_END_IGNORE_DEPRECATIONS
300 #endif // GTKMM_DISABLE_DEPRECATED
301 
set_response_sensitive(int response_id,bool setting)302 void Dialog::set_response_sensitive(int response_id, bool setting)
303 {
304   gtk_dialog_set_response_sensitive(gobj(), response_id, static_cast<int>(setting));
305 }
306 
set_default_response(int response_id)307 void Dialog::set_default_response(int response_id)
308 {
309   gtk_dialog_set_default_response(gobj(), response_id);
310 }
311 
get_widget_for_response(int response_id)312 Widget* Dialog::get_widget_for_response(int response_id)
313 {
314   return Glib::wrap(gtk_dialog_get_widget_for_response(gobj(), response_id));
315 }
316 
get_widget_for_response(int response_id) const317 const Widget* Dialog::get_widget_for_response(int response_id) const
318 {
319   return const_cast<Dialog*>(this)->get_widget_for_response(response_id);
320 }
321 
get_response_for_widget(const Gtk::Widget & widget) const322 int Dialog::get_response_for_widget(const Gtk::Widget& widget) const
323 {
324   return gtk_dialog_get_response_for_widget(const_cast<GtkDialog*>(gobj()), const_cast<GtkWidget*>(widget.gobj()));
325 }
326 
327 #ifndef GTKMM_DISABLE_DEPRECATED
328 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
alternative_button_order(const Glib::RefPtr<const Gdk::Screen> & screen)329 bool Dialog::alternative_button_order(const Glib::RefPtr<const Gdk::Screen>& screen)
330 {
331   return gtk_alternative_dialog_button_order(const_cast<GdkScreen*>(Glib::unwrap<Gdk::Screen>(screen)));
332 }
333 G_GNUC_END_IGNORE_DEPRECATIONS
334 #endif // GTKMM_DISABLE_DEPRECATED
335 
response(int response_id)336 void Dialog::response(int response_id)
337 {
338   gtk_dialog_response(gobj(), response_id);
339 }
340 
run()341 int Dialog::run()
342 {
343   return gtk_dialog_run(gobj());
344 }
345 
346 #ifndef GTKMM_DISABLE_DEPRECATED
347 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
get_action_area()348 ButtonBox* Dialog::get_action_area()
349 {
350   return Glib::wrap((GtkButtonBox*)(gtk_dialog_get_action_area(gobj())));
351 }
352 G_GNUC_END_IGNORE_DEPRECATIONS
353 #endif // GTKMM_DISABLE_DEPRECATED
354 
355 #ifndef GTKMM_DISABLE_DEPRECATED
356 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
get_action_area() const357 const ButtonBox* Dialog::get_action_area() const
358 {
359   return const_cast<Dialog*>(this)->get_action_area();
360 }
361 G_GNUC_END_IGNORE_DEPRECATIONS
362 #endif // GTKMM_DISABLE_DEPRECATED
363 
364 #ifndef GTKMM_DISABLE_DEPRECATED
365 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
get_vbox()366 Box* Dialog::get_vbox()
367 {
368   return Glib::wrap((GtkBox*)(gtk_dialog_get_content_area(gobj())));
369 }
370 G_GNUC_END_IGNORE_DEPRECATIONS
371 #endif // GTKMM_DISABLE_DEPRECATED
372 
373 #ifndef GTKMM_DISABLE_DEPRECATED
374 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
get_vbox() const375 const Box* Dialog::get_vbox() const
376 {
377   return const_cast<Dialog*>(this)->get_vbox();
378 }
379 G_GNUC_END_IGNORE_DEPRECATIONS
380 #endif // GTKMM_DISABLE_DEPRECATED
381 
get_content_area()382 Box* Dialog::get_content_area()
383 {
384   return Glib::wrap((GtkBox*)(gtk_dialog_get_content_area(gobj())));
385 }
386 
get_content_area() const387 const Box* Dialog::get_content_area() const
388 {
389   return const_cast<Dialog*>(this)->get_content_area();
390 }
391 
get_header_bar()392 HeaderBar* Dialog::get_header_bar()
393 {
394   return Glib::wrap((GtkHeaderBar*)(gtk_dialog_get_header_bar(gobj())));
395 }
396 
get_header_bar() const397 const HeaderBar* Dialog::get_header_bar() const
398 {
399   return const_cast<Dialog*>(this)->get_header_bar();
400 }
401 
402 
signal_response()403 Glib::SignalProxy< void,int > Dialog::signal_response()
404 {
405   return Glib::SignalProxy< void,int >(this, &Dialog_signal_response_info);
406 }
407 
408 
property_use_header_bar() const409 Glib::PropertyProxy_ReadOnly< bool > Dialog::property_use_header_bar() const
410 {
411   return Glib::PropertyProxy_ReadOnly< bool >(this, "use-header-bar");
412 }
413 
414 
on_response(int response_id)415 void Gtk::Dialog::on_response(int response_id)
416 {
417   const auto base = static_cast<BaseClassType*>(
418       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
419   );
420 
421   if(base && base->response)
422     (*base->response)(gobj(),response_id);
423 }
424 
425 
426 } // namespace Gtk
427 
428 
429