gtk-quartz-engine r5 - in trunk: . src



Author: rhult
Date: Mon Apr  7 19:37:54 2008
New Revision: 5
URL: http://svn.gnome.org/viewvc/gtk-quartz-engine?rev=5&view=rev

Log:
2008-04-07  Richard Hult  <richard imendio com>

	* src/quartz-draw.c:
	* src/quartz-style.c: Coding style fixes.


Modified:
   trunk/ChangeLog
   trunk/src/quartz-draw.c
   trunk/src/quartz-style.c

Modified: trunk/src/quartz-draw.c
==============================================================================
--- trunk/src/quartz-draw.c	(original)
+++ trunk/src/quartz-draw.c	Mon Apr  7 19:37:54 2008
@@ -27,8 +27,8 @@
                                                   CGContextRef  context);
 
 static void
-quartz_measure_button (HIThemeButtonDrawInfo *draw_info, 
-                       gint                   width, 
+quartz_measure_button (HIThemeButtonDrawInfo *draw_info,
+                       gint                   width,
                        gint                   height)
 {
   HIRect in_rect, out_rect;
@@ -41,21 +41,21 @@
 
   HIThemeGetButtonShape (&in_rect, draw_info, &shape);
   HIShapeGetBounds (shape, &out_rect);
-  g_print ("Shape: %d %d, %d %d  ", 
+  g_print ("Shape: %d %d, %d %d  ",
            (int) out_rect.origin.x,
            (int) out_rect.origin.y,
            (int) out_rect.size.width - (int) out_rect.origin.x,
            (int) out_rect.size.height - (int) out_rect.origin.y);
 
   HIThemeGetButtonBackgroundBounds (&in_rect, draw_info, &out_rect);
-  g_print ("Bounds: %d %d, %d %d  ", 
+  g_print ("Bounds: %d %d, %d %d  ",
            (int) out_rect.origin.x,
            (int) out_rect.origin.y,
            (int) out_rect.size.width - (int) out_rect.origin.x,
            (int) out_rect.size.height - (int) out_rect.origin.y);
 
   HIThemeGetButtonContentBounds (&in_rect, draw_info, &out_rect);
-  g_print ("Content: %d %d, %d %d\n", 
+  g_print ("Content: %d %d, %d %d\n",
            (int) out_rect.origin.x,
            (int) out_rect.origin.y,
            (int) out_rect.size.width - (int) out_rect.origin.x,
@@ -113,7 +113,7 @@
     draw_info.adornment |= kThemeAdornmentDefault;
 
   /* FIXME: Emulate default button pulsing. */
-  
+
   gtk_widget_style_get (widget,
                         "focus-line-width", &line_width,
                         NULL);

Modified: trunk/src/quartz-style.c
==============================================================================
--- trunk/src/quartz-style.c	(original)
+++ trunk/src/quartz-style.c	Mon Apr  7 19:37:54 2008
@@ -21,7 +21,7 @@
 #include <gtk/gtk.h>
 
 #include <Carbon/Carbon.h>
-#import <AppKit/AppKit.h>
+#include <AppKit/AppKit.h>
 
 #include "quartz-style.h"
 #include "quartz-draw.h"
@@ -29,55 +29,57 @@
 static GtkStyleClass *parent_class;
 
 /* FIXME: Fix GTK+ to export those in a quartz header file. */
-CGContextRef gdk_quartz_drawable_get_context (GdkDrawable *drawable, gboolean antialias);
-void gdk_quartz_drawable_release_context (GdkDrawable *drawable, CGContextRef context);
-static gboolean is_combo_box_child (GtkWidget *widget);
-
+CGContextRef gdk_quartz_drawable_get_context     (GdkDrawable  *drawable,
+                                                  gboolean      antialias);
+void         gdk_quartz_drawable_release_context (GdkDrawable  *drawable,
+                                                  CGContextRef  context);
 
 
 /* TODO:
  *
- * Put the button and frame draw functions in helper functions and
- * handle all the state/focus/active/etc stuff there.
+ * Put the button and frame draw functions in helper functions and handle
+ * all the state/focus/active/etc stuff there.
  *
  * Tweak the spacing between check/radio and the label.
  */
 
+static gboolean is_combo_box_child (GtkWidget *widget);
+
 static gchar *debug = NULL;
 #define DEBUG_DRAW if (debug && (strcmp (debug, "all") == 0 || strcmp (debug, G_OBJECT_TYPE_NAME (widget)) == 0)) \
-  g_print ("%s, %s, %s\n", __PRETTY_FUNCTION__, G_OBJECT_TYPE_NAME (widget), detail);
+    g_print ("%s, %s, %s\n", __PRETTY_FUNCTION__, G_OBJECT_TYPE_NAME (widget), detail);
 
 #define IS_DETAIL(d,x) (d && strcmp (d, x) == 0)
 
 static void
 style_setup_settings (void)
 {
-    GtkSettings *settings;
-    gint blink_time;
+  GtkSettings *settings;
+  gint blink_time;
+
+  debug = g_strdup (g_getenv ("DEBUG_DRAW"));
+
+  settings = gtk_settings_get_default ();
+  if (!settings)
+    return;
 
-    debug = g_strdup (g_getenv ("DEBUG_DRAW"));
+  /* FIXME: Get settings from the system or hardcodes default for
+   * things like popup menu delay, double click time/pixels defaults
+   * etc.
+   */
 
-    settings = gtk_settings_get_default ();
-    if (!settings)
-	return;
-
-    /* FIXME: Get settings from the system or hardcodes default for
-     * things like popup menu delay, double click time/pixels defaults
-     * etc.
-     */
-
-    blink_time = 2*500;
-    g_object_set (settings,
-			"gtk-cursor-blink", blink_time > 0,
-			"gtk-cursor-blink-time", blink_time,
-			NULL);
-    g_object_set (settings,
-			"gtk-double-click-distance", 2,
-			"gtk-double-click-time", 500,
-			NULL);
-    g_object_set (settings,
-			"gtk-dnd-drag-threshold", 5,
-			NULL);
+  blink_time = 2*500;
+  g_object_set (settings,
+                "gtk-cursor-blink", blink_time > 0,
+                "gtk-cursor-blink-time", blink_time,
+                NULL);
+  g_object_set (settings,
+                "gtk-double-click-distance", 2,
+                "gtk-double-click-time", 500,
+                NULL);
+  g_object_set (settings,
+                "gtk-dnd-drag-threshold", 5,
+                NULL);
 }
 
 static void
@@ -99,50 +101,50 @@
 
 /*
 
-System font, kThemeSystemFont:
+  System font, kThemeSystemFont:
 
   "Lucida Grande Regular 13" is used for text in menus, dialogs, and
   full-size controls.
 
-Emphasized system font, kThemeEmphasizedSystemFont:
+  Emphasized system font, kThemeEmphasizedSystemFont:
 
   "Lucida Grande Bold 13", use sparingly. It is used for the message
   text in alerts.
 
-Small system font, kThemeSmallSystemFont
+  Small system font, kThemeSmallSystemFont
 
   "Lucida Grande Regular 11" is used for informative text in
   alerts. It is also the default font for column headings in lists,
   for help tags, and for small controls. You can also use it to
   provide additional information about settings.
 
-Emphasized small system font, kThemeSmallEmphazisedSystemFont
+  Emphasized small system font, kThemeSmallEmphazisedSystemFont
 
   "Lucida Grande Bold 11", use sparingly. You might use it to title a
   group of settings that appear without a group box, or for brief
   informative text below a text field.
 
-Mini system font, kThemeMiniSystemFont
+  Mini system font, kThemeMiniSystemFont
 
   "Lucida Grande Regular 9" is used for mini controls. It can also be
   used for utility window labels and text.
 
-Emphasized mini system font, N/A
+  Emphasized mini system font, N/A
 
   "Lucida Grande Bold 9" is available for cases in which the
   emphasized small system font is too large.
 
-Application font, kThemeApplicationFont
+  Application font, kThemeApplicationFont
 
   "Lucida Grande Regular 13", the default font for user-created text
   documents.
 
-Label font, kThemeLabelFont
+  Label font, kThemeLabelFont
 
   "Lucida Grande Regular 10" is used for the labels on toolbar buttons
   and to label tick marks on full-size sliders.
 
-View font, kThemeViewsFont
+  View font, kThemeViewsFont
 
   "Lucida Grande Regular 12" as the default font of text in lists and
   tables.
@@ -172,32 +174,32 @@
   gchar *str;
   gchar buf[1024];
 
-#define RC_WIDGET(name,match,body,...) \
-  g_snprintf (buf, sizeof (buf), \
-              "style \"" name "\"=\"quartz-default\" {\n" \
-              body \
+#define RC_WIDGET(name,match,body,...)                                  \
+  g_snprintf (buf, sizeof (buf),                                        \
+              "style \"" name "\"=\"quartz-default\" {\n"               \
+              body                                                      \
               "} widget \"" match "\" style \"" name "\"\n", __VA_ARGS__); \
   gtk_rc_parse_string (buf);
 
-#define RC_WIDGET_CLASS(name,match,body,...) \
-  g_snprintf (buf, sizeof (buf), \
-              "style \"" name "\"=\"quartz-default\" {\n" \
-              body \
+#define RC_WIDGET_CLASS(name,match,body,...)                            \
+  g_snprintf (buf, sizeof (buf),                                        \
+              "style \"" name "\"=\"quartz-default\" {\n"               \
+              body                                                      \
               "} widget_class \"" match "\" style \"" name "\"\n", __VA_ARGS__); \
   gtk_rc_parse_string (buf);
 
-#define RC_CLASS(name,match,body,...) \
-  g_snprintf (buf, sizeof (buf), \
-              "style \"" name "\"=\"quartz-default\" {\n" \
-              body \
+#define RC_CLASS(name,match,body,...)                                   \
+  g_snprintf (buf, sizeof (buf),                                        \
+              "style \"" name "\"=\"quartz-default\" {\n"               \
+              body                                                      \
               "} class \"" match "\" style \"" name "\"\n", __VA_ARGS__); \
   gtk_rc_parse_string (buf);
 
   /* FIXME: Comment out for now, doesn't seem to do anything? */
   /*RC_WIDGET ("quartz-tooltips-caption", "gtk-tooltips.GtkLabel",
-             "fg[NORMAL] = { %d, %d, %d }\n"
-             "font_name = \"%s\"\n",
-             0, 0, 0, "Lucida Grande 11");
+    "fg[NORMAL] = { %d, %d, %d }\n"
+    "font_name = \"%s\"\n",
+    0, 0, 0, "Lucida Grande 11");
   */
 
   /* FIXME: Get the right background and frame colors. */
@@ -329,22 +331,22 @@
 
 static void
 draw_arrow (GtkStyle      *style,
-			GdkWindow     *window,
-			GtkStateType   state,
-			GtkShadowType  shadow,
-			GdkRectangle  *area,
-			GtkWidget     *widget,
-			const gchar   *detail,
-			GtkArrowType   arrow_type,
-			gboolean       fill,
-			gint           x,
-			gint           y,
-			gint           width,
-			gint           height)
+            GdkWindow     *window,
+            GtkStateType   state,
+            GtkShadowType  shadow,
+            GdkRectangle  *area,
+            GtkWidget     *widget,
+            const gchar   *detail,
+            GtkArrowType   arrow_type,
+            gboolean       fill,
+            gint           x,
+            gint           y,
+            gint           width,
+            gint           height)
 {
   CGContextRef context;
   HIRect rect;
-	HIThemePopupArrowDrawInfo arrow_info;
+  HIThemePopupArrowDrawInfo arrow_info;
 
   DEBUG_DRAW;
 
@@ -361,77 +363,78 @@
 
   arrow_info.version = 0;
   arrow_info.state = kThemeStateActive;
-	switch (arrow_type)
+
+  switch (arrow_type)
     {
-      case GTK_ARROW_UP:
-        arrow_info.orientation = kThemeArrowUp;
-        break;
-
-      default:
-      case GTK_ARROW_DOWN:
-        arrow_info.orientation = kThemeArrowDown;
-        break;
-
-      case GTK_ARROW_RIGHT:
-        arrow_info.orientation = kThemeArrowRight;
-        break;
-
-      case GTK_ARROW_LEFT:
-        arrow_info.orientation = kThemeArrowLeft;
-        break;
-   }
+    case GTK_ARROW_UP:
+      arrow_info.orientation = kThemeArrowUp;
+      break;
+
+    default:
+    case GTK_ARROW_DOWN:
+      arrow_info.orientation = kThemeArrowDown;
+      break;
+
+    case GTK_ARROW_RIGHT:
+      arrow_info.orientation = kThemeArrowRight;
+      break;
+
+    case GTK_ARROW_LEFT:
+      arrow_info.orientation = kThemeArrowLeft;
+      break;
+    }
 
   arrow_info.size = kThemeArrow9pt;
 
   HIThemeDrawPopupArrow (&rect, &arrow_info, context, kHIThemeOrientationNormal);
 
   gdk_quartz_drawable_release_context (GDK_WINDOW_OBJECT (window)->impl, context);
-  return;  
+  return;
 }
 
 static gboolean
 is_combo_box_child (GtkWidget *widget)
 {
-    GtkWidget *tmp;
+  GtkWidget *tmp;
 
-    for (tmp = widget->parent; tmp; tmp = tmp->parent)
-      {
-        if (GTK_IS_COMBO_BOX (tmp))
-          return TRUE;
-      }
+  for (tmp = widget->parent; tmp; tmp = tmp->parent)
+    {
+      if (GTK_IS_COMBO_BOX (tmp))
+        return TRUE;
+    }
 
-    return FALSE;
+  return FALSE;
 }
 
 static gboolean
 is_tree_view_child (GtkWidget *widget)
 {
-    GtkWidget *tmp;
+  GtkWidget *tmp;
 
-    for (tmp = widget->parent; tmp; tmp = tmp->parent)
-      {
-        if (GTK_IS_TREE_VIEW (tmp))
-          return TRUE;
-      }
+  for (tmp = widget->parent; tmp; tmp = tmp->parent)
+    {
+      if (GTK_IS_TREE_VIEW (tmp))
+        return TRUE;
+    }
 
-    return FALSE;
+  return FALSE;
 }
 
 static gboolean
 is_path_bar_button (GtkWidget *widget)
 {
-    GtkWidget *tmp;
+  GtkWidget *tmp;
 
-    if (!GTK_IS_BUTTON (widget))
-      return FALSE;
+  if (!GTK_IS_BUTTON (widget))
+    return FALSE;
 
-    for (tmp = widget->parent; tmp; tmp = tmp->parent)
-      {
-        if (strcmp (G_OBJECT_TYPE_NAME (tmp), "GtkPathBar") == 0)
-          return TRUE;
-      }
+  for (tmp = widget->parent; tmp; tmp = tmp->parent)
+    {
+      if (strcmp (G_OBJECT_TYPE_NAME (tmp), "GtkPathBar") == 0)
+        return TRUE;
+    }
 
-    return FALSE;
+  return FALSE;
 }
 
 /* Checks if the button is displaying just an icon and no text, used to
@@ -440,26 +443,26 @@
 static gboolean
 is_icon_only_button (GtkWidget *widget)
 {
-    if (!GTK_IS_BUTTON (widget))
-      return FALSE;
+  if (!GTK_IS_BUTTON (widget))
+    return FALSE;
 
-    /* FIXME: implement. */
+  /* FIXME: implement. */
 
-    return FALSE;
+  return FALSE;
 }
 
 static void
 draw_box (GtkStyle      *style,
-		GdkWindow     *window,
-		GtkStateType   state_type,
-		GtkShadowType  shadow_type,
-		GdkRectangle  *area,
-		GtkWidget     *widget,
-		const gchar   *detail,
-		gint           x,
-		gint           y,
-		gint           width,
-		gint           height)
+          GdkWindow     *window,
+          GtkStateType   state_type,
+          GtkShadowType  shadow_type,
+          GdkRectangle  *area,
+          GtkWidget     *widget,
+          const gchar   *detail,
+          gint           x,
+          gint           y,
+          gint           width,
+          gint           height)
 {
   DEBUG_DRAW;
 
@@ -521,14 +524,14 @@
       draw_info.value = kThemeButtonOff;
 
       if (state_type == GTK_STATE_ACTIVE)
-				draw_info.state = kThemeStatePressed;
+        draw_info.state = kThemeStatePressed;
       else if (state_type == GTK_STATE_INSENSITIVE)
-				draw_info.state = kThemeStateInactive;
+        draw_info.state = kThemeStateInactive;
       else
-				draw_info.state = kThemeStateActive;
+        draw_info.state = kThemeStateActive;
 
       if (GTK_WIDGET_HAS_FOCUS (widget))
-				draw_info.adornment |= kThemeAdornmentFocus;
+        draw_info.adornment |= kThemeAdornmentFocus;
 
       /* FIXME: We should make the button "greyed out" when the window
        * doesn't have focus, but I can't see how it can be done (it's
@@ -560,46 +563,46 @@
     {
       if (GTK_IS_TREE_VIEW (widget->parent) || GTK_IS_CLIST (widget->parent))
 	{
-		/* FIXME: refactor so that we can share this code with
-		 * normal buttons.
-		 */
-		CGContextRef context;
-		HIRect rect;
-		HIThemeButtonDrawInfo draw_info;
-
-		draw_info.version = 0;
-		draw_info.kind = kThemeListHeaderButton;
-		draw_info.adornment = kThemeAdornmentNone;
-		draw_info.value = kThemeButtonOff;
-
-		if (state_type == GTK_STATE_ACTIVE)
-			draw_info.state = kThemeStatePressed;
-		else if (state_type == GTK_STATE_INSENSITIVE)
-			draw_info.state = kThemeStateInactive;
-		else
-			draw_info.state = kThemeStateActive;
-
-		if (GTK_WIDGET_HAS_FOCUS (widget))
-			draw_info.adornment |= kThemeAdornmentFocus;
+          /* FIXME: refactor so that we can share this code with
+           * normal buttons.
+           */
+          CGContextRef context;
+          HIRect rect;
+          HIThemeButtonDrawInfo draw_info;
+
+          draw_info.version = 0;
+          draw_info.kind = kThemeListHeaderButton;
+          draw_info.adornment = kThemeAdornmentNone;
+          draw_info.value = kThemeButtonOff;
+
+          if (state_type == GTK_STATE_ACTIVE)
+            draw_info.state = kThemeStatePressed;
+          else if (state_type == GTK_STATE_INSENSITIVE)
+            draw_info.state = kThemeStateInactive;
+          else
+            draw_info.state = kThemeStateActive;
+
+          if (GTK_WIDGET_HAS_FOCUS (widget))
+            draw_info.adornment |= kThemeAdornmentFocus;
 
-		if (IS_DETAIL (detail, "buttondefault"))
-			draw_info.adornment |= kThemeAdornmentDefault;
+          if (IS_DETAIL (detail, "buttondefault"))
+            draw_info.adornment |= kThemeAdornmentDefault;
 
-		rect = CGRectMake (x, y, width, height);
+          rect = CGRectMake (x, y, width, height);
 
-		context = gdk_quartz_drawable_get_context (GDK_WINDOW_OBJECT (window)->impl, FALSE);
+          context = gdk_quartz_drawable_get_context (GDK_WINDOW_OBJECT (window)->impl, FALSE);
           if (!context)
             return;
 
-		HIThemeDrawButton (&rect,
-					 &draw_info,
-					 context,
-					 kHIThemeOrientationNormal,
-					 NULL);
+          HIThemeDrawButton (&rect,
+                             &draw_info,
+                             context,
+                             kHIThemeOrientationNormal,
+                             NULL);
 
-		gdk_quartz_drawable_release_context (GDK_WINDOW_OBJECT (window)->impl, context);
+          gdk_quartz_drawable_release_context (GDK_WINDOW_OBJECT (window)->impl, context);
 
-		return;
+          return;
 	}
       else /* Normal button. */
 	{
@@ -627,7 +630,7 @@
                               kind,
                               x, y,
                               width, height);
-		return;
+          return;
 	}
     }
   else if (IS_DETAIL (detail, "toolbar"))
