[gtk+] notebook: flip the render order



commit a3b3c91001840908891c1954a35c6892ca569e6e
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Mar 5 03:01:44 2011 -0500

    notebook: flip the render order
    
    The render order for tabs is now
    
    - left to right until the active tab
    - right to left until the active tab
    - active tab
    
    This allows themes that use non-straight lines for the tab curvature to
    draw them not worrying about flipping one side after the active tab.

 gtk/gtknotebook.c |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 77d44f9..e601bb7 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -4906,7 +4906,7 @@ gtk_notebook_paint (GtkWidget    *widget,
   GtkNotebookPrivate *priv;
   GtkNotebookPage *page;
   GtkAllocation allocation;
-  GList *children;
+  GList *children, *other_order;
   gboolean showarrow;
   gint width, height;
   gint x, y;
@@ -5061,8 +5061,13 @@ gtk_notebook_paint (GtkWidget    *widget,
   while (children)
     {
       page = children->data;
+
+      if (page == priv->cur_page)
+        break;
+
       children = gtk_notebook_search_page (notebook, children,
                                            step, TRUE);
+
       if (!gtk_widget_get_visible (page->child) ||
           !gtk_widget_get_mapped (page->tab_label))
         continue;
@@ -5071,6 +5076,37 @@ gtk_notebook_paint (GtkWidget    *widget,
       gtk_notebook_draw_tab (notebook, page, cr, tab_flags);
     }
 
+  if (children != NULL)
+    {
+      other_order = NULL;
+
+      while (children)
+        {
+          page = children->data;
+          children = gtk_notebook_search_page (notebook, children,
+                                               step, TRUE);
+          if (!gtk_widget_get_visible (page->child) ||
+              !gtk_widget_get_mapped (page->tab_label))
+            continue;
+
+          if (children != NULL)
+            other_order = g_list_prepend (other_order, children->data);
+        }
+
+      /* draw them with the opposite order */
+      children = other_order;
+
+      while (children)
+        {
+          page = children->data;
+
+          tab_flags = _gtk_notebook_get_tab_flags (notebook, page);
+          gtk_notebook_draw_tab (notebook, page, cr, tab_flags);
+
+          children = children->next;
+        }
+    }
+
   if (showarrow && priv->scrollable)
     {
       if (priv->has_before_previous)



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