glade/doc/widgetclasses.sgml
Juan Pablo Ugarte 0c4e3578b1 added files glade-base-editor.[ch]
* src/Makefile.am: added files glade-base-editor.[ch]

	* src/glade-accumulators.[ch]: new accumulators
	  glade_string_accumulator() and glade_stop_emission_accumulator ()

	* src/glade-app.c, src/glade-project.c and src/glade-command.c:
	  use of GladeWidgetClass toplevel flag.

	* src/glade-gtk.c: Use of GladeBaseEditor for GtkMenuBar, GtkToolBar
	  and GtkMenu editors.

	* src/glade-marshallers.list: added OBJECT:OBJECT,UINT
	  BOOLEAN:OBJECT,UINT BOOLEAN:OBJECT,OBJECT and STRING:OBJECT

	* src/glade-property.[ch]: Added old_value parameter to GladeProject
	  "value_changed" signal.

	* src/glade-widget-class.[ch]: added toplevel flag to GladeWidgetClass

	* src/glade.h: added GLADE_XML_TAG_TOPLEVEL

	* src/glade-base-editor.[ch]: Created GladeBaseEditor class from
	  GtkMenuBarEditor code from glade-gtk.c

	* widgets/gtk+.xml.in:
	  o added launch-editor-function for GtkToolbar and GtkMenu.
	  o Set GtkTextView post-create-function to empty (we do not need a
	    placeholder in it).
	  o Set toplevel="True" in GtkWindow and GtkMenu.

	* doc/widgetclasses.sgml: added toplevel property docs

	* po/POTFILES.in: added src/glade-base-editor.c
2006-07-13 21:38:19 +00:00

152 lines
4.6 KiB
Plaintext

<refentry id="widgetclasses" revision="8 Feb 2006">
<refmeta>
<refentrytitle>Widget Class Definitions</refentrytitle>
<refmiscinfo>Glade UI</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Widget Classes</refname>
<refpurpose>
How to augment or define a #GladeWidgetClass
</refpurpose>
</refnamediv>
<refsect1>
<title>Forward</title>
<para>
#GladeWidgetClass stuctures are added to a global pool using the `glade-widget-class' tag
and then later added to the palette through the `glade-widget-group' section; class-wide
parameters can be set on non-instantiatable classes; for example, parameters for
#GtkBox are valid for #GtkHBox and #GtkVBox.
</para>
<para>
Note that there are alot of features to support alot of special-cases from
toolkits; but assuming that a widget is completely configurable via properties
and does not implement any special container relationships (which we will
explain in further detail later on) the catalog entry should really just be
a one liner like this:
<programlisting>
<![CDATA[<glade-widget-class name="GtkLabel" generic-name="label" title="Label"/>]]></programlisting>
</para>
<para>
To delve further into details; the complex layout looks like this:
<programlisting>
<![CDATA[<glade-widget-class name="GtkLabel" generic-name="label" title="Label">
... widget class support functions go here
<properties>
... property definitions go here
</properties>
<children>
... child specific parameters go here
</children>
</glade-widget-class>]]></programlisting>
</para>
</refsect1>
<refsect2>
<title>Widget Class Parameters</title>
<variablelist>
<varlistentry>
<term>name</term>
<listitem>
<para>
The 'name' property is the class name of the widget; this will essentially be
used to instantiate the actual class by deriving 'gtk_label_get_type' from 'GtkLabel'
and searching for 'gtk_label_get_type' in the support library.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>generic-name</term>
<listitem>
<para>
The 'generic-name' property is used to get the icon name for the widget palette
and is a regular icon theme icon. The generic name is also used to generate
a default name for instances of the widget in the UI editor.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>title</term>
<listitem>
<para>
The'title' property is used to display the name of the class in the palette and widget
tree and will be translated before use in the interface.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>toplevel</term>
<listitem>
<para>
The'toplevel' property is used to know whether this widget class is toplevel or not
in Glade context.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>post-create-function</term>
<listitem>
<para>
The 'post-create-function' tag is a #GladePostCreateFunc support function that
gets called whenever a widget of 'this class' (or a widget derived from 'this class'
that didn't provide its own post-create-function) is instantiated.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>launch-editor-function</term>
<listitem>
<para>
The 'launch-editor-function' tag is a #GladeEditorLaunchFunc support function used to
launch a custom editor for this class; a good example for this is the #GtkMenuBar
which needs a special editor in order to be easier to use.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>get-internal-child-function</term>
<listitem>
<para>
The 'get-internal-child-function' tag is a #GladeGetInternalFunc support function
used to retrieve an internal child of a composite object (like a button in a
filechooser or something); support for internal children must also be added to
your application via libglade.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect3>
<title>Grouping widget classes in the catalog</title>
<para>
The widgets are groups in different groups in the Glade UI. Those groups
are defined in the catalog file as follows:
<programlisting>
<![CDATA[
<glade-widget-group name="my-widgets" title="My widgets">
<glade-widget-class-ref name="MyFirstWidget"/>
<glade-widget-class-ref name="MysecondWidget"/>
...
</glade-widget-group>]]></programlisting>
The file should contain one or more widget groups.
</para>
</refsect3>
</refentry>