@@ -666,11 +669,11 @@
     }
   else if (IS_DETAIL (detail, "menubar"))
     {
-		  /* TODO: What about vertical menubars? */
+      /* TODO: What about vertical menubars? */
       HIThemeMenuBarDrawInfo draw_info;
-			HIThemePlacardDrawInfo bg_draw_info;
+      HIThemePlacardDrawInfo bg_draw_info;
       HIRect rect;
-			HIRect bg_rect;
+      HIRect bg_rect;
       CGContextRef context;
 
       draw_info.version = 0;
@@ -680,18 +683,18 @@
       bg_draw_info.state = kThemeStateActive;
 
       /* We paint the Rect with a shift of 10 pixels on both sides to avoid round borders */
-			rect = CGRectMake (x-10, y, width+20, 22);
+      rect = CGRectMake (x-10, y, width+20, 22);
 
-			/* FIXME?: We shift one pixel to avoid the grey border */
-			bg_rect = CGRectMake (x-1, y-1, width+2, height+2);
+      /* FIXME?: We shift one pixel to avoid the grey border */
+      bg_rect = CGRectMake (x-1, y-1, width+2, height+2);
 
       context = gdk_quartz_drawable_get_context (GDK_WINDOW_OBJECT (window)->impl, FALSE);
       if (!context)
         return;
 
-			/* We fill the whole area with the background since the menubar has a fixed height
-			of 22 pixels, screw people with more than one text line in menubars */
-			HIThemeDrawPlacard (&bg_rect, &bg_draw_info, context, kHIThemeOrientationNormal);
+      /* We fill the whole area with the background since the menubar has a fixed height
+         of 22 pixels, screw people with more than one text line in menubars */
+      HIThemeDrawPlacard (&bg_rect, &bg_draw_info, context, kHIThemeOrientationNormal);
       HIThemeDrawMenuBarBackground (&rect, &draw_info, context, kHIThemeOrientationNormal);
 
       gdk_quartz_drawable_release_context (GDK_WINDOW_OBJECT (window)->impl, context);
@@ -756,11 +759,11 @@
         return;
 
       HIThemeDrawMenuItem (&menu_rect,
-				 &item_rect,
-				 &draw_info,
-				 context,
-				 kHIThemeOrientationNormal,
-				 NULL);
+                           &item_rect,
+                           &draw_info,
+                           context,
+                           kHIThemeOrientationNormal,
+                           NULL);
 
       gdk_quartz_drawable_release_context (GDK_WINDOW_OBJECT (window)->impl, context);
 
