Commit a3637ec6 authored by Carlos Garnacho's avatar Carlos Garnacho

s/child class/region/ everywhere.

"Child class" is an invented term anyway, and it conceptually defines
identifiable regions in widgets.
parent 198d75be
......@@ -63,7 +63,7 @@ struct SelectorElement
struct
{
GQuark name;
GtkChildClassFlags flags;
GtkRegionFlags flags;
} region;
};
};
......@@ -216,9 +216,9 @@ selector_path_prepend_glob (SelectorPath *path)
}
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;
......@@ -411,7 +411,7 @@ compare_selector_element (GtkWidgetPath *path,
}
else if (elem->elem_type == SELECTOR_REGION)
{
GtkChildClassFlags flags;
GtkRegionFlags flags;
if (!gtk_widget_path_iter_has_qregion (path, index,
elem->region.name,
......@@ -856,10 +856,10 @@ css_provider_commit (GtkCssProvider *css_provider)
}
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;
......@@ -889,16 +889,16 @@ parse_pseudo_class (GtkCssProvider *css_provider,
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;
......@@ -912,9 +912,9 @@ parse_pseudo_class (GtkCssProvider *css_provider,
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;
......@@ -984,7 +984,7 @@ parse_selector (GtkCssProvider *css_provider,
}
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);
......@@ -1027,7 +1027,7 @@ parse_selector (GtkCssProvider *css_provider,
if (scanner->token == ':' &&
path->state == GTK_STATE_NORMAL)
{
GtkChildClassFlags flags = 0;
GtkRegionFlags flags = 0;
GTokenType token;
/* Add glob selector if path is empty */
......
......@@ -571,13 +571,13 @@ typedef enum
} 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,
......
......@@ -5041,7 +5041,7 @@ gtk_notebook_draw_tab (GtkNotebook *notebook,
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) ||
......@@ -5056,19 +5056,19 @@ gtk_notebook_draw_tab (GtkNotebook *notebook,
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,
......@@ -5096,7 +5096,7 @@ gtk_notebook_draw_tab (GtkNotebook *notebook,
allocation.height + 2 * focus_width);
}
gtk_style_context_unset_child_class (context, "tab");
gtk_style_context_unset_region (context, "tab");
}
static void
......
......@@ -1763,7 +1763,7 @@ transform_detail_string (const gchar *detail,
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)
......@@ -1792,7 +1792,7 @@ transform_detail_string (const gchar *detail,
}
else if (g_str_has_prefix (detail, "cell_"))
{
GtkChildClassFlags row, col;
GtkRegionFlags row, col;
gboolean ruled = FALSE;
GStrv tokens;
guint i;
......@@ -1804,27 +1804,27 @@ transform_detail_string (const gchar *detail,
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);
}
......
......@@ -35,13 +35,13 @@
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
......@@ -60,7 +60,7 @@ struct PropertyValue
struct GtkStyleInfo
{
GArray *style_classes;
GArray *child_style_classes;
GArray *regions;
GtkJunctionSides junction_sides;
};
......@@ -141,7 +141,7 @@ style_info_new (void)
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;
}
......@@ -150,7 +150,7 @@ static void
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);
}
......@@ -164,9 +164,9 @@ style_info_copy (const 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;
......@@ -673,14 +673,14 @@ gtk_style_context_restore (GtkStyleContext *context)
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);
}
}
}
......@@ -728,9 +728,9 @@ style_class_find (GArray *array,
}
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;
......@@ -746,14 +746,14 @@ child_style_class_find (GArray *array,
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;
......@@ -845,7 +845,7 @@ gtk_style_context_has_class (GtkStyleContext *context,
}
GList *
gtk_style_context_list_child_classes (GtkStyleContext *context)
gtk_style_context_list_regions (GtkStyleContext *context)
{
GtkStyleContextPrivate *priv;
GtkStyleInfo *info;
......@@ -859,16 +859,14 @@ gtk_style_context_list_child_classes (GtkStyleContext *context)
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);
}
......@@ -876,9 +874,9 @@ gtk_style_context_list_child_classes (GtkStyleContext *context)
}
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;
......@@ -894,14 +892,14 @@ gtk_style_context_set_child_class (GtkStyleContext *context,
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)
{
......@@ -912,8 +910,8 @@ gtk_style_context_set_child_class (GtkStyleContext *context,
}
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;
......@@ -933,9 +931,9 @@ gtk_style_context_unset_child_class (GtkStyleContext *context,
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)
{
......@@ -946,9 +944,9 @@ gtk_style_context_unset_child_class (GtkStyleContext *context,
}
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;
......@@ -971,16 +969,14 @@ gtk_style_context_has_child_class (GtkStyleContext *context,
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;
}
......
......@@ -88,16 +88,16 @@ void gtk_style_context_unset_class (GtkStyleContext *context,
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,
......
......@@ -351,9 +351,9 @@ gtk_theming_engine_has_class (GtkThemingEngine *engine,
}
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;
......@@ -363,7 +363,7 @@ gtk_theming_engine_has_child_class (GtkThemingEngine *engine,
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
......
......@@ -167,11 +167,11 @@ void gtk_theming_engine_get_style (GtkThemingEngine *engine,
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,
......
......@@ -13233,17 +13233,17 @@ gtk_widget_get_path (GtkWidget *widget)
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);
}
......
......@@ -223,10 +223,10 @@ gtk_widget_path_iter_has_name (const GtkWidgetPath *path,
}
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;
......@@ -318,7 +318,7 @@ gboolean
gtk_widget_path_iter_has_qregion (const GtkWidgetPath *path,
guint pos,
GQuark qname,
GtkChildClassFlags *flags)
GtkRegionFlags *flags)
{
GtkPathElement *elem;
gpointer value;
......@@ -347,7 +347,7 @@ gboolean
gtk_widget_path_iter_has_region (const GtkWidgetPath *path,
guint pos,
const gchar *name,
GtkChildClassFlags *flags)
GtkRegionFlags *flags)
{
GQuark qname;
......
......@@ -59,24 +59,24 @@ gboolean gtk_widget_path_iter_has_qname (const GtkWidgetPath *path
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment