@Override void draw(Theme theme, GC gc, Rectangle bounds) { int /*long*/ buttonHandle = theme.buttonHandle; int /*long*/ gtkStyle = gtk_widget_get_style(buttonHandle); int /*long*/ drawable = gc.getGCData().drawable; theme.transferClipping(gc, gtkStyle); int state_type = getStateType(DrawData.COMBO_ARROW); if (relief != OS.GTK_RELIEF_NONE || ((state[DrawData.COMBO_ARROW] & (DrawData.PRESSED | DrawData.HOT)) != 0)) { byte[] detail = Converter.wcsToMbcs(null, "button", true); gtk_render_box (gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, arrow_button_x, y, arrow_button_width, height); gtk_render_arrow (gtkStyle, drawable, state_type, OS.GTK_SHADOW_OUT, null, arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height); gtkStyle = gtk_widget_get_style(entryHandle); theme.transferClipping(gc, gtkStyle); state_type = getStateType(DrawData.WIDGET_WHOLE); byte[] detail = Converter.wcsToMbcs(null, "entry", true); gtk_render_shadow (gtkStyle, drawable, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_IN, null, entryHandle, detail, x, y, width - arrow_button_width, height); xthickness = OS.gtk_style_get_xthickness(gtkStyle); ythickness = OS.gtk_style_get_xthickness(gtkStyle); height -= 2 * ythickness; detail = Converter.wcsToMbcs(null, "entry_bg", true); gtk_render_frame (gtkStyle, drawable, state_type, OS.GTK_SHADOW_NONE, null, entryHandle, detail, x, y, width - arrow_button_width, height);
rect.top = bounds.y; rect.bottom = bounds.y + bounds.height; int[] part = getPartId(DrawData.WIDGET_WHOLE); OS.DrawThemeBackground (hTheme, gc.handle, part[0], part[1], rect, null); RECT contentRect = new RECT(); hTheme = OS.OpenThemeData(0, getClassId()); int width = OS.GetThemeSysSize(hTheme, OS.SM_CXVSCROLL); rect.left = contentRect.right - width; rect.right = contentRect.right; rect.bottom = contentRect.bottom; part = getPartId(DrawData.COMBO_ARROW); OS.DrawThemeBackground (hTheme, gc.handle, part[0], part[1], rect, null); OS.CloseThemeData(hTheme);
@Override int hit(Theme theme, Point position, Rectangle bounds) { if (!bounds.contains(position)) return DrawData.WIDGET_NOWHERE; long /*int*/ buttonHandle = theme.buttonHandle; long /*int*/ gtkStyle = gtk_widget_get_style(buttonHandle); 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 xthickness = OS.gtk_style_get_xthickness(gtkStyle); // int ythickness = OS.gtk_style_get_xthickness(gtkStyle); int arrow_width = MIN_ARROW_SIZE; int x_border = xthickness + focus_padding; //int y_border = ythickness + focus_padding; if (interior_focus == 0) { x_border += focus_line_width; //y_border += focus_line_width; } int arrow_button_width = arrow_width + x_border * 2; int arrow_button_x = bounds.x + bounds.width - arrow_button_width; Rectangle arrowRect = new Rectangle(arrow_button_x, bounds.y, arrow_button_width, bounds.height); if (arrowRect.contains(position)) return DrawData.COMBO_ARROW; return DrawData.WIDGET_WHOLE; }
@Override int hit(Theme theme, Point position, Rectangle bounds) { if (!bounds.contains(position)) return DrawData.WIDGET_NOWHERE; int /*long*/ buttonHandle = theme.buttonHandle; int /*long*/ gtkStyle = gtk_widget_get_style(buttonHandle); 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 xthickness = OS.gtk_style_get_xthickness(gtkStyle); // int ythickness = OS.gtk_style_get_xthickness(gtkStyle); int arrow_width = MIN_ARROW_SIZE; int x_border = xthickness + focus_padding; //int y_border = ythickness + focus_padding; if (interior_focus == 0) { x_border += focus_line_width; //y_border += focus_line_width; } int arrow_button_width = arrow_width + x_border * 2; int arrow_button_x = bounds.x + bounds.width - arrow_button_width; Rectangle arrowRect = new Rectangle(arrow_button_x, bounds.y, arrow_button_width, bounds.height); if (arrowRect.contains(position)) return DrawData.COMBO_ARROW; return DrawData.WIDGET_WHOLE; }
@Override void draw(Theme theme, GC gc, Rectangle bounds) { int /*long*/ buttonHandle = theme.buttonHandle; int /*long*/ gtkStyle = gtk_widget_get_style(buttonHandle); int /*long*/ drawable = gc.getGCData().drawable; theme.transferClipping(gc, gtkStyle); int state_type = getStateType(DrawData.COMBO_ARROW); if (relief != OS.GTK_RELIEF_NONE || ((state[DrawData.COMBO_ARROW] & (DrawData.PRESSED | DrawData.HOT)) != 0)) { byte[] detail = Converter.wcsToMbcs(null, "button", true); gtk_render_box (gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, arrow_button_x, y, arrow_button_width, height); gtk_render_arrow (gtkStyle, drawable, state_type, OS.GTK_SHADOW_OUT, null, arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height); gtkStyle = gtk_widget_get_style(entryHandle); theme.transferClipping(gc, gtkStyle); state_type = getStateType(DrawData.WIDGET_WHOLE); byte[] detail = Converter.wcsToMbcs(null, "entry", true); gtk_render_shadow (gtkStyle, drawable, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_IN, null, entryHandle, detail, x, y, width - arrow_button_width, height); xthickness = OS.gtk_style_get_xthickness(gtkStyle); ythickness = OS.gtk_style_get_xthickness(gtkStyle); height -= 2 * ythickness; detail = Converter.wcsToMbcs(null, "entry_bg", true); gtk_render_frame (gtkStyle, drawable, state_type, OS.GTK_SHADOW_NONE, null, entryHandle, detail, x, y, width - arrow_button_width, height);
@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, EDIT); int[] part = getPartId(DrawData.WIDGET_WHOLE); int iPartId = part[0]; int iStateId = part[1]; RECT rect = new RECT (); rect.left = bounds.x; rect.right = bounds.x + bounds.width; rect.top = bounds.y; rect.bottom = bounds.y + bounds.height; RECT contentRect = new RECT(); OS.GetThemeBackgroundContentRect(hTheme, 0, iPartId, iStateId, rect, contentRect); OS.CloseThemeData(hTheme); hTheme = OS.OpenThemeData(0, getClassId()); int width = OS.GetThemeSysSize(hTheme, OS.SM_CXVSCROLL); OS.CloseThemeData(hTheme); Rectangle arrowRect = new Rectangle(contentRect.right - width, contentRect.top, contentRect.bottom - contentRect.top, width); if (arrowRect.contains(position)) return DrawData.COMBO_ARROW; return DrawData.WIDGET_WHOLE; }
@Override int hit(Theme theme, Point position, Rectangle bounds) { if (!bounds.contains(position)) return DrawData.WIDGET_NOWHERE; int /*long*/ buttonHandle = theme.buttonHandle; int /*long*/ gtkStyle = gtk_widget_get_style(buttonHandle); 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 xthickness = OS.gtk_style_get_xthickness(gtkStyle); // int ythickness = OS.gtk_style_get_xthickness(gtkStyle); int arrow_width = MIN_ARROW_SIZE; int x_border = xthickness + focus_padding; //int y_border = ythickness + focus_padding; if (interior_focus == 0) { x_border += focus_line_width; //y_border += focus_line_width; } int arrow_button_width = arrow_width + x_border * 2; int arrow_button_x = bounds.x + bounds.width - arrow_button_width; Rectangle arrowRect = new Rectangle(arrow_button_x, bounds.y, arrow_button_width, bounds.height); if (arrowRect.contains(position)) return DrawData.COMBO_ARROW; return DrawData.WIDGET_WHOLE; }
@Override void draw(Theme theme, GC gc, Rectangle bounds) { long /*int*/ buttonHandle = theme.buttonHandle; long /*int*/ gtkStyle = gtk_widget_get_style(buttonHandle); long /*int*/ drawable = gc.getGCData().drawable; theme.transferClipping(gc, gtkStyle); int state_type = getStateType(DrawData.COMBO_ARROW); if (relief != OS.GTK_RELIEF_NONE || ((state[DrawData.COMBO_ARROW] & (DrawData.PRESSED | DrawData.HOT)) != 0)) { byte[] detail = Converter.wcsToMbcs(null, "button", true); gtk_render_box (gtkStyle, drawable, state_type, shadow_type, null, buttonHandle, detail, arrow_button_x, y, arrow_button_width, height); gtk_render_arrow (gtkStyle, drawable, state_type, OS.GTK_SHADOW_OUT, null, arrowHandle, arrow_detail, OS.GTK_ARROW_DOWN, true, arrow_x, arrow_y, arrow_width, arrow_height); gtkStyle = gtk_widget_get_style(entryHandle); theme.transferClipping(gc, gtkStyle); state_type = getStateType(DrawData.WIDGET_WHOLE); byte[] detail = Converter.wcsToMbcs(null, "entry", true); gtk_render_shadow (gtkStyle, drawable, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_IN, null, entryHandle, detail, x, y, width - arrow_button_width, height); xthickness = OS.gtk_style_get_xthickness(gtkStyle); ythickness = OS.gtk_style_get_xthickness(gtkStyle); height -= 2 * ythickness; detail = Converter.wcsToMbcs(null, "entry_bg", true); gtk_render_frame (gtkStyle, drawable, state_type, OS.GTK_SHADOW_NONE, null, entryHandle, detail, x, y, width - arrow_button_width, height);