diff options
author | Murray Cumming <murrayc@usa.net> | 2003-11-01 17:01:02 +0000 |
---|---|---|
committer | Murray Cumming <murrayc@src.gnome.org> | 2003-11-01 17:01:02 +0000 |
commit | a86081587ca4aa8e090cffcc10dfe62412ed46b9 (patch) | |
tree | 73a8740f5d5c8d47e441f03b002b68801af7cb76 /glib/glibmm | |
parent | fe56b08cc8158d4022c51265803fa32f22d6c4d0 (diff) | |
download | glibmm-a86081587ca4aa8e090cffcc10dfe62412ed46b9.tar.gz |
Now uses ObjectBase instead of Object, because glib can now have
2003-11-01 Murray Cumming <murrayc@usa.net>
* glib/glibmm/propertyproxy.h, propertyproxy_base.[h|cc]: Now uses
ObjectBase instead of Object, because glib can now have properties
on interfaces. This is needed, for instance, by the GtkFileChooser
interface wrapper in gtkmm.
* glib/glibmm/object.h: Moved get/set_property() methods into
ObjectBase, for the same reason.
* tools/pm/WrapParser.pm, Output.pm: Added optional no_default_handler
parameter to gmmproc _WRAP_SIGNAL() macro, for signals whose
default signal handler is not in the klass struct and therefore
can not be overridden.
Diffstat (limited to 'glib/glibmm')
-rw-r--r-- | glib/glibmm/object.cc | 10 | ||||
-rw-r--r-- | glib/glibmm/object.h | 42 | ||||
-rw-r--r-- | glib/glibmm/objectbase.cc | 10 | ||||
-rw-r--r-- | glib/glibmm/objectbase.h | 44 | ||||
-rw-r--r-- | glib/glibmm/propertyproxy.h | 6 | ||||
-rw-r--r-- | glib/glibmm/propertyproxy_base.cc | 2 | ||||
-rw-r--r-- | glib/glibmm/propertyproxy_base.h | 10 |
7 files changed, 63 insertions, 61 deletions
diff --git a/glib/glibmm/object.cc b/glib/glibmm/object.cc index 4e94b428..518ffaad 100644 --- a/glib/glibmm/object.cc +++ b/glib/glibmm/object.cc @@ -273,15 +273,5 @@ void* Object::steal_data(const QueryQuark& id) return g_object_steal_qdata(gobj(), id); } -void Object::set_property_value(const Glib::ustring& property_name, const Glib::ValueBase& value) -{ - g_object_set_property(gobj(), property_name.c_str(), value.gobj()); -} - -void Object::get_property_value(const Glib::ustring& property_name, Glib::ValueBase& value) const -{ - g_object_get_property(const_cast<GObject*>(gobj()), property_name.c_str(), value.gobj()); -} - } // namespace Glib diff --git a/glib/glibmm/object.h b/glib/glibmm/object.h index 9cd42412..a67b387e 100644 --- a/glib/glibmm/object.h +++ b/glib/glibmm/object.h @@ -23,8 +23,6 @@ #include <glibmm/objectbase.h> #include <glibmm/wrap.h> #include <glibmm/quark.h> -#include <glibmm/signalproxy.h> -#include <glibmm/propertyproxy.h> #include <glibmm/refptr.h> #include <glibmm/utility.h> /* Could be private, but that would be tedious. */ #include <glibmm/value.h> @@ -126,20 +124,6 @@ public: //T& get_data_typed(const QueryQuark& quark) // { return *static_cast<T*>(get_data(quark)); } - /// You probably want to use a specific property_*() accessor method instead. - void set_property_value(const Glib::ustring& property_name, const Glib::ValueBase& value); - - /// You probably want to use a specific property_*() accessor method instead. - void get_property_value(const Glib::ustring& property_name, Glib::ValueBase& value) const; - - /// You probably want to use a specific property_*() accessor method instead. - template <class PropertyType> - void set_property(const Glib::ustring& property_name, const PropertyType& value); - - /// You probably want to use a specific property_*() accessor method instead. - template <class PropertyType> - void get_property(const Glib::ustring& property_name, PropertyType& value) const; - #ifndef DOXYGEN_SHOULD_SKIP_THIS private: @@ -156,32 +140,6 @@ private: //virtual void set_manage(); }; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -template <class PropertyType> -void Object::set_property(const Glib::ustring& property_name, const PropertyType& value) -{ - Glib::Value<PropertyType> property_value; - property_value.init(Glib::Value<PropertyType>::value_type()); - - property_value.set(value); - this->set_property_value(property_name, property_value); -} - -template <class PropertyType> -void Object::get_property(const Glib::ustring& property_name, PropertyType& value) const -{ - Glib::Value<PropertyType> property_value; - property_value.init(Glib::Value<PropertyType>::value_type()); - - this->get_property_value(property_name, property_value); - - value = property_value.get(); -} - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - } // namespace Glib #endif /* _GLIBMM_OBJECT_H */ diff --git a/glib/glibmm/objectbase.cc b/glib/glibmm/objectbase.cc index 33e4fdbd..9c06ab1c 100644 --- a/glib/glibmm/objectbase.cc +++ b/glib/glibmm/objectbase.cc @@ -247,6 +247,16 @@ bool ObjectBase::_cpp_destruction_is_in_progress() const return cpp_destruction_in_progress_; } +void ObjectBase::set_property_value(const Glib::ustring& property_name, const Glib::ValueBase& value) +{ + g_object_set_property(gobj(), property_name.c_str(), value.gobj()); +} + +void ObjectBase::get_property_value(const Glib::ustring& property_name, Glib::ValueBase& value) const +{ + g_object_get_property(const_cast<GObject*>(gobj()), property_name.c_str(), value.gobj()); +} + bool _gobject_cppinstance_already_deleted(GObject* gobject) { diff --git a/glib/glibmm/objectbase.h b/glib/glibmm/objectbase.h index d60ad7e3..c8adeeed 100644 --- a/glib/glibmm/objectbase.h +++ b/glib/glibmm/objectbase.h @@ -21,6 +21,8 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <glibmm/signalproxy.h> +#include <glibmm/propertyproxy.h> #include <sigc++/object.h> #include <typeinfo> #include <glibmmconfig.h> @@ -79,6 +81,22 @@ protected: void initialize(GObject* castitem); public: + + /// You probably want to use a specific property_*() accessor method instead. + void set_property_value(const Glib::ustring& property_name, const Glib::ValueBase& value); + + /// You probably want to use a specific property_*() accessor method instead. + void get_property_value(const Glib::ustring& property_name, Glib::ValueBase& value) const; + + /// You probably want to use a specific property_*() accessor method instead. + template <class PropertyType> + void set_property(const Glib::ustring& property_name, const PropertyType& value); + + /// You probably want to use a specific property_*() accessor method instead. + template <class PropertyType> + void get_property(const Glib::ustring& property_name, PropertyType& value) const; + + virtual void reference() const; // overrides SigC::ObjectBase::reference() virtual void unreference() const; // overrides SigC::ObjectBase::unreference() @@ -118,6 +136,32 @@ private: #endif }; +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +template <class PropertyType> +void ObjectBase::set_property(const Glib::ustring& property_name, const PropertyType& value) +{ + Glib::Value<PropertyType> property_value; + property_value.init(Glib::Value<PropertyType>::value_type()); + + property_value.set(value); + this->set_property_value(property_name, property_value); +} + +template <class PropertyType> +void ObjectBase::get_property(const Glib::ustring& property_name, PropertyType& value) const +{ + Glib::Value<PropertyType> property_value; + property_value.init(Glib::Value<PropertyType>::value_type()); + + this->get_property_value(property_name, property_value); + + value = property_value.get(); +} + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + bool _gobject_cppinstance_already_deleted(GObject* gobject); } // namespace Glib diff --git a/glib/glibmm/propertyproxy.h b/glib/glibmm/propertyproxy.h index a0da2764..47d2f585 100644 --- a/glib/glibmm/propertyproxy.h +++ b/glib/glibmm/propertyproxy.h @@ -34,7 +34,7 @@ class PropertyProxy : public PropertyProxy_Base public: typedef T PropertyType; - PropertyProxy(Object* obj, const char* name) + PropertyProxy(ObjectBase* obj, const char* name) : PropertyProxy_Base(obj, name) {} void set_value(const PropertyType& data); @@ -57,7 +57,7 @@ class PropertyProxy_WriteOnly : public PropertyProxy_Base public: typedef T PropertyType; - PropertyProxy_WriteOnly(Object* obj, const char* name) + PropertyProxy_WriteOnly(ObjectBase* obj, const char* name) : PropertyProxy_Base(obj, name) {} void set_value(const PropertyType& data) @@ -81,7 +81,7 @@ class PropertyProxy_ReadOnly : public PropertyProxy_Base public: typedef T PropertyType; - PropertyProxy_ReadOnly(Object* obj, const char* name) + PropertyProxy_ReadOnly(ObjectBase* obj, const char* name) : PropertyProxy_Base(obj, name) {} PropertyType get_value() const diff --git a/glib/glibmm/propertyproxy_base.cc b/glib/glibmm/propertyproxy_base.cc index 177ab6e8..5583f629 100644 --- a/glib/glibmm/propertyproxy_base.cc +++ b/glib/glibmm/propertyproxy_base.cc @@ -110,7 +110,7 @@ void SignalProxyProperty::callback(GObject*, GParamSpec* pspec, gpointer data) / //PropertyProxy_Base implementation: -PropertyProxy_Base::PropertyProxy_Base(Object* obj, const char* property_name) +PropertyProxy_Base::PropertyProxy_Base(ObjectBase* obj, const char* property_name) : obj_ (obj), property_name_ (property_name) diff --git a/glib/glibmm/propertyproxy_base.h b/glib/glibmm/propertyproxy_base.h index 5eb6d159..5174b93c 100644 --- a/glib/glibmm/propertyproxy_base.h +++ b/glib/glibmm/propertyproxy_base.h @@ -29,7 +29,7 @@ namespace Glib { -class Object; +class ObjectBase; /// Use the connect() method, with SigC::slot() to connect signals to signal handlers. class SignalProxyProperty : public SignalProxyBase @@ -56,13 +56,13 @@ private: class PropertyProxy_Base { public: - PropertyProxy_Base(Object* obj, const char* property_name); + PropertyProxy_Base(ObjectBase* obj, const char* property_name); PropertyProxy_Base(const PropertyProxy_Base& other); ///This signal will be emitted when the property changes. SignalProxyProperty signal_changed(); - Object* get_object() const { return obj_; } + ObjectBase* get_object() const { return obj_; } const char* get_name() const { return property_name_; } protected: @@ -70,11 +70,11 @@ protected: void get_property_(Glib::ValueBase& value) const; void reset_property_(); - Object* obj_; //The C++ wrapper instance of which this PropertyProxy is a member. + ObjectBase* obj_; //The C++ wrapper instance of which this PropertyProxy is a member. const char* property_name_; //Should be a static string literal. private: - // not implemented (for now) -- Why "for now"? I don't think it'll ever be needed. daniel. + //not implemented (for now) -- TODO: Why "for now"? I don't think it'll ever be needed. daniel. PropertyProxy_Base& operator=(const PropertyProxy_Base&); }; |