refactor button ui, rename resources to work with image cache
|
Before Width: | Height: | Size: 464 B After Width: | Height: | Size: 464 B |
|
Before Width: | Height: | Size: 675 B After Width: | Height: | Size: 675 B |
|
Before Width: | Height: | Size: 490 B After Width: | Height: | Size: 490 B |
|
Before Width: | Height: | Size: 861 B After Width: | Height: | Size: 861 B |
|
Before Width: | Height: | Size: 661 B After Width: | Height: | Size: 661 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 161 B |
|
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 171 B |
|
Before Width: | Height: | Size: 330 B After Width: | Height: | Size: 330 B |
|
Before Width: | Height: | Size: 405 B After Width: | Height: | Size: 405 B |
|
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 400 B After Width: | Height: | Size: 400 B |
|
Before Width: | Height: | Size: 466 B After Width: | Height: | Size: 466 B |
|
Before Width: | Height: | Size: 677 B After Width: | Height: | Size: 677 B |
|
Before Width: | Height: | Size: 496 B After Width: | Height: | Size: 496 B |
|
Before Width: | Height: | Size: 857 B After Width: | Height: | Size: 857 B |
|
Before Width: | Height: | Size: 676 B After Width: | Height: | Size: 676 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.ide.ui.laf.intellij;
|
||||
|
||||
import com.intellij.ide.ui.laf.darcula.DarculaLaf;
|
||||
import com.intellij.ide.ui.laf.darcula.ui.DarculaButtonUI;
|
||||
import com.intellij.ui.Gray;
|
||||
import sun.swing.SwingUtilities2;
|
||||
@@ -34,21 +33,6 @@ public class MacIntelliJButtonUI extends DarculaButtonUI {
|
||||
private static Rectangle textRect = new Rectangle();
|
||||
private static Rectangle iconRect = new Rectangle();
|
||||
|
||||
private static final Icon LEFT = DarculaLaf.loadIcon("buttonLeft.png");
|
||||
private static final Icon RIGHT = DarculaLaf.loadIcon("buttonRight.png");
|
||||
private static final Icon MIDDLE = DarculaLaf.loadIcon("buttonMiddle.png");
|
||||
private static final Icon LEFT_SELECTED = DarculaLaf.loadIcon("selectedButtonLeft.png");
|
||||
private static final Icon RIGHT_SELECTED = DarculaLaf.loadIcon("selectedButtonRight.png");
|
||||
private static final Icon MIDDLE_SELECTED = DarculaLaf.loadIcon("selectedButtonMiddle.png");
|
||||
private static final Icon LEFT_FOCUSED = DarculaLaf.loadIcon("focusedButtonLeft.png");
|
||||
private static final Icon RIGHT_FOCUSED = DarculaLaf.loadIcon("focusedButtonRight.png");
|
||||
private static final Icon MIDDLE_FOCUSED = DarculaLaf.loadIcon("focusedButtonMiddle.png");
|
||||
private static final Icon LEFT_SELECTED_FOCUSED = DarculaLaf.loadIcon("focusedSelectedButtonLeft.png");
|
||||
private static final Icon RIGHT_SELECTED_FOCUSED = DarculaLaf.loadIcon("focusedSelectedButtonRight.png");
|
||||
private static final Icon MIDDLE_SELECTED_FOCUSED = DarculaLaf.loadIcon("focusedSelectedButtonMiddle.png");
|
||||
private static final Icon HELP_BUTTON = DarculaLaf.loadIcon("helpButton.png");
|
||||
private static final Icon HELP_BUTTON_FOCUSED = DarculaLaf.loadIcon("focusedHelpButton.png");
|
||||
|
||||
@SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"})
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new MacIntelliJButtonUI();
|
||||
@@ -59,7 +43,7 @@ public class MacIntelliJButtonUI extends DarculaButtonUI {
|
||||
int w = c.getWidth();
|
||||
int h = c.getHeight();
|
||||
if (isHelpButton(c)) {
|
||||
Icon icon = c.hasFocus() ? HELP_BUTTON_FOCUSED : HELP_BUTTON;
|
||||
Icon icon = MacIntelliJIconCache.getIcon("helpButton", false, c.hasFocus(), false);
|
||||
int x = (w - icon.getIconWidth()) / 2;
|
||||
int y = (h - icon.getIconHeight()) / 2;
|
||||
icon.paintIcon(c, g, x, y);
|
||||
@@ -79,22 +63,19 @@ public class MacIntelliJButtonUI extends DarculaButtonUI {
|
||||
int x = isFocused ? 0 : 2;
|
||||
int y = isFocused ? 0 : (h - viewRect.height) / 2;
|
||||
Icon icon;
|
||||
icon = isDefault ? isFocused ? LEFT_SELECTED_FOCUSED : LEFT_SELECTED
|
||||
: isFocused ? LEFT_FOCUSED : LEFT;
|
||||
icon = MacIntelliJIconCache.getIcon("buttonLeft", isDefault, isFocused, false);
|
||||
icon.paintIcon(b, g, x, y);
|
||||
x += icon.getIconWidth();
|
||||
int stop = w - (isFocused ? 0 : 2) - (isFocused ? RIGHT_FOCUSED.getIconWidth() : RIGHT.getIconWidth());
|
||||
int stop = w - (isFocused ? 0 : 2) - (MacIntelliJIconCache.getIcon("buttonRight", isDefault, isFocused, false).getIconWidth());
|
||||
Graphics gg = g.create(0, 0, w, h);
|
||||
gg.setClip(x, y, stop - x, h);
|
||||
icon = isDefault ? isFocused ? MIDDLE_SELECTED_FOCUSED : MIDDLE_SELECTED
|
||||
: isFocused ? MIDDLE_FOCUSED : MIDDLE;
|
||||
icon = MacIntelliJIconCache.getIcon("buttonMiddle", isDefault, isFocused, false);
|
||||
while (x < stop) {
|
||||
icon.paintIcon(b, gg, x, y);
|
||||
x += icon.getIconWidth();
|
||||
}
|
||||
gg.dispose();
|
||||
icon = isDefault ? isFocused ? RIGHT_SELECTED_FOCUSED : RIGHT_SELECTED
|
||||
: isFocused ? RIGHT_FOCUSED : RIGHT;
|
||||
icon = MacIntelliJIconCache.getIcon("buttonRight", isDefault, isFocused, false);
|
||||
icon.paintIcon(b, g, stop, y);
|
||||
|
||||
clearTextShiftOffset();
|
||||
|
||||