mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-27 11:24:51 +00:00
8160448: Make GTK3 menus appearence similar to native
Reviewed-by: alexsch
This commit is contained in:
parent
7c91e56ca7
commit
0faa49fb23
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -49,16 +49,18 @@ class GTKGraphicsUtils extends SynthGraphicsUtils {
|
||||
int componentState = context.getComponentState();
|
||||
if ((componentState & SynthConstants.DISABLED) ==
|
||||
SynthConstants.DISABLED){
|
||||
Color orgColor = g.getColor();
|
||||
g.setColor(context.getStyle().getColor(context,
|
||||
GTKColorType.WHITE));
|
||||
x += 1;
|
||||
y += 1;
|
||||
super.paintText(context, g, text, x, y, mnemonicIndex);
|
||||
if (!GTKLookAndFeel.is3()) {
|
||||
Color orgColor = g.getColor();
|
||||
g.setColor(context.getStyle().getColor(context,
|
||||
GTKColorType.WHITE));
|
||||
x += 1;
|
||||
y += 1;
|
||||
super.paintText(context, g, text, x, y, mnemonicIndex);
|
||||
|
||||
g.setColor(orgColor);
|
||||
x -= 1;
|
||||
y -= 1;
|
||||
g.setColor(orgColor);
|
||||
x -= 1;
|
||||
y -= 1;
|
||||
}
|
||||
super.paintText(context, g, text, x, y, mnemonicIndex);
|
||||
}
|
||||
else {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -214,6 +214,18 @@ class GTKIconFactory {
|
||||
|
||||
Region region = context.getRegion();
|
||||
GTKStyle style = (GTKStyle) context.getStyle();
|
||||
if (GTKLookAndFeel.is3() && region == Region.MENU) {
|
||||
Object value = style.getClassSpecificValue("arrow-scaling");
|
||||
if (value instanceof Number) {
|
||||
iconDimension = (int)(((Number) value).floatValue() *
|
||||
(style.getFont(context).getSize2D() +
|
||||
2 * style.getClassSpecificIntValue(context,
|
||||
"indicator-spacing", DEFAULT_ICON_SPACING)));
|
||||
if (iconDimension > 0) {
|
||||
return iconDimension;
|
||||
}
|
||||
}
|
||||
}
|
||||
iconDimension = style.getClassSpecificIntValue(context,
|
||||
"indicator-size",
|
||||
(region == Region.CHECK_BOX_MENU_ITEM ||
|
||||
|
||||
@ -649,10 +649,19 @@ class GTKPainter extends SynthPainter {
|
||||
y += insets.top;
|
||||
if (orientation == JSeparator.HORIZONTAL) {
|
||||
w -= (insets.left + insets.right);
|
||||
detail = "hseparator";
|
||||
} else {
|
||||
h -= (insets.top + insets.bottom);
|
||||
detail = "vseparator";
|
||||
}
|
||||
if (GTKLookAndFeel.is3()) {
|
||||
if (id == Region.POPUP_MENU_SEPARATOR) {
|
||||
detail = "menuitem";
|
||||
h -= (insets.top + insets.bottom);
|
||||
} else {
|
||||
detail = "separator";
|
||||
}
|
||||
} else {
|
||||
detail = orientation == JSeparator.HORIZONTAL ?
|
||||
"hseparator" : "vseparator";
|
||||
}
|
||||
synchronized (UNIXToolkit.GTK_LOCK) {
|
||||
if (! ENGINE.paintCachedImage(g, x, y, w, h, id, state,
|
||||
@ -1381,8 +1390,13 @@ class GTKPainter extends SynthPainter {
|
||||
if (gtkState == SynthConstants.MOUSE_OVER) {
|
||||
shadow = ShadowType.IN;
|
||||
}
|
||||
if (!GTKLookAndFeel.is3()) {
|
||||
x += 3;
|
||||
y += 3;
|
||||
w = h = 7;
|
||||
}
|
||||
ENGINE.paintArrow(g, context, Region.MENU_ITEM, gtkState, shadow,
|
||||
dir, "menuitem", x + 3, y + 3, 7, 7);
|
||||
dir, "menuitem", x, y, w, h);
|
||||
}
|
||||
|
||||
public void paintCheckBoxMenuItemCheckIcon(SynthContext context,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user