struct
{
GQuark name;
- GtkChildClassFlags flags;
+ GtkRegionFlags flags;
} region;
};
};
}
static void
-selector_path_prepend_region (SelectorPath *path,
- const gchar *name,
- GtkChildClassFlags flags)
+selector_path_prepend_region (SelectorPath *path,
+ const gchar *name,
+ GtkRegionFlags flags)
{
SelectorElement *elem;
}
else if (elem->elem_type == SELECTOR_REGION)
{
- GtkChildClassFlags flags;
+ GtkRegionFlags flags;
if (!gtk_widget_path_iter_has_qregion (path, index,
elem->region.name,
}
static GTokenType
-parse_pseudo_class (GtkCssProvider *css_provider,
- GScanner *scanner,
- SelectorPath *selector,
- GtkChildClassFlags *flags)
+parse_pseudo_class (GtkCssProvider *css_provider,
+ GScanner *scanner,
+ SelectorPath *selector,
+ GtkRegionFlags *flags)
{
ParserSymbol symbol;
switch (symbol)
{
case SYMBOL_NTH_CHILD_EVEN:
- *flags = GTK_CHILD_CLASS_EVEN;
+ *flags = GTK_REGION_EVEN;
break;
case SYMBOL_NTH_CHILD_ODD:
- *flags = GTK_CHILD_CLASS_ODD;
+ *flags = GTK_REGION_ODD;
break;
case SYMBOL_NTH_CHILD_FIRST:
- *flags = GTK_CHILD_CLASS_FIRST;
+ *flags = GTK_REGION_FIRST;
break;
case SYMBOL_NTH_CHILD_LAST:
- *flags = GTK_CHILD_CLASS_LAST;
+ *flags = GTK_REGION_LAST;
break;
default:
break;
css_provider_pop_scope (css_provider);
}
else if (symbol == SYMBOL_FIRST_CHILD)
- *flags = GTK_CHILD_CLASS_FIRST;
+ *flags = GTK_REGION_FIRST;
else if (symbol == SYMBOL_LAST_CHILD)
- *flags = GTK_CHILD_CLASS_LAST;
+ *flags = GTK_REGION_LAST;
else
{
GtkStateType state;
}
else if (g_ascii_islower (scanner->value.v_identifier[0]))
{
- GtkChildClassFlags flags = 0;
+ GtkRegionFlags flags = 0;
gchar *region_name;
region_name = g_strdup (scanner->value.v_identifier);
if (scanner->token == ':' &&
path->state == GTK_STATE_NORMAL)
{
- GtkChildClassFlags flags = 0;
+ GtkRegionFlags flags = 0;
GTokenType token;
/* Add glob selector if path is empty */
} GtkStateFlags;
typedef enum {
- GTK_CHILD_CLASS_EVEN = 1 << 0,
- GTK_CHILD_CLASS_ODD = 1 << 1,
- GTK_CHILD_CLASS_FIRST = 1 << 2,
- GTK_CHILD_CLASS_LAST = 1 << 3,
- GTK_CHILD_CLASS_DEFAULT = 1 << 4,
- GTK_CHILD_CLASS_SORTED = 1 << 5
-} GtkChildClassFlags;
+ GTK_REGION_EVEN = 1 << 0,
+ GTK_REGION_ODD = 1 << 1,
+ GTK_REGION_FIRST = 1 << 2,
+ GTK_REGION_LAST = 1 << 3,
+ GTK_REGION_DEFAULT = 1 << 4,
+ GTK_REGION_SORTED = 1 << 5
+} GtkRegionFlags;
typedef enum {
GTK_JUNCTION_NONE = 0,
GtkStateType state_type;
GtkWidget *widget;
GtkStyleContext *context;
- GtkChildClassFlags flags = 0;
+ GtkRegionFlags flags = 0;
if (!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) ||
!gtk_widget_get_mapped (page->tab_label) ||
else
state_type = GTK_STATE_ACTIVE;
- if (position % 2 == 0)
- flags |= GTK_CHILD_CLASS_ODD;
+ if ((position + 1) % 2 == 0)
+ flags |= GTK_REGION_EVEN;
else
- flags |= GTK_CHILD_CLASS_EVEN;
+ flags |= GTK_REGION_ODD;
if (position == 0)
- flags |= GTK_CHILD_CLASS_FIRST;
+ flags |= GTK_REGION_FIRST;
if (is_last)
- flags |= GTK_CHILD_CLASS_LAST;
+ flags |= GTK_REGION_LAST;
context = gtk_widget_get_style_context (widget);
- gtk_style_context_set_child_class (context, "tab", flags);
+ gtk_style_context_set_region (context, "tab", flags);
gtk_paint_extension (gtk_widget_get_style (widget), cr,
state_type, GTK_SHADOW_OUT,
allocation.height + 2 * focus_width);
}
- gtk_style_context_unset_child_class (context, "tab");
+ gtk_style_context_unset_region (context, "tab");
}
static void
else if (strcmp (detail, "expander") == 0)
gtk_style_context_set_class (context, "expander");
else if (strcmp (detail, "tooltip") == 0)
- gtk_style_context_set_child_class (context, "tooltip", 0);
+ gtk_style_context_set_class (context, "tooltip");
else if (strcmp (detail, "frame") == 0)
gtk_style_context_set_class (context, "frame");
else if (strcmp (detail, "scrolled_window") == 0)
}
else if (g_str_has_prefix (detail, "cell_"))
{
- GtkChildClassFlags row, col;
+ GtkRegionFlags row, col;
gboolean ruled = FALSE;
GStrv tokens;
guint i;
while (tokens[i])
{
if (strcmp (tokens[i], "even") == 0)
- row |= GTK_CHILD_CLASS_EVEN;
+ row |= GTK_REGION_EVEN;
else if (strcmp (tokens[i], "odd") == 0)
- row |= GTK_CHILD_CLASS_ODD;
+ row |= GTK_REGION_ODD;
else if (strcmp (tokens[i], "start") == 0)
- col |= GTK_CHILD_CLASS_FIRST;
+ col |= GTK_REGION_FIRST;
else if (strcmp (tokens[i], "end") == 0)
- col |= GTK_CHILD_CLASS_LAST;
+ col |= GTK_REGION_LAST;
else if (strcmp (tokens[i], "ruled") == 0)
ruled = TRUE;
else if (strcmp (tokens[i], "sorted") == 0)
- col |= GTK_CHILD_CLASS_SORTED;
+ col |= GTK_REGION_SORTED;
i++;
}
if (!ruled)
- row &= ~(GTK_CHILD_CLASS_EVEN | GTK_CHILD_CLASS_ODD);
+ row &= ~(GTK_REGION_EVEN | GTK_REGION_ODD);
gtk_style_context_set_class (context, "cell");
- gtk_style_context_set_child_class (context, "row", row);
- gtk_style_context_set_child_class (context, "column", col);
+ gtk_style_context_set_region (context, "row", row);
+ gtk_style_context_set_region (context, "column", col);
g_strfreev (tokens);
}
typedef struct GtkStyleContextPrivate GtkStyleContextPrivate;
typedef struct GtkStyleProviderData GtkStyleProviderData;
typedef struct GtkStyleInfo GtkStyleInfo;
-typedef struct GtkChildClass GtkChildClass;
+typedef struct GtkRegion GtkRegion;
typedef struct PropertyValue PropertyValue;
-struct GtkChildClass
+struct GtkRegion
{
GQuark class_quark;
- GtkChildClassFlags flags;
+ GtkRegionFlags flags;
};
struct GtkStyleProviderData
struct GtkStyleInfo
{
GArray *style_classes;
- GArray *child_style_classes;
+ GArray *regions;
GtkJunctionSides junction_sides;
};
info = g_slice_new0 (GtkStyleInfo);
info->style_classes = g_array_new (FALSE, FALSE, sizeof (GQuark));
- info->child_style_classes = g_array_new (FALSE, FALSE, sizeof (GtkChildClass));
+ info->regions = g_array_new (FALSE, FALSE, sizeof (GtkRegion));
return info;
}
style_info_free (GtkStyleInfo *info)
{
g_array_free (info->style_classes, TRUE);
- g_array_free (info->child_style_classes, TRUE);
+ g_array_free (info->regions, TRUE);
g_slice_free (GtkStyleInfo, info);
}
info->style_classes->data,
info->style_classes->len);
- g_array_insert_vals (copy->child_style_classes, 0,
- info->child_style_classes->data,
- info->child_style_classes->len);
+ g_array_insert_vals (copy->regions, 0,
+ info->regions->data,
+ info->regions->len);
copy->junction_sides = info->junction_sides;
gtk_widget_path_iter_clear_regions (priv->widget_path, 0);
info = priv->info_stack->data;
- for (i = 0; i < info->child_style_classes->len; i++)
+ for (i = 0; i < info->regions->len; i++)
{
- GtkChildClass *child_class;
+ GtkRegion *region;
- child_class = &g_array_index (info->child_style_classes, GtkChildClass, i);
+ region = &g_array_index (info->regions, GtkRegion, i);
gtk_widget_path_iter_add_region (priv->widget_path, 0,
- g_quark_to_string (child_class->class_quark),
- child_class->flags);
+ g_quark_to_string (region->class_quark),
+ region->flags);
}
}
}
}
static gboolean
-child_style_class_find (GArray *array,
- GQuark class_quark,
- guint *position)
+region_find (GArray *array,
+ GQuark class_quark,
+ guint *position)
{
gint min, max, mid;
gboolean found = FALSE;
do
{
- GtkChildClass *child_class;
+ GtkRegion *region;
mid = min + max / 2;
- child_class = &g_array_index (array, GtkChildClass, mid);
+ region = &g_array_index (array, GtkRegion, mid);
- if (child_class->class_quark == class_quark)
+ if (region->class_quark == class_quark)
found = TRUE;
- else if (child_class->class_quark > class_quark)
+ else if (region->class_quark > class_quark)
min = mid = mid + 1;
else
max = mid = mid - 1;
}
GList *
-gtk_style_context_list_child_classes (GtkStyleContext *context)
+gtk_style_context_list_regions (GtkStyleContext *context)
{
GtkStyleContextPrivate *priv;
GtkStyleInfo *info;
g_assert (priv->info_stack != NULL);
info = priv->info_stack->data;
- for (i = 0; i < info->child_style_classes->len; i++)
+ for (i = 0; i < info->regions->len; i++)
{
- GtkChildClass *child_class;
+ GtkRegion *region;
const gchar *class_name;
- child_class = &g_array_index (info->child_style_classes,
- GtkChildClass,
- i);
+ region = &g_array_index (info->regions, GtkRegion, i);
- class_name = g_quark_to_string (child_class->class_quark);
+ class_name = g_quark_to_string (region->class_quark);
classes = g_list_prepend (classes, (gchar *) class_name);
}
}
void
-gtk_style_context_set_child_class (GtkStyleContext *context,
- const gchar *class_name,
- GtkChildClassFlags flags)
+gtk_style_context_set_region (GtkStyleContext *context,
+ const gchar *class_name,
+ GtkRegionFlags flags)
{
GtkStyleContextPrivate *priv;
GtkStyleInfo *info;
g_assert (priv->info_stack != NULL);
info = priv->info_stack->data;
- if (!child_style_class_find (info->child_style_classes, class_quark, &position))
+ if (!region_find (info->regions, class_quark, &position))
{
- GtkChildClass child_class;
+ GtkRegion region;
- child_class.class_quark = class_quark;
- child_class.flags = flags;
+ region.class_quark = class_quark;
+ region.flags = flags;
- g_array_insert_val (info->child_style_classes, position, child_class);
+ g_array_insert_val (info->regions, position, region);
if (priv->widget_path)
{
}
void
-gtk_style_context_unset_child_class (GtkStyleContext *context,
- const gchar *class_name)
+gtk_style_context_unset_region (GtkStyleContext *context,
+ const gchar *class_name)
{
GtkStyleContextPrivate *priv;
GtkStyleInfo *info;
g_assert (priv->info_stack != NULL);
info = priv->info_stack->data;
- if (child_style_class_find (info->child_style_classes, class_quark, &position))
+ if (region_find (info->regions, class_quark, &position))
{
- g_array_remove_index (info->child_style_classes, position);
+ g_array_remove_index (info->regions, position);
if (priv->widget_path)
{
}
gboolean
-gtk_style_context_has_child_class (GtkStyleContext *context,
- const gchar *class_name,
- GtkChildClassFlags *flags_return)
+gtk_style_context_has_region (GtkStyleContext *context,
+ const gchar *class_name,
+ GtkRegionFlags *flags_return)
{
GtkStyleContextPrivate *priv;
GtkStyleInfo *info;
g_assert (priv->info_stack != NULL);
info = priv->info_stack->data;
- if (child_style_class_find (info->child_style_classes, class_quark, &position))
+ if (region_find (info->regions, class_quark, &position))
{
if (flags_return)
{
- GtkChildClass *child_class;
+ GtkRegion *region;
- child_class = &g_array_index (info->child_style_classes,
- GtkChildClass, position);
-
- *flags_return = child_class->flags;
+ region = &g_array_index (info->regions, GtkRegion, position);
+ *flags_return = region->flags;
}
return TRUE;
}
gboolean gtk_style_context_has_class (GtkStyleContext *context,
const gchar *class_name);
-GList * gtk_style_context_list_child_classes (GtkStyleContext *context);
-
-void gtk_style_context_set_child_class (GtkStyleContext *context,
- const gchar *class_name,
- GtkChildClassFlags flags);
-void gtk_style_context_unset_child_class (GtkStyleContext *context,
- const gchar *class_name);
-gboolean gtk_style_context_has_child_class (GtkStyleContext *context,
- const gchar *class_name,
- GtkChildClassFlags *flags_return);
+GList * gtk_style_context_list_regions (GtkStyleContext *context);
+
+void gtk_style_context_set_region (GtkStyleContext *context,
+ const gchar *region_name,
+ GtkRegionFlags flags);
+void gtk_style_context_unset_region (GtkStyleContext *context,
+ const gchar *region_name);
+gboolean gtk_style_context_has_region (GtkStyleContext *context,
+ const gchar *region_name,
+ GtkRegionFlags *flags_return);
void gtk_style_context_get_style_property (GtkStyleContext *context,
const gchar *property_name,
}
gboolean
-gtk_theming_engine_has_child_class (GtkThemingEngine *engine,
- const gchar *style_class,
- GtkChildClassFlags *flags)
+gtk_theming_engine_has_region (GtkThemingEngine *engine,
+ const gchar *style_class,
+ GtkRegionFlags *flags)
{
GtkThemingEnginePrivate *priv;
g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), FALSE);
priv = engine->priv;
- return gtk_style_context_has_child_class (priv->context, style_class, flags);
+ return gtk_style_context_has_region (priv->context, style_class, flags);
}
GtkTextDirection
G_CONST_RETURN GtkWidgetPath * gtk_theming_engine_get_path (GtkThemingEngine *engine);
-gboolean gtk_theming_engine_has_class (GtkThemingEngine *engine,
- const gchar *style_class);
-gboolean gtk_theming_engine_has_child_class (GtkThemingEngine *engine,
- const gchar *style_class,
- GtkChildClassFlags *flags);
+gboolean gtk_theming_engine_has_class (GtkThemingEngine *engine,
+ const gchar *style_class);
+gboolean gtk_theming_engine_has_region (GtkThemingEngine *engine,
+ const gchar *style_class,
+ GtkRegionFlags *flags);
GtkStateFlags gtk_theming_engine_get_state (GtkThemingEngine *engine);
gboolean gtk_theming_engine_is_state_set (GtkThemingEngine *engine,
quark_style_context);
if (context)
- regions = reg = gtk_style_context_list_child_classes (context);
+ regions = reg = gtk_style_context_list_regions (context);
while (reg)
{
- GtkChildClassFlags flags;
+ GtkRegionFlags flags;
const gchar *region_name;
region_name = reg->data;
reg = reg->next;
- gtk_style_context_has_child_class (context, region_name, &flags);
+ gtk_style_context_has_region (context, region_name, &flags);
gtk_widget_path_iter_add_region (path, 0, region_name, flags);
}
}
void
-gtk_widget_path_iter_add_region (GtkWidgetPath *path,
- guint pos,
- const gchar *name,
- GtkChildClassFlags flags)
+gtk_widget_path_iter_add_region (GtkWidgetPath *path,
+ guint pos,
+ const gchar *name,
+ GtkRegionFlags flags)
{
GtkPathElement *elem;
GQuark qname;
gtk_widget_path_iter_has_qregion (const GtkWidgetPath *path,
guint pos,
GQuark qname,
- GtkChildClassFlags *flags)
+ GtkRegionFlags *flags)
{
GtkPathElement *elem;
gpointer value;
gtk_widget_path_iter_has_region (const GtkWidgetPath *path,
guint pos,
const gchar *name,
- GtkChildClassFlags *flags)
+ GtkRegionFlags *flags)
{
GQuark qname;
void gtk_widget_path_iter_add_region (GtkWidgetPath *path,
guint pos,
const gchar *name,
- GtkChildClassFlags flags);
+ GtkRegionFlags flags);
void gtk_widget_path_iter_remove_region (GtkWidgetPath *path,
guint pos,
const gchar *name);
void gtk_widget_path_iter_clear_regions (GtkWidgetPath *path,
guint pos);
-GSList * gtk_widget_path_iter_list_regions (const GtkWidgetPath *path,
+GSList * gtk_widget_path_iter_list_regions (cosnt GtkWidgetPath *path,
guint pos);
gboolean gtk_widget_path_iter_has_region (const GtkWidgetPath *path,
guint pos,
const gchar *name,
- GtkChildClassFlags *flags);
+ GtkRegionFlags *flags);
gboolean gtk_widget_path_iter_has_qregion (const GtkWidgetPath *path,
guint pos,
GQuark qname,
- GtkChildClassFlags *flags);
+ GtkRegionFlags *flags);
GType gtk_widget_path_get_widget_type (const GtkWidgetPath *path);