]> Pileus Git - ~andy/gtk/blob - gtk/gtkstylecontext.c
13b85974d19fa443c75420e0a3b766483cf1f843
[~andy/gtk] / gtk / gtkstylecontext.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include "config.h"
21
22 #include <gdk/gdk.h>
23 #include <stdlib.h>
24 #include <gobject/gvaluecollector.h>
25
26 #include "gtkstylecontext.h"
27 #include "gtktypebuiltins.h"
28 #include "gtkthemingengine.h"
29 #include "gtkintl.h"
30 #include "gtkwidget.h"
31 #include "gtkprivate.h"
32
33 #include "gtkalias.h"
34
35 typedef struct GtkStyleContextPrivate GtkStyleContextPrivate;
36 typedef struct GtkStyleProviderData GtkStyleProviderData;
37 typedef struct GtkStyleInfo GtkStyleInfo;
38 typedef struct GtkChildClass GtkChildClass;
39 typedef struct PropertyValue PropertyValue;
40
41 struct GtkChildClass
42 {
43   GQuark class_quark;
44   GtkChildClassFlags flags;
45 };
46
47 struct GtkStyleProviderData
48 {
49   GtkStyleProvider *provider;
50   guint priority;
51 };
52
53 struct PropertyValue
54 {
55   GType       widget_type;
56   GParamSpec *pspec;
57   GValue      value;
58 };
59
60 struct GtkStyleInfo
61 {
62   GArray *style_classes;
63   GArray *child_style_classes;
64   GtkJunctionSides junction_sides;
65 };
66
67 struct GtkStyleContextPrivate
68 {
69   GdkScreen *screen;
70
71   GList *providers;
72   GList *providers_last;
73
74   GSList *icon_factories;
75
76   GtkStyleSet *store;
77   GtkWidgetPath *widget_path;
78
79   GArray *property_cache;
80
81   GtkStateFlags state_flags;
82   GSList *info_stack;
83
84   GtkThemingEngine *theming_engine;
85
86   GtkTextDirection direction;
87 };
88
89 enum {
90   PROP_0,
91   PROP_SCREEN,
92   PROP_DIRECTION
93 };
94
95 static void gtk_style_context_finalize (GObject *object);
96
97 static void gtk_style_context_impl_set_property (GObject      *object,
98                                                  guint         prop_id,
99                                                  const GValue *value,
100                                                  GParamSpec   *pspec);
101 static void gtk_style_context_impl_get_property (GObject      *object,
102                                                  guint         prop_id,
103                                                  GValue       *value,
104                                                  GParamSpec   *pspec);
105
106
107 G_DEFINE_TYPE (GtkStyleContext, gtk_style_context, G_TYPE_OBJECT)
108
109 static void
110 gtk_style_context_class_init (GtkStyleContextClass *klass)
111 {
112   GObjectClass *object_class = G_OBJECT_CLASS (klass);
113
114   object_class->finalize = gtk_style_context_finalize;
115   object_class->set_property = gtk_style_context_impl_set_property;
116   object_class->get_property = gtk_style_context_impl_get_property;
117
118   g_object_class_install_property (object_class,
119                                    PROP_SCREEN,
120                                    g_param_spec_object ("screen",
121                                                         P_("Screen"),
122                                                         P_("The associated GdkScreen"),
123                                                         GDK_TYPE_SCREEN,
124                                                         GTK_PARAM_READWRITE));
125   g_object_class_install_property (object_class,
126                                    PROP_DIRECTION,
127                                    g_param_spec_enum ("direction",
128                                                       P_("Direction"),
129                                                       P_("Text direction"),
130                                                       GTK_TYPE_TEXT_DIRECTION,
131                                                       GTK_TEXT_DIR_LTR,
132                                                       GTK_PARAM_READWRITE));
133
134   g_type_class_add_private (object_class, sizeof (GtkStyleContextPrivate));
135 }
136
137 static GtkStyleInfo *
138 style_info_new (void)
139 {
140   GtkStyleInfo *info;
141
142   info = g_slice_new0 (GtkStyleInfo);
143   info->style_classes = g_array_new (FALSE, FALSE, sizeof (GQuark));
144   info->child_style_classes = g_array_new (FALSE, FALSE, sizeof (GtkChildClass));
145
146   return info;
147 }
148
149 static void
150 style_info_free (GtkStyleInfo *info)
151 {
152   g_array_free (info->style_classes, TRUE);
153   g_array_free (info->child_style_classes, TRUE);
154   g_slice_free (GtkStyleInfo, info);
155 }
156
157 static GtkStyleInfo *
158 style_info_copy (const GtkStyleInfo *info)
159 {
160   GtkStyleInfo *copy;
161
162   copy = style_info_new ();
163   g_array_insert_vals (copy->style_classes, 0,
164                        info->style_classes->data,
165                        info->style_classes->len);
166
167   g_array_insert_vals (copy->child_style_classes, 0,
168                        info->child_style_classes->data,
169                        info->child_style_classes->len);
170
171   copy->junction_sides = info->junction_sides;
172
173   return copy;
174 }
175
176 static void
177 gtk_style_context_init (GtkStyleContext *style_context)
178 {
179   GtkStyleContextPrivate *priv;
180   GtkStyleInfo *info;
181
182   priv = style_context->priv = G_TYPE_INSTANCE_GET_PRIVATE (style_context,
183                                                             GTK_TYPE_STYLE_CONTEXT,
184                                                             GtkStyleContextPrivate);
185
186   priv->store = gtk_style_set_new ();
187   priv->theming_engine = (GtkThemingEngine *) gtk_theming_engine_load (NULL);
188
189   priv->direction = GTK_TEXT_DIR_RTL;
190
191   /* Create default info store */
192   info = style_info_new ();
193   priv->info_stack = g_slist_prepend (priv->info_stack, info);
194 }
195
196 static GtkStyleProviderData *
197 style_provider_data_new (GtkStyleProvider *provider,
198                          guint             priority)
199 {
200   GtkStyleProviderData *data;
201
202   data = g_slice_new (GtkStyleProviderData);
203   data->provider = g_object_ref (provider);
204   data->priority = priority;
205
206   return data;
207 }
208
209 static void
210 style_provider_data_free (GtkStyleProviderData *data)
211 {
212   g_object_unref (data->provider);
213   g_slice_free (GtkStyleProviderData, data);
214 }
215
216 static void
217 clear_property_cache (GtkStyleContext *context)
218 {
219   GtkStyleContextPrivate *priv;
220
221   priv = context->priv;
222
223   if (priv->property_cache)
224     {
225       guint i;
226
227       for (i = 0; i < priv->property_cache->len; i++)
228         {
229           PropertyValue *node = &g_array_index (priv->property_cache, PropertyValue, i);
230
231           g_param_spec_unref (node->pspec);
232           g_value_unset (&node->value);
233         }
234
235       g_array_free (priv->property_cache, TRUE);
236       priv->property_cache = NULL;
237     }
238 }
239
240 static void
241 gtk_style_context_finalize (GObject *object)
242 {
243   GtkStyleContextPrivate *priv;
244   GtkStyleContext *style_context;
245
246   style_context = GTK_STYLE_CONTEXT (object);
247   priv = style_context->priv;
248
249   g_list_foreach (priv->providers, (GFunc) style_provider_data_free, NULL);
250   g_list_free (priv->providers);
251
252   clear_property_cache (GTK_STYLE_CONTEXT (object));
253
254   g_slist_foreach (priv->info_stack, (GFunc) style_info_free, NULL);
255   g_slist_free (priv->info_stack);
256
257   g_slist_foreach (priv->icon_factories, (GFunc) g_object_unref, NULL);
258   g_slist_free (priv->icon_factories);
259
260   G_OBJECT_CLASS (gtk_style_context_parent_class)->finalize (object);
261 }
262
263 static void
264 gtk_style_context_impl_set_property (GObject      *object,
265                                      guint         prop_id,
266                                      const GValue *value,
267                                      GParamSpec   *pspec)
268 {
269   GtkStyleContextPrivate *priv;
270   GtkStyleContext *style_context;
271
272   style_context = GTK_STYLE_CONTEXT (object);
273   priv = style_context->priv;
274
275   switch (prop_id)
276     {
277     case PROP_SCREEN:
278       gtk_style_context_set_screen (style_context,
279                                     g_value_get_object (value));
280       break;
281     case PROP_DIRECTION:
282       gtk_style_context_set_direction (style_context,
283                                        g_value_get_enum (value));
284       break;
285     default:
286       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
287       break;
288     }
289 }
290
291 static void
292 gtk_style_context_impl_get_property (GObject    *object,
293                                      guint       prop_id,
294                                      GValue     *value,
295                                      GParamSpec *pspec)
296 {
297   GtkStyleContextPrivate *priv;
298   GtkStyleContext *style_context;
299
300   style_context = GTK_STYLE_CONTEXT (object);
301   priv = style_context->priv;
302
303   switch (prop_id)
304     {
305     case PROP_SCREEN:
306       g_value_set_object (value, priv->screen);
307       break;
308     case PROP_DIRECTION:
309       g_value_set_enum (value, priv->direction);
310       break;
311     default:
312       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
313       break;
314     }
315 }
316
317 static void
318 rebuild_properties (GtkStyleContext *context)
319 {
320   GtkStyleContextPrivate *priv;
321   GList *list;
322
323   priv = context->priv;
324   list = priv->providers;
325
326   gtk_style_set_clear (priv->store);
327
328   while (list)
329     {
330       GtkStyleProviderData *data;
331       GtkStyleSet *provider_style;
332
333       data = list->data;
334       list = list->next;
335
336       provider_style = gtk_style_provider_get_style (data->provider,
337                                                      priv->widget_path);
338
339       if (provider_style)
340         {
341           gtk_style_set_merge (priv->store, provider_style, TRUE);
342           g_object_unref (provider_style);
343         }
344     }
345
346   gtk_style_set_get (priv->store, GTK_STATE_NORMAL,
347                      "engine", &priv->theming_engine,
348                      NULL);
349 }
350
351 static void
352 rebuild_icon_factories (GtkStyleContext *context)
353 {
354   GtkStyleContextPrivate *priv;
355   GList *providers;
356
357   priv = context->priv;
358
359   g_slist_foreach (priv->icon_factories, (GFunc) g_object_unref, NULL);
360   g_slist_free (priv->icon_factories);
361   priv->icon_factories = NULL;
362
363   for (providers = priv->providers_last; providers; providers = providers->prev)
364     {
365       GtkIconFactory *factory;
366       GtkStyleProviderData *data;
367
368       data = providers->data;
369       factory = gtk_style_provider_get_icon_factory (data->provider,
370                                                      priv->widget_path);
371
372       if (factory)
373         priv->icon_factories = g_slist_prepend (priv->icon_factories, factory);
374     }
375 }
376
377 void
378 gtk_style_context_add_provider (GtkStyleContext  *context,
379                                 GtkStyleProvider *provider,
380                                 guint             priority)
381 {
382   GtkStyleContextPrivate *priv;
383   GtkStyleProviderData *new_data;
384   gboolean added = FALSE;
385   GList *list;
386
387   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
388   g_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
389
390   priv = context->priv;
391   new_data = style_provider_data_new (provider, priority);
392   list = priv->providers;
393
394   while (list)
395     {
396       GtkStyleProviderData *data;
397
398       data = list->data;
399
400       /* Provider was already attached to the style
401        * context, remove in order to add the new data
402        */
403       if (data->provider == provider)
404         {
405           GList *link;
406
407           link = list;
408           list = list->next;
409
410           /* Remove and free link */
411           priv->providers = g_list_remove_link (priv->providers, link);
412           style_provider_data_free (link->data);
413           g_list_free_1 (link);
414
415           continue;
416         }
417
418       if (!added &&
419           data->priority > priority)
420         {
421           priv->providers = g_list_insert_before (priv->providers, list, new_data);
422           added = TRUE;
423         }
424
425       list = list->next;
426     }
427
428   if (!added)
429     priv->providers = g_list_append (priv->providers, new_data);
430
431   priv->providers_last = g_list_last (priv->providers);
432
433   if (priv->widget_path)
434     {
435       rebuild_properties (context);
436       clear_property_cache (context);
437       rebuild_icon_factories (context);
438     }
439 }
440
441 void
442 gtk_style_context_remove_provider (GtkStyleContext  *context,
443                                    GtkStyleProvider *provider)
444 {
445   GtkStyleContextPrivate *priv;
446   gboolean removed = FALSE;
447   GList *list;
448
449   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
450   g_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
451
452   priv = context->priv;
453   list = priv->providers;
454
455   while (list)
456     {
457       GtkStyleProviderData *data;
458
459       data = list->data;
460
461       if (data->provider == provider)
462         {
463           priv->providers = g_list_remove_link (priv->providers, list);
464           style_provider_data_free (list->data);
465           g_list_free_1 (list);
466
467           removed = TRUE;
468
469           break;
470         }
471
472       list = list->next;
473     }
474
475   if (removed)
476     {
477       priv->providers_last = g_list_last (priv->providers);
478
479       if (priv->widget_path)
480         {
481           rebuild_properties (context);
482           clear_property_cache (context);
483           rebuild_icon_factories (context);
484         }
485     }
486 }
487
488 void
489 gtk_style_context_get_property (GtkStyleContext *context,
490                                 const gchar     *property,
491                                 GtkStateType     state,
492                                 GValue          *value)
493 {
494   GtkStyleContextPrivate *priv;
495
496   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
497   g_return_if_fail (property != NULL);
498   g_return_if_fail (state < GTK_STATE_LAST);
499   g_return_if_fail (value != NULL);
500
501   priv = context->priv;
502   gtk_style_set_get_property (priv->store, property, state, value);
503 }
504
505 void
506 gtk_style_context_get_valist (GtkStyleContext *context,
507                               GtkStateType     state,
508                               va_list          args)
509 {
510   GtkStyleContextPrivate *priv;
511
512   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
513   g_return_if_fail (state < GTK_STATE_LAST);
514
515   priv = context->priv;
516   gtk_style_set_get_valist (priv->store, state, args);
517 }
518
519 void
520 gtk_style_context_get (GtkStyleContext *context,
521                        GtkStateType     state,
522                        ...)
523 {
524   GtkStyleContextPrivate *priv;
525   va_list args;
526
527   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
528   g_return_if_fail (state < GTK_STATE_LAST);
529
530   priv = context->priv;
531
532   va_start (args, state);
533   gtk_style_set_get_valist (priv->store, state, args);
534   va_end (args);
535 }
536
537 void
538 gtk_style_context_set_state (GtkStyleContext *context,
539                              GtkStateFlags    flags)
540 {
541   GtkStyleContextPrivate *priv;
542
543   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
544
545   priv = context->priv;
546   priv->state_flags = flags;
547 }
548
549 GtkStateFlags
550 gtk_style_context_get_state (GtkStyleContext *context)
551 {
552   GtkStyleContextPrivate *priv;
553
554   g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), 0);
555
556   priv = context->priv;
557   return priv->state_flags;
558 }
559
560 gboolean
561 gtk_style_context_is_state_set (GtkStyleContext *context,
562                                 GtkStateType     state)
563 {
564   GtkStyleContextPrivate *priv;
565
566   g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), FALSE);
567
568   priv = context->priv;
569
570   switch (state)
571     {
572     case GTK_STATE_NORMAL:
573       return priv->state_flags == 0;
574     case GTK_STATE_ACTIVE:
575       return priv->state_flags & GTK_STATE_FLAG_ACTIVE;
576     case GTK_STATE_PRELIGHT:
577       return priv->state_flags & GTK_STATE_FLAG_PRELIGHT;
578     case GTK_STATE_SELECTED:
579       return priv->state_flags & GTK_STATE_FLAG_SELECTED;
580     case GTK_STATE_INSENSITIVE:
581       return priv->state_flags & GTK_STATE_FLAG_INSENSITIVE;
582     case GTK_STATE_INCONSISTENT:
583       return priv->state_flags & GTK_STATE_FLAG_INCONSISTENT;
584     case GTK_STATE_FOCUSED:
585       return priv->state_flags & GTK_STATE_FLAG_FOCUSED;
586     default:
587       return FALSE;
588     }
589 }
590
591 void
592 gtk_style_context_set_path (GtkStyleContext *context,
593                             GtkWidgetPath   *path)
594 {
595   GtkStyleContextPrivate *priv;
596
597   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
598   g_return_if_fail (path != NULL);
599
600   priv = context->priv;
601
602   if (priv->widget_path)
603     {
604       gtk_widget_path_free (priv->widget_path);
605       priv->widget_path = NULL;
606     }
607
608   if (path)
609     {
610       priv->widget_path = gtk_widget_path_copy (path);
611       rebuild_properties (context);
612       clear_property_cache (context);
613       rebuild_icon_factories (context);
614     }
615 }
616
617 G_CONST_RETURN GtkWidgetPath *
618 gtk_style_context_get_path (GtkStyleContext *context)
619 {
620   GtkStyleContextPrivate *priv;
621
622   priv = context->priv;
623   return priv->widget_path;
624 }
625
626 void
627 gtk_style_context_save (GtkStyleContext *context)
628 {
629   GtkStyleContextPrivate *priv;
630   GtkStyleInfo *info;
631
632   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
633
634   priv = context->priv;
635
636   g_assert (priv->info_stack != NULL);
637
638   info = style_info_copy (priv->info_stack->data);
639   priv->info_stack = g_slist_prepend (priv->info_stack, info);
640 }
641
642 void
643 gtk_style_context_restore (GtkStyleContext *context)
644 {
645   GtkStyleContextPrivate *priv;
646   GtkStyleInfo *info;
647
648   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
649
650   priv = context->priv;
651
652   if (priv->info_stack)
653     {
654       info = priv->info_stack->data;
655       priv->info_stack = g_slist_remove (priv->info_stack, info);
656       style_info_free (info);
657     }
658
659   if (!priv->info_stack)
660     {
661       g_warning ("Unpaired gtk_style_context_restore() call");
662
663       /* Create default region */
664       info = style_info_new ();
665       priv->info_stack = g_slist_prepend (priv->info_stack, info);
666     }
667
668   if (priv->widget_path)
669     {
670       guint i;
671
672       /* Update widget path regions */
673       gtk_widget_path_iter_clear_regions (priv->widget_path, 0);
674       info = priv->info_stack->data;
675
676       for (i = 0; i < info->child_style_classes->len; i++)
677         {
678           GtkChildClass *child_class;
679
680           child_class = &g_array_index (info->child_style_classes, GtkChildClass, i);
681           gtk_widget_path_iter_add_region (priv->widget_path, 0,
682                                            g_quark_to_string (child_class->class_quark),
683                                            child_class->flags);
684         }
685     }
686 }
687
688 static gboolean
689 style_class_find (GArray *array,
690                   GQuark  class_quark,
691                   guint  *position)
692 {
693   gint min, max, mid;
694   gboolean found = FALSE;
695
696   if (position)
697     *position = 0;
698
699   if (!array || array->len == 0)
700     return FALSE;
701
702   min = 0;
703   max = array->len - 1;
704
705   do
706     {
707       GQuark item;
708
709       mid = min + max / 2;
710       item = g_array_index (array, GQuark, mid);
711
712       if (class_quark == item)
713         found = TRUE;
714       else if (class_quark > item)
715         min = mid = mid + 1;
716       else
717         max = mid = mid - 1;
718     }
719   while (!found && min <= max);
720
721   if (mid < 0)
722     mid = 0;
723
724   if (position)
725     *position = mid;
726
727   return found;
728 }
729
730 static gboolean
731 child_style_class_find (GArray *array,
732                         GQuark  class_quark,
733                         guint  *position)
734 {
735   gint min, max, mid;
736   gboolean found = FALSE;
737
738   if (position)
739     *position = 0;
740
741   if (!array || array->len == 0)
742     return FALSE;
743
744   min = 0;
745   max = array->len - 1;
746
747   do
748     {
749       GtkChildClass *child_class;
750
751       mid = min + max / 2;
752       child_class = &g_array_index (array, GtkChildClass, mid);
753
754       if (child_class->class_quark == class_quark)
755         found = TRUE;
756       else if (child_class->class_quark > class_quark)
757         min = mid = mid + 1;
758       else
759         max = mid = mid - 1;
760     }
761   while (!found && min <= max);
762
763   if (mid < 0)
764     mid = 0;
765
766   if (position)
767     *position = mid;
768
769   return found;
770 }
771
772 void
773 gtk_style_context_set_class (GtkStyleContext *context,
774                              const gchar     *class_name)
775 {
776   GtkStyleContextPrivate *priv;
777   GtkStyleInfo *info;
778   GQuark class_quark;
779   guint position;
780
781   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
782   g_return_if_fail (class_name != NULL);
783
784   priv = context->priv;
785   class_quark = g_quark_from_string (class_name);
786
787   g_assert (priv->info_stack != NULL);
788   info = priv->info_stack->data;
789
790   if (!style_class_find (info->style_classes, class_quark, &position))
791     g_array_insert_val (info->style_classes, position, class_quark);
792 }
793
794 void
795 gtk_style_context_unset_class (GtkStyleContext *context,
796                                const gchar     *class_name)
797 {
798   GtkStyleContextPrivate *priv;
799   GtkStyleInfo *info;
800   GQuark class_quark;
801   guint position;
802
803   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
804   g_return_if_fail (class_name != NULL);
805
806   class_quark = g_quark_try_string (class_name);
807
808   if (!class_quark)
809     return;
810
811   priv = context->priv;
812
813   g_assert (priv->info_stack != NULL);
814   info = priv->info_stack->data;
815
816   if (style_class_find (info->style_classes, class_quark, &position))
817     g_array_remove_index (info->style_classes, position);
818 }
819
820 gboolean
821 gtk_style_context_has_class (GtkStyleContext *context,
822                              const gchar     *class_name)
823 {
824   GtkStyleContextPrivate *priv;
825   GtkStyleInfo *info;
826   GQuark class_quark;
827
828   g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), FALSE);
829   g_return_val_if_fail (class_name != NULL, FALSE);
830
831   class_quark = g_quark_try_string (class_name);
832
833   if (!class_quark)
834     return FALSE;
835
836   priv = context->priv;
837
838   g_assert (priv->info_stack != NULL);
839   info = priv->info_stack->data;
840
841   if (style_class_find (info->style_classes, class_quark, NULL))
842     return TRUE;
843
844   return FALSE;
845 }
846
847 GList *
848 gtk_style_context_list_child_classes (GtkStyleContext *context)
849 {
850   GtkStyleContextPrivate *priv;
851   GtkStyleInfo *info;
852   GList *classes = NULL;
853   guint i;
854
855   g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
856
857   priv = context->priv;
858
859   g_assert (priv->info_stack != NULL);
860   info = priv->info_stack->data;
861
862   for (i = 0; i < info->child_style_classes->len; i++)
863     {
864       GtkChildClass *child_class;
865       const gchar *class_name;
866
867       child_class = &g_array_index (info->child_style_classes,
868                                     GtkChildClass,
869                                     i);
870
871       class_name = g_quark_to_string (child_class->class_quark);
872       classes = g_list_prepend (classes, (gchar *) class_name);
873     }
874
875   return classes;
876 }
877
878 void
879 gtk_style_context_set_child_class (GtkStyleContext    *context,
880                                    const gchar        *class_name,
881                                    GtkChildClassFlags  flags)
882 {
883   GtkStyleContextPrivate *priv;
884   GtkStyleInfo *info;
885   GQuark class_quark;
886   guint position;
887
888   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
889   g_return_if_fail (class_name != NULL);
890
891   priv = context->priv;
892   class_quark = g_quark_from_string (class_name);
893
894   g_assert (priv->info_stack != NULL);
895   info = priv->info_stack->data;
896
897   if (!child_style_class_find (info->child_style_classes, class_quark, &position))
898     {
899       GtkChildClass child_class;
900
901       child_class.class_quark = class_quark;
902       child_class.flags = flags;
903
904       g_array_insert_val (info->child_style_classes, position, child_class);
905
906       if (priv->widget_path)
907         {
908           gtk_widget_path_iter_add_region (priv->widget_path, 0, class_name, flags);
909           rebuild_properties (context);
910         }
911     }
912 }
913
914 void
915 gtk_style_context_unset_child_class (GtkStyleContext    *context,
916                                      const gchar        *class_name)
917 {
918   GtkStyleContextPrivate *priv;
919   GtkStyleInfo *info;
920   GQuark class_quark;
921   guint position;
922
923   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
924   g_return_if_fail (class_name != NULL);
925
926   class_quark = g_quark_try_string (class_name);
927
928   if (!class_quark)
929     return;
930
931   priv = context->priv;
932
933   g_assert (priv->info_stack != NULL);
934   info = priv->info_stack->data;
935
936   if (child_style_class_find (info->child_style_classes, class_quark, &position))
937     {
938       g_array_remove_index (info->child_style_classes, position);
939
940       if (priv->widget_path)
941         {
942           gtk_widget_path_iter_remove_region (priv->widget_path, 0, class_name);
943           rebuild_properties (context);
944         }
945     }
946 }
947
948 gboolean
949 gtk_style_context_has_child_class (GtkStyleContext    *context,
950                                    const gchar        *class_name,
951                                    GtkChildClassFlags *flags_return)
952 {
953   GtkStyleContextPrivate *priv;
954   GtkStyleInfo *info;
955   GQuark class_quark;
956   guint position;
957
958   g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), FALSE);
959   g_return_val_if_fail (class_name != NULL, FALSE);
960
961   if (flags_return)
962     *flags_return = 0;
963
964   class_quark = g_quark_try_string (class_name);
965
966   if (!class_quark)
967     return FALSE;
968
969   priv = context->priv;
970
971   g_assert (priv->info_stack != NULL);
972   info = priv->info_stack->data;
973
974   if (child_style_class_find (info->child_style_classes, class_quark, &position))
975     {
976       if (flags_return)
977         {
978           GtkChildClass *child_class;
979
980           child_class = &g_array_index (info->child_style_classes,
981                                         GtkChildClass, position);
982
983           *flags_return = child_class->flags;
984         }
985       return TRUE;
986     }
987
988   return FALSE;
989 }
990
991 static gint
992 style_property_values_cmp (gconstpointer bsearch_node1,
993                            gconstpointer bsearch_node2)
994 {
995   const PropertyValue *val1 = bsearch_node1;
996   const PropertyValue *val2 = bsearch_node2;
997
998   if (val1->widget_type == val2->widget_type)
999     return val1->pspec < val2->pspec ? -1 : val1->pspec == val2->pspec ? 0 : 1;
1000   else
1001     return val1->widget_type < val2->widget_type ? -1 : 1;
1002 }
1003
1004 const GValue *
1005 _gtk_style_context_peek_style_property (GtkStyleContext *context,
1006                                         GType            widget_type,
1007                                         GParamSpec      *pspec)
1008 {
1009   GtkStyleContextPrivate *priv;
1010   PropertyValue *pcache, key = { 0 };
1011   GList *list;
1012   guint i;
1013
1014   priv = context->priv;
1015
1016   key.widget_type = widget_type;
1017   key.pspec = pspec;
1018
1019   /* need value cache array */
1020   if (!priv->property_cache)
1021     priv->property_cache = g_array_new (FALSE, FALSE, sizeof (PropertyValue));
1022   else
1023     {
1024       pcache = bsearch (&key,
1025                         priv->property_cache->data, priv->property_cache->len,
1026                         sizeof (PropertyValue), style_property_values_cmp);
1027       if (pcache)
1028         return &pcache->value;
1029     }
1030
1031   i = 0;
1032   while (i < priv->property_cache->len &&
1033          style_property_values_cmp (&key, &g_array_index (priv->property_cache, PropertyValue, i)) >= 0)
1034     i++;
1035
1036   g_array_insert_val (priv->property_cache, i, key);
1037   pcache = &g_array_index (priv->property_cache, PropertyValue, i);
1038
1039   /* cache miss, initialize value type, then set contents */
1040   g_param_spec_ref (pcache->pspec);
1041   g_value_init (&pcache->value, G_PARAM_SPEC_VALUE_TYPE (pspec));
1042
1043   if (priv->widget_path)
1044     {
1045       for (list = priv->providers_last; list; list = list->prev)
1046         {
1047           GtkStyleProviderData *data;
1048
1049           data = list->data;
1050
1051           if (gtk_style_provider_get_style_property (data->provider, priv->widget_path,
1052                                                      pspec->name, &pcache->value))
1053             return &pcache->value;
1054         }
1055     }
1056
1057   /* not supplied by any provider, revert to default */
1058   g_param_value_set_default (pspec, &pcache->value);
1059
1060   return &pcache->value;
1061 }
1062
1063 void
1064 gtk_style_context_get_style_property (GtkStyleContext *context,
1065                                       const gchar     *property_name,
1066                                       GValue          *value)
1067 {
1068   GtkStyleContextPrivate *priv;
1069   GtkWidgetClass *widget_class;
1070   GParamSpec *pspec;
1071   const GValue *peek_value;
1072   GType widget_type;
1073
1074   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1075   g_return_if_fail (property_name != NULL);
1076   g_return_if_fail (value != NULL);
1077
1078   priv = context->priv;
1079
1080   if (!priv->widget_path)
1081     return;
1082
1083   widget_type = gtk_widget_path_get_widget_type (priv->widget_path);
1084
1085   widget_class = g_type_class_ref (widget_type);
1086   pspec = gtk_widget_class_find_style_property (widget_class, property_name);
1087   g_type_class_unref (widget_class);
1088
1089   if (!pspec)
1090     {
1091       g_warning ("%s: widget class `%s' has no style property named `%s'",
1092                  G_STRLOC,
1093                  g_type_name (widget_type),
1094                  property_name);
1095       return;
1096     }
1097
1098   peek_value = _gtk_style_context_peek_style_property (context,
1099                                                        widget_type,
1100                                                        pspec);
1101
1102   if (G_VALUE_TYPE (value) == G_VALUE_TYPE (peek_value))
1103     g_value_copy (peek_value, value);
1104   else if (g_value_type_transformable (G_VALUE_TYPE (peek_value), G_VALUE_TYPE (value)))
1105     g_value_transform (peek_value, value);
1106   else
1107     g_warning ("can't retrieve style property `%s' of type `%s' as value of type `%s'",
1108                pspec->name,
1109                G_VALUE_TYPE_NAME (peek_value),
1110                G_VALUE_TYPE_NAME (value));
1111 }
1112
1113 void
1114 gtk_style_context_get_style_valist (GtkStyleContext *context,
1115                                     va_list          args)
1116 {
1117   GtkStyleContextPrivate *priv;
1118   const gchar *prop_name;
1119
1120   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1121
1122   prop_name = va_arg (args, const gchar *);
1123   priv = context->priv;
1124
1125   if (!priv->widget_path)
1126     return;
1127
1128   while (prop_name)
1129     {
1130       GtkWidgetClass *widget_class;
1131       GParamSpec *pspec;
1132       const GValue *peek_value;
1133       GType widget_type;
1134       gchar *error;
1135
1136       widget_type = gtk_widget_path_get_widget_type (priv->widget_path);
1137
1138       widget_class = g_type_class_ref (widget_type);
1139       pspec = gtk_widget_class_find_style_property (widget_class, prop_name);
1140       g_type_class_unref (widget_class);
1141
1142       if (!pspec)
1143         {
1144           g_warning ("%s: widget class `%s' has no style property named `%s'",
1145                      G_STRLOC,
1146                      g_type_name (widget_type),
1147                      prop_name);
1148           continue;
1149         }
1150
1151       peek_value = _gtk_style_context_peek_style_property (context,
1152                                                            widget_type,
1153                                                            pspec);
1154
1155       G_VALUE_LCOPY (peek_value, args, 0, &error);
1156
1157       if (error)
1158         {
1159           g_warning ("can't retrieve style property `%s' of type `%s': %s",
1160                      pspec->name,
1161                      G_VALUE_TYPE_NAME (peek_value),
1162                      error);
1163           g_free (error);
1164         }
1165
1166       prop_name = va_arg (args, const gchar *);
1167     }
1168 }
1169
1170 void
1171 gtk_style_context_get_style (GtkStyleContext *context,
1172                              ...)
1173 {
1174   va_list args;
1175
1176   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1177
1178   va_start (args, context);
1179   gtk_style_context_get_style_valist (context, args);
1180   va_end (args);
1181 }
1182
1183
1184 GtkIconSet *
1185 gtk_style_context_lookup_icon_set (GtkStyleContext *context,
1186                                    const gchar     *stock_id)
1187 {
1188   GtkStyleContextPrivate *priv;
1189   GSList *list;
1190
1191   g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
1192   g_return_val_if_fail (stock_id != NULL, NULL);
1193
1194   priv = context->priv;
1195
1196   for (list = priv->icon_factories; list; list = list->next)
1197     {
1198       GtkIconFactory *factory;
1199       GtkIconSet *icon_set;
1200
1201       factory = list->data;
1202       icon_set = gtk_icon_factory_lookup (factory, stock_id);
1203
1204       if (icon_set)
1205         return icon_set;
1206     }
1207
1208   return gtk_icon_factory_lookup_default (stock_id);
1209 }
1210
1211 void
1212 gtk_style_context_set_screen (GtkStyleContext *context,
1213                               GdkScreen       *screen)
1214 {
1215   GtkStyleContextPrivate *priv;
1216
1217   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1218
1219   priv = context->priv;
1220   priv->screen = screen;
1221
1222   g_object_notify (G_OBJECT (context), "screen");
1223 }
1224
1225 GdkScreen *
1226 gtk_style_context_get_screen (GtkStyleContext *context)
1227 {
1228   GtkStyleContextPrivate *priv;
1229
1230   g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
1231
1232   priv = context->priv;
1233   return priv->screen;
1234 }
1235
1236 void
1237 gtk_style_context_set_direction (GtkStyleContext  *context,
1238                                  GtkTextDirection  direction)
1239 {
1240   GtkStyleContextPrivate *priv;
1241
1242   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1243
1244   priv = context->priv;
1245   priv->direction = direction;
1246
1247   g_object_notify (G_OBJECT (context), "direction");
1248 }
1249
1250 GtkTextDirection
1251 gtk_style_context_get_direction (GtkStyleContext *context)
1252 {
1253   GtkStyleContextPrivate *priv;
1254
1255   g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), GTK_TEXT_DIR_LTR);
1256
1257   priv = context->priv;
1258   return priv->direction;
1259 }
1260
1261 void
1262 gtk_style_context_set_junction_sides (GtkStyleContext  *context,
1263                                       GtkJunctionSides  sides)
1264 {
1265   GtkStyleContextPrivate *priv;
1266   GtkStyleInfo *info;
1267
1268   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1269
1270   priv = context->priv;
1271   info = priv->info_stack->data;
1272   info->junction_sides = sides;
1273 }
1274
1275 GtkJunctionSides
1276 gtk_style_context_get_junction_sides (GtkStyleContext *context)
1277 {
1278   GtkStyleContextPrivate *priv;
1279   GtkStyleInfo *info;
1280
1281   g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), 0);
1282
1283   priv = context->priv;
1284   info = priv->info_stack->data;
1285   return info->junction_sides;
1286 }
1287
1288 gboolean
1289 gtk_style_context_lookup_color (GtkStyleContext *context,
1290                                 const gchar     *color_name,
1291                                 GdkColor        *color)
1292 {
1293   GtkStyleContextPrivate *priv;
1294   GtkSymbolicColor *sym_color;
1295
1296   g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), FALSE);
1297   g_return_val_if_fail (color_name != NULL, FALSE);
1298   g_return_val_if_fail (color != NULL, FALSE);
1299
1300   priv = context->priv;
1301   sym_color = gtk_style_set_lookup_color (priv->store, color_name);
1302
1303   if (!sym_color)
1304     return FALSE;
1305
1306   return gtk_symbolic_color_resolve (sym_color, priv->store, color);
1307 }
1308
1309 /* Paint methods */
1310 void
1311 gtk_render_check (GtkStyleContext *context,
1312                   cairo_t         *cr,
1313                   gdouble          x,
1314                   gdouble          y,
1315                   gdouble          width,
1316                   gdouble          height)
1317 {
1318   GtkStyleContextPrivate *priv;
1319   GtkThemingEngineClass *engine_class;
1320
1321   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1322   g_return_if_fail (cr != NULL);
1323
1324   priv = context->priv;
1325   engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
1326
1327   _gtk_theming_engine_set_context (priv->theming_engine, context);
1328   engine_class->render_check (priv->theming_engine, cr,
1329                               x, y, width, height);
1330 }
1331
1332 void
1333 gtk_render_option (GtkStyleContext *context,
1334                    cairo_t         *cr,
1335                    gdouble          x,
1336                    gdouble          y,
1337                    gdouble          width,
1338                    gdouble          height)
1339 {
1340   GtkStyleContextPrivate *priv;
1341   GtkThemingEngineClass *engine_class;
1342
1343   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1344   g_return_if_fail (cr != NULL);
1345
1346   priv = context->priv;
1347   engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
1348
1349   _gtk_theming_engine_set_context (priv->theming_engine, context);
1350   engine_class->render_option (priv->theming_engine, cr,
1351                                x, y, width, height);
1352 }
1353
1354 void
1355 gtk_render_arrow (GtkStyleContext *context,
1356                   cairo_t         *cr,
1357                   gdouble          angle,
1358                   gdouble          x,
1359                   gdouble          y,
1360                   gdouble          size)
1361 {
1362   GtkStyleContextPrivate *priv;
1363   GtkThemingEngineClass *engine_class;
1364
1365   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1366   g_return_if_fail (cr != NULL);
1367
1368   priv = context->priv;
1369   engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
1370
1371   _gtk_theming_engine_set_context (priv->theming_engine, context);
1372   engine_class->render_arrow (priv->theming_engine, cr,
1373                               angle, x, y, size);
1374 }
1375
1376 void
1377 gtk_render_background (GtkStyleContext *context,
1378                        cairo_t         *cr,
1379                        gdouble          x,
1380                        gdouble          y,
1381                        gdouble          width,
1382                        gdouble          height)
1383 {
1384   GtkStyleContextPrivate *priv;
1385   GtkThemingEngineClass *engine_class;
1386
1387   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1388   g_return_if_fail (cr != NULL);
1389
1390   priv = context->priv;
1391   engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
1392
1393   _gtk_theming_engine_set_context (priv->theming_engine, context);
1394   engine_class->render_background (priv->theming_engine, cr, x, y, width, height);
1395 }
1396
1397 void
1398 gtk_render_frame (GtkStyleContext *context,
1399                   cairo_t         *cr,
1400                   gdouble          x,
1401                   gdouble          y,
1402                   gdouble          width,
1403                   gdouble          height)
1404 {
1405   GtkStyleContextPrivate *priv;
1406   GtkThemingEngineClass *engine_class;
1407
1408   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1409   g_return_if_fail (cr != NULL);
1410
1411   priv = context->priv;
1412   engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
1413
1414   _gtk_theming_engine_set_context (priv->theming_engine, context);
1415   engine_class->render_frame (priv->theming_engine, cr, x, y, width, height);
1416 }
1417
1418 void
1419 gtk_render_expander (GtkStyleContext *context,
1420                      cairo_t         *cr,
1421                      gdouble          x,
1422                      gdouble          y,
1423                      gdouble          width,
1424                      gdouble          height)
1425 {
1426   GtkStyleContextPrivate *priv;
1427   GtkThemingEngineClass *engine_class;
1428
1429   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1430   g_return_if_fail (cr != NULL);
1431
1432   priv = context->priv;
1433   engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
1434
1435   _gtk_theming_engine_set_context (priv->theming_engine, context);
1436   engine_class->render_expander (priv->theming_engine, cr, x, y, width, height);
1437 }
1438
1439 void
1440 gtk_render_focus (GtkStyleContext *context,
1441                   cairo_t         *cr,
1442                   gdouble          x,
1443                   gdouble          y,
1444                   gdouble          width,
1445                   gdouble          height)
1446 {
1447   GtkStyleContextPrivate *priv;
1448   GtkThemingEngineClass *engine_class;
1449
1450   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1451   g_return_if_fail (cr != NULL);
1452
1453   priv = context->priv;
1454   engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
1455
1456   _gtk_theming_engine_set_context (priv->theming_engine, context);
1457   engine_class->render_focus (priv->theming_engine, cr, x, y, width, height);
1458 }
1459
1460 void
1461 gtk_render_layout (GtkStyleContext *context,
1462                    cairo_t         *cr,
1463                    gdouble          x,
1464                    gdouble          y,
1465                    PangoLayout     *layout)
1466 {
1467   GtkStyleContextPrivate *priv;
1468   GtkThemingEngineClass *engine_class;
1469
1470   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1471   g_return_if_fail (cr != NULL);
1472
1473   priv = context->priv;
1474   engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
1475
1476   _gtk_theming_engine_set_context (priv->theming_engine, context);
1477   engine_class->render_layout (priv->theming_engine, cr, x, y, layout);
1478 }
1479
1480 void
1481 gtk_render_line (GtkStyleContext *context,
1482                  cairo_t         *cr,
1483                  gdouble          x0,
1484                  gdouble          y0,
1485                  gdouble          x1,
1486                  gdouble          y1)
1487 {
1488   GtkStyleContextPrivate *priv;
1489   GtkThemingEngineClass *engine_class;
1490
1491   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1492   g_return_if_fail (cr != NULL);
1493
1494   priv = context->priv;
1495   engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
1496
1497   _gtk_theming_engine_set_context (priv->theming_engine, context);
1498   engine_class->render_line (priv->theming_engine, cr, x0, y0, x1, y1);
1499 }
1500
1501 void
1502 gtk_render_slider (GtkStyleContext *context,
1503                    cairo_t         *cr,
1504                    gdouble          x,
1505                    gdouble          y,
1506                    gdouble          width,
1507                    gdouble          height,
1508                    GtkOrientation   orientation)
1509 {
1510   GtkStyleContextPrivate *priv;
1511   GtkThemingEngineClass *engine_class;
1512
1513   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1514   g_return_if_fail (cr != NULL);
1515
1516   priv = context->priv;
1517   engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
1518
1519   _gtk_theming_engine_set_context (priv->theming_engine, context);
1520   engine_class->render_slider (priv->theming_engine, cr, x, y, width, height, orientation);
1521 }
1522
1523 void
1524 gtk_render_frame_gap (GtkStyleContext *context,
1525                       cairo_t         *cr,
1526                       gdouble          x,
1527                       gdouble          y,
1528                       gdouble          width,
1529                       gdouble          height,
1530                       GtkPositionType  gap_side,
1531                       gdouble          xy0_gap,
1532                       gdouble          xy1_gap)
1533 {
1534   GtkStyleContextPrivate *priv;
1535   GtkThemingEngineClass *engine_class;
1536
1537   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1538   g_return_if_fail (cr != NULL);
1539
1540   priv = context->priv;
1541   engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
1542
1543   _gtk_theming_engine_set_context (priv->theming_engine, context);
1544   engine_class->render_frame_gap (priv->theming_engine, cr,
1545                                   x, y, width, height, gap_side,
1546                                   xy0_gap, xy1_gap);
1547 }
1548
1549 void
1550 gtk_render_extension (GtkStyleContext *context,
1551                       cairo_t         *cr,
1552                       gdouble          x,
1553                       gdouble          y,
1554                       gdouble          width,
1555                       gdouble          height,
1556                       GtkPositionType  gap_side)
1557 {
1558   GtkStyleContextPrivate *priv;
1559   GtkThemingEngineClass *engine_class;
1560
1561   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1562   g_return_if_fail (cr != NULL);
1563
1564   priv = context->priv;
1565   engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
1566
1567   _gtk_theming_engine_set_context (priv->theming_engine, context);
1568   engine_class->render_extension (priv->theming_engine, cr, x, y, width, height, gap_side);
1569 }
1570
1571 void
1572 gtk_render_handle (GtkStyleContext *context,
1573                    cairo_t         *cr,
1574                    gdouble          x,
1575                    gdouble          y,
1576                    gdouble          width,
1577                    gdouble          height,
1578                    GtkOrientation   orientation)
1579 {
1580   GtkStyleContextPrivate *priv;
1581   GtkThemingEngineClass *engine_class;
1582
1583   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
1584   g_return_if_fail (cr != NULL);
1585
1586   priv = context->priv;
1587   engine_class = GTK_THEMING_ENGINE_GET_CLASS (priv->theming_engine);
1588
1589   _gtk_theming_engine_set_context (priv->theming_engine, context);
1590   engine_class->render_handle (priv->theming_engine, cr, x, y, width, height, orientation);
1591 }
1592
1593 #define __GTK_STYLE_CONTEXT_C__
1594 #include "gtkaliasdef.c"