Re: Gtk value types



On Thursday 13 November 2008 01:24:16 Philip Kovacs wrote:

> Use the property_ paradigm, as follows:
>
> #include <gtkmm.h>
>
> class MyWidget : public Gtk::EventBox
> {
>   public:
>     MyWidget () : my_color (this, "my-color") {}
>     ~MyWidget () {}
>
>   public:
>     Glib::PropertyProxy<GdkColor> property_color ()
>     {
>       return Glib::PropertyProxy<GdkColor>(this, "my-color");
>     }
>
>   private:
>     Glib::PropertyProxy<GdkColor> my_color;
> };
>
> int main (int argc, char** argv)
> {
>   Gtk::Main main(argc, argv);
>
>   MyWidget widget;
>
>   /* get/set your color:
>   widget.property_color() = ...
>   GdkColor color = widget.property_color();
>   */
> }
>
> Phil


Great thanks. I'll use the property_paradigm.
But in your example PropertyProxy doesn't add new property to gobject. (As i 
understand)

Using Gdk::Color instead of GdkColor was the solution for me.

Larik Ishkulov.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]