summaryrefslogtreecommitdiff
path: root/packages/gtk+/gtk+-2.6.4-1.osso7/gtkseparatortoolitem.c.diff
blob: 63203f7db6b5589ebf8ab0cbbe7a0bef1e5d1b0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
--- gtk+-2.6.4/gtk/gtkseparatortoolitem.c	2004-08-09 19:59:52.000000000 +0300
+++ gtk+-2.6.4/gtk/gtkseparatortoolitem.c	2005-04-06 16:19:37.937770944 +0300
@@ -29,6 +29,7 @@
 #include "gtktoolbar.h"
 
 #define MENU_ID "gtk-separator-tool-item-menu-id"
+#define HILDON_SEPARATOR_HEIGHT 40
 
 enum {
   PROP_0,
@@ -137,6 +138,18 @@
 							 P_("Whether the separator is drawn, or just blank"),
 							 TRUE,
 							 G_PARAM_READWRITE));
+  /* Hildon addition : some new style properties we need. */
+  gtk_widget_class_install_style_property(widget_class,
+					   g_param_spec_int ("separator_size",
+							      P_("Separator size"), P_("The thickness of the separator. -1 for default behaviour."),
+							     -1, G_MAXINT, -1, G_PARAM_READWRITE));
+
+  gtk_widget_class_install_style_property (widget_class,
+				   g_param_spec_boolean ("is_image",
+							 P_("Is separator an image or a line"),
+							 P_("Whether the separator is drawn as an image, or just as a line"),
+							 FALSE,
+							 G_PARAM_READWRITE));
   
   g_type_class_add_private (object_class, sizeof (GtkSeparatorToolItemPrivate));
 }
@@ -213,14 +226,26 @@
   GtkToolItem *item = GTK_TOOL_ITEM (widget);
   GtkOrientation orientation = gtk_tool_item_get_orientation (item);
   
+  /* Hildon modifications from here on:
+   * if the "separator_size" style property
+   * is the default value (it has not been set
+   * in resource files), use default gtk+ behaviour.
+   */
+  gint separator_size = -1;
+  
+  gtk_widget_style_get( widget, "separator_size", &separator_size, NULL );
+  
+  if (separator_size == -1)
+    separator_size = get_space_size (item);
+
   if (orientation == GTK_ORIENTATION_HORIZONTAL)
     {
-      requisition->width = get_space_size (item);
+      requisition->width = separator_size;
       requisition->height = 1;
     }
   else
     {
-      requisition->height = get_space_size (item);
+      requisition->height = separator_size;
       requisition->width = 1;
     }
 }
@@ -235,10 +260,30 @@
 
   if (priv->draw)
     {
+      gboolean is_image = FALSE;
       if (widget->parent && GTK_IS_TOOLBAR (widget->parent))
 	toolbar = GTK_TOOLBAR (widget->parent);
 
-      _gtk_toolbar_paint_space_line (widget, toolbar,
+      gtk_widget_style_get( widget, "is_image", &is_image, NULL );
+      if (is_image)
+      {
+        gint separator_size = -1;
+        GtkOrientation orientation = gtk_tool_item_get_orientation (GTK_TOOL_ITEM (widget));
+        
+        gtk_widget_style_get( widget, "separator_size", &separator_size, NULL );
+        
+        /* if style property not set, use gtk+
+         * default behaviour. */
+        if (separator_size == -1)
+          separator_size = get_space_size (GTK_TOOL_ITEM (widget));
+        	
+        gtk_paint_box( widget->style, widget->window, GTK_WIDGET_STATE(widget),
+          GTK_SHADOW_NONE, &event->area, widget,
+          orientation == GTK_ORIENTATION_HORIZONTAL ? "vertical" : "horizontal",
+          widget->allocation.x, widget->allocation.y + (widget->allocation.height - HILDON_SEPARATOR_HEIGHT) / 2,
+          separator_size, HILDON_SEPARATOR_HEIGHT );
+      } else
+        _gtk_toolbar_paint_space_line (widget, toolbar,
 				     &(event->area), &widget->allocation);
     }