[gtk+] notebook: correctly define the header region



commit db60046af4d5f1be6d99896c4c6dd612ae03fe3e
Author: William Jon McCann <william jon mccann gmail com>
Date:   Fri Oct 4 17:34:48 2013 -0400

    notebook: correctly define the header region
    
    Correctly define the header region to only be the area under the
    tabs.

 gtk/gtknotebook.c |   33 ++++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 7aa11e1..97a8f30 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -5159,7 +5159,9 @@ gtk_notebook_paint (GtkWidget    *widget,
   GList *children;
   gboolean showarrow;
   gint width, height;
+  gint header_width, header_height;
   gint x, y;
+  gint header_x, header_y;
   guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
   gint gap_x = 0, gap_width = 0, step = STEP_PREV;
   gboolean is_rtl;
@@ -5202,30 +5204,43 @@ gtk_notebook_paint (GtkWidget    *widget,
   else
     page = priv->cur_page;
 
-  gtk_style_context_save (context);
-  gtk_style_context_add_class (context, GTK_STYLE_CLASS_HEADER);
-  gtk_render_background (context, cr,
-                         x, y, width, page->allocation.height);
-  gtk_render_frame (context, cr,
-                    x, y, width, page->allocation.height);
-  gtk_style_context_restore (context);
+  header_x = x;
+  header_y = y;
+  header_width = width;
+  header_height = height;
 
   switch (tab_pos)
     {
     case GTK_POS_TOP:
       y += page->allocation.height;
-      /* fall thru */
+      height -= page->allocation.height;
+      header_height = page->allocation.height;
+      break;
     case GTK_POS_BOTTOM:
       height -= page->allocation.height;
+      header_y += height;
+      header_height = page->allocation.height;
       break;
     case GTK_POS_LEFT:
       x += page->allocation.width;
-      /* fall thru */
+      width -= page->allocation.width;
+      header_width = page->allocation.width;
+      break;
     case GTK_POS_RIGHT:
       width -= page->allocation.width;
+      header_width = page->allocation.width;
+      header_x += width;
       break;
     }
 
+  gtk_style_context_save (context);
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_HEADER);
+  gtk_render_background (context, cr,
+                         header_x, header_y, header_width, header_height);
+  gtk_render_frame (context, cr,
+                    header_x, header_y, header_width, header_height);
+  gtk_style_context_restore (context);
+
   if (!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, priv->cur_page) ||
       !gtk_widget_get_mapped (priv->cur_page->tab_label))
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]