Re: Properties

From: Date: Thu, 02 Mar 2006 04:34:35 +0000
Subject: Re: Properties
References: 1  Groups: php.gtk.doc 
Request: Send a blank email to php-gtk-doc+get-1879@lists.php.net to get a copy of this message
The confusion here stems partly from terminology. The 'properties' you see exposed via GtkWindow object are actually 'fields' of the GtkWindow structure. Open up gtk/gtkwindow.h file from Gtk+ source distribution and scroll down to struct _GtkWindow definition. You will see a list of structure fields that should parallel the ones our GtkWindow object has. These fields are picked up by the h2def parser which generates a definition for each one. See (define-object Window... ) in ext/gtk+/gtk-types.def. The list of fields there should be the same as the structure fields you saw in the header file. The 'properties' of GtkWindow that the Gtk+ documentation mentions have nothing to do with the actual GtkWindow structure. There may be some overlap, or they may be completely disjoint. The GtkWindow class (remember we're in Gtk+ land here, not PHP-GTK) defines these properties during class registration. For example, focus-on-map property is defined as: g_object_class_install_property (gobject_class,
                   PROP_FOCUS_ON_MAP,
                   g_param_spec_boolean ("focus_on_map",
                                                         P_("Focus on map"),
                                                         P_("TRUE if the window should receive the input focus when mapped."),
                                                         TRUE,
                                                         G_PARAM_READWRITE));
And then there are is a getter and a setter function that do the actual work of manipulating it. gtk_window_set_property() { ... switch (prop_id) { ...
    case PROP_FOCUS_ON_MAP:
      gtk_window_set_focus_on_map (window,
                   g_value_get_boolean (value));
      break;
...
     }
} And same for getter. These class properties are not exposed directly in PHP-GTK. You have to use get_property() and set_property() methods of the GObject class to manipulate them. I understand that this is somewhat confusing, but that's just the way it is. HTH, -Andrei On Feb 28, 2006, at 1:59 PM, Scott Mattocks wrote:
I noticed that the list of properties for GtkWindow in our docs is different from the list in the Gtk+-2.0 docs. Can anyone explain why? We have some things they don't and we are missing some things they have. I tried to see what reflection tells me about the class but an empty array is returned when I run the following: $r = new ReflectionClass('GtkWindow'); var_dump($r->getProperties()); Thanks, --Scott Mattocks http://www.crisscott.com --PHP-GTK Documentation Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.gtk.doc (#1879) next »