mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
move win10 specific code from intellij laf
This commit is contained in:
@@ -15,10 +15,8 @@
|
||||
*/
|
||||
package com.intellij.ide.ui.laf.intellij;
|
||||
|
||||
import com.intellij.ide.ui.laf.IntelliJLaf;
|
||||
import com.intellij.ide.ui.laf.darcula.ui.DarculaCheckBoxUI;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
@@ -34,39 +32,6 @@ public class IntelliJCheckBoxUI extends DarculaCheckBoxUI {
|
||||
return new IntelliJCheckBoxUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawCheckIcon(JComponent c, Graphics2D g, JCheckBox b, Rectangle iconRect, boolean selected, boolean enabled) {
|
||||
if (!IntelliJLaf.isWindowsNativeLook()) {
|
||||
super.drawCheckIcon(c, g, b, iconRect, selected, enabled);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
final Color color = enabled ? b.getForeground() : getBorderColor1(false, false);
|
||||
g.setColor(color);
|
||||
|
||||
Rectangle r = new Rectangle(iconRect.x + JBUI.scale(2), iconRect.y + JBUI.scale(2), iconRect.width - JBUI.scale(4), iconRect.height - JBUI.scale(4));
|
||||
g.drawRect(r.x, r.y, r.width, r.height);
|
||||
|
||||
if (selected) {
|
||||
final int x1 = r.x + JBUI.scale(3);
|
||||
final int y1 = r.y + r.height / 2 + JBUI.scale(1);
|
||||
final int x2 = r.x + r.height / 2 - JBUI.scale(1);
|
||||
final int y2 = r.y + r.height - JBUI.scale(4);
|
||||
|
||||
final Graphics2D iconGraphics = (Graphics2D)g.create(0, 0, c.getWidth(), c.getHeight());
|
||||
iconGraphics.setColor(color);
|
||||
iconGraphics.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
|
||||
iconGraphics.setStroke(new BasicStroke(JBUI.scale(1.5f), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
|
||||
|
||||
if (enabled) {
|
||||
iconGraphics.drawLine(x1, y1, x2, y2);
|
||||
iconGraphics.drawLine(x2, y2, r.x + r.width - JBUI.scale(2), r.y + JBUI.scale(4));
|
||||
}
|
||||
iconGraphics.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintCheckSign(Graphics2D g, boolean enabled, int w, int h) {
|
||||
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
|
||||
@@ -85,13 +50,4 @@ public class IntelliJCheckBoxUI extends DarculaCheckBoxUI {
|
||||
g.drawLine(x1, y1 - 2, x2, y2 - 2);
|
||||
g.drawLine(x2, y2 - 2, w - JBUI.scale(2) - 1, JBUI.scale(5) - 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawText(JComponent c, Graphics2D g, JCheckBox b, FontMetrics fm, Rectangle textRect, String text) {
|
||||
super.drawText(c, g, b, fm, textRect, text);
|
||||
if (IntelliJLaf.isWindowsNativeLook() && b.hasFocus()) {
|
||||
g.setColor(b.getForeground());
|
||||
UIUtil.drawDottedRectangle(g, textRect.x-2, textRect.y-1, textRect.width + textRect.x + 1, textRect.height+3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.ide.ui.laf.intellij;
|
||||
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class WinIntelliJCheckBoxUI extends IntelliJCheckBoxUI {
|
||||
|
||||
@SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"})
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new WinIntelliJCheckBoxUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawCheckIcon(JComponent c, Graphics2D g, JCheckBox b, Rectangle iconRect, boolean selected, boolean enabled) {
|
||||
final Color color = enabled ? b.getForeground() : getBorderColor1(false, false);
|
||||
g.setColor(color);
|
||||
|
||||
Rectangle r = new Rectangle(iconRect.x + JBUI.scale(2), iconRect.y + JBUI.scale(2), iconRect.width - JBUI.scale(4), iconRect.height - JBUI.scale(4));
|
||||
g.drawRect(r.x, r.y, r.width, r.height);
|
||||
|
||||
if (selected) {
|
||||
final int x1 = r.x + JBUI.scale(3);
|
||||
final int y1 = r.y + r.height / 2 + JBUI.scale(1);
|
||||
final int x2 = r.x + r.height / 2 - JBUI.scale(1);
|
||||
final int y2 = r.y + r.height - JBUI.scale(4);
|
||||
|
||||
final Graphics2D iconGraphics = (Graphics2D)g.create(0, 0, c.getWidth(), c.getHeight());
|
||||
iconGraphics.setColor(color);
|
||||
iconGraphics.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
|
||||
iconGraphics.setStroke(new BasicStroke(JBUI.scale(1.5f), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
|
||||
|
||||
if (enabled) {
|
||||
iconGraphics.drawLine(x1, y1, x2, y2);
|
||||
iconGraphics.drawLine(x2, y2, r.x + r.width - JBUI.scale(2), r.y + JBUI.scale(4));
|
||||
}
|
||||
iconGraphics.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawText(JComponent c, Graphics2D g, JCheckBox b, FontMetrics fm, Rectangle textRect, String text) {
|
||||
super.drawText(c, g, b, fm, textRect, text);
|
||||
if (b.hasFocus()) {
|
||||
g.setColor(b.getForeground());
|
||||
UIUtil.drawDottedRectangle(g, textRect.x - 2, textRect.y - 1, textRect.width + textRect.x + 1, textRect.height + 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ ProgressBar.foreground=808080
|
||||
FormattedTextField.background=ffffff
|
||||
|
||||
|
||||
CheckBoxUI=com.intellij.ide.ui.laf.intellij.IntelliJCheckBoxUI
|
||||
CheckBoxUI=com.intellij.ide.ui.laf.intellij.WinIntelliJCheckBoxUI
|
||||
CheckBox.border=com.intellij.ide.ui.laf.darcula.ui.DarculaCheckBoxBorder
|
||||
CheckBox.darcula.inactiveFillColor=00000000
|
||||
CheckBox.darcula.borderColor1=444444
|
||||
|
||||
Reference in New Issue
Block a user