Commit d80bf079 authored by Benjamin Otte's avatar Benjamin Otte

stylecontext: Deprecate regions

Regions are done in a very non-css way. They don't fit the DOM in that
they don't integrate into the CSS tree and they have very weird matching
behavior in selectors.

So I'm deprecating them now. GtkNotebook and GtkTreeview will continue
to use them and as long as they do, we can't remove the code for it.
But once those are ported it might be safe to remove the code as it will
clean up lots of places in the code by quite a bit.
parent 8451b15d
......@@ -2035,7 +2035,9 @@ notebook_tab_prepare_style_context (GtkNotebook *notebook,
if (use_flags && (page != NULL))
flags = _gtk_notebook_get_tab_flags (notebook, page);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_add_region (context, GTK_STYLE_REGION_TAB, flags);
G_GNUC_END_IGNORE_DEPRECATIONS
add_tab_position_style_class (context, tab_pos);
return state;
......
......@@ -79,14 +79,18 @@
* #GtkSettings:gtk-theme-name setting or a hierarchy change in the rendered
* widget.
*
* # Style Classes and Regions # {#gtkstylecontext-classes}
* # Style Classes # {#gtkstylecontext-classes}
*
* Widgets can add style classes to their context, which can be used
* to associate different styles by class
* (see [Selectors][gtkcssprovider-selectors]).
* Theme engines can also use style classes to vary their rendering.
*
* Widgets can also add regions with flags to their context.
* # Style Regions
*
* Widgets can also add regions with flags to their context. This feature is
* deprecated and will be removed in a future GTK+ update. Please use style
* classes instead.
*
* The regions used by GTK+ widgets are:
*
......@@ -1823,6 +1827,8 @@ gtk_style_context_list_classes (GtkStyleContext *context)
* itself with g_list_free() when you are done with it.
*
* Since: 3.0
*
* Deprecated: 3.14
**/
GList *
gtk_style_context_list_regions (GtkStyleContext *context)
......@@ -1902,6 +1908,8 @@ _gtk_style_context_check_region_name (const gchar *str)
* and “-”, starting always with a lowercase letter.
*
* Since: 3.0
*
* Deprecated: 3.14
**/
void
gtk_style_context_add_region (GtkStyleContext *context,
......@@ -1943,6 +1951,8 @@ gtk_style_context_add_region (GtkStyleContext *context,
* Removes a region from @context.
*
* Since: 3.0
*
* Deprecated: 3.14
**/
void
gtk_style_context_remove_region (GtkStyleContext *context,
......@@ -1986,6 +1996,8 @@ gtk_style_context_remove_region (GtkStyleContext *context,
* Returns: %TRUE if region is defined
*
* Since: 3.0
*
* Deprecated: 3.14
**/
gboolean
gtk_style_context_has_region (GtkStyleContext *context,
......
......@@ -939,17 +939,17 @@ GDK_AVAILABLE_IN_ALL
gboolean gtk_style_context_has_class (GtkStyleContext *context,
const gchar *class_name);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_14
GList * gtk_style_context_list_regions (GtkStyleContext *context);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_14
void gtk_style_context_add_region (GtkStyleContext *context,
const gchar *region_name,
GtkRegionFlags flags);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_14
void gtk_style_context_remove_region (GtkStyleContext *context,
const gchar *region_name);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_14
gboolean gtk_style_context_has_region (GtkStyleContext *context,
const gchar *region_name,
GtkRegionFlags *flags_return);
......
......@@ -648,6 +648,8 @@ gtk_theming_engine_has_class (GtkThemingEngine *engine,
* Returns: %TRUE if region is defined
*
* Since: 3.0
*
* Deprecated: 3.14
**/
gboolean
gtk_theming_engine_has_region (GtkThemingEngine *engine,
......@@ -662,7 +664,9 @@ gtk_theming_engine_has_region (GtkThemingEngine *engine,
g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), FALSE);
priv = engine->priv;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
return gtk_style_context_has_region (priv->context, style_region, flags);
G_GNUC_END_IGNORE_DEPRECATIONS
}
/**
......
......@@ -232,7 +232,7 @@ const GtkWidgetPath * gtk_theming_engine_get_path (GtkThemingEngine *engine);
GDK_AVAILABLE_IN_ALL
gboolean gtk_theming_engine_has_class (GtkThemingEngine *engine,
const gchar *style_class);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_14
gboolean gtk_theming_engine_has_region (GtkThemingEngine *engine,
const gchar *style_region,
GtkRegionFlags *flags);
......
......@@ -5188,8 +5188,10 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
gtk_style_context_set_state (context, state);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_CELL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_add_region (context, GTK_STYLE_REGION_ROW, row_flags);
gtk_style_context_add_region (context, GTK_STYLE_REGION_COLUMN, column_flags);
G_GNUC_END_IGNORE_DEPRECATIONS
if (node == tree_view->priv->cursor_node && has_can_focus_cell
&& ((column == tree_view->priv->focus_column
......@@ -14574,7 +14576,9 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
context = gtk_widget_get_style_context (widget);
gtk_style_context_save (context);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_add_region (context, GTK_STYLE_REGION_COLUMN, 0);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_widget_style_get (widget,
"allow-rules", &allow_rules,
......@@ -14589,7 +14593,9 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
else
row_flags = GTK_REGION_EVEN;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_add_region (context, GTK_STYLE_REGION_ROW, row_flags);
G_GNUC_END_IGNORE_DEPRECATIONS
}
is_separator = row_is_separator (tree_view, &iter, NULL);
......
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