![]() |
![]() |
![]() |
Glade UI Builder Reference Manual | ![]() |
---|
Property Class DefinitionsProperty Classes — How to augment or define a GladePropertyClass |
There are alot of things that can be done with properties in glade; properties can be added and removed from widget classes, lets list all the different things you can do with properties.
Properties of the 'property' tag:
name |
The name to be used in the interface, this string is translated. (if name is not specified; it defaults to the nickname of the GParamSpec) |
id |
This is manditory and specifies the property that we are modifying (or adding) |
disabled |
Remove this property from this widget class and derived classes |
default |
A default value to be used for this property |
translatable |
For text properties, whether the property value is translatable in glade interfaces (this will enable the i18n dialog on text properties). Defaults to False. |
common |
If set to "True", the property will end up on the common tab even if its not a property of GtkWidgetClass. |
optional |
Whether this property is an optional property, this will make the property insensitive and add a check box to enable it (like width/height-request for example). |
optional-default |
If this is in fact an optional property; whether it is enabled by default. |
query |
If query is set; the property will be queried from the user in a dialog when adding the owning widget class instance to the project. |
save |
Whether to save this property to the glade file (default "True") |
visible |
Whether to show the property in the editor (default "True") |
ignore |
Whether to set the property on the object instance (via g_object_set_property or plugin override functions) when it changes in the editor (the value in the editor is the value saved). |
resource |
This is for string properties that represent filenames that are packaged with the glade file (like pixbufs); you can set this to "True" and the string property will be treated like a resource. |
Child tags of the 'property' tag:
spec |
Specifies a function to be used to return a GParamSpec for this property; this is used to add virtual properties to an object (like the "size" property on GtkBox). |
tooltip |
The tooltip to be displayed in the property editor for this property, this is also translated. The tooltip defaults to the blurb of the associated GParamSpec. |
visible-lines |
An integer value to specify how many lines will be shown for text properties in the editor (this doesnt really work because of the complexity of calculating size of rendered text; instead, just set this to 2 if you want the text property to be edited in a textview with a scrolled window as opposed to a simple text entry). |
set-function |
A GladeSetPropertyFunc used to set the property instead of |
get-function |
A GladeSetPropertyFunc function used to set the property instead of Technical note: that the get-function is hardly ever used, the only time glade-3 will actually ask the object what a property's value should be; is when adding a widget to a container and introspecting the values that the container assigned the child as packing properties. |
verify-function |
A GladeVerifyPropertyFunc function to verify whether the requested value is valid. If specified; the editor will not allow the user to commit a value that this function returns False for. Technical note: verify functions are nescisary in glade-3 because of the abstraction between the value maintained in the glade-3 core and the value that is actually on the said GObject's property. In other words, if verify-function returns false; glade's value won't change and set-function won't be called, if set-function decides not commit the said value, thats its own rotten business (hehe) and if the property is set to ignore="True", verify functions will still function properly even if set-functions are not called for that property. |
Enum and Flag type properties tend to have long complicated names unsuited for the glade environment, glade will allow you to substitute these names using the displayable-values child tag; the form looks like this:
<property id="pack-type"> <displayable-values> <value id="GTK_PACK_START" name="Start"></value> <value id="GTK_PACK_END" name="End"></value> </displayable-values> </property>
Note that the "name" (which will be the resulting name for each `id') is a translated string.
A widget class may have default packing properties for each type of container that it can be added to; a short example should suffice as a description of how this works:
<packing-defaults> <parent-class name="GtkVBox"> <child-property id="expand" default="false"/> </parent-class> </packing-defaults>
Note that you can list any number of 'packing-defaults' in a row.
Properties can have additional parameters; these are completely unused by glade but may be usefull for a plugin writer who may want to use the GladeParameter api to find parameters on property classes; the form looks like this:
<property id="foo"> <parameters> <parameter key="Min" value="1"/> <parameter key="Max" value="10000"/> </parameters> </property>