1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/label.h>
4 #include <gtkmm/private/label_p.h>
9 /* Copyright 1998-2002 The gtkmm Development Team
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.
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.
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.
26 #include <gtk/gtklabel.h>
27 #include <gtkmm/menu.h>
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))
38 Label::Label(const Glib::ustring& label, bool mnemonic)
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))
44 Label::Label(const Glib::ustring& label, float xalign, float yalign, bool mnemonic)
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))
49 set_alignment(xalign, yalign);
52 Label::Label(const Glib::ustring& label, AlignmentEnum xalign, AlignmentEnum yalign, bool mnemonic)
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))
57 set_alignment(xalign, yalign);
60 void Label::select_region(int start_offset)
62 gtk_label_select_region(gobj(), start_offset, -1 /* See C docs */);
71 void Label_signal_populate_popup_callback(GtkLabel* self, GtkMenu* p0,void* data)
74 typedef sigc::slot< void,Menu* > SlotType;
76 // Do not try to call a signal on a disassociated wrapper.
77 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
81 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
82 (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
87 Glib::exception_handlers_invoke();
92 const Glib::SignalProxyInfo Label_signal_populate_popup_info =
95 (GCallback) &Label_signal_populate_popup_callback,
96 (GCallback) &Label_signal_populate_popup_callback
99 } // anonymous namespace
105 Gtk::Label* wrap(GtkLabel* object, bool take_copy)
107 return dynamic_cast<Gtk::Label *> (Glib::wrap_auto ((GObject*)(object), take_copy));
110 } /* namespace Glib */
116 /* The *_Class implementation: */
118 const Glib::Class& Label_Class::init()
120 if(!gtype_) // create the GType if necessary
122 // Glib::Class has to know the class init function to clone custom types.
123 class_init_func_ = &Label_Class::class_init_function;
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();
129 // Create the wrapper type, with the same class/instance size as the base type.
130 register_derived_type(gtk_label_get_type());
132 // Add derived versions of interfaces, if the C type implements any interfaces:
138 void Label_Class::class_init_function(void* g_class, void* class_data)
140 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
141 CppClassParent::class_init_function(klass, class_data);
143 klass->populate_popup = &populate_popup_callback;
147 void Label_Class::populate_popup_callback(GtkLabel* self, GtkMenu* p0)
149 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
150 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
157 if(obj && obj->is_derived_())
159 try // Trap C++ exceptions which would normally be lost because this is a C callback.
161 // Call the virtual member method, which derived classes might override.
162 obj->on_populate_popup(Glib::wrap(p0)
167 Glib::exception_handlers_invoke();
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).
176 // Call the original underlying C function:
177 if(base && base->populate_popup)
178 (*base->populate_popup)(self, p0);
183 Glib::ObjectBase* Label_Class::wrap_new(GObject* o)
185 return manage(new Label((GtkLabel*)(o)));
190 /* The implementation: */
192 Label::Label(const Glib::ConstructParams& construct_params)
194 Gtk::Misc(construct_params)
198 Label::Label(GtkLabel* castitem)
200 Gtk::Misc((GtkMisc*)(castitem))
209 Label::CppClassType Label::label_class_; // initialize static member
211 GType Label::get_type()
213 return label_class_.init().get_type();
216 GType Label::get_base_type()
218 return gtk_label_get_type();
222 void Label::set_text(const Glib::ustring & str)
224 gtk_label_set_text(gobj(), str.c_str());
227 Glib::ustring Label::get_text() const
229 return Glib::convert_const_gchar_ptr_to_ustring(gtk_label_get_text(const_cast<GtkLabel*>(gobj())));
232 void Label::set_attributes(Pango::AttrList& attrs)
234 gtk_label_set_attributes(gobj(), (attrs).gobj());
237 Pango::AttrList Label::get_attributes() const
239 return Pango::AttrList((gtk_label_get_attributes(const_cast<GtkLabel*>(gobj()))));
242 void Label::set_label(const Glib::ustring& str)
244 gtk_label_set_label(gobj(), str.c_str());
247 Glib::ustring Label::get_label() const
249 return Glib::convert_const_gchar_ptr_to_ustring(gtk_label_get_label(const_cast<GtkLabel*>(gobj())));
252 void Label::set_markup(const Glib::ustring& str)
254 gtk_label_set_markup(gobj(), str.c_str());
257 void Label::set_use_markup(bool setting)
259 gtk_label_set_use_markup(gobj(), static_cast<int>(setting));
262 bool Label::get_use_markup() const
264 return gtk_label_get_use_markup(const_cast<GtkLabel*>(gobj()));
267 void Label::set_use_underline(bool setting)
269 gtk_label_set_use_underline(gobj(), static_cast<int>(setting));
272 bool Label::get_use_underline() const
274 return gtk_label_get_use_underline(const_cast<GtkLabel*>(gobj()));
277 void Label::set_markup_with_mnemonic(const Glib::ustring& str)
279 gtk_label_set_markup_with_mnemonic(gobj(), str.c_str());
282 guint Label::get_mnemonic_keyval() const
284 return gtk_label_get_mnemonic_keyval(const_cast<GtkLabel*>(gobj()));
287 void Label::set_mnemonic_widget(Widget& widget)
289 gtk_label_set_mnemonic_widget(gobj(), (widget).gobj());
292 Widget* Label::get_mnemonic_widget()
294 return Glib::wrap(gtk_label_get_mnemonic_widget(gobj()));
297 const Widget* Label::get_mnemonic_widget() const
299 return Glib::wrap(gtk_label_get_mnemonic_widget(const_cast<GtkLabel*>(gobj())));
302 void Label::set_text_with_mnemonic(const Glib::ustring& str)
304 gtk_label_set_text_with_mnemonic(gobj(), str.c_str());
307 void Label::set_justify(Justification jtype)
309 gtk_label_set_justify(gobj(), ((GtkJustification)(jtype)));
312 Justification Label::get_justify() const
314 return ((Justification)(gtk_label_get_justify(const_cast<GtkLabel*>(gobj()))));
317 void Label::set_ellipsize(Pango::EllipsizeMode mode)
319 gtk_label_set_ellipsize(gobj(), ((PangoEllipsizeMode)(mode)));
322 Pango::EllipsizeMode Label::get_ellipsize() const
324 return ((Pango::EllipsizeMode)(gtk_label_get_ellipsize(const_cast<GtkLabel*>(gobj()))));
327 void Label::set_width_chars(int n_chars)
329 gtk_label_set_width_chars(gobj(), n_chars);
332 int Label::get_width_chars() const
334 return gtk_label_get_width_chars(const_cast<GtkLabel*>(gobj()));
337 void Label::set_max_width_chars(int n_chars)
339 gtk_label_set_max_width_chars(gobj(), n_chars);
342 int Label::get_max_width_chars() const
344 return gtk_label_get_max_width_chars(const_cast<GtkLabel*>(gobj()));
347 void Label::set_pattern(const Glib::ustring& pattern)
349 gtk_label_set_pattern(gobj(), pattern.c_str());
352 void Label::set_line_wrap(bool wrap)
354 gtk_label_set_line_wrap(gobj(), static_cast<int>(wrap));
357 bool Label::get_line_wrap() const
359 return gtk_label_get_line_wrap(const_cast<GtkLabel*>(gobj()));
362 void Label::set_selectable(bool setting)
364 gtk_label_set_selectable(gobj(), static_cast<int>(setting));
367 bool Label::get_selectable() const
369 return gtk_label_get_selectable(const_cast<GtkLabel*>(gobj()));
372 void Label::set_angle(double angle)
374 gtk_label_set_angle(gobj(), angle);
377 double Label::get_angle() const
379 return gtk_label_get_angle(const_cast<GtkLabel*>(gobj()));
382 void Label::select_region(int start_offset, int end_offset)
384 gtk_label_select_region(gobj(), start_offset, end_offset);
387 bool Label::get_selection_bounds(int& start, int& end) const
389 return gtk_label_get_selection_bounds(const_cast<GtkLabel*>(gobj()), &start, &end);
392 Glib::RefPtr<Pango::Layout> Label::get_layout()
395 Glib::RefPtr<Pango::Layout> retvalue = Glib::wrap(gtk_label_get_layout(gobj()));
398 retvalue->reference(); //The function does not do a ref for us.
402 Glib::RefPtr<const Pango::Layout> Label::get_layout() const
405 Glib::RefPtr<const Pango::Layout> retvalue = Glib::wrap(gtk_label_get_layout(const_cast<GtkLabel*>(gobj())));
408 retvalue->reference(); //The function does not do a ref for us.
412 void Label::get_layout_offsets(int& x, int& y) const
414 gtk_label_get_layout_offsets(const_cast<GtkLabel*>(gobj()), &x, &y);
417 void Label::set_single_line_mode(bool single_line_mode)
419 gtk_label_set_single_line_mode(gobj(), static_cast<int>(single_line_mode));
422 bool Label::get_single_line_mode() const
424 return gtk_label_get_single_line_mode(const_cast<GtkLabel*>(gobj()));
428 Glib::SignalProxy1< void,Menu* > Label::signal_populate_popup()
430 return Glib::SignalProxy1< void,Menu* >(this, &Label_signal_populate_popup_info);
434 Glib::PropertyProxy<Glib::ustring> Label::property_label()
436 return Glib::PropertyProxy<Glib::ustring>(this, "label");
439 Glib::PropertyProxy_ReadOnly<Glib::ustring> Label::property_label() const
441 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "label");
444 Glib::PropertyProxy<Pango::AttrList> Label::property_attributes()
446 return Glib::PropertyProxy<Pango::AttrList>(this, "attributes");
449 Glib::PropertyProxy_ReadOnly<Pango::AttrList> Label::property_attributes() const
451 return Glib::PropertyProxy_ReadOnly<Pango::AttrList>(this, "attributes");
454 Glib::PropertyProxy<bool> Label::property_use_markup()
456 return Glib::PropertyProxy<bool>(this, "use-markup");
459 Glib::PropertyProxy_ReadOnly<bool> Label::property_use_markup() const
461 return Glib::PropertyProxy_ReadOnly<bool>(this, "use-markup");
464 Glib::PropertyProxy<bool> Label::property_use_underline()
466 return Glib::PropertyProxy<bool>(this, "use-underline");
469 Glib::PropertyProxy_ReadOnly<bool> Label::property_use_underline() const
471 return Glib::PropertyProxy_ReadOnly<bool>(this, "use-underline");
474 Glib::PropertyProxy<Justification> Label::property_justify()
476 return Glib::PropertyProxy<Justification>(this, "justify");
479 Glib::PropertyProxy_ReadOnly<Justification> Label::property_justify() const
481 return Glib::PropertyProxy_ReadOnly<Justification>(this, "justify");
484 Glib::PropertyProxy_WriteOnly<Glib::ustring> Label::property_pattern()
486 return Glib::PropertyProxy_WriteOnly<Glib::ustring>(this, "pattern");
489 Glib::PropertyProxy_ReadOnly<Glib::ustring> Label::property_pattern() const
491 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "pattern");
494 Glib::PropertyProxy<bool> Label::property_wrap()
496 return Glib::PropertyProxy<bool>(this, "wrap");
499 Glib::PropertyProxy_ReadOnly<bool> Label::property_wrap() const
501 return Glib::PropertyProxy_ReadOnly<bool>(this, "wrap");
504 Glib::PropertyProxy<bool> Label::property_selectable()
506 return Glib::PropertyProxy<bool>(this, "selectable");
509 Glib::PropertyProxy_ReadOnly<bool> Label::property_selectable() const
511 return Glib::PropertyProxy_ReadOnly<bool>(this, "selectable");
514 Glib::PropertyProxy_ReadOnly<guint> Label::property_mnemonic_keyval() const
516 return Glib::PropertyProxy_ReadOnly<guint>(this, "mnemonic-keyval");
519 Glib::PropertyProxy<Widget*> Label::property_mnemonic_widget()
521 return Glib::PropertyProxy<Widget*>(this, "mnemonic-widget");
524 Glib::PropertyProxy_ReadOnly<Widget*> Label::property_mnemonic_widget() const
526 return Glib::PropertyProxy_ReadOnly<Widget*>(this, "mnemonic-widget");
529 Glib::PropertyProxy_ReadOnly<int> Label::property_cursor_position() const
531 return Glib::PropertyProxy_ReadOnly<int>(this, "cursor-position");
534 Glib::PropertyProxy_ReadOnly<int> Label::property_selection_bound() const
536 return Glib::PropertyProxy_ReadOnly<int>(this, "selection-bound");
539 Glib::PropertyProxy<Pango::EllipsizeMode> Label::property_ellipsize()
541 return Glib::PropertyProxy<Pango::EllipsizeMode>(this, "ellipsize");
544 Glib::PropertyProxy_ReadOnly<Pango::EllipsizeMode> Label::property_ellipsize() const
546 return Glib::PropertyProxy_ReadOnly<Pango::EllipsizeMode>(this, "ellipsize");
549 Glib::PropertyProxy<int> Label::property_width_chars()
551 return Glib::PropertyProxy<int>(this, "width-chars");
554 Glib::PropertyProxy_ReadOnly<int> Label::property_width_chars() const
556 return Glib::PropertyProxy_ReadOnly<int>(this, "width-chars");
559 Glib::PropertyProxy<bool> Label::property_single_line_mode()
561 return Glib::PropertyProxy<bool>(this, "single-line-mode");
564 Glib::PropertyProxy_ReadOnly<bool> Label::property_single_line_mode() const
566 return Glib::PropertyProxy_ReadOnly<bool>(this, "single-line-mode");
569 Glib::PropertyProxy<double> Label::property_angle()
571 return Glib::PropertyProxy<double>(this, "angle");
574 Glib::PropertyProxy_ReadOnly<double> Label::property_angle() const
576 return Glib::PropertyProxy_ReadOnly<double>(this, "angle");
579 Glib::PropertyProxy<int> Label::property_max_width_chars()
581 return Glib::PropertyProxy<int>(this, "max-width-chars");
584 Glib::PropertyProxy_ReadOnly<int> Label::property_max_width_chars() const
586 return Glib::PropertyProxy_ReadOnly<int>(this, "max-width-chars");
590 void Gtk::Label::on_populate_popup(Menu* menu)
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).
596 if(base && base->populate_popup)
597 (*base->populate_popup)(gobj(),(GtkMenu*)Glib::unwrap(menu));