From: <kr_...@us...> - 2004-05-05 21:09:56
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18961 Modified Files: gtkdropdownbutton.c gtkdropdowntoolbutton.c Log Message: move to GTK 2.4 Index: gtkdropdownbutton.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/gtkdropdownbutton.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gtkdropdownbutton.c 22 Aug 2003 21:45:08 -0000 1.1 --- gtkdropdownbutton.c 5 May 2004 21:09:47 -0000 1.2 *************** *** 95,98 **** --- 95,234 ---- }; + static const GtkBorder default_default_border = { 1, 1, 1, 1 }; + static const GtkBorder default_default_outside_border = { 0, 0, 0, 0 }; + + static void + gtk_button_get_props (GtkButton *button, + GtkBorder *default_border, + GtkBorder *default_outside_border, + gboolean *interior_focus) + { + GtkWidget *widget = GTK_WIDGET (button); + GtkBorder *tmp_border; + + if (default_border) + { + gtk_widget_style_get (widget, "default_border", &tmp_border, NULL); + + if (tmp_border) + { + *default_border = *tmp_border; + g_free (tmp_border); + } + else + *default_border = default_default_border; + } + + if (default_outside_border) + { + gtk_widget_style_get (widget, "default_outside_border", &tmp_border, NULL); + + if (tmp_border) + { + *default_outside_border = *tmp_border; + g_free (tmp_border); + } + else + *default_outside_border = default_default_outside_border; + } + + if (interior_focus) + gtk_widget_style_get (widget, "interior_focus", interior_focus, NULL); + } + + void _gtk_button_paint (GtkButton *button, + GdkRectangle *area, + GtkStateType state_type, + GtkShadowType shadow_type, + const gchar *main_detail, + const gchar *default_detail) + { + GtkWidget *widget; + gint width, height; + gint x, y; + gint border_width; + GtkBorder default_border; + GtkBorder default_outside_border; + gboolean interior_focus; + gint focus_width; + gint focus_pad; + + if (GTK_WIDGET_DRAWABLE (button)) + { + widget = GTK_WIDGET (button); + border_width = GTK_CONTAINER (widget)->border_width; + + gtk_button_get_props (button, &default_border, &default_outside_border, &interior_focus); + gtk_widget_style_get (GTK_WIDGET (widget), + "focus-line-width", &focus_width, + "focus-padding", &focus_pad, + NULL); + + 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; + + 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); + + x += default_border.left; + y += default_border.top; + width -= default_border.left + default_border.right; + height -= default_border.top + default_border.bottom; + } + else if (GTK_WIDGET_CAN_DEFAULT (widget)) + { + x += default_outside_border.left; + y += default_outside_border.top; + width -= default_outside_border.left + default_outside_border.right; + height -= default_outside_border.top + default_outside_border.bottom; + } + + 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 (button->relief != GTK_RELIEF_NONE || button->depressed || + GTK_WIDGET_STATE(widget) == GTK_STATE_PRELIGHT) + gtk_paint_box (widget->style, widget->window, + state_type, + shadow_type, area, widget, "button", + x, y, width, 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->ythickness + 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); + } + } + } + + static GtkButtonClass *parent_class = NULL; Index: gtkdropdowntoolbutton.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/gtkdropdowntoolbutton.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gtkdropdowntoolbutton.c 14 Dec 2003 10:51:39 -0000 1.2 --- gtkdropdowntoolbutton.c 5 May 2004 21:09:47 -0000 1.3 *************** *** 59,62 **** --- 59,66 ---- } + GtkWidget *_gtk_tool_button_get_button (GtkToolButton *button) + { + return GTK_BIN(button)->child; + } static void |