]> Pileus Git - ~andy/gtk/blob - docs/styles.txt
GtkWIdget::style_set initial emission,
[~andy/gtk] / docs / styles.txt
1 HANDLING WIDGET STYLES
2 ======================
3
4
5 A widget gets created with a default style.
6 The global default style can be affected by gtk_widget_set_default_style()
7 and can be queried by gtk_widget_get_default_style().
8 The initial style that is assigned to a widget as default style upon
9 creation can be affected by wrapping the widget's creation as follows:
10 gtk_widget_push_style (my_style);
11 widget = gtk_type_new (gtk_button_get_type ());
12 gtk_widget_pop_style ();
13
14 There are certain functions to affect widget styles after a widget's
15 creation:
16
17 gtk_widget_set_style ()
18   Save the default style and set a user style.
19   This will override a previously set user style or
20   previously set rc styles.
21
22 gtk_widget_set_rc_style ()
23   Set GTK_RC_STYLE to indicate that an rc lookup has been performed.
24   If there is an rc style for a widget, set it and save the default style,
25   restore the default style otherwise.
26   This will override a previously set user style or rc style.
27
28 gtk_widget_ensure_style ()
29   Ensure taht the widget either has a user style set, or an rc lookup
30   has been performed.
31
32 gtk_rc_get_style ()
33   Return an rc style for a widget if there is one.
34
35 gtk_widget_set_name ()
36   Change widget name, and perform a new rc lookup if no user style
37   is set.
38
39 gtk_widget_realize ()
40   Besides realizing the widget this function will:
41   - perform an rc lookup if neccessary,
42   - attach a widget's style.
43
44 gtk_widget_get_style ()
45   Return a widgets style, this function will perform an rc lookup
46   if neccessary.
47
48 gtk_widget_set_parent ()
49   This function will perform rc lookups recursively for all widgets
50   that do not have a user style set.
51
52 gtk_style_copy ()
53   This function can be used to copy a widgets style.
54   The style can subsequntly be changed (e.g., by modifications to the
55   red/green/blue values of a certain color) and then be applied to the
56   widget via gtk_widget_set_style().
57
58
59 GtkWidget::style_set
60   This signal will be emitted for a widget once its style changes with
61   an additional argument previous_style wich will hold the widget->style
62   avlue from a previous emission.
63   The initial emission of this signal is guaranteed to happen prior
64   to any GtkWidget::size_request emission, and will have the previous_style
65   argument set to NULL.
66   The GtkWidgetClass implements a default handler for this signal that
67   will set the widget's window's background of widgets that provide their
68   own windows according to the new style.
69   Derived widgets need to overide this default handler, if:
70   - their size requisition depends on the current style.
71     (e.g., on the style's fonts)
72   - they set the background of widget->window to something other than.
73     style->bg. (e.g., GtkListItem)
74   - the widget provides windows other than widget->window.
75   - the widget has any other stored dependencies on the style.
76                    
77
78
79 Flag indications:
80
81 !GTK_RC_STYLE && !GTK_USER_STYLE:
82   The widget has it's default style set, no rc lookup has been
83   performed, the widget has not been size requested yet and is
84   therefore not yet realized.
85
86 GTK_USER_STYLE:
87   GTK_RC_STYLE is not set.
88   The widget has a user style assigned, and it's default style has been
89   saved.
90
91 GTK_RC_STYLE:
92   GTK_USER_STYLE is not set.
93   If the widget has a saved default style, it has been assigned an
94   rc style. If the widget does not have a saved default style, it still
95   has its default style but an rc lookup has already been performed.
96
97
98         - Tim Janik <timj@gimp.org>
99           1998/02/27