Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / label.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/label.h>
4 #include <gtkmm/private/label_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* Copyright 1998-2002 The gtkmm Development Team
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public
22  * License along with this library; if not, write to the Free
23  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25
26 #include <gtk/gtklabel.h>
27 #include <gtkmm/menu.h>
28
29 namespace Gtk
30 {
31
32 Label::Label()
33 :
34   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
35   Gtk::Misc(Glib::ConstructParams(label_class_.init(), (char*) 0))
36 {}
37
38 Label::Label(const Glib::ustring& label, bool mnemonic)
39 :
40   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
41   Gtk::Misc(Glib::ConstructParams(label_class_.init(), "label",label.c_str(),"use_underline",gboolean(mnemonic), (char*) 0))
42 {}
43
44 Label::Label(const Glib::ustring& label, float xalign, float yalign, bool mnemonic)
45 :
46   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
47   Gtk::Misc(Glib::ConstructParams(label_class_.init(), "label",label.c_str(),"use_underline",gboolean(mnemonic), (char*) 0))
48 {
49   set_alignment(xalign, yalign);
50 }
51
52 Label::Label(const Glib::ustring& label, AlignmentEnum xalign, AlignmentEnum yalign, bool mnemonic)
53 :
54   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
55   Gtk::Misc(Glib::ConstructParams(label_class_.init(), "label",label.c_str(),"use_underline",gboolean(mnemonic), (char*) 0))
56 {
57   set_alignment(xalign, yalign);
58 }
59
60 void Label::select_region(int start_offset)
61 {
62   gtk_label_select_region(gobj(), start_offset, -1 /* See C docs */);
63 }
64
65 } // namespace Gtk
66
67
68 namespace
69 {
70
71 void Label_signal_populate_popup_callback(GtkLabel* self, GtkMenu* p0,void* data)
72 {
73   using namespace Gtk;
74   typedef sigc::slot< void,Menu* > SlotType;
75
76   // Do not try to call a signal on a disassociated wrapper.
77   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
78   {
79     try
80     {
81       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
82         (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
83 );
84     }
85     catch(...)
86     {
87       Glib::exception_handlers_invoke();
88     }
89   }
90 }
91
92 const Glib::SignalProxyInfo Label_signal_populate_popup_info =
93 {
94   "populate_popup",
95   (GCallback) &Label_signal_populate_popup_callback,
96   (GCallback) &Label_signal_populate_popup_callback
97 };
98
99 } // anonymous namespace
100
101
102 namespace Glib
103 {
104
105 Gtk::Label* wrap(GtkLabel* object, bool take_copy)
106 {
107   return dynamic_cast<Gtk::Label *> (Glib::wrap_auto ((GObject*)(object), take_copy));
108 }
109
110 } /* namespace Glib */
111
112 namespace Gtk
113 {
114
115
116 /* The *_Class implementation: */
117
118 const Glib::Class& Label_Class::init()
119 {
120   if(!gtype_) // create the GType if necessary
121   {
122     // Glib::Class has to know the class init function to clone custom types.
123     class_init_func_ = &Label_Class::class_init_function;
124
125     // This is actually just optimized away, apparently with no harm.
126     // Make sure that the parent type has been created.
127     //CppClassParent::CppObjectType::get_type();
128
129     // Create the wrapper type, with the same class/instance size as the base type.
130     register_derived_type(gtk_label_get_type());
131
132     // Add derived versions of interfaces, if the C type implements any interfaces:
133   }
134
135   return *this;
136 }
137
138 void Label_Class::class_init_function(void* g_class, void* class_data)
139 {
140   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
141   CppClassParent::class_init_function(klass, class_data);
142
143   klass->populate_popup = &populate_popup_callback;
144 }
145
146
147 void Label_Class::populate_popup_callback(GtkLabel* self, GtkMenu* p0)
148 {
149   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
150       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
151
152   // Non-gtkmmproc-generated custom classes implicitly call the default
153   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
154   // generated classes can use this optimisation, which avoids the unnecessary
155   // parameter conversions if there is no possibility of the virtual function
156   // being overridden:
157   if(obj && obj->is_derived_())
158   {
159     try // Trap C++ exceptions which would normally be lost because this is a C callback.
160     {
161       // Call the virtual member method, which derived classes might override.
162       obj->on_populate_popup(Glib::wrap(p0)
163 );
164     }
165     catch(...)
166     {
167       Glib::exception_handlers_invoke();
168     }
169   }
170   else
171   {
172     BaseClassType *const base = static_cast<BaseClassType*>(
173         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
174     );
175
176     // Call the original underlying C function:
177     if(base && base->populate_popup)
178       (*base->populate_popup)(self, p0);
179   }
180 }
181
182
183 Glib::ObjectBase* Label_Class::wrap_new(GObject* o)
184 {
185   return manage(new Label((GtkLabel*)(o)));
186
187 }
188
189
190 /* The implementation: */
191
192 Label::Label(const Glib::ConstructParams& construct_params)
193 :
194   Gtk::Misc(construct_params)
195 {
196   }
197
198 Label::Label(GtkLabel* castitem)
199 :
200   Gtk::Misc((GtkMisc*)(castitem))
201 {
202   }
203
204 Label::~Label()
205 {
206   destroy_();
207 }
208
209 Label::CppClassType Label::label_class_; // initialize static member
210
211 GType Label::get_type()
212 {
213   return label_class_.init().get_type();
214 }
215
216 GType Label::get_base_type()
217 {
218   return gtk_label_get_type();
219 }
220
221
222 void Label::set_text(const Glib::ustring & str)
223 {
224   gtk_label_set_text(gobj(), str.c_str());
225 }
226
227 Glib::ustring Label::get_text() const
228 {
229   return Glib::convert_const_gchar_ptr_to_ustring(gtk_label_get_text(const_cast<GtkLabel*>(gobj())));
230 }
231
232 void Label::set_attributes(Pango::AttrList& attrs)
233 {
234   gtk_label_set_attributes(gobj(), (attrs).gobj());
235 }
236
237 Pango::AttrList Label::get_attributes() const
238 {
239   return Pango::AttrList((gtk_label_get_attributes(const_cast<GtkLabel*>(gobj()))));
240 }
241
242 void Label::set_label(const Glib::ustring& str)
243 {
244   gtk_label_set_label(gobj(), str.c_str());
245 }
246
247 Glib::ustring Label::get_label() const
248 {
249   return Glib::convert_const_gchar_ptr_to_ustring(gtk_label_get_label(const_cast<GtkLabel*>(gobj())));
250 }
251
252 void Label::set_markup(const Glib::ustring& str)
253 {
254   gtk_label_set_markup(gobj(), str.c_str());
255 }
256
257 void Label::set_use_markup(bool setting)
258 {
259   gtk_label_set_use_markup(gobj(), static_cast<int>(setting));
260 }
261
262 bool Label::get_use_markup() const
263 {
264   return gtk_label_get_use_markup(const_cast<GtkLabel*>(gobj()));
265 }
266
267 void Label::set_use_underline(bool setting)
268 {
269   gtk_label_set_use_underline(gobj(), static_cast<int>(setting));
270 }
271
272 bool Label::get_use_underline() const
273 {
274   return gtk_label_get_use_underline(const_cast<GtkLabel*>(gobj()));
275 }
276
277 void Label::set_markup_with_mnemonic(const Glib::ustring& str)
278 {
279   gtk_label_set_markup_with_mnemonic(gobj(), str.c_str());
280 }
281
282 guint Label::get_mnemonic_keyval() const
283 {
284   return gtk_label_get_mnemonic_keyval(const_cast<GtkLabel*>(gobj()));
285 }
286
287 void Label::set_mnemonic_widget(Widget& widget)
288 {
289   gtk_label_set_mnemonic_widget(gobj(), (widget).gobj());
290 }
291
292 Widget* Label::get_mnemonic_widget()
293 {
294   return Glib::wrap(gtk_label_get_mnemonic_widget(gobj()));
295 }
296
297 const Widget* Label::get_mnemonic_widget() const
298 {
299   return Glib::wrap(gtk_label_get_mnemonic_widget(const_cast<GtkLabel*>(gobj())));
300 }
301
302 void Label::set_text_with_mnemonic(const Glib::ustring& str)
303 {
304   gtk_label_set_text_with_mnemonic(gobj(), str.c_str());
305 }
306
307 void Label::set_justify(Justification jtype)
308 {
309   gtk_label_set_justify(gobj(), ((GtkJustification)(jtype)));
310 }
311
312 Justification Label::get_justify() const
313 {
314   return ((Justification)(gtk_label_get_justify(const_cast<GtkLabel*>(gobj()))));
315 }
316
317 void Label::set_ellipsize(Pango::EllipsizeMode mode)
318 {
319   gtk_label_set_ellipsize(gobj(), ((PangoEllipsizeMode)(mode)));
320 }
321
322 Pango::EllipsizeMode Label::get_ellipsize() const
323 {
324   return ((Pango::EllipsizeMode)(gtk_label_get_ellipsize(const_cast<GtkLabel*>(gobj()))));
325 }
326
327 void Label::set_width_chars(int n_chars)
328 {
329   gtk_label_set_width_chars(gobj(), n_chars);
330 }
331
332 int Label::get_width_chars() const
333 {
334   return gtk_label_get_width_chars(const_cast<GtkLabel*>(gobj()));
335 }
336
337 void Label::set_max_width_chars(int n_chars)
338 {
339   gtk_label_set_max_width_chars(gobj(), n_chars);
340 }
341
342 int Label::get_max_width_chars() const
343 {
344   return gtk_label_get_max_width_chars(const_cast<GtkLabel*>(gobj()));
345 }
346
347 void Label::set_pattern(const Glib::ustring& pattern)
348 {
349   gtk_label_set_pattern(gobj(), pattern.c_str());
350 }
351
352 void Label::set_line_wrap(bool wrap)
353 {
354   gtk_label_set_line_wrap(gobj(), static_cast<int>(wrap));
355 }
356
357 bool Label::get_line_wrap() const
358 {
359   return gtk_label_get_line_wrap(const_cast<GtkLabel*>(gobj()));
360 }
361
362 void Label::set_selectable(bool setting)
363 {
364   gtk_label_set_selectable(gobj(), static_cast<int>(setting));
365 }
366
367 bool Label::get_selectable() const
368 {
369   return gtk_label_get_selectable(const_cast<GtkLabel*>(gobj()));
370 }
371
372 void Label::set_angle(double angle)
373 {
374   gtk_label_set_angle(gobj(), angle);
375 }
376
377 double Label::get_angle() const
378 {
379   return gtk_label_get_angle(const_cast<GtkLabel*>(gobj()));
380 }
381
382 void Label::select_region(int start_offset, int end_offset)
383 {
384   gtk_label_select_region(gobj(), start_offset, end_offset);
385 }
386
387 bool Label::get_selection_bounds(int& start, int& end) const
388 {
389   return gtk_label_get_selection_bounds(const_cast<GtkLabel*>(gobj()), &start, &end);
390 }
391
392 Glib::RefPtr<Pango::Layout> Label::get_layout()
393 {
394
395   Glib::RefPtr<Pango::Layout> retvalue = Glib::wrap(gtk_label_get_layout(gobj()));
396
397   if(retvalue)
398     retvalue->reference(); //The function does not do a ref for us.
399   return retvalue;
400 }
401
402 Glib::RefPtr<const Pango::Layout> Label::get_layout() const
403 {
404
405   Glib::RefPtr<const Pango::Layout> retvalue = Glib::wrap(gtk_label_get_layout(const_cast<GtkLabel*>(gobj())));
406
407   if(retvalue)
408     retvalue->reference(); //The function does not do a ref for us.
409   return retvalue;
410 }
411
412 void Label::get_layout_offsets(int& x, int& y) const
413 {
414   gtk_label_get_layout_offsets(const_cast<GtkLabel*>(gobj()), &x, &y);
415 }
416
417 void Label::set_single_line_mode(bool single_line_mode)
418 {
419   gtk_label_set_single_line_mode(gobj(), static_cast<int>(single_line_mode));
420 }
421
422 bool Label::get_single_line_mode() const
423 {
424   return gtk_label_get_single_line_mode(const_cast<GtkLabel*>(gobj()));
425 }
426
427
428 Glib::SignalProxy1< void,Menu* > Label::signal_populate_popup()
429 {
430   return Glib::SignalProxy1< void,Menu* >(this, &Label_signal_populate_popup_info);
431 }
432
433
434 Glib::PropertyProxy<Glib::ustring> Label::property_label() 
435 {
436   return Glib::PropertyProxy<Glib::ustring>(this, "label");
437 }
438
439 Glib::PropertyProxy_ReadOnly<Glib::ustring> Label::property_label() const
440 {
441   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "label");
442 }
443
444 Glib::PropertyProxy<Pango::AttrList> Label::property_attributes() 
445 {
446   return Glib::PropertyProxy<Pango::AttrList>(this, "attributes");
447 }
448
449 Glib::PropertyProxy_ReadOnly<Pango::AttrList> Label::property_attributes() const
450 {
451   return Glib::PropertyProxy_ReadOnly<Pango::AttrList>(this, "attributes");
452 }
453
454 Glib::PropertyProxy<bool> Label::property_use_markup() 
455 {
456   return Glib::PropertyProxy<bool>(this, "use-markup");
457 }
458
459 Glib::PropertyProxy_ReadOnly<bool> Label::property_use_markup() const
460 {
461   return Glib::PropertyProxy_ReadOnly<bool>(this, "use-markup");
462 }
463
464 Glib::PropertyProxy<bool> Label::property_use_underline() 
465 {
466   return Glib::PropertyProxy<bool>(this, "use-underline");
467 }
468
469 Glib::PropertyProxy_ReadOnly<bool> Label::property_use_underline() const
470 {
471   return Glib::PropertyProxy_ReadOnly<bool>(this, "use-underline");
472 }
473
474 Glib::PropertyProxy<Justification> Label::property_justify() 
475 {
476   return Glib::PropertyProxy<Justification>(this, "justify");
477 }
478
479 Glib::PropertyProxy_ReadOnly<Justification> Label::property_justify() const
480 {
481   return Glib::PropertyProxy_ReadOnly<Justification>(this, "justify");
482 }
483
484 Glib::PropertyProxy_WriteOnly<Glib::ustring> Label::property_pattern() 
485 {
486   return Glib::PropertyProxy_WriteOnly<Glib::ustring>(this, "pattern");
487 }
488
489 Glib::PropertyProxy_ReadOnly<Glib::ustring> Label::property_pattern() const
490 {
491   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "pattern");
492 }
493
494 Glib::PropertyProxy<bool> Label::property_wrap() 
495 {
496   return Glib::PropertyProxy<bool>(this, "wrap");
497 }
498
499 Glib::PropertyProxy_ReadOnly<bool> Label::property_wrap() const
500 {
501   return Glib::PropertyProxy_ReadOnly<bool>(this, "wrap");
502 }
503
504 Glib::PropertyProxy<bool> Label::property_selectable() 
505 {
506   return Glib::PropertyProxy<bool>(this, "selectable");
507 }
508
509 Glib::PropertyProxy_ReadOnly<bool> Label::property_selectable() const
510 {
511   return Glib::PropertyProxy_ReadOnly<bool>(this, "selectable");
512 }
513
514 Glib::PropertyProxy_ReadOnly<guint> Label::property_mnemonic_keyval() const
515 {
516   return Glib::PropertyProxy_ReadOnly<guint>(this, "mnemonic-keyval");
517 }
518
519 Glib::PropertyProxy<Widget*> Label::property_mnemonic_widget() 
520 {
521   return Glib::PropertyProxy<Widget*>(this, "mnemonic-widget");
522 }
523
524 Glib::PropertyProxy_ReadOnly<Widget*> Label::property_mnemonic_widget() const
525 {
526   return Glib::PropertyProxy_ReadOnly<Widget*>(this, "mnemonic-widget");
527 }
528
529 Glib::PropertyProxy_ReadOnly<int> Label::property_cursor_position() const
530 {
531   return Glib::PropertyProxy_ReadOnly<int>(this, "cursor-position");
532 }
533
534 Glib::PropertyProxy_ReadOnly<int> Label::property_selection_bound() const
535 {
536   return Glib::PropertyProxy_ReadOnly<int>(this, "selection-bound");
537 }
538
539 Glib::PropertyProxy<Pango::EllipsizeMode> Label::property_ellipsize() 
540 {
541   return Glib::PropertyProxy<Pango::EllipsizeMode>(this, "ellipsize");
542 }
543
544 Glib::PropertyProxy_ReadOnly<Pango::EllipsizeMode> Label::property_ellipsize() const
545 {
546   return Glib::PropertyProxy_ReadOnly<Pango::EllipsizeMode>(this, "ellipsize");
547 }
548
549 Glib::PropertyProxy<int> Label::property_width_chars() 
550 {
551   return Glib::PropertyProxy<int>(this, "width-chars");
552 }
553
554 Glib::PropertyProxy_ReadOnly<int> Label::property_width_chars() const
555 {
556   return Glib::PropertyProxy_ReadOnly<int>(this, "width-chars");
557 }
558
559 Glib::PropertyProxy<bool> Label::property_single_line_mode() 
560 {
561   return Glib::PropertyProxy<bool>(this, "single-line-mode");
562 }
563
564 Glib::PropertyProxy_ReadOnly<bool> Label::property_single_line_mode() const
565 {
566   return Glib::PropertyProxy_ReadOnly<bool>(this, "single-line-mode");
567 }
568
569 Glib::PropertyProxy<double> Label::property_angle() 
570 {
571   return Glib::PropertyProxy<double>(this, "angle");
572 }
573
574 Glib::PropertyProxy_ReadOnly<double> Label::property_angle() const
575 {
576   return Glib::PropertyProxy_ReadOnly<double>(this, "angle");
577 }
578
579 Glib::PropertyProxy<int> Label::property_max_width_chars() 
580 {
581   return Glib::PropertyProxy<int>(this, "max-width-chars");
582 }
583
584 Glib::PropertyProxy_ReadOnly<int> Label::property_max_width_chars() const
585 {
586   return Glib::PropertyProxy_ReadOnly<int>(this, "max-width-chars");
587 }
588
589
590 void Gtk::Label::on_populate_popup(Menu* menu)
591 {
592   BaseClassType *const base = static_cast<BaseClassType*>(
593       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
594   );
595
596   if(base && base->populate_popup)
597     (*base->populate_popup)(gobj(),(GtkMenu*)Glib::unwrap(menu));
598 }
599
600
601 } // namespace Gtk
602
603