aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorRodney Dawes <dobey@ximian.com>2003-12-23 01:31:46 +0800
committerRodney Dawes <dobey@src.gnome.org>2003-12-23 01:31:46 +0800
commit1e0a5a8fa1c2e36347a7ecb361a3824b1690ac28 (patch)
tree52178999d7a39fce46e964dff3fe0566f78aa1f1 /widgets
parent412fb3d0c449250fa36116fe06af6dc52313e185 (diff)
downloadgsoc2013-evolution-1e0a5a8fa1c2e36347a7ecb361a3824b1690ac28.tar.gz
gsoc2013-evolution-1e0a5a8fa1c2e36347a7ecb361a3824b1690ac28.tar.zst
gsoc2013-evolution-1e0a5a8fa1c2e36347a7ecb361a3824b1690ac28.zip
Fix for bug #46349
2003-12-22 Rodney Dawes <dobey@ximian.com> Fix for bug #46349 * e-combo-button.c: Use the appropriate style painting for a button widget, since we are a button svn path=/trunk/; revision=24002
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/ChangeLog7
-rw-r--r--widgets/misc/e-combo-button.c102
2 files changed, 74 insertions, 35 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index bbc66fd5c1..975778b0e4 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,10 @@
+2003-12-22 Rodney Dawes <dobey@ximian.com>
+
+ Fix for bug #46349
+
+ * e-combo-button.c: Use the appropriate style painting for a
+ button widget, since we are a button
+
2003-12-18 Harry Lu <harry.lu@sun.com>
* e-cell-date-edit.c: (e_cell_date_edit_do_popup): call
diff --git a/widgets/misc/e-combo-button.c b/widgets/misc/e-combo-button.c
index 5d77d9daf8..bffa0ea5a7 100644
--- a/widgets/misc/e-combo-button.c
+++ b/widgets/misc/e-combo-button.c
@@ -137,51 +137,83 @@ paint (EComboButton *combo_button,
GdkRectangle *area)
{
EComboButtonPrivate *priv = combo_button->priv;
+ GtkWidget *widget = GTK_WIDGET (combo_button);
GtkShadowType shadow_type;
+ gboolean interior_focus;
int separator_x;
+ int focus_width, focus_pad;
+ int x, y, width, height;
+ int border_width;
- gdk_window_set_back_pixmap (GTK_WIDGET (combo_button)->window, NULL, TRUE);
- gdk_window_clear_area (GTK_WIDGET (combo_button)->window,
- area->x, area->y,
- area->width, area->height);
+ if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
+ shadow_type = GTK_SHADOW_IN;
+ else if (GTK_BUTTON (widget)->relief == GTK_RELIEF_NONE
+ && GTK_WIDGET_STATE (widget) != GTK_STATE_PRELIGHT)
+ shadow_type = GTK_SHADOW_NONE;
+ else
+ shadow_type = GTK_SHADOW_OUT;
- /* Only paint the outline if we are in prelight state. */
- if (GTK_WIDGET_STATE (combo_button) != GTK_STATE_PRELIGHT
- && GTK_WIDGET_STATE (combo_button) != GTK_STATE_ACTIVE)
- return;
+ border_width = GTK_CONTAINER (widget)->border_width;
+
+ x = widget->allocation.x + border_width;
+ y = widget->allocation.y + border_width;
+ width = widget->allocation.width - border_width * 2;
+ height = widget->allocation.height - border_width * 2;
separator_x = (priv->label->allocation.width
+ priv->label->allocation.x
+ priv->arrow_pixmap->allocation.x) / 2;
- if (GTK_WIDGET_STATE (combo_button) == GTK_STATE_ACTIVE)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
+ gtk_widget_style_get (GTK_WIDGET (widget),
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ "interior-focus", &interior_focus,
+ NULL);
+
+ if (GTK_WIDGET_HAS_DEFAULT (widget)
+ && GTK_BUTTON (widget)->relief == GTK_RELIEF_NORMAL)
+ gtk_paint_box (widget->style, widget->window,
+ GTK_STATE_NORMAL, GTK_SHADOW_IN,
+ area, widget, "buttondefault",
+ x, y, width, height);
+
+ if (!interior_focus && GTK_WIDGET_HAS_FOCUS (widget)) {
+ x += focus_width + focus_pad;
+ y += focus_width + focus_pad;
+ width -= 2 * (focus_width + focus_pad);
+ height -= 2 * (focus_width + focus_pad);
+ }
+
+ if (GTK_WIDGET_STATE (widget) != GTK_STATE_ACTIVE
+ || GTK_BUTTON (widget)->depressed) {
+ gtk_paint_box (widget->style, widget->window,
+ GTK_WIDGET_STATE (widget), shadow_type,
+ area, widget, "button",
+ x, y, separator_x, height);
+ gtk_paint_box (widget->style, widget->window,
+ GTK_WIDGET_STATE (widget), shadow_type,
+ area, widget, "button",
+ separator_x, y, width - separator_x, height);
+ }
- gtk_paint_box (GTK_WIDGET (combo_button)->style,
- GTK_WIDGET (combo_button)->window,
- GTK_STATE_PRELIGHT,
- shadow_type,
- area,
- GTK_WIDGET (combo_button),
- "button",
- 0,
- 0,
- separator_x,
- GTK_WIDGET (combo_button)->allocation.height);
-
- gtk_paint_box (GTK_WIDGET (combo_button)->style,
- GTK_WIDGET (combo_button)->window,
- GTK_STATE_PRELIGHT,
- shadow_type,
- area,
- GTK_WIDGET (combo_button),
- "button",
- separator_x,
- 0,
- GTK_WIDGET (combo_button)->allocation.width - separator_x,
- GTK_WIDGET (combo_button)->allocation.height);
+ if (GTK_WIDGET_HAS_FOCUS (widget)) {
+ if (interior_focus) {
+ x += widget->style->xthickness + focus_pad;
+ y += widget->style->ythickness + focus_pad;
+ width -= 2 * (widget->style->xthickness + focus_pad);
+ height -= 2 * (widget->style->xthickness + focus_pad);
+ } else {
+ x -= focus_width + focus_pad;
+ y -= focus_width + focus_pad;
+ width += 2 * (focus_width + focus_pad);
+ height += 2 * (focus_width + focus_pad);
+ }
+
+ gtk_paint_focus (widget->style, widget->window,
+ GTK_WIDGET_STATE (widget),
+ area, widget, "button",
+ x, y, width, height);
+ }
}