]> Pileus Git - ~andy/gtk/commitdiff
Bug 112647 (Bill Haneman, patch by Narayana Pattipati):
authorMatthias Clasen <maclas@gmx.de>
Sat, 21 Feb 2004 23:25:29 +0000 (23:25 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sat, 21 Feb 2004 23:25:29 +0000 (23:25 +0000)
Sun Feb 22 00:23:40 2004  Matthias Clasen  <maclas@gmx.de>

Bug 112647 (Bill Haneman, patch by Narayana Pattipati):

* gtk/gtkcheckmenuitem.c: Introduce a new style property
indicator_size and use it instead of the hardcoded value.

* gtk/gtkmenu.c (gtk_menu_size_request): Make sure each menu
item gets enough vertical space for the label and the indicator.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkcheckmenuitem.c
gtk/gtkmenu.c

index 9dc29595fa8d3388b06be5f3372741ec2800f46d..2e7bb78dbda4f3f572c8508c547d4d75e75f8826 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Sun Feb 22 00:23:40 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Bug 112647 (Bill Haneman, patch by Narayana Pattipati):
+       
+       * gtk/gtkcheckmenuitem.c: Introduce a new style property 
+       indicator_size and use it instead of the hardcoded value.
+       
+       * gtk/gtkmenu.c (gtk_menu_size_request): Make sure each menu 
+       item gets enough vertical space for the label and the indicator.
+
 Sat Feb 21 20:20:11 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtksettings.c (gtk_settings_class_init): Use P_ instead of
index 9dc29595fa8d3388b06be5f3372741ec2800f46d..2e7bb78dbda4f3f572c8508c547d4d75e75f8826 100644 (file)
@@ -1,3 +1,13 @@
+Sun Feb 22 00:23:40 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Bug 112647 (Bill Haneman, patch by Narayana Pattipati):
+       
+       * gtk/gtkcheckmenuitem.c: Introduce a new style property 
+       indicator_size and use it instead of the hardcoded value.
+       
+       * gtk/gtkmenu.c (gtk_menu_size_request): Make sure each menu 
+       item gets enough vertical space for the label and the indicator.
+
 Sat Feb 21 20:20:11 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtksettings.c (gtk_settings_class_init): Use P_ instead of
index 9dc29595fa8d3388b06be5f3372741ec2800f46d..2e7bb78dbda4f3f572c8508c547d4d75e75f8826 100644 (file)
@@ -1,3 +1,13 @@
+Sun Feb 22 00:23:40 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Bug 112647 (Bill Haneman, patch by Narayana Pattipati):
+       
+       * gtk/gtkcheckmenuitem.c: Introduce a new style property 
+       indicator_size and use it instead of the hardcoded value.
+       
+       * gtk/gtkmenu.c (gtk_menu_size_request): Make sure each menu 
+       item gets enough vertical space for the label and the indicator.
+
 Sat Feb 21 20:20:11 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtksettings.c (gtk_settings_class_init): Use P_ instead of
index 9dc29595fa8d3388b06be5f3372741ec2800f46d..2e7bb78dbda4f3f572c8508c547d4d75e75f8826 100644 (file)
@@ -1,3 +1,13 @@
+Sun Feb 22 00:23:40 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Bug 112647 (Bill Haneman, patch by Narayana Pattipati):
+       
+       * gtk/gtkcheckmenuitem.c: Introduce a new style property 
+       indicator_size and use it instead of the hardcoded value.
+       
+       * gtk/gtkmenu.c (gtk_menu_size_request): Make sure each menu 
+       item gets enough vertical space for the label and the indicator.
+
 Sat Feb 21 20:20:11 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtksettings.c (gtk_settings_class_init): Use P_ instead of
index 9dc29595fa8d3388b06be5f3372741ec2800f46d..2e7bb78dbda4f3f572c8508c547d4d75e75f8826 100644 (file)
@@ -1,3 +1,13 @@
+Sun Feb 22 00:23:40 2004  Matthias Clasen  <maclas@gmx.de>
+
+       Bug 112647 (Bill Haneman, patch by Narayana Pattipati):
+       
+       * gtk/gtkcheckmenuitem.c: Introduce a new style property 
+       indicator_size and use it instead of the hardcoded value.
+       
+       * gtk/gtkmenu.c (gtk_menu_size_request): Make sure each menu 
+       item gets enough vertical space for the label and the indicator.
+
 Sat Feb 21 20:20:11 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * gtk/gtksettings.c (gtk_settings_class_init): Use P_ instead of
index 1bcfd71aa07e49776450c1089f26dc3550e48f2e..e20a2ed157ecdc5af38cd3a7d4336f40d929f465 100644 (file)
@@ -29,8 +29,6 @@
 #include "gtkintl.h"
 #include "gtkmarshalers.h"
 
-#define CHECK_TOGGLE_SIZE 12
-
 enum {
   TOGGLED,
   LAST_SIGNAL
@@ -136,6 +134,16 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
                                                          FALSE,
                                                          G_PARAM_READWRITE));
   
