summaryrefslogtreecommitdiff
path: root/gtk/gtknotebook.c
diff options
context:
space:
mode:
authorPaolo Borelli <pborelli@gnome.org>2014-06-12 21:12:18 +0200
committerPaolo Borelli <pborelli@gnome.org>2014-06-14 21:37:07 +0200
commitc184458ab3b583ab2fa6e0a6da5934941b3cbe7d (patch)
tree73fc7913511351adc036f49e81243d5bd4dd6ecc /gtk/gtknotebook.c
parentfea939b3d75a97ded2e631235644500fcc2301cf (diff)
downloadgtk+-c184458ab3b583ab2fa6e0a6da5934941b3cbe7d.tar.gz
notebook: set tab position style class on the main frame
We want to have .top etc also on the notebook frame, not only on the header frame. The patch includes a reftest by Benjamin.
Diffstat (limited to 'gtk/gtknotebook.c')
-rw-r--r--gtk/gtknotebook.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index c94f906f96..1e48671e9a 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -1987,6 +1987,29 @@ _gtk_notebook_get_tab_flags (GtkNotebook *notebook,
return flags;
}
+static void
+add_tab_position_style_class (GtkStyleContext *context,
+ gint tab_pos)
+{
+ switch (tab_pos)
+ {
+ case GTK_POS_TOP:
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
+ break;
+ case GTK_POS_BOTTOM:
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
+ break;
+ case GTK_POS_LEFT:
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
+ break;
+ case GTK_POS_RIGHT:
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
+ break;
+ default:
+ break;
+ }
+}
+
static GtkStateFlags
notebook_tab_prepare_style_context (GtkNotebook *notebook,
GtkNotebookPage *page,
@@ -2013,24 +2036,7 @@ notebook_tab_prepare_style_context (GtkNotebook *notebook,
flags = _gtk_notebook_get_tab_flags (notebook, page);
gtk_style_context_add_region (context, GTK_STYLE_REGION_TAB, flags);
-
- switch (tab_pos)
- {
- case GTK_POS_TOP:
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
- break;
- case GTK_POS_BOTTOM:
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
- break;
- case GTK_POS_LEFT:
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
- break;
- case GTK_POS_RIGHT:
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
- break;
- default:
- break;
- }
+ add_tab_position_style_class (context, tab_pos);
return state;
}
@@ -5277,29 +5283,26 @@ gtk_notebook_paint (GtkWidget *widget,
header_height = height;
gtk_style_context_save (context);
+ add_tab_position_style_class (context, tab_pos);
switch (tab_pos)
{
case GTK_POS_TOP:
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
y += page->allocation.height;
height -= page->allocation.height;
header_height = page->allocation.height;
break;
case GTK_POS_BOTTOM:
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
height -= page->allocation.height;
header_y += height;
header_height = page->allocation.height;
break;
case GTK_POS_LEFT:
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
x += page->allocation.width;
width -= page->allocation.width;
header_width = page->allocation.width;
break;
case GTK_POS_RIGHT:
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
width -= page->allocation.width;
header_width = page->allocation.width;
header_x += width;
@@ -5399,6 +5402,9 @@ gtk_notebook_paint (GtkWidget *widget,
"has-tab-gap", &has_tab_gap,
NULL);
+ if (priv->show_tabs)
+ add_tab_position_style_class (context, tab_pos);
+
if (priv->show_border)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_FRAME);