stylecontext: Remove long outdated docs

The part about transition animations doesn't apply since 3.8.
This commit is contained in:
Benjamin Otte 2014-06-19 19:46:52 +02:00
parent 87e2a7d4b2
commit 8451b15d6e

View File

@ -79,103 +79,6 @@
* #GtkSettings:gtk-theme-name setting or a hierarchy change in the rendered * #GtkSettings:gtk-theme-name setting or a hierarchy change in the rendered
* widget. * widget.
* *
* # Transition Animations
*
* #GtkStyleContext has built-in support for state change transitions.
* Note that these animations respect the #GtkSettings:gtk-enable-animations
* setting.
*
* For simple widgets where state changes affect the whole widget area,
* calling gtk_style_context_notify_state_change() with a %NULL region
* is sufficient to trigger the transition animation. And GTK+ already
* does that when gtk_widget_set_state() or gtk_widget_set_state_flags()
* are called.
*
* If a widget needs to declare several animatable regions (i.e. not
* affecting the whole widget area), its #GtkWidget::draw signal handler
* needs to wrap the render operations for the different regions with
* calls to gtk_style_context_push_animatable_region() and
* gtk_style_context_pop_animatable_region(). These functions take an
* identifier for the region which must be unique within the style context.
* For simple widgets with a fixed set of animatable regions, using an
* enumeration works well:
*
* An example for Using an enumeration to identify animatable regions:
*
* |[<!-- language="C" -->
* enum {
* REGION_ENTRY,
* REGION_BUTTON_UP,
* REGION_BUTTON_DOWN
* };
*
* ...
*
* gboolean
* spin_button_draw (GtkWidget *widget,
* cairo_t *cr)
* {
* GtkStyleContext *context;
*
* context = gtk_widget_get_style_context (widget);
*
* gtk_style_context_push_animatable_region (context,
* GUINT_TO_POINTER (REGION_ENTRY));
*
* gtk_render_background (cr, 0, 0, 100, 30);
* gtk_render_frame (cr, 0, 0, 100, 30);
*
* gtk_style_context_pop_animatable_region (context);
*
* ...
* }
* ]|
*
* For complex widgets with an arbitrary number of animatable regions, it
* is up to the implementation to come up with a way to uniquely identify
* each animatable region. Using pointers to internal structs is one way
* to achieve this:
*
* An example for using struct pointers to identify animatable regions:
* |[<!-- language="C" -->
* void
* notebook_draw_tab (GtkWidget *widget,
* NotebookPage *page,
* cairo_t *cr)
* {
* gtk_style_context_push_animatable_region (context, page);
* gtk_render_extension (cr, page->x, page->y, page->width, page->height);
* gtk_style_context_pop_animatable_region (context);
* }
* ]|
*
* The widget also needs to notify the style context about a state change
* for a given animatable region so the animation is triggered.
*
* An example for triggering a state change animation on a region:
* |[<!-- language="C" -->
* gboolean
* notebook_motion_notify (GtkWidget *widget,
* GdkEventMotion *event)
* {
* GtkStyleContext *context;
* NotebookPage *page;
*
* context = gtk_widget_get_style_context (widget);
* page = find_page_under_pointer (widget, event);
* gtk_style_context_notify_state_change (context,
* gtk_widget_get_window (widget),
* page,
* GTK_STATE_PRELIGHT,
* TRUE);
* ...
* }
* ]|
*
* gtk_style_context_notify_state_change() accepts %NULL region IDs as a
* special value, in this case, the whole widget area will be updated
* by the animation.
*
* # Style Classes and Regions # {#gtkstylecontext-classes} * # Style Classes and Regions # {#gtkstylecontext-classes}
* *
* Widgets can add style classes to their context, which can be used * Widgets can add style classes to their context, which can be used