@@ -814,7 +817,7 @@
 
       return;
     }
-  else if (IS_DETAIL (detail, "spinbutton_up") || 
+  else if (IS_DETAIL (detail, "spinbutton_up") ||
            IS_DETAIL (detail, "spinbutton_down"))
     {
       return; /* Ignore. */
@@ -846,7 +849,7 @@
 
       /* FIXME: This is really weird, might be a bg in the backend. We
        * have to flip the context while drawing the progess bar,
-       * otherwise it ends up with a strange offset. 
+       * otherwise it ends up with a strange offset.
        */
 
       if (GDK_IS_PIXMAP (window))
@@ -904,7 +907,7 @@
       draw_info.bounds = rect;
 
       adj = gtk_range_get_adjustment (GTK_RANGE (widget));
-      
+
       draw_info.min = adj->lower;
       draw_info.max = adj->upper;
       draw_info.value = adj->value;
@@ -1001,21 +1004,21 @@
     }
 
   parent_class->draw_box (style, window, state_type, shadow_type, area,
-				widget, detail, x, y, width, height);
+                          widget, detail, x, y, width, height);
 }
 
 static void
 draw_check (GtkStyle      *style,
-			GdkWindow     *window,
-			GtkStateType   state_type,
-			GtkShadowType  shadow_type,
-			GdkRectangle  *area,
-			GtkWidget     *widget,
-			const gchar   *detail,
-			gint           x,
-			gint           y,
-			gint           width,
-			gint           height)
+            GdkWindow     *window,
+            GtkStateType   state_type,
+            GtkShadowType  shadow_type,
+            GdkRectangle  *area,
+            GtkWidget     *widget,
+            const gchar   *detail,
+            gint           x,
+            gint           y,
+            gint           width,
+            gint           height)
 {
   DEBUG_DRAW;
 
@@ -1072,16 +1075,16 @@
 
 static void
 draw_option (GtkStyle      *style,
-			 GdkWindow     *window,
-			 GtkStateType   state_type,
-			 GtkShadowType  shadow,
-			 GdkRectangle  *area,
-			 GtkWidget     *widget,
-			 const gchar   *detail,
-			 gint           x,
-			 gint           y,
-			 gint           width,
-			 gint           height)
+             GdkWindow     *window,
+             GtkStateType   state_type,
+             GtkShadowType  shadow,
+             GdkRectangle  *area,
+             GtkWidget     *widget,
+             const gchar   *detail,
+             gint           x,
+             gint           y,
+             gint           width,
+             gint           height)
 {
   DEBUG_DRAW;
 
@@ -1136,19 +1139,19 @@
 
 static void
 draw_tab (GtkStyle      *style,
-		GdkWindow     *window,
-		GtkStateType   state,
-		GtkShadowType  shadow,
-		GdkRectangle  *area,
-		GtkWidget     *widget,
-		const gchar   *detail,
-		gint           x,
-		gint           y,
-		gint           width,
-		gint           height)
+          GdkWindow     *window,
+          GtkStateType   state,
+          GtkShadowType  shadow,
+          GdkRectangle  *area,
+          GtkWidget     *widget,
+          const gchar   *detail,
+          gint           x,
+          gint           y,
+          gint           width,
+          gint           height)
 {
   DEBUG_DRAW;
- return;
+  return;
 }
 
 static void
