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