gtk-quartz-engine r16 - in trunk: . src theme



Author: rhult
Date: Wed Oct 29 18:29:40 2008
New Revision: 16
URL: http://svn.gnome.org/viewvc/gtk-quartz-engine?rev=16&view=rev

Log:
2008-10-29  Richard Hult  <richard imendio com>

	* src/quartz-style.c: (find_last_notebook_tab_forall),
	(draw_extension): Add notebook tab drawing.
	* theme/gtkrc: Forgot to commit those before.


Modified:
   trunk/ChangeLog
   trunk/src/quartz-style.c
   trunk/theme/gtkrc

Modified: trunk/src/quartz-style.c
==============================================================================
--- trunk/src/quartz-style.c	(original)
+++ trunk/src/quartz-style.c	Wed Oct 29 18:29:40 2008
@@ -1112,6 +1112,30 @@
   return;
 }
 
+typedef struct {
+  GtkWidget *notebook;
+  gint       max_x;
+} FindLastNotebookTabData;
+
+static void
+find_last_notebook_tab_forall (GtkWidget *widget,
+                               gpointer   user_data)
+{
+  FindLastNotebookTabData *data = user_data;
+
+  if (gtk_widget_get_parent (widget) != data->notebook)
+    return;
+
+  /* Filter out all the non-tab-label widgets by checking if the child has a
+   * tab label in which case it isn't one... Very ugly.
+   */
+  if (gtk_notebook_get_tab_label (GTK_NOTEBOOK (data->notebook), widget))
+    return;
+
+  if (data->max_x < widget->allocation.x)
+    data->max_x = widget->allocation.x;
+}
+
 static void
 draw_extension (GtkStyle        *style,
                 GdkWindow       *window,
@@ -1128,9 +1152,70 @@
 {
   DEBUG_DRAW;
 
+  if (widget && GTK_IS_NOTEBOOK (widget) && IS_DETAIL (detail, "tab"))
+    {
+      HIRect rect, out_rect;
+      HIThemeTabDrawInfo draw_info;
+      CGContextRef context;
+
+      context = get_context (GDK_WINDOW_OBJECT (window)->impl, area);
+      if (!context)
+        return;
+
+      rect = CGRectMake (x, y, width, height);
+
+      draw_info.version = 1;
+      draw_info.direction = kThemeTabNorth;
+      draw_info.size = kHIThemeTabSizeNormal;
+      draw_info.adornment = kHIThemeTabAdornmentTrailingSeparator;
+      draw_info.kind = kHIThemeTabKindNormal;
+
+      if (state_type == GTK_STATE_ACTIVE)
+        draw_info.style = kThemeTabNonFront;
+      else if (state_type == GTK_STATE_INSENSITIVE)
+        draw_info.style = kThemeTabNonFrontInactive;
+      else
+        draw_info.style = kThemeTabFront;
+
+      /* Try to draw notebook tabs okish. It's quite hacky but oh well... */
+      if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (widget)) == 1)
+        draw_info.position = kHIThemeTabPositionOnly;
+      else
+        {
+          FindLastNotebookTabData data;
+          gint border_width;
+          gint extra_width;
+
+          data.notebook = widget;
+          data.max_x = 0;
+          gtk_container_forall (GTK_CONTAINER (widget), find_last_notebook_tab_forall, &data);
+
+          border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+          extra_width = GTK_NOTEBOOK (widget)->tab_hborder + widget->style->xthickness;
+
+          /* This might need some tweaking to work in all cases. */
+          if (x == widget->allocation.x + border_width)
+            draw_info.position = kHIThemeTabPositionFirst;
+          else if (x == data.max_x - extra_width)
+            draw_info.position = kHIThemeTabPositionLast;
+          else 
+            draw_info.position = kHIThemeTabPositionMiddle;
+        }
+
+      HIThemeDrawTab (&rect,
+                      &draw_info,
+                      context,
+                      kHIThemeOrientationNormal,
+                      &out_rect);
+
+      gdk_quartz_drawable_release_context (GDK_WINDOW_OBJECT (window)->impl, context);
+    }
+
+#if 0
   parent_class->draw_extension (style, window, state_type,
                                 shadow_type, area, widget, detail,
                                 x, y, width, height, gap_side);
+#endif
 }
 
 static void

Modified: trunk/theme/gtkrc
==============================================================================
--- trunk/theme/gtkrc	(original)
+++ trunk/theme/gtkrc	Wed Oct 29 18:29:40 2008
@@ -35,16 +35,15 @@
   GtkComboBox::arrow-size = 0
   GtkComboBox::shadow-type = none
 
-  GtkNotebook::tab-curvature = 5
-  GtkNotebook::tab-overlap = 1
-  GtkNotebook::tab-vborder = 300
+  GtkNotebook::tab-curvature = 4
+  GtkNotebook::tab-overlap = 0
   
   GtkTreeView::allow-rules = 1
   GtkTreeView::expander-size = 14
   GtkToolbar::internal-padding = 3
   GtkExpander::expander-size = 14
 
-  #GtkScrolledWindow::scrollbar-spacing = 1
+  GtkScrolledWindow::scrollbar-spacing = 0
 
   #GtkMenuItem::toggle-spacing = ...
   GtkMenuItem::horizontal-padding = 8
@@ -56,9 +55,29 @@
 }
 class "*" style "quartz-default"
 
-style "quartz-toolbar" = "quartz-default"
+style "quartz-toolbar"
 {
-	xthickness = 3
-	ythickness = 3
+  xthickness = 3
+  ythickness = 3
+
+  engine "quartz" {}
+}
+widget_class "*Toolbar*" style "quartz-toolbar"
+
+style "quartz-frame"
+{
+  xthickness = 2
+  ythickness = 2
+
+  engine "quartz" {}
+}
+widget_class "*.<GtkFrame>" style "quartz-frame"
+
+style "quartz-scrolled-window"
+{
+  xthickness = 2
+  ythickness = 2
+
+  engine "quartz" {}
 }
-widget_class "*ToolTip*" style "quartz-toolbar"
+widget_class "*.<GtkScrolledWindow>" style "quartz-scrolled-window"



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