@@ -1168,65 +1171,65 @@
   DEBUG_DRAW;
   if (widget
       && GTK_IS_NOTEBOOK (widget)
-			&& detail
-			&& !strcmp (detail, "tab"))
+      && detail
+      && !strcmp (detail, "tab"))
     {
       HIRect rect, out_rect;
       HIThemeTabDrawInfo draw_info;
-			CGContextRef context;
-	  /* bool first, last;
-	     gint border_width; */
-
-		if (height > 22 &&
-				(gap_side == GTK_POS_RIGHT || gap_side == GTK_POS_LEFT))
-			rect = CGRectMake (x, y + height/2 - 22/2, width, height);
-	  else
-			rect = CGRectMake (x, y, width, height);
+      CGContextRef context;
+      /* bool first, last;
+         gint border_width; */
+
+      if (height > 22 &&
+          (gap_side == GTK_POS_RIGHT || gap_side == GTK_POS_LEFT))
+        rect = CGRectMake (x, y + height/2 - 22/2, width, height);
+      else
+        rect = CGRectMake (x, y, width, height);
 
-	  context = gdk_quartz_drawable_get_context (GDK_WINDOW_OBJECT (window)->impl, FALSE);
-	  if (!context)
+      context = gdk_quartz_drawable_get_context (GDK_WINDOW_OBJECT (window)->impl, FALSE);
+      if (!context)
         return;
 
-		draw_info.version = 1;
-		draw_info.direction = kThemeTabNorth;
-		draw_info.size = kHIThemeTabSizeNormal;
-		draw_info.adornment = kHIThemeTabAdornmentNone;
-		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;
-		
-
-		/* TODO: figure out the last one and take thickness into account
-
-		border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-	  first = widget->allocation.x == x + border_width;
-	  last = FALSE;
-
-	  if (first && last)
-			  draw_info.position = kHIThemeTabPositionFirst;
-	  else if (first)
-			  draw_info.position = kHIThemeTabPositionFirst;
-	  else if (last)
-			  draw_info.position = kHIThemeTabPositionLast;
-	  else
-			  draw_info.position = kHIThemeTabPositionMiddle;*/
-
-	  draw_info.position = kHIThemeTabPositionOnly;
-
-
-		HIThemeDrawTab (&rect,
-                    &draw_info,
-										context,
-											kHIThemeOrientationNormal,
-											&out_rect);
-		gdk_quartz_drawable_release_context (GDK_WINDOW_OBJECT (window)->impl, context);
+      draw_info.version = 1;
+      draw_info.direction = kThemeTabNorth;
+      draw_info.size = kHIThemeTabSizeNormal;
+      draw_info.adornment = kHIThemeTabAdornmentNone;
+      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;
+
+
+      /* TODO: figure out the last one and take thickness into account
+
+         border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+         first = widget->allocation.x == x + border_width;
+         last = FALSE;
+
+         if (first && last)
+         draw_info.position = kHIThemeTabPositionFirst;
+         else if (first)
+         draw_info.position = kHIThemeTabPositionFirst;
+         else if (last)
+         draw_info.position = kHIThemeTabPositionLast;
+         else
+         draw_info.position = kHIThemeTabPositionMiddle;*/
+
+      draw_info.position = kHIThemeTabPositionOnly;
+
+
+      HIThemeDrawTab (&rect,
+                      &draw_info,
+                      context,
+                      kHIThemeOrientationNormal,
+                      &out_rect);
+      gdk_quartz_drawable_release_context (GDK_WINDOW_OBJECT (window)->impl, context);
+
+    }
 
   return;
   parent_class->draw_extension (style, window, state_type,
@@ -1235,32 +1238,41 @@
 }
 
 static void
