13
0
livetrax/libs/gtkmm2/gtk/gtkmm/toolbutton.cc

385 lines
10 KiB
C++
Raw Normal View History

// Generated by gtkmmproc -- DO NOT MODIFY!
#include <gtkmm/toolbutton.h>
#include <gtkmm/private/toolbutton_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/gtktoolbutton.h>
namespace Gtk
{
ToolButton::ToolButton(const Glib::ustring& label)
:
Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
Gtk::ToolItem(Glib::ConstructParams(toolbutton_class_.init(), "label", label.c_str(), (char*) 0))
{
}
} // namespace Gtk
namespace
{
static const Glib::SignalProxyInfo ToolButton_signal_clicked_info =
{
"clicked",
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};
} // anonymous namespace
namespace Glib
{
Gtk::ToolButton* wrap(GtkToolButton* object, bool take_copy)
{
return dynamic_cast<Gtk::ToolButton *> (Glib::wrap_auto ((GObject*)(object), take_copy));
}
} /* namespace Glib */
namespace Gtk
{
/* The *_Class implementation: */
const Glib::Class& ToolButton_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_ = &ToolButton_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_tool_button_get_type());
// Add derived versions of interfaces, if the C type implements any interfaces:
}
return *this;
}
void ToolButton_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);
#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
klass->clicked = &clicked_callback;
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
}
#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void ToolButton_Class::clicked_callback(GtkToolButton* self)
{
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
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<CppObjectType* const>(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<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);
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
Glib::ObjectBase* ToolButton_Class::wrap_new(GObject* o)
{
return manage(new ToolButton((GtkToolButton*)(o)));
}
/* The implementation: */
ToolButton::ToolButton(const Glib::ConstructParams& construct_params)
:
Gtk::ToolItem(construct_params)
{
}
ToolButton::ToolButton(GtkToolButton* castitem)
:
Gtk::ToolItem((GtkToolItem*)(castitem))
{
}
ToolButton::~ToolButton()
{
destroy_();
}
ToolButton::CppClassType ToolButton::toolbutton_class_; // initialize static member
GType ToolButton::get_type()
{
return toolbutton_class_.init().get_type();
}
GType ToolButton::get_base_type()
{
return gtk_tool_button_get_type();
}
ToolButton::ToolButton()
:
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
Glib::ObjectBase(0),
Gtk::ToolItem(Glib::ConstructParams(toolbutton_class_.init()))
{
}
ToolButton::ToolButton(const Gtk::StockID& stock_id)
:
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
Glib::ObjectBase(0),
Gtk::ToolItem(Glib::ConstructParams(toolbutton_class_.init(), "stock_id", (stock_id).get_c_str(), static_cast<char*>(0)))
{
}
ToolButton::ToolButton(Widget& icon_widget, const Glib::ustring& label)
:
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
Glib::ObjectBase(0),
Gtk::ToolItem(Glib::ConstructParams(toolbutton_class_.init(), "icon_widget", (icon_widget).gobj(), "label", label.c_str(), static_cast<char*>(0)))
{
}
void ToolButton::set_label(const Glib::ustring& label)
{
gtk_tool_button_set_label(gobj(), label.c_str());
}
Glib::ustring ToolButton::get_label() const
{
return Glib::convert_const_gchar_ptr_to_ustring(gtk_tool_button_get_label(const_cast<GtkToolButton*>(gobj())));
}
void ToolButton::set_use_underline(bool use_underline)
{
gtk_tool_button_set_use_underline(gobj(), static_cast<int>(use_underline));
}
bool ToolButton::get_use_underline() const
{
return gtk_tool_button_get_use_underline(const_cast<GtkToolButton*>(gobj()));
}
void ToolButton::set_stock_id(const Gtk::StockID& stock_id)
{
gtk_tool_button_set_stock_id(gobj(), (stock_id).get_c_str());
}
Glib::ustring ToolButton::get_stock_id() const
{
return Glib::convert_const_gchar_ptr_to_ustring(gtk_tool_button_get_stock_id(const_cast<GtkToolButton*>(gobj())));
}
void ToolButton::set_icon_name(const Glib::ustring& icon_name)
{
gtk_tool_button_set_icon_name(gobj(), icon_name.c_str());
}
Glib::ustring ToolButton::get_icon_name() const
{
return Glib::convert_const_gchar_ptr_to_ustring(gtk_tool_button_get_icon_name(const_cast<GtkToolButton*>(gobj())));
}
void ToolButton::set_icon_widget(Widget& icon_widget)
{
gtk_tool_button_set_icon_widget(gobj(), (icon_widget).gobj());
}
Widget* ToolButton::get_icon_widget()
{
return Glib::wrap(gtk_tool_button_get_icon_widget(gobj()));
}
const Widget* ToolButton::get_icon_widget() const
{
return const_cast<ToolButton*>(this)->get_icon_widget();
}
void ToolButton::set_label_widget(Widget& label_widget)
{
gtk_tool_button_set_label_widget(gobj(), (label_widget).gobj());
}
Widget* ToolButton::get_label_widget()
{
return Glib::wrap(gtk_tool_button_get_label_widget(gobj()));
}
const Widget* ToolButton::get_label_widget() const
{
return const_cast<ToolButton*>(this)->get_label_widget();
}
Glib::SignalProxy0< void > ToolButton::signal_clicked()
{
return Glib::SignalProxy0< void >(this, &ToolButton_signal_clicked_info);
}
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<Glib::ustring> ToolButton::property_label()
{
return Glib::PropertyProxy<Glib::ustring>(this, "label");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<Glib::ustring> ToolButton::property_label() const
{
return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "label");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> ToolButton::property_use_underline()
{
return Glib::PropertyProxy<bool>(this, "use-underline");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> ToolButton::property_use_underline() const
{
return Glib::PropertyProxy_ReadOnly<bool>(this, "use-underline");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<Gtk::Widget*> ToolButton::property_label_widget()
{
return Glib::PropertyProxy<Gtk::Widget*>(this, "label-widget");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<Gtk::Widget*> ToolButton::property_label_widget() const
{
return Glib::PropertyProxy_ReadOnly<Gtk::Widget*>(this, "label-widget");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<Glib::ustring> ToolButton::property_stock_id()
{
return Glib::PropertyProxy<Glib::ustring>(this, "stock-id");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<Glib::ustring> ToolButton::property_stock_id() const
{
return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "stock-id");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<Gtk::Widget> ToolButton::property_icon_widget()
{
return Glib::PropertyProxy<Gtk::Widget>(this, "icon-widget");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<Gtk::Widget> ToolButton::property_icon_widget() const
{
return Glib::PropertyProxy_ReadOnly<Gtk::Widget>(this, "icon-widget");
}
#endif //GLIBMM_PROPERTIES_ENABLED
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void Gtk::ToolButton::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());
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED
} // namespace Gtk