summaryrefslogtreecommitdiff
path: root/gtk/gtkmenubar.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2001-06-04 23:15:51 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-06-04 23:15:51 +0000
commit1b3c9214371d89a4872574d700b86cb71d6eee56 (patch)
treecc6c602393a292313c61da2b246b5a6b4de2ff4d /gtk/gtkmenubar.c
parent9cc992b6e732fef6edf2153821354a6b1b6a5af6 (diff)
downloadgtk+-1b3c9214371d89a4872574d700b86cb71d6eee56.tar.gz
Handle case where we need to parse the xsetting as if it were an RC file
2001-05-10 Havoc Pennington <hp@redhat.com> * gtk/gtksettings.c (gtk_settings_get_property): Handle case where we need to parse the xsetting as if it were an RC file string. * gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial value of palette from settings, not from static variable * gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to xsettings translation table * gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because hardcoding the toolbar style conflicts with new customizable toolbar style philosophy (gtk_toolbar_class_init): add settings for default toolbar style; these are used unless the app specifically forces a toolbar style * gtk/gtksettings.c (settings_install_property_parser): only return at the start if we warn and parser == NULL * gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the palette changed handler so we don't notify dead color selections * gtk/gtkstyle.c (gtk_default_draw_shadow): handle xthickness/ythickness of 0 or 1 properly (gtk_default_draw_resize_grip): clear the background behind the resize grips, and align to bottom right if we square the area to be drawn. * gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on statusbar label to 1, so it doesn't make toplevels resize oddly (gtk_statusbar_size_request): add grip size to request (gtk_statusbar_size_allocate): hack so the hbox still works with the grip size in the request * gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix bug where showing all on a toplevel makes the toolbar button text appear despite the toolbar mode * gtk/gtkmenubar.c: add internal padding style property * gtk/gtktoolbar.c: Add internal padding style property; add shadow type style property * gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget state; and put Container::border_width outside the frame * gtk/gtktextview.c: don't draw focus rectangle if we're in interior focus mode, we just use blinking cursor
Diffstat (limited to 'gtk/gtkmenubar.c')
-rw-r--r--gtk/gtkmenubar.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index 9616638422..9965fef932 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -37,7 +37,7 @@
#define BORDER_SPACING 0
#define CHILD_SPACING 3
-
+#define DEFAULT_IPADDING 1
static void gtk_menu_bar_class_init (GtkMenuBarClass *klass);
static void gtk_menu_bar_size_request (GtkWidget *widget,
@@ -136,6 +136,16 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
GTK_TYPE_SHADOW_TYPE,
GTK_SHADOW_OUT,
G_PARAM_READABLE));
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_int ("internal_padding",
+ _("Internal padding"),
+ _("Amount of border space between the menubar shadow and the menu items"),
+ 0,
+ G_MAXINT,
+ DEFAULT_IPADDING,
+ G_PARAM_READABLE));
+
}
GtkWidget*
@@ -177,6 +187,7 @@ gtk_menu_bar_size_request (GtkWidget *widget,
GList *children;
gint nchildren;
GtkRequisition child_requisition;
+ gint ipadding;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MENU_BAR (widget));
@@ -184,7 +195,7 @@ gtk_menu_bar_size_request (GtkWidget *widget,
requisition->width = 0;
requisition->height = 0;
-
+
if (GTK_WIDGET_VISIBLE (widget))
{
menu_bar = GTK_MENU_BAR (widget);
@@ -222,11 +233,15 @@ gtk_menu_bar_size_request (GtkWidget *widget,
}
}
+ gtk_widget_style_get (widget, "internal_padding", &ipadding, NULL);
+
requisition->width += (GTK_CONTAINER (menu_bar)->border_width +
widget->style->xthickness +
+ ipadding +
BORDER_SPACING) * 2;
requisition->height += (GTK_CONTAINER (menu_bar)->border_width +
widget->style->ythickness +
+ ipadding +
BORDER_SPACING) * 2;
if (nchildren > 0)
@@ -245,6 +260,7 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
GtkAllocation child_allocation;
GtkRequisition child_requisition;
guint offset;
+ gint ipadding;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MENU_BAR (widget));
@@ -259,15 +275,19 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
allocation->x, allocation->y,
allocation->width, allocation->height);
+ gtk_widget_style_get (widget, "internal_padding", &ipadding, NULL);
+
if (menu_shell->children)
{
child_allocation.x = (GTK_CONTAINER (menu_bar)->border_width +
widget->style->xthickness +
+ ipadding +
BORDER_SPACING);
offset = child_allocation.x; /* Window edge to menubar start */
child_allocation.y = (GTK_CONTAINER (menu_bar)->border_width +
widget->style->ythickness +
+ ipadding +
BORDER_SPACING);
child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2);
@@ -314,13 +334,18 @@ gtk_menu_bar_paint (GtkWidget *widget, GdkRectangle *area)
if (GTK_WIDGET_DRAWABLE (widget))
{
+ gint border;
+
+ border = GTK_CONTAINER (widget)->border_width;
+
gtk_paint_box (widget->style,
widget->window,
- GTK_STATE_NORMAL,
+ GTK_WIDGET_STATE (widget),
get_shadow_type (GTK_MENU_BAR (widget)),
area, widget, "menubar",
- 0, 0,
- -1,-1);
+ border, border,
+ widget->allocation.width - border * 2,
+ widget->allocation.height - border * 2);
}
}