-draw_box_gap (GtkStyle * style, GdkWindow * window, GtkStateType state_type,
-				GtkShadowType shadow_type, GdkRectangle * area,
-				GtkWidget * widget, const gchar * detail, gint x,
-				gint y, gint width, gint height, GtkPositionType gap_side,
-				gint gap_x, gint gap_width)
+draw_box_gap (GtkStyle        *style,
+              GdkWindow       *window,
+              GtkStateType     state_type,
+              GtkShadowType    shadow_type,
+              GdkRectangle    *area,
+              GtkWidget       *widget,
+              const gchar     *detail,
+              gint             x,
+              gint             y,
+              gint             width,
+              gint             height,
+              GtkPositionType  gap_side,
+              gint             gap_x,
+              gint             gap_width)
 {
   DEBUG_DRAW;
 
   return;
   parent_class->draw_box_gap (style, window, state_type, shadow_type,
-						area, widget, detail, x, y, width, height,
-						gap_side, gap_x, gap_width);
+                              area, widget, detail, x, y, width, height,
+                              gap_side, gap_x, gap_width);
 }
 
 static void
 draw_flat_box (GtkStyle      *style,
-				 GdkWindow     *window,
-				 GtkStateType   state_type,
-				 GtkShadowType  shadow_type,
-				 GdkRectangle  *area,
-				 GtkWidget     *widget,
-				 const gchar   *detail,
-				 gint           x,
-				 gint           y,
-				 gint           width,
-				 gint           height)
+               GdkWindow     *window,
+               GtkStateType   state_type,
+               GtkShadowType  shadow_type,
+               GdkRectangle  *area,
+               GtkWidget     *widget,
+               const gchar   *detail,
+               gint           x,
+               gint           y,
+               gint           width,
+               gint           height)
 {
   DEBUG_DRAW;
 
@@ -1387,38 +1399,38 @@
     }
 
   parent_class->draw_flat_box (style, window, state_type, shadow_type,
-						 area, widget, detail, x, y, width, height);
+                               area, widget, detail, x, y, width, height);
 }
 
 static void
 draw_expander (GtkStyle         *style,
-				 GdkWindow        *window,
-				 GtkStateType      state,
-				 GdkRectangle     *area,
-				 GtkWidget        *widget,
-				 const gchar      *detail,
-				 gint              x,
-				 gint              y,
-				 GtkExpanderStyle  expander_style)
+               GdkWindow        *window,
+               GtkStateType      state,
+               GdkRectangle     *area,
+               GtkWidget        *widget,
+               const gchar      *detail,
+               gint              x,
+               gint              y,
+               GtkExpanderStyle  expander_style)
 {
   DEBUG_DRAW;
 
   parent_class->draw_expander (style, window, state, area, widget,
-						 detail, x, y, expander_style);
+                               detail, x, y, expander_style);
 }
 
 static void
 draw_shadow (GtkStyle      *style,
-			 GdkWindow     *window,
-			 GtkStateType   state_type,
-			 GtkShadowType  shadow_type,
-			 GdkRectangle  *area,
-			 GtkWidget     *widget,
-			 const gchar   *detail,
-			 gint           x,
-			 gint           y,
-			 gint           width,
-			 gint           height)
+             GdkWindow     *window,
+             GtkStateType   state_type,
+             GtkShadowType  shadow_type,
+             GdkRectangle  *area,
+             GtkWidget     *widget,
+             const gchar   *detail,
+             gint           x,
+             gint           y,
+             gint           width,
+             gint           height)
 {
   GtkWidget *child = NULL;
 
@@ -1426,7 +1438,7 @@
 
   if (GTK_IS_BIN (widget))
     child = gtk_bin_get_child (GTK_BIN (widget));
-    
+
   /* Scrolled window with treeview in it. */
   if (IS_DETAIL (detail, "scrolled_window") && GTK_IS_TREE_VIEW (child))
     {
@@ -1518,7 +1530,7 @@
   return;
   g_print ("Missing implementation of draw_shadow for %s\n", detail);
   parent_class->draw_shadow (style, window, state_type, shadow_type, area,
-					 widget, detail, x, y, width, height);
+                             widget, detail, x, y, width, height);
 }
 
 static void
