@Override Rectangle computeTrim(Theme theme, GC gc) { if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { int /*long*/ hTheme = OS.OpenThemeData(0, getClassId()); RECT rect = new RECT (); rect.left = clientArea.x; rect.right = clientArea.x + clientArea.width; rect.top = clientArea.y; rect.bottom = clientArea.y + clientArea.height; RECT extent = new RECT (); int[] part = getPartId(DrawData.WIDGET_WHOLE); OS.GetThemeBackgroundExtent(hTheme, gc.handle, part[0], part[1], rect, extent); OS.CloseThemeData(hTheme); if ((style & SWT.DROP_DOWN) != 0) { SIZE size = new SIZE(); part = getPartId(DrawData.TOOLITEM_ARROW); OS.GetThemePartSize(hTheme, 0, part[0], part[1], null, OS.TS_TRUE, size); extent.right = Math.max(extent.left, extent.right + size.cx); } else { extent.left -= INSET; extent.top -= INSET; extent.right += INSET; extent.bottom += INSET; } return new Rectangle(extent.left, extent.top, extent.right - extent.left, extent.bottom - extent.top); } return new Rectangle(0, 0, 0, 0); }
int state_type = getStateType(DrawData.WIDGET_WHOLE); int /*long*/ separatorHandle = theme.separatorHandle; byte[] detail = Converter.wcsToMbcs(null, "vseparator", true); int /*long*/ gtkStyle = gtk_widget_get_style (separatorHandle); theme.transferClipping(gc, gtkStyle); if ((parent.style & SWT.VERTICAL) != 0) { int /*long*/ gtkStyle = gtk_widget_get_style (buttonHandle); theme.transferClipping (gc, gtkStyle); int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); int state_type = getStateType(DrawData.WIDGET_WHOLE); gtk_render_box(gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, x, y, width, height); int arrow_y = y + (height - arrow_height) / 2; byte[] arrow_detail = Converter.wcsToMbcs(null, "arrow", true); gtk_render_arrow (gtkStyle, drawable, state_type, OS.GTK_SHADOW_NONE, null, theme.arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height); if (clientArea != null) { clientArea.width -= bounds.x + bounds.width - arrow_x; gtk_render_focus (gtkStyle, drawable, state_type, null, buttonHandle, detail, x, y, width, height);
@Override int hit(Theme theme, Point position, Rectangle bounds) { if (!bounds.contains(position)) return DrawData.WIDGET_NOWHERE; if ((style & SWT.DROP_DOWN) != 0) { int /*long*/ buttonHandle = theme.buttonHandle; int /*long*/ gtkStyle = gtk_widget_get_style (buttonHandle); int xthickness = OS.gtk_style_get_xthickness(gtkStyle); int interior_focus = theme.getWidgetProperty(buttonHandle, "interior-focus"); int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); int focus_padding = theme.getWidgetProperty(buttonHandle, "focus-padding"); int arrow_width = ARROW_WIDTH; int arrow_x = bounds.x + bounds.width - arrow_width - xthickness - focus_padding; if (interior_focus == 0) arrow_x -= focus_line_width; if (arrow_x <= position.x) return DrawData.TOOLITEM_ARROW; } return DrawData.WIDGET_WHOLE; }
int state_type = getStateType(DrawData.WIDGET_WHOLE); long /*int*/ separatorHandle = theme.separatorHandle; byte[] detail = Converter.wcsToMbcs(null, "vseparator", true); long /*int*/ gtkStyle = gtk_widget_get_style (separatorHandle); theme.transferClipping(gc, gtkStyle); if ((parent.style & SWT.VERTICAL) != 0) { long /*int*/ gtkStyle = gtk_widget_get_style (buttonHandle); theme.transferClipping (gc, gtkStyle); int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); int state_type = getStateType(DrawData.WIDGET_WHOLE); gtk_render_box(gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, x, y, width, height); int arrow_y = y + (height - arrow_height) / 2; byte[] arrow_detail = Converter.wcsToMbcs(null, "arrow", true); gtk_render_arrow (gtkStyle, drawable, state_type, OS.GTK_SHADOW_NONE, null, theme.arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height); if (clientArea != null) { clientArea.width -= bounds.x + bounds.width - arrow_x; gtk_render_focus (gtkStyle, drawable, state_type, null, buttonHandle, detail, x, y, width, height);
@Override int hit(Theme theme, Point position, Rectangle bounds) { if (!bounds.contains(position)) return DrawData.WIDGET_NOWHERE; if ((style & SWT.DROP_DOWN) != 0) { int /*long*/ buttonHandle = theme.buttonHandle; int /*long*/ gtkStyle = gtk_widget_get_style (buttonHandle); int xthickness = OS.gtk_style_get_xthickness(gtkStyle); int interior_focus = theme.getWidgetProperty(buttonHandle, "interior-focus"); int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); int focus_padding = theme.getWidgetProperty(buttonHandle, "focus-padding"); int arrow_width = ARROW_WIDTH; int arrow_x = bounds.x + bounds.width - arrow_width - xthickness - focus_padding; if (interior_focus == 0) arrow_x -= focus_line_width; if (arrow_x <= position.x) return DrawData.TOOLITEM_ARROW; } return DrawData.WIDGET_WHOLE; }
int state_type = getStateType(DrawData.WIDGET_WHOLE); int /*long*/ separatorHandle = theme.separatorHandle; byte[] detail = Converter.wcsToMbcs(null, "vseparator", true); int /*long*/ gtkStyle = gtk_widget_get_style (separatorHandle); theme.transferClipping(gc, gtkStyle); if ((parent.style & SWT.VERTICAL) != 0) { int /*long*/ gtkStyle = gtk_widget_get_style (buttonHandle); theme.transferClipping (gc, gtkStyle); int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); int state_type = getStateType(DrawData.WIDGET_WHOLE); gtk_render_box(gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, x, y, width, height); int arrow_y = y + (height - arrow_height) / 2; byte[] arrow_detail = Converter.wcsToMbcs(null, "arrow", true); gtk_render_arrow (gtkStyle, drawable, state_type, OS.GTK_SHADOW_NONE, null, theme.arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height); if (clientArea != null) { clientArea.width -= bounds.x + bounds.width - arrow_x; gtk_render_focus (gtkStyle, drawable, state_type, null, buttonHandle, detail, x, y, width, height);
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()); try { RECT rect = new RECT (); 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); if (code[0] == OS.HTNOWHERE) return DrawData.WIDGET_NOWHERE; if ((style & SWT.DROP_DOWN) != 0) { SIZE size = new SIZE(); part = getPartId(DrawData.TOOLITEM_ARROW); OS.GetThemePartSize(hTheme, 0, part[0], part[1], rect, OS.TS_TRUE, size); rect.left = Math.max(rect.left, rect.right - size.cx);
@Override int hit(Theme theme, Point position, Rectangle bounds) { if (!bounds.contains(position)) return DrawData.WIDGET_NOWHERE; if ((style & SWT.DROP_DOWN) != 0) { long /*int*/ buttonHandle = theme.buttonHandle; long /*int*/ gtkStyle = gtk_widget_get_style (buttonHandle); int xthickness = OS.gtk_style_get_xthickness(gtkStyle); int interior_focus = theme.getWidgetProperty(buttonHandle, "interior-focus"); int focus_line_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); int focus_padding = theme.getWidgetProperty(buttonHandle, "focus-padding"); int arrow_width = ARROW_WIDTH; int arrow_x = bounds.x + bounds.width - arrow_width - xthickness - focus_padding; if (interior_focus == 0) arrow_x -= focus_line_width; if (arrow_x <= position.x) return DrawData.TOOLITEM_ARROW; } return DrawData.WIDGET_WHOLE; }
@Override void draw(Theme theme, GC gc, Rectangle bounds) { if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { int /*long*/ hTheme = OS.OpenThemeData(0, getClassId()); RECT rect = new RECT (); rect.left = bounds.x; if ((style & SWT.DROP_DOWN) != 0) { size = new SIZE(); dropPart = getPartId(DrawData.TOOLITEM_ARROW); OS.GetThemePartSize(hTheme, gc.handle, dropPart[0], dropPart[1], rect, OS.TS_TRUE, size); rect.right -= size.cx; if (rect.right < rect.left) rect.right = rect.left; int[] part = getPartId(DrawData.WIDGET_WHOLE); OS.DrawThemeBackground(hTheme, gc.handle, part[0], part[1], rect, null); Rectangle clientArea = this.clientArea;
@Override Rectangle computeTrim(Theme theme, GC gc) { int /*long*/ buttonHandle = theme.buttonHandle; int /*long*/ gtkStyle = gtk_widget_get_style(buttonHandle); int focus_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); int focus_padding = theme.getWidgetProperty(buttonHandle, "focus-padding"); int xthickness = OS.gtk_style_get_xthickness(gtkStyle); int ythickness = OS.gtk_style_get_ythickness(gtkStyle); int borderX = xthickness + focus_width + focus_padding; int borderY = ythickness + focus_width + focus_padding; int x = clientArea.x - borderX; int y = clientArea.y - borderY; int width = clientArea.width + 2 * borderX; int height = clientArea.height + 2 * borderY; if ((style & SWT.DROP_DOWN) != 0) { width += ARROW_WIDTH; } return new Rectangle(x, y, width, height); }
@Override Rectangle computeTrim(Theme theme, GC gc) { int /*long*/ buttonHandle = theme.buttonHandle; int /*long*/ gtkStyle = gtk_widget_get_style(buttonHandle); int focus_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); int focus_padding = theme.getWidgetProperty(buttonHandle, "focus-padding"); int xthickness = OS.gtk_style_get_xthickness(gtkStyle); int ythickness = OS.gtk_style_get_ythickness(gtkStyle); int borderX = xthickness + focus_width + focus_padding; int borderY = ythickness + focus_width + focus_padding; int x = clientArea.x - borderX; int y = clientArea.y - borderY; int width = clientArea.width + 2 * borderX; int height = clientArea.height + 2 * borderY; if ((style & SWT.DROP_DOWN) != 0) { width += ARROW_WIDTH; } return new Rectangle(x, y, width, height); }
@Override Rectangle computeTrim(Theme theme, GC gc) { long /*int*/ buttonHandle = theme.buttonHandle; long /*int*/ gtkStyle = gtk_widget_get_style(buttonHandle); int focus_width = theme.getWidgetProperty(buttonHandle, "focus-line-width"); int focus_padding = theme.getWidgetProperty(buttonHandle, "focus-padding"); int xthickness = OS.gtk_style_get_xthickness(gtkStyle); int ythickness = OS.gtk_style_get_ythickness(gtkStyle); int borderX = xthickness + focus_width + focus_padding; int borderY = ythickness + focus_width + focus_padding; int x = clientArea.x - borderX; int y = clientArea.y - borderY; int width = clientArea.width + 2 * borderX; int height = clientArea.height + 2 * borderY; if ((style & SWT.DROP_DOWN) != 0) { width += ARROW_WIDTH; } return new Rectangle(x, y, width, height); }