summaryrefslogtreecommitdiff
path: root/libs/gtkmm2/gtk/gtkmm/button.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/gtkmm2/gtk/gtkmm/button.cc')
-rw-r--r--libs/gtkmm2/gtk/gtkmm/button.cc682
1 files changed, 682 insertions, 0 deletions
diff --git a/libs/gtkmm2/gtk/gtkmm/button.cc b/libs/gtkmm2/gtk/gtkmm/button.cc
new file mode 100644
index 0000000000..01a3265d8c
--- /dev/null
+++ b/libs/gtkmm2/gtk/gtkmm/button.cc
@@ -0,0 +1,682 @@
+// Generated by gtkmmproc -- DO NOT MODIFY!
+
+#include <gtkmm/button.h>
+#include <gtkmm/private/button_p.h>
+
+// -*- 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 <gtk/gtklabel.h>
+#include <gtk/gtkmisc.h>
+#include <gtk/gtkbutton.h>
+#include <gtkmm/stock.h>
+
+
+namespace Gtk
+{
+
+Button::Button(const Glib::ustring& label, bool mnemonic)
+:
+ Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
+ Gtk::Bin(Glib::ConstructParams(button_class_.init(), "label",label.c_str(),"use_underline",gboolean(mnemonic), (char*) 0))
+{}
+
+Button::Button(const StockID& stock_id)
+:
+ Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
+ Gtk::Bin(Glib::ConstructParams(button_class_.init(), "use_stock",1,"label",stock_id.get_c_str(), (char*) 0))
+{}
+
+} // namespace Gtk
+
+
+namespace
+{
+
+const Glib::SignalProxyInfo Button_signal_pressed_info =
+{
+ "pressed",
+ (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
+ (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
+};
+
+
+const Glib::SignalProxyInfo Button_signal_released_info =
+{
+ "released",
+ (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
+ (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
+};
+
+
+const Glib::SignalProxyInfo Button_signal_clicked_info =
+{
+ "clicked",
+ (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
+ (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
+};
+
+
+const Glib::SignalProxyInfo Button_signal_enter_info =
+{
+ "enter",
+ (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
+ (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
+};
+
+
+const Glib::SignalProxyInfo Button_signal_leave_info =
+{
+ "leave",
+ (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
+ (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
+};
+
+
+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<Gtk::Button *> (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<BaseClassType*>(g_class);
+ CppClassParent::class_init_function(klass, class_data);
+
+ klass->pressed = &pressed_callback;
+ klass->released = &released_callback;
+ klass->clicked = &clicked_callback;
+ klass->enter = &enter_callback;
+ klass->leave = &leave_callback;
+ klass->activate = &activate_callback;
+}
+
+
+void Button_Class::pressed_callback(GtkButton* self)
+{
+ CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+ 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 && obj->is_derived_())
+ {
+ try // Trap C++ exceptions which would normally be lost because this is a C callback.
+ {
+ // Call the virtual member method, which derived classes might override.
+ obj->on_pressed();
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ }
+ else
+ {
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ 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)
+{
+ CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+ 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 && obj->is_derived_())
+ {
+ try // Trap C++ exceptions which would normally be lost because this is a C callback.
+ {
+ // Call the virtual member method, which derived classes might override.
+ obj->on_released();
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ }
+ else
+ {
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ 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)
+{
+ CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+ 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 && obj->is_derived_())
+ {
+ try // Trap C++ exceptions which would normally be lost because this is a C callback.
+ {
+ // Call the virtual member method, which derived classes might override.
+ obj->on_clicked();
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ }
+ else
+ {
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ 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)
+{
+ CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+ 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 && obj->is_derived_())
+ {
+ try // Trap C++ exceptions which would normally be lost because this is a C callback.
+ {
+ // Call the virtual member method, which derived classes might override.
+ obj->on_enter();
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ }
+ else
+ {
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ 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)
+{
+ CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+ 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 && obj->is_derived_())
+ {
+ try // Trap C++ exceptions which would normally be lost because this is a C callback.
+ {
+ // Call the virtual member method, which derived classes might override.
+ obj->on_leave();
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ }
+ else
+ {
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ 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)
+{
+ CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+ 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 && obj->is_derived_())
+ {
+ try // Trap C++ exceptions which would normally be lost because this is a C callback.
+ {
+ // Call the virtual member method, which derived classes might override.
+ obj->on_activate();
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ }
+ else
+ {
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ 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);
+ }
+}
+
+
+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()
+:
+ Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
+ 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<GtkButton*>(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<GtkButton*>(gobj())));
+}
+
+void Button::set_use_underline(bool use_underline)
+{
+ gtk_button_set_use_underline(gobj(), static_cast<int>(use_underline));
+}
+
+bool Button::get_use_underline() const
+{
+ return gtk_button_get_use_underline(const_cast<GtkButton*>(gobj()));
+}
+
+void Button::set_use_stock(bool use_stock)
+{
+ gtk_button_set_use_stock(gobj(), static_cast<int>(use_stock));
+}
+
+bool Button::get_use_stock() const
+{
+ return gtk_button_get_use_stock(const_cast<GtkButton*>(gobj()));
+}
+
+void Button::set_focus_on_click(bool focus_on_click)
+{
+ gtk_button_set_focus_on_click(gobj(), static_cast<int>(focus_on_click));
+}
+
+bool Button::get_focus_on_click() const
+{
+ return gtk_button_get_focus_on_click(const_cast<GtkButton*>(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 Glib::wrap(gtk_button_get_image(const_cast<GtkButton*>(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);
+}
+
+
+Glib::PropertyProxy<Glib::ustring> Button::property_label()
+{
+ return Glib::PropertyProxy<Glib::ustring>(this, "label");
+}
+
+Glib::PropertyProxy_ReadOnly<Glib::ustring> Button::property_label() const
+{
+ return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "label");
+}
+
+Glib::PropertyProxy<ReliefStyle> Button::property_relief()
+{
+ return Glib::PropertyProxy<ReliefStyle>(this, "relief");
+}
+
+Glib::PropertyProxy_ReadOnly<ReliefStyle> Button::property_relief() const
+{
+ return Glib::PropertyProxy_ReadOnly<ReliefStyle>(this, "relief");
+}
+
+Glib::PropertyProxy<bool> Button::property_use_underline()
+{
+ return Glib::PropertyProxy<bool>(this, "use-underline");
+}
+
+Glib::PropertyProxy_ReadOnly<bool> Button::property_use_underline() const
+{
+ return Glib::PropertyProxy_ReadOnly<bool>(this, "use-underline");
+}
+
+Glib::PropertyProxy<bool> Button::property_use_stock()
+{
+ return Glib::PropertyProxy<bool>(this, "use-stock");
+}
+
+Glib::PropertyProxy_ReadOnly<bool> Button::property_use_stock() const
+{
+ return Glib::PropertyProxy_ReadOnly<bool>(this, "use-stock");
+}
+
+Glib::PropertyProxy<bool> Button::property_focus_on_click()
+{
+ return Glib::PropertyProxy<bool>(this, "focus-on-click");
+}
+
+Glib::PropertyProxy_ReadOnly<bool> Button::property_focus_on_click() const
+{
+ return Glib::PropertyProxy_ReadOnly<bool>(this, "focus-on-click");
+}
+
+Glib::PropertyProxy<float> Button::property_xalign()
+{
+ return Glib::PropertyProxy<float>(this, "xalign");
+}
+
+Glib::PropertyProxy_ReadOnly<float> Button::property_xalign() const
+{
+ return Glib::PropertyProxy_ReadOnly<float>(this, "xalign");
+}
+
+Glib::PropertyProxy<float> Button::property_yalign()
+{
+ return Glib::PropertyProxy<float>(this, "yalign");
+}
+
+Glib::PropertyProxy_ReadOnly<float> Button::property_yalign() const
+{
+ return Glib::PropertyProxy_ReadOnly<float>(this, "yalign");
+}
+
+Glib::PropertyProxy<Gtk::Widget*> Button::property_image()
+{
+ return Glib::PropertyProxy<Gtk::Widget*>(this, "image");
+}
+
+Glib::PropertyProxy_ReadOnly<Gtk::Widget*> Button::property_image() const
+{
+ return Glib::PropertyProxy_ReadOnly<Gtk::Widget*>(this, "image");
+}
+
+
+void Gtk::Button::on_pressed()
+{
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ 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<BaseClassType*>(
+ 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<BaseClassType*>(
+ 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<BaseClassType*>(
+ 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<BaseClassType*>(
+ 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<BaseClassType*>(
+ 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());
+}
+
+
+} // namespace Gtk
+
+