@Override int hit(Theme theme, Point position, Rectangle bounds) { if (!(OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ())) return DrawData.WIDGET_NOWHERE; if (!bounds.contains(position)) return DrawData.WIDGET_NOWHERE; int /*long*/ hTheme = OS.OpenThemeData(0, getClassId()); RECT rect = new RECT (); rect.left = bounds.x; rect.right = bounds.x + bounds.width; rect.top = bounds.y; rect.bottom = bounds.y + bounds.height; POINT pt = new POINT(); pt.x = position.x; pt.y = position.y; short[] code = new short[1]; int[] part = getPartId(DrawData.WIDGET_WHOLE); OS.HitTestThemeBackground(hTheme, 0, part[0], part[1], 0, rect, 0, pt, code); OS.CloseThemeData (hTheme); return code[0] == OS.HTNOWHERE ? DrawData.WIDGET_NOWHERE : DrawData.WIDGET_WHOLE; }
if ((style & SWT.RADIO) != 0) { int /*long*/ radioButtonHandle = theme.radioButtonHandle; int /*long*/ gtkStyle = gtk_widget_get_style (radioButtonHandle); theme.transferClipping (gc, gtkStyle); int indicator_size = theme.getWidgetProperty(radioButtonHandle, "indicator-size"); prelight_width = bounds.width - (2 * border_width); prelight_height = bounds.height - (2 * border_width); gtk_render_frame (gtkStyle, drawable, OS.GTK_STATE_PRELIGHT, OS.GTK_SHADOW_ETCHED_OUT, null, radioButtonHandle, detail, prelight_x, prelight_y, prelight_width, prelight_height); int state_type = getStateType(DrawData.WIDGET_WHOLE); OS.gtk_paint_option(gtkStyle, drawable, state_type, shadow_type, null, radioButtonHandle, detail, x, y, indicator_size, indicator_size); if (clientArea != null) { prelight_width = bounds.width - (2 * border_width); prelight_height = bounds.height - (2 * border_width); gtk_render_frame (gtkStyle, drawable, OS.GTK_STATE_PRELIGHT, OS.GTK_SHADOW_ETCHED_OUT, null, checkButtonHandle, detail, prelight_x, prelight_y, prelight_width, prelight_height); int state_type = getStateType(DrawData.WIDGET_WHOLE); gtk_render_check (gtkStyle, drawable, state_type, shadow_type, checkButtonHandle, detail, x, y, indicator_size, indicator_size); if (clientArea != null) { clientArea.x = bounds.x + 2 * indicator_spacing + border_width + indicator_size; int /*long*/ gtkStyle = gtk_widget_get_style (buttonHandle); theme.transferClipping (gc, gtkStyle); int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); byte[] detail = Converter.wcsToMbcs(null, (state & DrawData.DEFAULTED) != 0 ? "buttondefault" : "button", true); if ((state & DrawData.DEFAULTED) != 0 && relief == OS.GTK_RELIEF_NORMAL) {
if ((style & SWT.RADIO) != 0) { long /*int*/ radioButtonHandle = theme.radioButtonHandle; long /*int*/ gtkStyle = gtk_widget_get_style (radioButtonHandle); theme.transferClipping (gc, gtkStyle); int indicator_size = theme.getWidgetProperty(radioButtonHandle, "indicator-size"); prelight_width = bounds.width - (2 * border_width); prelight_height = bounds.height - (2 * border_width); gtk_render_frame (gtkStyle, drawable, OS.GTK_STATE_PRELIGHT, OS.GTK_SHADOW_ETCHED_OUT, null, radioButtonHandle, detail, prelight_x, prelight_y, prelight_width, prelight_height); int state_type = getStateType(DrawData.WIDGET_WHOLE); OS.gtk_paint_option(gtkStyle, drawable, state_type, shadow_type, null, radioButtonHandle, detail, x, y, indicator_size, indicator_size); if (clientArea != null) { prelight_width = bounds.width - (2 * border_width); prelight_height = bounds.height - (2 * border_width); gtk_render_frame (gtkStyle, drawable, OS.GTK_STATE_PRELIGHT, OS.GTK_SHADOW_ETCHED_OUT, null, checkButtonHandle, detail, prelight_x, prelight_y, prelight_width, prelight_height); int state_type = getStateType(DrawData.WIDGET_WHOLE); gtk_render_check (gtkStyle, drawable, state_type, shadow_type, checkButtonHandle, detail, x, y, indicator_size, indicator_size); if (clientArea != null) { clientArea.x = bounds.x + 2 * indicator_spacing + border_width + indicator_size; long /*int*/ gtkStyle = gtk_widget_get_style (buttonHandle); theme.transferClipping (gc, gtkStyle); int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); byte[] detail = Converter.wcsToMbcs(null, (state & DrawData.DEFAULTED) != 0 ? "buttondefault" : "button", true); if ((state & DrawData.DEFAULTED) != 0 && relief == OS.GTK_RELIEF_NORMAL) {
if ((style & SWT.RADIO) != 0) { int /*long*/ radioButtonHandle = theme.radioButtonHandle; int /*long*/ gtkStyle = gtk_widget_get_style (radioButtonHandle); theme.transferClipping (gc, gtkStyle); int indicator_size = theme.getWidgetProperty(radioButtonHandle, "indicator-size"); prelight_width = bounds.width - (2 * border_width); prelight_height = bounds.height - (2 * border_width); gtk_render_frame (gtkStyle, drawable, OS.GTK_STATE_PRELIGHT, OS.GTK_SHADOW_ETCHED_OUT, null, radioButtonHandle, detail, prelight_x, prelight_y, prelight_width, prelight_height); int state_type = getStateType(DrawData.WIDGET_WHOLE); OS.gtk_paint_option(gtkStyle, drawable, state_type, shadow_type, null, radioButtonHandle, detail, x, y, indicator_size, indicator_size); if (clientArea != null) { prelight_width = bounds.width - (2 * border_width); prelight_height = bounds.height - (2 * border_width); gtk_render_frame (gtkStyle, drawable, OS.GTK_STATE_PRELIGHT, OS.GTK_SHADOW_ETCHED_OUT, null, checkButtonHandle, detail, prelight_x, prelight_y, prelight_width, prelight_height); int state_type = getStateType(DrawData.WIDGET_WHOLE); gtk_render_check (gtkStyle, drawable, state_type, shadow_type, checkButtonHandle, detail, x, y, indicator_size, indicator_size); if (clientArea != null) { clientArea.x = bounds.x + 2 * indicator_spacing + border_width + indicator_size; int /*long*/ gtkStyle = gtk_widget_get_style (buttonHandle); theme.transferClipping (gc, gtkStyle); int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); byte[] detail = Converter.wcsToMbcs(null, (state & DrawData.DEFAULTED) != 0 ? "buttondefault" : "button", true); if ((state & DrawData.DEFAULTED) != 0 && relief == OS.GTK_RELIEF_NORMAL) {
if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { int /*long*/ hTheme = OS.OpenThemeData(0, getClassId()); RECT rect = new RECT (); rect.left = bounds.x; rect.top = bounds.y; rect.bottom = bounds.y + bounds.height; int[] part = getPartId(DrawData.WIDGET_WHOLE); if ((style & (SWT.CHECK | SWT.RADIO)) != 0) { SIZE size = new SIZE();