+  gtk_widget_class_install_style_property (widget_class,
+                                           g_param_spec_int ("indicator_size",
+                                                             P_("Indicator Size")
+,
+                                                             P_("Size of check or radio indicator"),
+                                                             0,
+                                                             G_MAXINT,
+                                                             12,
+                                                             G_PARAM_READABLE));
+
   widget_class->expose_event = gtk_check_menu_item_expose;
   
   menu_item_class->activate = gtk_check_menu_item_activate;
@@ -241,14 +249,16 @@ gtk_check_menu_item_toggle_size_request (GtkMenuItem *menu_item,
                                         gint        *requisition)
 {
   guint toggle_spacing;
+  guint indicator_size;
   
   g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (menu_item));
   
   gtk_widget_style_get (GTK_WIDGET (menu_item),
                        "toggle_spacing", &toggle_spacing,
+                       "indicator_size", &indicator_size,
                        NULL);
-  
-  *requisition = CHECK_TOGGLE_SIZE + toggle_spacing;
+
+  *requisition = indicator_size + toggle_spacing;
 }
 
 void
@@ -406,7 +416,6 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
   GtkWidget *widget;
   GtkStateType state_type;
   GtkShadowType shadow_type;
-  gint width, height;
   gint x, y;
 
   if (GTK_WIDGET_DRAWABLE (check_menu_item))
@@ -415,17 +424,16 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
       guint toggle_size;
       guint toggle_spacing;
       guint horizontal_padding;
+      guint indicator_size;
       
       widget = GTK_WIDGET (check_menu_item);
 
       gtk_widget_style_get (GTK_WIDGET (check_menu_item),
                            "toggle_spacing", &toggle_spacing,
                            "horizontal_padding", &horizontal_padding,
+                           "indicator_size", &indicator_size,
                            NULL);
 
-      width = 8;
-      height = 8;
-
       toggle_size = GTK_MENU_ITEM (check_menu_item)->toggle_size;
       offset = GTK_CONTAINER (check_menu_item)->border_width + widget->style->xthickness;
       
@@ -435,16 +443,16 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
       if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
        {
          x = widget->allocation.x + offset + horizontal_padding +
-           (toggle_size - toggle_spacing - width) / 2;
+           (toggle_size - toggle_spacing - indicator_size) / 2;
        }
       else 
        {
          x = widget->allocation.x + widget->allocation.width -
            offset - horizontal_padding - toggle_size + toggle_spacing +
-           (toggle_size - toggle_spacing - width) / 2;
+           (toggle_size - toggle_spacing - indicator_size) / 2;
        }
       
-      y = widget->allocation.y + (widget->allocation.height - height) / 2;
+      y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
 
       if (check_menu_item->active ||
          check_menu_item->always_show_toggle ||
@@ -467,14 +475,14 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
              gtk_paint_option (widget->style, widget->window,
                                state_type, shadow_type,
                                area, widget, "option",
-                               x, y, width, height);
+                               x, y, indicator_size, indicator_size);
            }
          else
            {
              gtk_paint_check (widget->style, widget->window,
                               state_type, shadow_type,
                               area, widget, "check",
-                              x, y, width, height);
+                              x, y, indicator_size, indicator_size);
            }
        }
     }
index c7b7d04df31bb275a65fd53056cf4e79afec22af..bd53ad6ec46536c18325aeb1975bf70210af68cb 100644 (file)
@@ -2078,7 +2078,7 @@ gtk_menu_size_request (GtkWidget      *widget,
        part = child_requisition.width / (r - l);
        requisition->width = MAX (requisition->width, part);
 
-       part = child_requisition.height / (b - t);
+       part = MAX (child_requisition.height, toggle_size) / (b - t);
        priv->heights[t] = MAX (priv->heights[t], part);
     }