mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-09-20 05:50:11 +00:00
693fa02b83
Fri Feb 27 15:31:55 1998 Tim Janik <timj@gimp.org> * gtk/gtktipsquery.c: we make an active server grab now, this way we can change the cursor globally and don't need to tweak event masks of other windows. * gtk/gtkframe.c (gtk_frame_style_set): recompute label size. * gtk/gtkwidget.h: * gtk/gtkwidget.c: New signal GtkWidget::style_set to be emitted when a widget's style changed. New flag GTK_RC_STYLE to indicate whether an rc lookup has been perfomed for the widget. (gtk_widget_ensure_style): New function. (gtk_widget_set_rc_style): New function. * docs/styles.txt: new file.
96 lines
3.1 KiB
Plaintext
96 lines
3.1 KiB
Plaintext
HANDLING WIDGET STYLES
|
|
======================
|
|
|
|
|
|
A widget gets created with a default style.
|
|
The global default style can be affected by gtk_widget_set_default_style()
|
|
and can be queried by gtk_widget_get_default_style().
|
|
The initial style that is assigned to a widget as default style upon
|
|
creation can be affected by wrapping the widget's creation as follows:
|
|
gtk_widget_push_style (my_style);
|
|
widget = gtk_type_new (gtk_button_get_type ());
|
|
gtk_widget_pop_style ();
|
|
|
|
There are certain functions to affect widget styles after a widget's
|
|
creation:
|
|
|
|
gtk_widget_set_style ()
|
|
Save the default style and set a user style.
|
|
This will override a previously set user style or
|
|
previously set rc styles.
|
|
|
|
gtk_widget_set_rc_style ()
|
|
Set GTK_RC_STYLE to indicate that an rc lookup has been performed.
|
|
If there is an rc style for a widget, set it and save the default style,
|
|
restore the default style otherwise.
|
|
This will override a previously set user style or rc style.
|
|
|
|
gtk_widget_ensure_style ()
|
|
Ensure taht the widget either has a user style set, or an rc lookup
|
|
has been performed.
|
|
|
|
gtk_rc_get_style ()
|
|
Return an rc style for a widget if there is one.
|
|
|
|
gtk_widget_set_name ()
|
|
Change widget name, and perform a new rc lookup if no user style
|
|
is set.
|
|
|
|
gtk_widget_realize ()
|
|
Besides realizing the widget this function will:
|
|
- perform an rc lookup if neccessary,
|
|
- attach a widget's style.
|
|
|
|
gtk_widget_get_style ()
|
|
Return a widgets style, this function will perform an rc lookup
|
|
if neccessary.
|
|
|
|
gtk_widget_set_parent ()
|
|
This function will perform rc lookups recursively for all widgets
|
|
that do not have a user style set.
|
|
|
|
gtk_style_copy ()
|
|
This function can be used to copy a widgets style.
|
|
The style can subsequntly be changed (e.g., by modifications to the
|
|
red/green/blue values of a certain color) and then be applied to the
|
|
widget via gtk_widget_set_style().
|
|
|
|
|
|
GtkWidget::style_set
|
|
This signal will be emitted for a widget once its style changes with
|
|
the previous style supplied.
|
|
the GtkWidgetClass implements a default handler for this signal that
|
|
will set the widget's window's background of widgets that provide their
|
|
own windows according to the new style.
|
|
Derived widgets need to overide this default handler, if:
|
|
- their size requisition depends on the current style.
|
|
(e.g., on the style's fonts)
|
|
- they set the background of widget->window to something other than.
|
|
style->bg. (e.g., GtkListItem)
|
|
- the widget provides windows other than widget->window.
|
|
- the widget has any other stored dependencies on the style.
|
|
|
|
|
|
|
|
Flag indications:
|
|
|
|
!GTK_RC_STYLE && !GTK_USER_STYLE:
|
|
The widget has it's default style set, and no rc lookup has been
|
|
performed.
|
|
|
|
GTK_USER_STYLE:
|
|
GTK_RC_STYLE is not set.
|
|
The widget has a user style assigned, and it's default style has been
|
|
saved.
|
|
|
|
GTK_RC_STYLE:
|
|
GTK_USER_STYLE is not set.
|
|
If the widget has a saved default style, it has been assigned an
|
|
rc style.
|
|
If the widget does not have a saved default style, it still has its
|
|
default style but an rc lookup has already been performed.
|
|
|
|
|
|
- Tim Janik <timj@gimp.org>
|
|
1998/02/27
|