summaryrefslogtreecommitdiff
path: root/gtk/gtkoptionmenu.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-04-30 23:23:54 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-04-30 23:23:54 +0000
commit2d372c4053d512c1825f681326f6e4187c399e5a (patch)
treef88f272aef4068e7614f02c68b33584b27eac334 /gtk/gtkoptionmenu.c
parent483f2d520346952ed7f20d632b1a5967549d3a53 (diff)
downloadgdk-pixbuf-2d372c4053d512c1825f681326f6e4187c399e5a.tar.gz
Add an extra parameter use_text to gtk_paint_label() to deal with
Mon Apr 30 19:18:07 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkstyle.[ch] gtk/gtkaccellabel.c gtk/gtkcellrenderertext.c gtk/gtkhruler.c gtk/gtkhscale.c gtk/gtklabel.c gtk/gtkprogressbar.c gtk/gtkvruler.c gtk/gtkvscale.c: Add an extra parameter use_text to gtk_paint_label() to deal with style->bg[] vs style->text[]. * gtk/gtkbbox.c gtk/gtkdialog.c: Tweak padding some to deal with GtkWidget::interior_focus = TRUE better. * gtk/gtkbutton.c * gtk/gtkwidget.c (gtk_widget_style_get_valist): Remove G_VALUE_NO_COPY_CONTENTS, to correspond with the recent change that had to be made with g_object_get.
Diffstat (limited to 'gtk/gtkoptionmenu.c')
-rw-r--r--gtk/gtkoptionmenu.c63
1 files changed, 47 insertions, 16 deletions
diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c
index 6c8a18f4c..7343efffb 100644
--- a/gtk/gtkoptionmenu.c
+++ b/gtk/gtkoptionmenu.c
@@ -41,11 +41,13 @@ typedef struct _GtkOptionMenuProps GtkOptionMenuProps;
struct _GtkOptionMenuProps
{
+ gboolean interior_focus;
GtkRequisition indicator_size;
GtkBorder indicator_spacing;
};
static GtkOptionMenuProps default_props = {
+ FALSE,
{ 12, 8 },
{ 3, 7, 2, 2 } /* Left, right, top, bottom */
};
@@ -336,6 +338,7 @@ gtk_option_menu_get_props (GtkOptionMenu *option_menu,
gtk_widget_style_get (GTK_WIDGET (option_menu),
"indicator_size", &indicator_size,
"indicator_spacing", &indicator_spacing,
+ "interior_focus", &props->interior_focus,
NULL);
if (indicator_size)
@@ -439,19 +442,29 @@ gtk_option_menu_paint (GtkWidget *widget,
if (GTK_WIDGET_DRAWABLE (widget))
{
+ gint border_width = GTK_CONTAINER (widget)->border_width;
+
gtk_option_menu_get_props (GTK_OPTION_MENU (widget), &props);
- button_area.x = GTK_CONTAINER (widget)->border_width + 1;
- button_area.y = GTK_CONTAINER (widget)->border_width + 1;
- button_area.width = widget->allocation.width - button_area.x * 2;
- button_area.height = widget->allocation.height - button_area.y * 2;
+ button_area.x = border_width;
+ button_area.y = border_width;
+ button_area.width = widget->allocation.width - 2 * border_width;
+ button_area.height = widget->allocation.height - 2 * border_width;
- /* This is evil, and should be elimated here and in the button
- * code. The point is to clear the focus, and make it
- * sort of transparent if it isn't there.
- */
- gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
- gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height);
+ if (!props.interior_focus)
+ {
+ button_area.x += 1;
+ button_area.y += 1;
+ button_area.width -= 2;
+ button_area.height -= 2;
+
+ /* This is evil, and should be elimated here and in the button
+ * code. The point is to clear the focus, and make it
+ * sort of transparent if it isn't there.
+ */
+ gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
+ gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height);
+ }
gtk_paint_box(widget->style, widget->window,
GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
@@ -469,12 +482,30 @@ gtk_option_menu_paint (GtkWidget *widget,
props.indicator_size.width, props.indicator_size.height);
if (GTK_WIDGET_HAS_FOCUS (widget))
- gtk_paint_focus (widget->style, widget->window,
- area, widget, "button",
- button_area.x - 1,
- button_area.y - 1,
- button_area.width + 1,
- button_area.height + 1);
+ {
+ if (props.interior_focus)
+ {
+ button_area.x += widget->style->xthickness + 1;
+ button_area.y += widget->style->ythickness + 1;
+ button_area.width -= 2 * (widget->style->xthickness + 1)
+ + props.indicator_spacing.left + props.indicator_spacing.right + props.indicator_size.width;
+ button_area.height -= 2 * (widget->style->ythickness + 1);
+ }
+ else
+ {
+ button_area.x -= 1;
+ button_area.y -= 1;
+ button_area.width += 2;
+ button_area.height += 2;
+ }
+
+ gtk_paint_focus (widget->style, widget->window,
+ area, widget, "button",
+ button_area.x,
+ button_area.y,
+ button_area.width - 1,
+ button_area.height - 1);
+ }
}
}