Alternate look for scrollbar sliders



Don't know if someone likes this alternate style for the sliders 
of scrollbars in Gtk+2. If not I've learned how to implement gtk2 theme
engines...


Ciao,
Mathias
-- 
WWW:           http://www.informatik.hu-berlin.de/~hasselma/
PGP/GnuPG:     1024-Bit DSA: ID 55E572F3, 1024-Bit RSA: ID EAAF7CF1
Index: gtkstyle.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstyle.c,v
retrieving revision 1.68
diff -u -r1.68 gtkstyle.c
--- gtkstyle.c	2001/06/21 17:45:26	1.68
+++ gtkstyle.c	2001/07/14 02:51:27
@@ -29,6 +29,7 @@
 #include "gtkgc.h"
 #include "gtkrc.h"
 #include "gtkspinbutton.h"
+#include "gtkrange.h"
 #include "gtkstyle.h"
 #include "gtkwidget.h"
 #include "gtkthemes.h"
@@ -2892,6 +2893,44 @@
 		       y + style->ythickness + 1,
 		       y + height - style->ythickness - 3,
 		       x + width - (indicator_size.width + indicator_spacing.left + indicator_spacing.right) - style->xthickness);
+    }
+  else if (detail && strcmp (detail, "slider") == 0)
+    {
+      if (GTK_IS_RANGE (widget))
+        {
+	  GtkRange * range = GTK_RANGE (widget);
+
+	  if (range->orientation == GTK_ORIENTATION_VERTICAL)
+	    {
+	      GdkGC * dark_gc = style->dark_gc[state_type];
+	      GdkGC * bright_gc = style->light_gc[state_type];
+	      gint half_height, stripes, sy, n;
+	
+	      half_height = height / 2;
+	      stripes = MIN(6, half_height - 1 * style->ythickness - 1);
+	      sy = y + half_height - stripes;
+	     
+	      for (n = 2 * stripes; n > 0; --n, ++sy)
+		  gdk_draw_line (window, n & 1 ? bright_gc : dark_gc,
+			         x + style->xthickness + 1, sy,
+			         x + width - style->xthickness - 2, sy);
+            }
+	  else if (range->orientation == GTK_ORIENTATION_HORIZONTAL)
+	    {
+	      GdkGC * dark_gc = style->dark_gc[state_type];
+	      GdkGC * bright_gc = style->light_gc[state_type];
+	      gint half_width, stripes, sx, n;
+	
+	      half_width = width / 2;
+	      stripes = MIN(6, half_width - 1 * style->xthickness - 1);
+	      sx = x + half_width - stripes;
+	     
+	      for (n = 2 * stripes; n > 0; --n, ++sx)
+		  gdk_draw_line (window, n & 1 ? bright_gc : dark_gc,
+		  		 sx, y + style->xthickness + 1,
+		  		 sx, y + height - style->xthickness - 2);
+	    }
+	}
     }
 }
 


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