@@ -1548,14 +1560,14 @@
 
 static void
 draw_hline (GtkStyle     *style,
-			GdkWindow    *window,
-			GtkStateType  state_type,
-			GdkRectangle *area,
-			GtkWidget    *widget,
-			const gchar  *detail,
-			gint          x1,
-			gint          x2,
-			gint          y)
+            GdkWindow    *window,
+            GtkStateType  state_type,
+            GdkRectangle *area,
+            GtkWidget    *widget,
+            const gchar  *detail,
+            gint          x1,
+            gint          x2,
+            gint          y)
 {
   DEBUG_DRAW;
 
@@ -1604,31 +1616,31 @@
 
 static void
 draw_vline (GtkStyle     *style,
-			GdkWindow    *window,
-			GtkStateType  state_type,
-			GdkRectangle *area,
-			GtkWidget    *widget,
-			const gchar  *detail,
-			gint          y1,
-			gint          y2,
-			gint          x)
+            GdkWindow    *window,
+            GtkStateType  state_type,
+            GdkRectangle *area,
+            GtkWidget    *widget,
+            const gchar  *detail,
+            gint          y1,
+            gint          y2,
+            gint          x)
 {
   DEBUG_DRAW;
 }
 
 static void
 draw_slider (GtkStyle       *style,
-			 GdkWindow      *window,
-			 GtkStateType    state_type,
-			 GtkShadowType   shadow_type,
-			 GdkRectangle   *area,
-			 GtkWidget      *widget,
-			 const gchar    *detail,
-			 gint            x,
-			 gint            y,
-			 gint            width,
-			 gint            height,
-			 GtkOrientation  orientation)
+             GdkWindow      *window,
+             GtkStateType    state_type,
+             GtkShadowType   shadow_type,
+             GdkRectangle   *area,
+             GtkWidget      *widget,
+             const gchar    *detail,
+             gint            x,
+             gint            y,
+             gint            width,
+             gint            height,
+             GtkOrientation  orientation)
 {
   DEBUG_DRAW;
 
@@ -1638,60 +1650,60 @@
     }
 
   /*  parent_class->draw_slider (style, window, state_type, shadow_type, area,
-					 widget, detail, x, y, width, height,
-					 orientation);
+      widget, detail, x, y, width, height,
+      orientation);
   */
 }
 
 static void
 draw_resize_grip (GtkStyle      *style,
-			GdkWindow     *window,
-			GtkStateType   state_type,
-			GdkRectangle  *area,
-			GtkWidget     *widget,
-			const gchar   *detail,
-			GdkWindowEdge  edge,
-			gint           x,
-			gint           y,
-			gint           width,
-			gint           height)
+                  GdkWindow     *window,
+                  GtkStateType   state_type,
+                  GdkRectangle  *area,
+                  GtkWidget     *widget,
+                  const gchar   *detail,
+                  GdkWindowEdge  edge,
+                  gint           x,
+                  gint           y,
+                  gint           width,
+                  gint           height)
 {
   DEBUG_DRAW;
 
   /*  parent_class->draw_resize_grip (style, window, state_type, area,
-					widget, detail, edge, x, y, width,
-					height);
+      widget, detail, edge, x, y, width,
+      height);
   */
 }
 
 static void
 draw_handle (GtkStyle       *style,
-			 GdkWindow      *window,
-			 GtkStateType    state_type,
-			 GtkShadowType   shadow_type,
-			 GdkRectangle   *area,
-			 GtkWidget      *widget,
-			 const gchar    *detail,
-			 gint            x,
-			 gint            y,
-			 gint            width,
-			 gint            height,
-			 GtkOrientation  orientation)
+             GdkWindow      *window,
+             GtkStateType    state_type,
+             GtkShadowType   shadow_type,
+             GdkRectangle   *area,
+             GtkWidget      *widget,
+             const gchar    *detail,
+             gint            x,
+             gint            y,
+             gint            width,
+             gint            height,
+             GtkOrientation  orientation)
 {
   DEBUG_DRAW;
 }
 
 static void
 draw_focus (GtkStyle     *style,
-			GdkWindow    *window,
-			GtkStateType  state_type,
+            GdkWindow    *window,
+            GtkStateType  state_type,
             GdkRectangle *area,
-			GtkWidget    *widget,
-			const gchar  *detail,
+            GtkWidget    *widget,
+            const gchar  *detail,
             gint          x,
-			gint          y,
-			gint          width,
-			gint          height)
+            gint          y,
+            gint          width,
+            gint          height)
 {
   DEBUG_DRAW;
 
@@ -1707,7 +1719,7 @@
 
   HIThemeDrawFocusRect (&rect, TRUE, context, kHIThemeOrientationNormal);
 
- gdk_quartz_drawable_release_context (GDK_WINDOW_OBJECT (window)->impl, context);
+  gdk_quartz_drawable_release_context (GDK_WINDOW_OBJECT (window)->impl, context);
 #endif
 }
 
