// Generated by gtkmmproc -- DO NOT MODIFY! #include #include // -*- c++ -*- /* $Id: statusicon.ccg,v 1.4 2006/06/21 20:34:39 murrayc Exp $ */ /* Copyright 2005 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 namespace Gtk { Glib::RefPtr StatusIcon::create_from_file(const std::string& filename) { Glib::RefPtr status_icon( new StatusIcon() ); status_icon->set_from_file(filename); return status_icon; } bool StatusIcon::get_geometry(Glib::RefPtr& screen, Gdk::Rectangle& area, Orientation& orientation) { GdkScreen* cscreen = 0; GdkRectangle carea; const bool result = gtk_status_icon_get_geometry(const_cast(gobj()), &cscreen, &carea, (GtkOrientation*)(&orientation)); if(cscreen) screen = Glib::wrap(cscreen); *(area.gobj()) = carea; return result; } void StatusIcon::popup_menu_at_position(Menu& menu, guint button, guint32 activate_time) { gtk_menu_popup(menu.gobj(), NULL, NULL, gtk_status_icon_position_menu, gobj() /* user_data, passed to gtk_status_icon_position_menu()/ */, button, activate_time); } } // namespace Gtk namespace { static gboolean StatusIcon_signal_size_changed_callback(GtkStatusIcon* self, gint p0,void* data) { using namespace Gtk; typedef sigc::slot< bool,int > SlotType; // Do not try to call a signal on a disassociated wrapper. if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) { #ifdef GLIBMM_EXCEPTIONS_ENABLED try { #endif //GLIBMM_EXCEPTIONS_ENABLED if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) return static_cast((*static_cast(slot))(p0 )); #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } #endif //GLIBMM_EXCEPTIONS_ENABLED } typedef gboolean RType; return RType(); } static gboolean StatusIcon_signal_size_changed_notify_callback(GtkStatusIcon* self, gint p0, void* data) { using namespace Gtk; typedef sigc::slot< void,int > SlotType; // Do not try to call a signal on a disassociated wrapper. if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) { #ifdef GLIBMM_EXCEPTIONS_ENABLED try { #endif //GLIBMM_EXCEPTIONS_ENABLED if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) (*static_cast(slot))(p0 ); #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } #endif //GLIBMM_EXCEPTIONS_ENABLED } typedef gboolean RType; return RType(); } static const Glib::SignalProxyInfo StatusIcon_signal_size_changed_info = { "size_changed", (GCallback) &StatusIcon_signal_size_changed_callback, (GCallback) &StatusIcon_signal_size_changed_notify_callback }; static const Glib::SignalProxyInfo StatusIcon_signal_activate_info = { "activate", (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, (GCallback) &Glib::SignalProxyNormal::slot0_void_callback }; static void StatusIcon_signal_popup_menu_callback(GtkStatusIcon* self, guint p0,guint32 p1,void* data) { using namespace Gtk; typedef sigc::slot< void,guint,guint32 > SlotType; // Do not try to call a signal on a disassociated wrapper. if(Glib::ObjectBase::_get_current_wrapper((GObject*) self)) { #ifdef GLIBMM_EXCEPTIONS_ENABLED try { #endif //GLIBMM_EXCEPTIONS_ENABLED if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) (*static_cast(slot))(p0, p1); #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } #endif //GLIBMM_EXCEPTIONS_ENABLED } } static const Glib::SignalProxyInfo StatusIcon_signal_popup_menu_info = { "popup_menu", (GCallback) &StatusIcon_signal_popup_menu_callback, (GCallback) &StatusIcon_signal_popup_menu_callback }; } // anonymous namespace namespace Glib { Glib::RefPtr wrap(GtkStatusIcon* object, bool take_copy) { return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); //We use dynamic_cast<> in case of multiple inheritance. } } /* namespace Glib */ namespace Gtk { /* The *_Class implementation: */ const Glib::Class& StatusIcon_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_ = &StatusIcon_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_status_icon_get_type()); // Add derived versions of interfaces, if the C type implements any interfaces: } return *this; } void StatusIcon_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->size_changed = &size_changed_callback; #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED } #ifdef GLIBMM_VFUNCS_ENABLED #endif //GLIBMM_VFUNCS_ENABLED #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED gboolean StatusIcon_Class::size_changed_callback(GtkStatusIcon* self, gint p0) { 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. return static_cast(obj->on_size_changed(p0 )); #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->size_changed) return (*base->size_changed)(self, p0); typedef gboolean RType; return RType(); } #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED Glib::ObjectBase* StatusIcon_Class::wrap_new(GObject* object) { return new StatusIcon((GtkStatusIcon*)object); } /* The implementation: */ GtkStatusIcon* StatusIcon::gobj_copy() { reference(); return gobj(); } StatusIcon::StatusIcon(const Glib::ConstructParams& construct_params) : Glib::Object(construct_params) {} StatusIcon::StatusIcon(GtkStatusIcon* castitem) : Glib::Object((GObject*)(castitem)) {} StatusIcon::~StatusIcon() {} StatusIcon::CppClassType StatusIcon::statusicon_class_; // initialize static member GType StatusIcon::get_type() { return statusicon_class_.init().get_type(); } GType StatusIcon::get_base_type() { return gtk_status_icon_get_type(); } StatusIcon::StatusIcon() : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(0), Glib::Object(Glib::ConstructParams(statusicon_class_.init())) { } StatusIcon::StatusIcon(const Glib::RefPtr& pixbuf) : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(0), Glib::Object(Glib::ConstructParams(statusicon_class_.init(), "pixbuf", Glib::unwrap(pixbuf), static_cast(0))) { } StatusIcon::StatusIcon(const StockID& stock) : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(0), Glib::Object(Glib::ConstructParams(statusicon_class_.init(), "stock", (stock).get_c_str(), static_cast(0))) { } StatusIcon::StatusIcon(const Glib::ustring& icon_name) : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(0), Glib::Object(Glib::ConstructParams(statusicon_class_.init(), "icon_name", icon_name.c_str(), static_cast(0))) { } Glib::RefPtr StatusIcon::create(const Glib::RefPtr& pixbuf) { return Glib::RefPtr( new StatusIcon(pixbuf) ); } Glib::RefPtr StatusIcon::create(const StockID& stock_id) { return Glib::RefPtr( new StatusIcon(stock_id) ); } Glib::RefPtr StatusIcon::create(const Glib::ustring& icon_name) { return Glib::RefPtr( new StatusIcon(icon_name) ); } void StatusIcon::set(const Glib::RefPtr& pixbuf) { gtk_status_icon_set_from_pixbuf(gobj(), Glib::unwrap(pixbuf)); } void StatusIcon::set_from_file(const Glib::ustring& filename) { gtk_status_icon_set_from_file(gobj(), filename.c_str()); } void StatusIcon::set(const StockID& stock_id) { gtk_status_icon_set_from_stock(gobj(), (stock_id).get_c_str()); } void StatusIcon::set(const Glib::ustring& icon_name) { gtk_status_icon_set_from_icon_name(gobj(), icon_name.c_str()); } ImageType StatusIcon::get_storage_type() const { return ((ImageType)(gtk_status_icon_get_storage_type(const_cast(gobj())))); } Glib::RefPtr StatusIcon::get_pixbuf() { return Glib::wrap(gtk_status_icon_get_pixbuf(gobj())); } Glib::RefPtr StatusIcon::get_pixbuf() const { return const_cast(this)->get_pixbuf(); } StockID StatusIcon::get_stock() const { return StockID(gtk_status_icon_get_stock(const_cast(gobj()))); } Glib::ustring StatusIcon::get_icon_name() const { return Glib::convert_const_gchar_ptr_to_ustring(gtk_status_icon_get_icon_name(const_cast(gobj()))); } int StatusIcon::get_size() const { return gtk_status_icon_get_size(const_cast(gobj())); } void StatusIcon::set_screen(const Glib::RefPtr& screen) { gtk_status_icon_set_screen(gobj(), Glib::unwrap(screen)); } Glib::RefPtr StatusIcon::get_screen() { Glib::RefPtr retvalue = Glib::wrap(gtk_status_icon_get_screen(gobj())); if(retvalue) retvalue->reference(); //The function does not do a ref for us. return retvalue; } Glib::RefPtr StatusIcon::get_screen() const { return const_cast(this)->get_screen(); } void StatusIcon::set_tooltip(const Glib::ustring& tooltip_text) { gtk_status_icon_set_tooltip(gobj(), tooltip_text.c_str()); } void StatusIcon::set_visible(bool visible) { gtk_status_icon_set_visible(gobj(), static_cast(visible)); } bool StatusIcon::get_visible() const { return gtk_status_icon_get_visible(const_cast(gobj())); } void StatusIcon::set_blinking(bool blinking) { gtk_status_icon_set_blinking(gobj(), static_cast(blinking)); } bool StatusIcon::get_blinking() const { return gtk_status_icon_get_blinking(const_cast(gobj())); } bool StatusIcon::is_embedded() const { return gtk_status_icon_is_embedded(const_cast(gobj())); } Glib::SignalProxy1< bool,int > StatusIcon::signal_size_changed() { return Glib::SignalProxy1< bool,int >(this, &StatusIcon_signal_size_changed_info); } Glib::SignalProxy0< void > StatusIcon::signal_activate() { return Glib::SignalProxy0< void >(this, &StatusIcon_signal_activate_info); } Glib::SignalProxy2< void,guint,guint32 > StatusIcon::signal_popup_menu() { return Glib::SignalProxy2< void,guint,guint32 >(this, &StatusIcon_signal_popup_menu_info); } #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy< Glib::RefPtr > StatusIcon::property_pixbuf() { return Glib::PropertyProxy< Glib::RefPtr >(this, "pixbuf"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly< Glib::RefPtr > StatusIcon::property_pixbuf() const { return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "pixbuf"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_WriteOnly StatusIcon::property_file() { return Glib::PropertyProxy_WriteOnly(this, "file"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy StatusIcon::property_stock() { return Glib::PropertyProxy(this, "stock"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly StatusIcon::property_stock() const { return Glib::PropertyProxy_ReadOnly(this, "stock"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy StatusIcon::property_icon_name() { return Glib::PropertyProxy(this, "icon-name"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly StatusIcon::property_icon_name() const { return Glib::PropertyProxy_ReadOnly(this, "icon-name"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly StatusIcon::property_storage_type() const { return Glib::PropertyProxy_ReadOnly(this, "storage-type"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly StatusIcon::property_size() const { return Glib::PropertyProxy_ReadOnly(this, "size"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy StatusIcon::property_blinking() { return Glib::PropertyProxy(this, "blinking"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_PROPERTIES_ENABLED Glib::PropertyProxy_ReadOnly StatusIcon::property_blinking() const { return Glib::PropertyProxy_ReadOnly(this, "blinking"); } #endif //GLIBMM_PROPERTIES_ENABLED #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED bool Gtk::StatusIcon::on_size_changed(int size) { 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->size_changed) return (*base->size_changed)(gobj(),size); typedef bool RType; return RType(); } #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED #ifdef GLIBMM_VFUNCS_ENABLED #endif //GLIBMM_VFUNCS_ENABLED } // namespace Gtk