Commit 48a4f88a authored by Carlos Garnacho's avatar Carlos Garnacho

Mark orientable widgets with the vertical/horizontal css classes

This can be used to theme widgets differently depending on the
orientation. Bug 639157, reported by Christian Dywan.
parent 529fcc84
......@@ -80,11 +80,29 @@ void
gtk_orientable_set_orientation (GtkOrientable *orientable,
GtkOrientation orientation)
{
GtkStyleContext *context;
g_return_if_fail (GTK_IS_ORIENTABLE (orientable));
g_object_set (orientable,
"orientation", orientation,
NULL);
if (GTK_IS_WIDGET (orientable))
{
context = gtk_widget_get_style_context (GTK_WIDGET (orientable));
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_VERTICAL);
}
else
{
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VERTICAL);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_HORIZONTAL);
}
}
}
/**
......
......@@ -399,6 +399,20 @@ struct _GtkStyleContextClass
*/
#define GTK_STYLE_CLASS_ERROR "error"
/**
* GTK_STYLE_CLASS_HORIZONTAL:
*
* A widget class for horizontally layered widgets.
*/
#define GTK_STYLE_CLASS_HORIZONTAL "horizontal"
/**
* GTK_STYLE_CLASS_VERTICAL:
*
* A widget class for vertically layered widgets.
*/
#define GTK_STYLE_CLASS_VERTICAL "vertical"
/* Predefined set of widget regions */
......
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