// Generated by gtkmmproc -- DO NOT MODIFY! #include #include // -*- c++ -*- /* $Id$ */ /* * * Copyright 1998-2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include namespace Gtk { Button::Button(const Glib::ustring& label, bool mnemonic) : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(0), Gtk::Bin(Glib::ConstructParams(button_class_.init(), "label",label.c_str(),"use_underline",gboolean(mnemonic), static_cast(0))) {} Button::Button(const StockID& stock_id) : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(0), Gtk::Bin(Glib::ConstructParams(button_class_.init(), "use_stock",1,"label",stock_id.get_c_str(), static_cast(0))) {} } // namespace Gtk namespace { static const Glib::SignalProxyInfo Button_signal_pressed_info = { "pressed", (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, (GCallback) &Glib::SignalProxyNormal::slot0_void_callback }; static const Glib::SignalProxyInfo Button_signal_released_info = { "released", (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, (GCallback) &Glib::SignalProxyNormal::slot0_void_callback }; static const Glib::SignalProxyInfo Button_signal_clicked_info = { "clicked", (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, (GCallback) &Glib::SignalProxyNormal::slot0_void_callback }; static const Glib::SignalProxyInfo Button_signal_enter_info = { "enter", (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, (GCallback) &Glib::SignalProxyNormal::slot0_void_callback }; static const Glib::SignalProxyInfo Button_signal_leave_info = { "leave", (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, (GCallback) &Glib::SignalProxyNormal::slot0_void_callback }; static const Glib::SignalProxyInfo Button_signal_activate_info = { "activate", (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, (GCallback) &Glib::SignalProxyNormal::slot0_void_callback }; } // anonymous namespace namespace Glib { Gtk::Button* wrap(GtkButton* object, bool take_copy) { return dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)); } } /* namespace Glib */ namespace Gtk { /* The *_Class implementation: */ const Glib::Class& Button_Class::init() { if(!gtype_) // create the GType if necessary { // Glib::Class has to know the class init function to clone custom types. class_init_func_ = &Button_Class::class_init_function; // This is actually just optimized away, apparently with no harm. // Make sure that the parent type has been created. //CppClassParent::CppObjectType::get_type(); // Create the wrapper type, with the same class/instance size as the base type. register_derived_type(gtk_button_get_type()); // Add derived versions of interfaces, if the C type implements any interfaces: } return *this; } void Button_Class::class_init_function(void* g_class, void* class_data) { BaseClassType *const klass = static_cast(g_class); CppClassParent::class_init_function(klass, class_data); #ifdef GLIBMM_VFUNCS_ENABLED #endif //GLIBMM_VFUNCS_ENABLED #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED klass->pressed = &pressed_callback; klass->released = &released_callback; klass->clicked = &clicked_callback; klass->enter = &enter_callback; klass->leave = &leave_callback; klass->activate = &activate_callback; #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED } #ifdef GLIBMM_VFUNCS_ENABLED #endif //GLIBMM_VFUNCS_ENABLED #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED void Button_Class::pressed_callback(GtkButton* self) { Glib::ObjectBase *const obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); // Non-gtkmmproc-generated custom classes implicitly call the default // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- // generated classes can use this optimisation, which avoids the unnecessary // parameter conversions if there is no possibility of the virtual function // being overridden: if(obj_base && obj_base->is_derived_()) { CppObjectType *const obj = dynamic_cast(obj_base); if(obj) // This can be NULL during destruction. { #ifdef GLIBMM_EXCEPTIONS_ENABLED try // Trap C++ exceptions which would normally be lost because this is a C callback. { #endif //GLIBMM_EXCEPTIONS_ENABLED // Call the virtual member method, which derived classes might override. obj->on_pressed(); return; #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } #endif //GLIBMM_EXCEPTIONS_ENABLED } } BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->pressed) (*base->pressed)(self); } void Button_Class::released_callback(GtkButton* self) { Glib::ObjectBase *const obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); // Non-gtkmmproc-generated custom classes implicitly call the default // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- // generated classes can use this optimisation, which avoids the unnecessary // parameter conversions if there is no possibility of the virtual function // being overridden: if(obj_base && obj_base->is_derived_()) { CppObjectType *const obj = dynamic_cast(obj_base); if(obj) // This can be NULL during destruction. { #ifdef GLIBMM_EXCEPTIONS_ENABLED try // Trap C++ exceptions which would normally be lost because this is a C callback. { #endif //GLIBMM_EXCEPTIONS_ENABLED // Call the virtual member method, which derived classes might override. obj->on_released(); return; #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } #endif //GLIBMM_EXCEPTIONS_ENABLED } } BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->released) (*base->released)(self); } void Button_Class::clicked_callback(GtkButton* self) { Glib::ObjectBase *const obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); // Non-gtkmmproc-generated custom classes implicitly call the default // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- // generated classes can use this optimisation, which avoids the unnecessary // parameter conversions if there is no possibility of the virtual function // being overridden: if(obj_base && obj_base->is_derived_()) { CppObjectType *const obj = dynamic_cast(obj_base); if(obj) // This can be NULL during destruction. { #ifdef GLIBMM_EXCEPTIONS_ENABLED try // Trap C++ exceptions which would normally be lost because this is a C callback. { #endif //GLIBMM_EXCEPTIONS_ENABLED // Call the virtual member method, which derived classes might override. obj->on_clicked(); return; #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } #endif //GLIBMM_EXCEPTIONS_ENABLED } } BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->clicked) (*base->clicked)(self); } void Button_Class::enter_callback(GtkButton* self) { Glib::ObjectBase *const obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); // Non-gtkmmproc-generated custom classes implicitly call the default // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- // generated classes can use this optimisation, which avoids the unnecessary // parameter conversions if there is no possibility of the virtual function // being overridden: if(obj_base && obj_base->is_derived_()) { CppObjectType *const obj = dynamic_cast(obj_base); if(obj) // This can be NULL during destruction. { #ifdef GLIBMM_EXCEPTIONS_ENABLED try // Trap C++ exceptions which would normally be lost because this is a C callback. { #endif //GLIBMM_EXCEPTIONS_ENABLED // Call the virtual member method, which derived classes might override. obj->on_enter(); return; #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } #endif //GLIBMM_EXCEPTIONS_ENABLED } } BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->enter) (*base->enter)(self); } void Button_Class::leave_callback(GtkButton* self) { Glib::ObjectBase *const obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); // Non-gtkmmproc-generated custom classes implicitly call the default // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- // generated classes can use this optimisation, which avoids the unnecessary // parameter conversions if there is no possibility of the virtual function // being overridden: if(obj_base && obj_base->is_derived_()) { CppObjectType *const obj = dynamic_cast(obj_base); if(obj) // This can be NULL during destruction. { #ifdef GLIBMM_EXCEPTIONS_ENABLED try // Trap C++ exceptions which would normally be lost because this is a C callback. { #endif //GLIBMM_EXCEPTIONS_ENABLED // Call the virtual member method, which derived classes might override. obj->on_leave(); return; #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } #endif //GLIBMM_EXCEPTIONS_ENABLED } } BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->leave) (*base->leave)(self); } void Button_Class::activate_callback(GtkButton* self) { Glib::ObjectBase *const obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); // Non-gtkmmproc-generated custom classes implicitly call the default // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- // generated classes can use this optimisation, which avoids the unnecessary // parameter conversions if there is no possibility of the virtual function // being overridden: if(obj_base && obj_base->is_derived_()) { CppObjectType *const obj = dynamic_cast(obj_base); if(obj) // This can be NULL during destruction. { #ifdef GLIBMM_EXCEPTIONS_ENABLED try // Trap C++ exceptions which would normally be lost because this is a C callback. { #endif //GLIBMM_EXCEPTIONS_ENABLED // Call the virtual member method, which derived classes might override. obj->on_activate(); return; #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } #endif //GLIBMM_EXCEPTIONS_ENABLED } } BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->activate) (*base->activate)(self); } #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED Glib::ObjectBase* Button_Class::wrap_new(GObject* o) { return manage(new Button((GtkButton*)(o))); } /* The implementation: */ Button::Button(const Glib::ConstructParams& construct_params) : Gtk::Bin(construct_params) { } Button::Button(GtkButton* castitem) : Gtk::Bin((GtkBin*)(castitem)) { } Button::~Button() { destroy_(); } Button::CppClassType Button::button_class_; // initialize static member GType Button::get_type() { return button_class_.init().get_type(); } GType Button::get_base_type() { return gtk_button_get_type(); } Button::Button() : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(0), Gtk::Bin(Glib::ConstructParams(button_class_.init())) { } void Button::pressed() { gtk_button_pressed(gobj()); } void Button::released() { gtk_button_released(gobj()); } void Button::clicked() { gtk_button_clicked(gobj()); } void Button::enter() { gtk_button_enter(gobj()); } void Button::leave() { gtk_button_leave(gobj()); } void Button::set_relief(ReliefStyle newstyle) { gtk_button_set_relief(gobj(), ((GtkReliefStyle)(newstyle))); } ReliefStyle Button::get_relief() const { return ((ReliefStyle)(gtk_button_get_relief(const_cast(gobj())))); } void Button::set_label(const Glib::ustring& label) { gtk_button_set_label(gobj(), label.c_str()); } Glib::ustring Button::get_label() const { return Glib::convert_const_gchar_ptr_to_ustring(gtk_button_get_label(const_cast(gobj()))); } void Button::set_use_underline(bool use_underline) { gtk_button_set_use_underline(gobj(), static_cast(use_underline)); } bool Button::get_use_underline() const { return gtk_button_get_use_underline(const_cast(gobj())); } void Button::set_use_stock(bool use_stock) { gtk_button_set_use_stock(gobj(), static_cast(use_stock)); } bool Button::get_use_stock() const { return gtk_button_get_use_stock(const_cast(gobj())); } void Button::set_focus_on_click(bool focus_on_click) { gtk_button_set_focus_on_click(gobj(), static_cast(focus_on_click)); } bool Button::get_focus_on_click() const { return gtk_button_get_focus_on_click(const_cast(gobj())); } void Button::set_alignment(float xalign, float yalign) { gtk_button_set_alignment(gobj(), xalign, yalign); } void Button::get_alignment(float& xalign, float& yalign) { gtk_button_get_alignment(gobj(), &(xalign), &(yalign)); } void Button::set_image(Widget& image) { gtk_button_set_image(gobj(), (image).gobj()); } Widget* Button::get_image() { return Glib::wrap(gtk_button_get_image(gobj())); } const Widget* Button::get_image() const { return const_cast(this)->get_image(); } void Button::set_image_position(PositionType position) { gtk_button_set_image_position(gobj(), ((GtkPositionType)(position))); } PositionType Button::get_image_position() const { return ((PositionType)(gtk_button_get_image_position(const_cast(gobj())))); } Glib::SignalProxy0< void > Button::signal_pressed() { return Glib::SignalProxy0< void >(this, &Button_signal_pressed_info); } Glib::SignalProxy0< void > Button::signal_released() { return Glib::SignalProxy0< void >(this, &Button_signal_released_info); } Glib::SignalProxy0< void > Button::signal_clicked() { return Glib::SignalProxy0< void >(this, &Button_signal_clicked_info); } Glib::SignalProxy0< void > Button::signal_enter() { return Glib::SignalProxy0< void >(this, &Button_signal_enter_info); } Glib::SignalProxy0< void > Button::signal_leave() { return Glib::SignalProxy0< void >(this, &Button_signal_leave_info); } Glib::SignalProxy0< void > Button::signal_activate() { return Glib::SignalProxy0< void >(this, &Button_signal_activate_info); } #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy Button::property_label() { return Glib::PropertyProxy(this, "label"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly Button::property_label() const { return Glib::PropertyProxy_ReadOnly(this, "label"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy Button::property_relief() { return Glib::PropertyProxy(this, "relief"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly Button::property_relief() const { return Glib::PropertyProxy_ReadOnly(this, "relief"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy Button::property_use_underline() { return Glib::PropertyProxy(this, "use-underline"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly Button::property_use_underline() const { return Glib::PropertyProxy_ReadOnly(this, "use-underline"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy Button::property_use_stock() { return Glib::PropertyProxy(this, "use-stock"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly Button::property_use_stock() const { return Glib::PropertyProxy_ReadOnly(this, "use-stock"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy Button::property_focus_on_click() { return Glib::PropertyProxy(this, "focus-on-click"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly Button::property_focus_on_click() const { return Glib::PropertyProxy_ReadOnly(this, "focus-on-click"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy Button::property_xalign() { return Glib::PropertyProxy(this, "xalign"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly Button::property_xalign() const { return Glib::PropertyProxy_ReadOnly(this, "xalign"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy Button::property_yalign() { return Glib::PropertyProxy(this, "yalign"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly Button::property_yalign() const { return Glib::PropertyProxy_ReadOnly(this, "yalign"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy Button::property_image() { return Glib::PropertyProxy(this, "image"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly Button::property_image() const { return Glib::PropertyProxy_ReadOnly(this, "image"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy Button::property_image_position() { return Glib::PropertyProxy(this, "image-position"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly Button::property_image_position() const { return Glib::PropertyProxy_ReadOnly(this, "image-position"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED void Gtk::Button::on_pressed() { BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->pressed) (*base->pressed)(gobj()); } void Gtk::Button::on_released() { BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->released) (*base->released)(gobj()); } void Gtk::Button::on_clicked() { BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->clicked) (*base->clicked)(gobj()); } void Gtk::Button::on_enter() { BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->enter) (*base->enter)(gobj()); } void Gtk::Button::on_leave() { BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->leave) (*base->leave)(gobj()); } void Gtk::Button::on_activate() { BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->activate) (*base->activate)(gobj()); } #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED #ifdef GLIBMM_VFUNCS_ENABLED #endif //GLIBMM_VFUNCS_ENABLED } // namespace Gtk