mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
Document <classname> in paths.
2006-03-23 Matthias Clasen <mclasen@redhat.com> * gtk/tmpl/gtkrc.sgml: Document <classname> in paths.
This commit is contained in:
parent
ac879843d0
commit
997470889e
@ -1,3 +1,7 @@
|
|||||||
|
2006-03-23 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/tmpl/gtkrc.sgml: Document <classname> in paths.
|
||||||
|
|
||||||
2006-03-22 Matthias Clasen <mclasen@redhat.com>
|
2006-03-22 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gtk/gtk-sections.txt: Additions.
|
* gtk/gtk-sections.txt: Additions.
|
||||||
|
@ -56,48 +56,50 @@ of such a statement:
|
|||||||
widget "mywindow.*.GtkEntry" style "my-entry-class"
|
widget "mywindow.*.GtkEntry" style "my-entry-class"
|
||||||
</programlisting></informalexample>
|
</programlisting></informalexample>
|
||||||
|
|
||||||
attaches the style <literal>"my-entry-class"</literal>
|
attaches the style <literal>"my-entry-class"</literal> to all
|
||||||
to all widgets whose <firstterm>widget path</firstterm>
|
widgets whose <firstterm>widget path</firstterm> matches the
|
||||||
matches the <firstterm>pattern</firstterm>
|
<firstterm>pattern</firstterm> <literal>"mywindow.*.GtkEntry"</literal>.
|
||||||
<literal>"mywindow.*.GtkEntry"</literal>. That is, all
|
That is, all #GtkEntry widgets which are part of a #GtkWindow named
|
||||||
#GtkEntry widgets which are part of a #GtkWindow named <literal>"mywindow"</literal>.
|
<literal>"mywindow"</literal>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The patterns here are given in the standard shell glob
|
The patterns here are given in the standard shell glob syntax.
|
||||||
syntax. The <literal>"?"</literal> wildcard matches
|
The <literal>"?"</literal> wildcard matches any character, while
|
||||||
any character, while <literal>"*"</literal> matches
|
<literal>"*"</literal> matches zero or more of any character.
|
||||||
zero or more of any character. The three types of
|
The three types of matching are against the widget path, the
|
||||||
matching are against the widget path, the
|
<firstterm>class path</firstterm> and the class hierarchy. Both the
|
||||||
<firstterm>class path</firstterm> and the class
|
widget path and the class path consist of a <literal>"."</literal>
|
||||||
hierarchy. Both the widget path and the class path consist of a
|
separated list of all the parents of the widget and the widget itself
|
||||||
<literal>"."</literal> separated list of all the
|
from outermost to innermost. The difference is that in the widget path,
|
||||||
parents of the widget and the widget itself from
|
the name assigned by gtk_widget_set_name() is used if present, otherwise
|
||||||
outermost to innermost. The difference is that in
|
the class name of the widget, while for the class path, the class name is
|
||||||
the widget path, the name assigned by
|
always used.
|
||||||
gtk_widget_set_name() is used
|
|
||||||
if present, otherwise the class name of the widget, while
|
|
||||||
for the class path, the class name is always used.
|
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
So, if you have a #GtkEntry named
|
Since GTK+ 2.10,<literal>widget_class</literal> paths can also contain
|
||||||
<literal>"myentry"</literal>, inside of a horizontal box in a window
|
<literal><:classname></literal> substrings, which are matching
|
||||||
named <literal>"mywindow"</literal>, then the
|
the class with the given name and any derived classes. For instance,
|
||||||
|
<informalexample><programlisting>
|
||||||
|
widget_class "*<GtkMenuItem>.GtkLabel" style "my-style"
|
||||||
|
</programlisting></informalexample>
|
||||||
|
will match #GtkLabel widgets which are contained in any kind of menu item.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
So, if you have a #GtkEntry named <literal>"myentry"</literal>, inside of a
|
||||||
|
horizontal box in a window named <literal>"mywindow"</literal>, then the
|
||||||
widget path is: <literal>"mywindow.GtkHBox.myentry"</literal>
|
widget path is: <literal>"mywindow.GtkHBox.myentry"</literal>
|
||||||
while the class path is: <literal>"GtkWindow.GtkHBox.GtkEntry"</literal>.
|
while the class path is: <literal>"GtkWindow.GtkHBox.GtkEntry"</literal>.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Matching against class is a little different. The pattern
|
Matching against class is a little different. The pattern match is done
|
||||||
match is done against all class names in the widgets
|
against all class names in the widgets class hierarchy (not the layout
|
||||||
class hierarchy (not the layout hierarchy) in sequence, so the
|
hierarchy) in sequence, so the pattern:
|
||||||
pattern:
|
|
||||||
<informalexample><programlisting>
|
<informalexample><programlisting>
|
||||||
class "GtkButton" style "my-style"
|
class "GtkButton" style "my-style"
|
||||||
</programlisting></informalexample>
|
</programlisting></informalexample>
|
||||||
will match not just #GtkButton widgets,
|
will match not just #GtkButton widgets, but also #GtkToggleButton and
|
||||||
but also #GtkToggleButton and
|
#GtkCheckButton widgets, since those classes derive from #GtkButton.
|
||||||
#GtkCheckButton widgets, since
|
|
||||||
those classes derive from #GtkButton.
|
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Additionally, a priority can be specified for each pattern, and styles
|
Additionally, a priority can be specified for each pattern, and styles
|
||||||
@ -133,10 +135,11 @@ in so far is composed.
|
|||||||
For this, every RC style is matched against the widgets class path,
|
For this, every RC style is matched against the widgets class path,
|
||||||
the widgets name path and widgets inheritance hierarchy.
|
the widgets name path and widgets inheritance hierarchy.
|
||||||
As a consequence, significant slowdown can be caused by utilization of many
|
As a consequence, significant slowdown can be caused by utilization of many
|
||||||
RC styles and by using RC sytle patterns that are slow or complicated to match
|
RC styles and by using RC style patterns that are slow or complicated to match
|
||||||
against a given widget.
|
against a given widget.
|
||||||
The following ordered list provides a number of advices (prioritized by effectiveness)
|
The following ordered list provides a number of advices (prioritized by
|
||||||
to reduce the performance overhead associated with RC style matches:
|
effectiveness) to reduce the performance overhead associated with RC style
|
||||||
|
matches:
|
||||||
|
|
||||||
<orderedlist>
|
<orderedlist>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user