Blame docs/styles.txt

Packit Service fb6fa5
HANDLING WIDGET STYLES
Packit Service fb6fa5
======================
Packit Service fb6fa5
Packit Service fb6fa5
Packit Service fb6fa5
A widget gets created with a default style.
Packit Service fb6fa5
The global default style can be affected by gtk_widget_set_default_style()
Packit Service fb6fa5
and can be queried by gtk_widget_get_default_style().
Packit Service fb6fa5
The initial style that is assigned to a widget as default style upon
Packit Service fb6fa5
creation can be affected by wrapping the widget's creation as follows:
Packit Service fb6fa5
gtk_widget_push_style (my_style);
Packit Service fb6fa5
widget = gtk_type_new (gtk_button_get_type ());
Packit Service fb6fa5
gtk_widget_pop_style ();
Packit Service fb6fa5
Packit Service fb6fa5
There are certain functions to affect widget styles after a widget's
Packit Service fb6fa5
creation:
Packit Service fb6fa5
Packit Service fb6fa5
gtk_widget_set_style ()
Packit Service fb6fa5
  Save the default style and set a user style.
Packit Service fb6fa5
  This will override a previously set user style or
Packit Service fb6fa5
  previously set rc styles.
Packit Service fb6fa5
Packit Service fb6fa5
gtk_widget_set_rc_style ()
Packit Service fb6fa5
  Set GTK_RC_STYLE to indicate that an rc lookup has been performed.
Packit Service fb6fa5
  If there is an rc style for a widget, set it and save the default style,
Packit Service fb6fa5
  restore the default style otherwise.
Packit Service fb6fa5
  This will override a previously set user style or rc style.
Packit Service fb6fa5
Packit Service fb6fa5
gtk_widget_reset_rc_styles ()
Packit Service fb6fa5
  Descends through a widget hierarchy and sets the rc style
Packit Service fb6fa5
  on all widgets that don't have a user style set.
Packit Service fb6fa5
Packit Service fb6fa5
gtk_widget_restore_default_style ()
Packit Service fb6fa5
  Reset the widget's style to the default style, this is only useful if
Packit Service fb6fa5
  the widgets default style had been saved by previous calls to
Packit Service fb6fa5
  gtk_widget_set_style() or gtk_widget_set_rc_style().
Packit Service fb6fa5
Packit Service fb6fa5
gtk_widget_ensure_style ()
Packit Service fb6fa5
  Ensure that the widget either has a user style set, or an rc lookup
Packit Service fb6fa5
  has been performed.
Packit Service fb6fa5
Packit Service fb6fa5
gtk_rc_get_style ()
Packit Service fb6fa5
  Return an rc style for a widget if there is one.
Packit Service fb6fa5
Packit Service fb6fa5
gtk_widget_set_name ()
Packit Service fb6fa5
  Change widget name, and perform a new rc lookup if no user style
Packit Service fb6fa5
  is set.
Packit Service fb6fa5
Packit Service fb6fa5
gtk_widget_realize ()
Packit Service fb6fa5
  Besides realizing the widget this function will:
Packit Service fb6fa5
  - perform an rc lookup if necessary,
Packit Service fb6fa5
  - attach a widget's style.
Packit Service fb6fa5
Packit Service fb6fa5
gtk_widget_get_style ()
Packit Service fb6fa5
  Return a widgets style, this function will perform an rc lookup
Packit Service fb6fa5
  if necessary.
Packit Service fb6fa5
Packit Service fb6fa5
gtk_widget_set_parent ()
Packit Service fb6fa5
  This function will perform rc lookups recursively for all widgets
Packit Service fb6fa5
  that do not have a user style set.
Packit Service fb6fa5
Packit Service fb6fa5
gtk_style_copy ()
Packit Service fb6fa5
  This function can be used to copy a widget's style.
Packit Service fb6fa5
  The style can subsequently be changed (e.g., by modifications to the
Packit Service fb6fa5
  red/green/blue values of a certain color) and then be applied to the
Packit Service fb6fa5
  widget via gtk_widget_set_style().
Packit Service fb6fa5
Packit Service fb6fa5
Packit Service fb6fa5
GtkWidget::style_set
Packit Service fb6fa5
  This signal will be emitted for a widget once its style changes with
Packit Service fb6fa5
  an additional argument previous_style which will hold the widget->style
Packit Service fb6fa5
  value from a previous emission.
Packit Service fb6fa5
  The initial emission of this signal is guaranteed to happen prior
Packit Service fb6fa5
  to any GtkWidget::size_request emission, and will have the previous_style
Packit Service fb6fa5
  argument set to NULL.
Packit Service fb6fa5
  The GtkWidgetClass implements a default handler for this signal that
Packit Service fb6fa5
  will set the widget's window's background of widgets that provide their
Packit Service fb6fa5
  own windows according to the new style.
Packit Service fb6fa5
  Derived widgets need to override this default handler, if:
Packit Service fb6fa5
  - their size requisition depends on the current style.
Packit Service fb6fa5
    (e.g., on the style's fonts)
Packit Service fb6fa5
  - they set the background of widget->window to something other than.
Packit Service fb6fa5
    style->bg. (e.g., GtkListItem)
Packit Service fb6fa5
  - the widget provides windows other than widget->window.
Packit Service fb6fa5
  - the widget has any other stored dependencies on the style.
Packit Service fb6fa5
                   
Packit Service fb6fa5
Packit Service fb6fa5
Packit Service fb6fa5
Flag indications:
Packit Service fb6fa5
Packit Service fb6fa5
!GTK_RC_STYLE && !GTK_USER_STYLE:
Packit Service fb6fa5
  The widget has its default style set, no rc lookup has been
Packit Service fb6fa5
  performed, the widget has not been size requested yet and is
Packit Service fb6fa5
  therefore not yet realized.
Packit Service fb6fa5
Packit Service fb6fa5
GTK_USER_STYLE:
Packit Service fb6fa5
  GTK_RC_STYLE is not set.
Packit Service fb6fa5
  The widget has a user style assigned, and its default style has been
Packit Service fb6fa5
  saved.
Packit Service fb6fa5
Packit Service fb6fa5
GTK_RC_STYLE:
Packit Service fb6fa5
  GTK_USER_STYLE is not set.
Packit Service fb6fa5
  If the widget has a saved default style, it has been assigned an
Packit Service fb6fa5
  rc style. If the widget does not have a saved default style, it still
Packit Service fb6fa5
  has its default style but an rc lookup has already been performed.
Packit Service fb6fa5
Packit Service fb6fa5
Packit Service fb6fa5
	- Tim Janik <timj@gimp.org>
Packit Service fb6fa5
	  1998/02/27