8152968: JTree Collapse Buttons Clipped Off Under GTK

Reviewed-by: alexsch
This commit is contained in:
Semyon Sadetsky 2016-07-08 20:28:28 +03:00
parent 190b31b133
commit 876a0a5b94
3 changed files with 13 additions and 4 deletions

View File

@ -1339,14 +1339,14 @@ class GTKPainter extends SynthPainter {
Graphics g, int state, int x, int y, int w, int h) {
ENGINE.paintExpander(g, context, Region.TREE,
GTKLookAndFeel.synthStateToGTKState(context.getRegion(), state),
ExpanderStyle.EXPANDED, "treeview", x, y, w, h);
ExpanderStyle.EXPANDED, "expander", x, y, w, h);
}
public void paintTreeCollapsedIcon(SynthContext context,
Graphics g, int state, int x, int y, int w, int h) {
ENGINE.paintExpander(g, context, Region.TREE,
GTKLookAndFeel.synthStateToGTKState(context.getRegion(), state),
ExpanderStyle.COLLAPSED, "treeview", x, y, w, h);
ExpanderStyle.COLLAPSED, "expander", x, y, w, h);
}
public void paintCheckBoxIcon(SynthContext context,

View File

@ -854,6 +854,12 @@ class GTKStyle extends SynthStyle implements GTKConstants {
return indicatorSpacing + focusSize + focusPad;
} else if (GTKLookAndFeel.is3() && "ComboBox.forceOpaque".equals(key)) {
return true;
} else if ("Tree.expanderSize".equals(key)) {
Object value = getClassSpecificValue("expander-size");
if (value instanceof Integer) {
return (Integer)value + 4;
}
return null;
}
// Is it a stock icon ?
@ -1136,7 +1142,6 @@ class GTKStyle extends SynthStyle implements GTKConstants {
CLASS_SPECIFIC_MAP.put("Slider.thumbWidth", "slider-length");
CLASS_SPECIFIC_MAP.put("Slider.trackBorder", "trough-border");
CLASS_SPECIFIC_MAP.put("SplitPane.size", "handle-size");
CLASS_SPECIFIC_MAP.put("Tree.expanderSize", "expander-size");
CLASS_SPECIFIC_MAP.put("ScrollBar.thumbHeight", "slider-width");
CLASS_SPECIFIC_MAP.put("ScrollBar.width", "slider-width");
CLASS_SPECIFIC_MAP.put("TextArea.caretForeground", "cursor-color");

View File

@ -1586,13 +1586,17 @@ static void gtk3_paint_expander(WidgetType widget_type, GtkStateType state_type,
fp_gtk_style_context_save (context);
GtkStateFlags flags = get_gtk_flags(state_type);
if (expander_style == GTK_EXPANDER_EXPANDED) {
flags |= GTK_STATE_FLAG_ACTIVE;
}
fp_gtk_style_context_set_state(context, flags);
if (detail != 0) {
transform_detail_string(detail, context);
}
fp_gtk_render_expander (context, cr, x, y, width, height);
fp_gtk_render_expander (context, cr, x + 2, y + 2, width - 4, height - 4);
fp_gtk_style_context_restore (context);
}