@@ -1725,7 +1737,7 @@
 {
   DEBUG_DRAW;
 
-  if (state_type == GTK_STATE_PRELIGHT && 
+  if (state_type == GTK_STATE_PRELIGHT &&
       GTK_IS_PROGRESS_BAR (widget) && IS_DETAIL (detail, "progressbar"))
     {
       /* Ignore this, it looks very out of place on the mac (I think
@@ -1743,9 +1755,9 @@
 static void
 quartz_style_init_from_rc (GtkStyle * style, GtkRcStyle * rc_style)
 {
-    style_setup_system_font (style);
+  style_setup_system_font (style);
 
-    parent_class->init_from_rc (style, rc_style);
+  parent_class->init_from_rc (style, rc_style);
 }
 
 static void
@@ -1781,7 +1793,7 @@
     {
       /* FIXME: Implement bg pixmaps? */
       if (style->rc_style && style->rc_style->bg_pixmap_name[i])
-	style->bg_pixmap[i] = (GdkPixmap *) GDK_PARENT_RELATIVE;
+        style->bg_pixmap[i] = (GdkPixmap *) GDK_PARENT_RELATIVE;
 
       gdk_colormap_alloc_color (style->colormap, &style->fg[i], FALSE, TRUE);
       gdk_colormap_alloc_color (style->colormap, &style->bg[i], FALSE, TRUE);
@@ -1821,7 +1833,7 @@
 static void
 quartz_style_unrealize (GtkStyle * style)
 {
-	parent_class->unrealize (style);
+  parent_class->unrealize (style);
 }
 
 static void
@@ -1860,22 +1872,22 @@
 void
 quartz_style_register_type (GTypeModule * module)
 {
-    static const GTypeInfo object_info = {
-	sizeof (QuartzStyleClass),
-	(GBaseInitFunc) NULL,
-	(GBaseFinalizeFunc) NULL,
-	(GClassInitFunc) quartz_style_class_init,
-	NULL,			/* class_finalize */
-	NULL,			/* class_data */
-	sizeof (QuartzStyle),
-	0,			/* n_preallocs */
-	(GInstanceInitFunc) NULL,
-    };
-
-    quartz_type_style = g_type_module_register_type (module,
-								 GTK_TYPE_STYLE,
-								 "QuartzStyle",
-								 &object_info, 0);
+  static const GTypeInfo object_info = {
+    sizeof (QuartzStyleClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) quartz_style_class_init,
+    NULL,			/* class_finalize */
+    NULL,			/* class_data */
+    sizeof (QuartzStyle),
+    0,			/* n_preallocs */
+    (GInstanceInitFunc) NULL,
+  };
+
+  quartz_type_style = g_type_module_register_type (module,
+                                                   GTK_TYPE_STYLE,
+                                                   "QuartzStyle",
+                                                   &object_info, 0);
 }
 
 void



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