mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-14 06:17:47 -04:00
Animations on Scroll Bar
This commit is contained in:
parent
61afad30c8
commit
f4303a0480
@ -203,32 +203,6 @@ public class BEButtonUI extends BasicButtonUI implements Skin {
|
|||||||
dh -= (insets.top + insets.bottom);
|
dh -= (insets.top + insets.bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (toolbar)
|
|
||||||
//此状态下JToggleButton和JButton使用各自的背景实现,2012-10-16前无论是不是JToggleButton都是使用该种实是不太合理的
|
|
||||||
if (model.isRollover() || model.isPressed())
|
|
||||||
if (c instanceof JToggleButton)
|
|
||||||
BEToggleButtonUI.ICON_9.get("rollover").draw((Graphics2D) g, dx, dy, dw, dh);
|
|
||||||
else
|
|
||||||
ICON_9.get("pressed").draw((Graphics2D) g, dx, dy, dw, dh);
|
|
||||||
else if (model.isSelected())
|
|
||||||
BEToggleButtonUI.ICON_9.get("selected").draw((Graphics2D) g, dx, dy, dw, dh);
|
|
||||||
else {
|
|
||||||
//TODO 其它状态下的按钮背景样式需要完善,要不然看起来太硬!
|
|
||||||
// skin.paintSkin(g, dx, dy, dw, dh, state);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//TODO 其它状态下的按钮背景样式需要完善,要不然看起来太硬!
|
|
||||||
String key;
|
|
||||||
if (model.isArmed() && model.isPressed() || model.isSelected())
|
|
||||||
key = "pressed";
|
|
||||||
else if (!model.isEnabled())
|
|
||||||
key = "disabled";
|
|
||||||
else if (model.isRollover())
|
|
||||||
key = "rollover";
|
|
||||||
else
|
|
||||||
key = "normal";
|
|
||||||
ICON_9.get(key).draw((Graphics2D) g, dx, dy, dw, dh);
|
|
||||||
}*/
|
|
||||||
AnimationController.paintSkin(c, INSTANCE, g, dx, dy, dw, dh, getXPButtonState(b));
|
AnimationController.paintSkin(c, INSTANCE, g, dx, dy, dw, dh, getXPButtonState(b));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,7 +221,7 @@ public class BEButtonUI extends BasicButtonUI implements Skin {
|
|||||||
return toolbar ? Part.TP_BUTTON : Part.BP_PUSHBUTTON;
|
return toolbar ? Part.TP_BUTTON : Part.BP_PUSHBUTTON;
|
||||||
}
|
}
|
||||||
|
|
||||||
static State getXPButtonState(AbstractButton b) {
|
public static State getXPButtonState(AbstractButton b) {
|
||||||
Part part = getXPButtonType(b);
|
Part part = getXPButtonType(b);
|
||||||
ButtonModel model = b.getModel();
|
ButtonModel model = b.getModel();
|
||||||
State state = State.NORMAL;
|
State state = State.NORMAL;
|
||||||
@ -276,13 +250,13 @@ public class BEButtonUI extends BasicButtonUI implements Skin {
|
|||||||
else if (!model.isEnabled())
|
else if (!model.isEnabled())
|
||||||
state = State.DISABLED;
|
state = State.DISABLED;
|
||||||
else if (model.isSelected() && model.isRollover())
|
else if (model.isSelected() && model.isRollover())
|
||||||
state = State.HOTCHECKED;
|
state = State.ROLLOVERCHECKED;
|
||||||
else if (model.isSelected())
|
else if (model.isSelected())
|
||||||
state = State.CHECKED;
|
state = State.CHECKED;
|
||||||
else if (model.isRollover())
|
else if (model.isRollover())
|
||||||
state = State.HOT;
|
state = State.ROLLOVER;
|
||||||
else if (b.hasFocus())
|
else if (b.hasFocus())
|
||||||
state = State.HOT;
|
state = State.ROLLOVER;
|
||||||
} else
|
} else
|
||||||
if ((model.isArmed() && model.isPressed())
|
if ((model.isArmed() && model.isPressed())
|
||||||
|| model.isSelected())
|
|| model.isSelected())
|
||||||
@ -290,7 +264,7 @@ public class BEButtonUI extends BasicButtonUI implements Skin {
|
|||||||
else if (!model.isEnabled())
|
else if (!model.isEnabled())
|
||||||
state = State.DISABLED;
|
state = State.DISABLED;
|
||||||
else if (model.isRollover() || model.isPressed())
|
else if (model.isRollover() || model.isPressed())
|
||||||
state = State.HOT;
|
state = State.ROLLOVER;
|
||||||
else if (b instanceof JButton
|
else if (b instanceof JButton
|
||||||
&& ((JButton) b).isDefaultButton())
|
&& ((JButton) b).isDefaultButton())
|
||||||
state = State.DEFAULTED;
|
state = State.DEFAULTED;
|
||||||
@ -304,27 +278,7 @@ public class BEButtonUI extends BasicButtonUI implements Skin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paintSkinRaw(Graphics g, int dx, int dy, int dw, int dh, TMSchema.State state) {
|
public void paintSkinRaw(Graphics g, int dx, int dy, int dw, int dh, TMSchema.State state) {
|
||||||
String key;
|
ICON_9.get(state.toString()).draw((Graphics2D) g, dx, dy, dw, dh);
|
||||||
switch (state) {
|
|
||||||
case SELECTED:
|
|
||||||
key = "selected";
|
|
||||||
break;
|
|
||||||
case PRESSED:
|
|
||||||
key = "pressed";
|
|
||||||
break;
|
|
||||||
case DISABLED:
|
|
||||||
key = "disabled";
|
|
||||||
break;
|
|
||||||
case HOT:
|
|
||||||
key = "rollover";
|
|
||||||
break;
|
|
||||||
case NORMAL:
|
|
||||||
key = "normal";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ICON_9.get(key).draw((Graphics2D) g, dx, dy, dw, dh);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -183,7 +183,7 @@ public class BEComboBoxUI extends BasicComboBoxUI
|
|||||||
} else if (isPopupVisible(comboBox)) {
|
} else if (isPopupVisible(comboBox)) {
|
||||||
state = State.PRESSED;
|
state = State.PRESSED;
|
||||||
} else if (mouseInside) {
|
} else if (mouseInside) {
|
||||||
state = State.HOT;
|
state = State.ROLLOVER;
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
@ -198,7 +198,7 @@ public class BEComboBoxUI extends BasicComboBoxUI
|
|||||||
case DISABLED:
|
case DISABLED:
|
||||||
key = "disabled";
|
key = "disabled";
|
||||||
break;
|
break;
|
||||||
case HOT:
|
case ROLLOVER:
|
||||||
key = "rollover";
|
key = "rollover";
|
||||||
break;
|
break;
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
|
@ -24,8 +24,13 @@ import javax.swing.UIManager;
|
|||||||
import javax.swing.plaf.ComponentUI;
|
import javax.swing.plaf.ComponentUI;
|
||||||
import javax.swing.plaf.basic.BasicArrowButton;
|
import javax.swing.plaf.basic.BasicArrowButton;
|
||||||
import javax.swing.plaf.basic.BasicScrollBarUI;
|
import javax.swing.plaf.basic.BasicScrollBarUI;
|
||||||
|
import org.jackhuang.hmcl.laf.button.BEButtonUI;
|
||||||
|
import org.jackhuang.hmcl.laf.utils.AnimationController;
|
||||||
|
|
||||||
import org.jackhuang.hmcl.laf.utils.Icon9Factory;
|
import org.jackhuang.hmcl.laf.utils.Icon9Factory;
|
||||||
|
import org.jackhuang.hmcl.laf.utils.Skin;
|
||||||
|
import org.jackhuang.hmcl.laf.utils.TMSchema;
|
||||||
|
import org.jackhuang.hmcl.laf.utils.TMSchema.State;
|
||||||
import org.jackhuang.hmcl.util.ui.GraphicsUtils;
|
import org.jackhuang.hmcl.util.ui.GraphicsUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,7 +42,7 @@ import org.jackhuang.hmcl.util.ui.GraphicsUtils;
|
|||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @see com.sun.java.swing.plaf.windows.WindowsScrollBarUI
|
* @see com.sun.java.swing.plaf.windows.WindowsScrollBarUI
|
||||||
*/
|
*/
|
||||||
public class BEScrollBarUI extends BasicScrollBarUI {
|
public class BEScrollBarUI extends BasicScrollBarUI implements Skin {
|
||||||
|
|
||||||
public static final Icon9Factory ICON_9 = new Icon9Factory("scroll_bar");
|
public static final Icon9Factory ICON_9 = new Icon9Factory("scroll_bar");
|
||||||
|
|
||||||
@ -68,7 +73,7 @@ public class BEScrollBarUI extends BasicScrollBarUI {
|
|||||||
* up/down. It differs from BasicArrowButton in that the preferred size is
|
* up/down. It differs from BasicArrowButton in that the preferred size is
|
||||||
* always a square.
|
* always a square.
|
||||||
*/
|
*/
|
||||||
protected class BEArrowButton extends BasicArrowButton {
|
protected class BEArrowButton extends BasicArrowButton implements Skin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new windows arrow button.
|
* Instantiates a new windows arrow button.
|
||||||
@ -91,7 +96,6 @@ public class BEScrollBarUI extends BasicScrollBarUI {
|
|||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
Graphics2D g2 = (Graphics2D) g;
|
Graphics2D g2 = (Graphics2D) g;
|
||||||
String id = "arrow";
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case NORTH:
|
case NORTH:
|
||||||
break;
|
break;
|
||||||
@ -108,8 +112,7 @@ public class BEScrollBarUI extends BasicScrollBarUI {
|
|||||||
g2.rotate(Math.PI / 2);
|
g2.rotate(Math.PI / 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ICON_9.getWithScrollState(id, getModel().isPressed(), getModel().isRollover())
|
AnimationController.paintSkin(this, this, g, 0, 0, getWidth(), getHeight(), BEButtonUI.getXPButtonState(this));
|
||||||
.draw(g2, 0, 0, getWidth(), getHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -128,6 +131,16 @@ public class BEScrollBarUI extends BasicScrollBarUI {
|
|||||||
}
|
}
|
||||||
return new Dimension(size, size);
|
return new Dimension(size, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paintSkinRaw(Graphics g, int x, int y, int w, int h, TMSchema.State state) {
|
||||||
|
ICON_9.get("arrow", state.toString()).draw((Graphics2D) g, x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TMSchema.Part getPart(JComponent c) {
|
||||||
|
return TMSchema.Part.SBP_ARROWBTN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------- END
|
//----------------------------------------------------------------------------------- END
|
||||||
|
|
||||||
@ -148,10 +161,21 @@ public class BEScrollBarUI extends BasicScrollBarUI {
|
|||||||
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
|
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
|
||||||
if (thumbBounds.isEmpty() || !scrollbar.isEnabled())
|
if (thumbBounds.isEmpty() || !scrollbar.isEnabled())
|
||||||
return;
|
return;
|
||||||
Color color = GraphicsUtils.getWebColor(isDragging ? "#616161" : isThumbRollover() ? "#919191" : "#C2C2C2");
|
AnimationController.paintSkin(c, this, g, thumbBounds.x, thumbBounds.y, thumbBounds.width, thumbBounds.height, isDragging ? State.PRESSED : isThumbRollover() ? State.ROLLOVER : State.NORMAL);
|
||||||
g.setColor(color);
|
|
||||||
g.fillRect(thumbBounds.x, thumbBounds.y, thumbBounds.width, thumbBounds.height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paintSkinRaw(Graphics g, int x, int y, int w, int h, State state) {
|
||||||
|
Color color = GraphicsUtils.getWebColor(state == State.PRESSED ? "#616161" : state == State.ROLLOVER ? "#919191" : "#C2C2C2");
|
||||||
|
g.setColor(color);
|
||||||
|
g.fillRect(x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TMSchema.Part getPart(JComponent c) {
|
||||||
|
return TMSchema.Part.SBP_THUMBBTNHORZ;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------- END
|
//----------------------------------------------------------------------------------- END
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public class AnimationController implements ActionListener, PropertyChangeListen
|
|||||||
if (newState == State.DEFAULTED)
|
if (newState == State.DEFAULTED)
|
||||||
// it seems for DEFAULTED button state Vista does animation from
|
// it seems for DEFAULTED button state Vista does animation from
|
||||||
// HOT
|
// HOT
|
||||||
oldState = State.HOT;
|
oldState = State.ROLLOVER;
|
||||||
if (oldState != null) {
|
if (oldState != null) {
|
||||||
long duration;
|
long duration;
|
||||||
//if (newState == State.DEFAULTED) {
|
//if (newState == State.DEFAULTED) {
|
||||||
|
@ -136,7 +136,7 @@ public class Icon9Factory extends RawCache<NinePatch> {
|
|||||||
put("toggle_button", "selected", "toggle_button_selected");
|
put("toggle_button", "selected", "toggle_button_selected");
|
||||||
put("toggle_button", "rollover", "toggle_button_rover");
|
put("toggle_button", "rollover", "toggle_button_rover");
|
||||||
|
|
||||||
put("scroll_bar", "arrow", "arrow");
|
put("scroll_bar", "arrow_normal", "arrow");
|
||||||
put("scroll_bar", "arrow_rollover", "arrow_rover");
|
put("scroll_bar", "arrow_rollover", "arrow_rover");
|
||||||
put("scroll_bar", "arrow_pressed", "arrow_pressed");
|
put("scroll_bar", "arrow_pressed", "arrow_pressed");
|
||||||
put("scroll_bar", "scroll_pane_border", "scroll_pane_bg1");
|
put("scroll_bar", "scroll_pane_border", "scroll_pane_bg1");
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||||
*/
|
*/
|
||||||
package org.jackhuang.hmcl.laf.utils;
|
package org.jackhuang.hmcl.laf.utils;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||||
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
@ -41,7 +42,7 @@ package org.jackhuang.hmcl.laf.utils;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* <p>These classes are designed to be used while the
|
* <p>These classes are designed to be used while the
|
||||||
* corresponding <code>LookAndFeel</code> class has been installed
|
* corresponding <code>LookAndFeel</code> class has been installed
|
||||||
* (<code>UIManager.setLookAndFeel(new <i>XXX</i>LookAndFeel())</code>).
|
* (<code>UIManager.setLookAndFeel(new <i>XXX</i>LookAndFeel())</code>).
|
||||||
@ -55,7 +56,6 @@ package org.jackhuang.hmcl.laf.utils;
|
|||||||
* encouraged.
|
* encouraged.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -94,112 +94,95 @@ public class TMSchema {
|
|||||||
WINDOW
|
WINDOW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An enumeration of the Windows compoent parts
|
* An enumeration of the Windows compoent parts
|
||||||
*/
|
*/
|
||||||
public static enum Part {
|
public static enum Part {
|
||||||
MENU (Control.MENU, 0), // Special case, not in native
|
MENU(Control.MENU, 0), // Special case, not in native
|
||||||
MP_BARBACKGROUND (Control.MENU, 7),
|
MP_BARBACKGROUND(Control.MENU, 7),
|
||||||
MP_BARITEM (Control.MENU, 8),
|
MP_BARITEM(Control.MENU, 8),
|
||||||
MP_POPUPBACKGROUND (Control.MENU, 9),
|
MP_POPUPBACKGROUND(Control.MENU, 9),
|
||||||
MP_POPUPBORDERS (Control.MENU, 10),
|
MP_POPUPBORDERS(Control.MENU, 10),
|
||||||
MP_POPUPCHECK (Control.MENU, 11),
|
MP_POPUPCHECK(Control.MENU, 11),
|
||||||
MP_POPUPCHECKBACKGROUND (Control.MENU, 12),
|
MP_POPUPCHECKBACKGROUND(Control.MENU, 12),
|
||||||
MP_POPUPGUTTER (Control.MENU, 13),
|
MP_POPUPGUTTER(Control.MENU, 13),
|
||||||
MP_POPUPITEM (Control.MENU, 14),
|
MP_POPUPITEM(Control.MENU, 14),
|
||||||
MP_POPUPSEPARATOR (Control.MENU, 15),
|
MP_POPUPSEPARATOR(Control.MENU, 15),
|
||||||
MP_POPUPSUBMENU (Control.MENU, 16),
|
MP_POPUPSUBMENU(Control.MENU, 16),
|
||||||
|
BP_PUSHBUTTON(Control.BUTTON, 1),
|
||||||
BP_PUSHBUTTON (Control.BUTTON, 1),
|
|
||||||
BP_RADIOBUTTON(Control.BUTTON, 2),
|
BP_RADIOBUTTON(Control.BUTTON, 2),
|
||||||
BP_CHECKBOX (Control.BUTTON, 3),
|
BP_CHECKBOX(Control.BUTTON, 3),
|
||||||
BP_GROUPBOX (Control.BUTTON, 4),
|
BP_GROUPBOX(Control.BUTTON, 4),
|
||||||
|
CP_COMBOBOX(Control.COMBOBOX, 0),
|
||||||
CP_COMBOBOX (Control.COMBOBOX, 0),
|
|
||||||
CP_DROPDOWNBUTTON(Control.COMBOBOX, 1),
|
CP_DROPDOWNBUTTON(Control.COMBOBOX, 1),
|
||||||
CP_BACKGROUND (Control.COMBOBOX, 2),
|
CP_BACKGROUND(Control.COMBOBOX, 2),
|
||||||
CP_TRANSPARENTBACKGROUND (Control.COMBOBOX, 3),
|
CP_TRANSPARENTBACKGROUND(Control.COMBOBOX, 3),
|
||||||
CP_BORDER (Control.COMBOBOX, 4),
|
CP_BORDER(Control.COMBOBOX, 4),
|
||||||
CP_READONLY (Control.COMBOBOX, 5),
|
CP_READONLY(Control.COMBOBOX, 5),
|
||||||
CP_DROPDOWNBUTTONRIGHT (Control.COMBOBOX, 6),
|
CP_DROPDOWNBUTTONRIGHT(Control.COMBOBOX, 6),
|
||||||
CP_DROPDOWNBUTTONLEFT (Control.COMBOBOX, 7),
|
CP_DROPDOWNBUTTONLEFT(Control.COMBOBOX, 7),
|
||||||
CP_CUEBANNER (Control.COMBOBOX, 8),
|
CP_CUEBANNER(Control.COMBOBOX, 8),
|
||||||
|
EP_EDIT(Control.EDIT, 0),
|
||||||
|
|
||||||
EP_EDIT (Control.EDIT, 0),
|
|
||||||
EP_EDITTEXT(Control.EDIT, 1),
|
EP_EDITTEXT(Control.EDIT, 1),
|
||||||
|
HP_HEADERITEM(Control.HEADER, 1),
|
||||||
HP_HEADERITEM(Control.HEADER, 1),
|
|
||||||
HP_HEADERSORTARROW(Control.HEADER, 4),
|
HP_HEADERSORTARROW(Control.HEADER, 4),
|
||||||
|
|
||||||
LBP_LISTBOX(Control.LISTBOX, 0),
|
LBP_LISTBOX(Control.LISTBOX, 0),
|
||||||
|
|
||||||
LVP_LISTVIEW(Control.LISTVIEW, 0),
|
LVP_LISTVIEW(Control.LISTVIEW, 0),
|
||||||
|
PP_PROGRESS(Control.PROGRESS, 0),
|
||||||
PP_PROGRESS (Control.PROGRESS, 0),
|
PP_BAR(Control.PROGRESS, 1),
|
||||||
PP_BAR (Control.PROGRESS, 1),
|
PP_BARVERT(Control.PROGRESS, 2),
|
||||||
PP_BARVERT (Control.PROGRESS, 2),
|
PP_CHUNK(Control.PROGRESS, 3),
|
||||||
PP_CHUNK (Control.PROGRESS, 3),
|
|
||||||
PP_CHUNKVERT(Control.PROGRESS, 4),
|
PP_CHUNKVERT(Control.PROGRESS, 4),
|
||||||
|
RP_GRIPPER(Control.REBAR, 1),
|
||||||
RP_GRIPPER (Control.REBAR, 1),
|
|
||||||
RP_GRIPPERVERT(Control.REBAR, 2),
|
RP_GRIPPERVERT(Control.REBAR, 2),
|
||||||
|
SBP_SCROLLBAR(Control.SCROLLBAR, 0),
|
||||||
SBP_SCROLLBAR (Control.SCROLLBAR, 0),
|
SBP_ARROWBTN(Control.SCROLLBAR, 1),
|
||||||
SBP_ARROWBTN (Control.SCROLLBAR, 1),
|
SBP_THUMBBTNHORZ(Control.SCROLLBAR, 2),
|
||||||
SBP_THUMBBTNHORZ (Control.SCROLLBAR, 2),
|
SBP_THUMBBTNVERT(Control.SCROLLBAR, 3),
|
||||||
SBP_THUMBBTNVERT (Control.SCROLLBAR, 3),
|
SBP_LOWERTRACKHORZ(Control.SCROLLBAR, 4),
|
||||||
SBP_LOWERTRACKHORZ(Control.SCROLLBAR, 4),
|
SBP_UPPERTRACKHORZ(Control.SCROLLBAR, 5),
|
||||||
SBP_UPPERTRACKHORZ(Control.SCROLLBAR, 5),
|
SBP_LOWERTRACKVERT(Control.SCROLLBAR, 6),
|
||||||
SBP_LOWERTRACKVERT(Control.SCROLLBAR, 6),
|
SBP_UPPERTRACKVERT(Control.SCROLLBAR, 7),
|
||||||
SBP_UPPERTRACKVERT(Control.SCROLLBAR, 7),
|
SBP_GRIPPERHORZ(Control.SCROLLBAR, 8),
|
||||||
SBP_GRIPPERHORZ (Control.SCROLLBAR, 8),
|
SBP_GRIPPERVERT(Control.SCROLLBAR, 9),
|
||||||
SBP_GRIPPERVERT (Control.SCROLLBAR, 9),
|
SBP_SIZEBOX(Control.SCROLLBAR, 10),
|
||||||
SBP_SIZEBOX (Control.SCROLLBAR, 10),
|
SPNP_UP(Control.SPIN, 1),
|
||||||
|
|
||||||
SPNP_UP (Control.SPIN, 1),
|
|
||||||
SPNP_DOWN(Control.SPIN, 2),
|
SPNP_DOWN(Control.SPIN, 2),
|
||||||
|
TABP_TABITEM(Control.TAB, 1),
|
||||||
TABP_TABITEM (Control.TAB, 1),
|
TABP_TABITEMLEFTEDGE(Control.TAB, 2),
|
||||||
TABP_TABITEMLEFTEDGE (Control.TAB, 2),
|
|
||||||
TABP_TABITEMRIGHTEDGE(Control.TAB, 3),
|
TABP_TABITEMRIGHTEDGE(Control.TAB, 3),
|
||||||
TABP_PANE (Control.TAB, 9),
|
TABP_PANE(Control.TAB, 9),
|
||||||
|
TP_TOOLBAR(Control.TOOLBAR, 0),
|
||||||
TP_TOOLBAR (Control.TOOLBAR, 0),
|
TP_BUTTON(Control.TOOLBAR, 1),
|
||||||
TP_BUTTON (Control.TOOLBAR, 1),
|
TP_SEPARATOR(Control.TOOLBAR, 5),
|
||||||
TP_SEPARATOR (Control.TOOLBAR, 5),
|
TP_SEPARATORVERT(Control.TOOLBAR, 6),
|
||||||
TP_SEPARATORVERT (Control.TOOLBAR, 6),
|
TKP_TRACK(Control.TRACKBAR, 1),
|
||||||
|
TKP_TRACKVERT(Control.TRACKBAR, 2),
|
||||||
TKP_TRACK (Control.TRACKBAR, 1),
|
TKP_THUMB(Control.TRACKBAR, 3),
|
||||||
TKP_TRACKVERT (Control.TRACKBAR, 2),
|
TKP_THUMBBOTTOM(Control.TRACKBAR, 4),
|
||||||
TKP_THUMB (Control.TRACKBAR, 3),
|
TKP_THUMBTOP(Control.TRACKBAR, 5),
|
||||||
TKP_THUMBBOTTOM(Control.TRACKBAR, 4),
|
TKP_THUMBVERT(Control.TRACKBAR, 6),
|
||||||
TKP_THUMBTOP (Control.TRACKBAR, 5),
|
TKP_THUMBLEFT(Control.TRACKBAR, 7),
|
||||||
TKP_THUMBVERT (Control.TRACKBAR, 6),
|
TKP_THUMBRIGHT(Control.TRACKBAR, 8),
|
||||||
TKP_THUMBLEFT (Control.TRACKBAR, 7),
|
TKP_TICS(Control.TRACKBAR, 9),
|
||||||
TKP_THUMBRIGHT (Control.TRACKBAR, 8),
|
TKP_TICSVERT(Control.TRACKBAR, 10),
|
||||||
TKP_TICS (Control.TRACKBAR, 9),
|
|
||||||
TKP_TICSVERT (Control.TRACKBAR, 10),
|
|
||||||
|
|
||||||
TVP_TREEVIEW(Control.TREEVIEW, 0),
|
TVP_TREEVIEW(Control.TREEVIEW, 0),
|
||||||
TVP_GLYPH (Control.TREEVIEW, 2),
|
TVP_GLYPH(Control.TREEVIEW, 2),
|
||||||
|
WP_WINDOW(Control.WINDOW, 0),
|
||||||
WP_WINDOW (Control.WINDOW, 0),
|
WP_CAPTION(Control.WINDOW, 1),
|
||||||
WP_CAPTION (Control.WINDOW, 1),
|
WP_MINCAPTION(Control.WINDOW, 3),
|
||||||
WP_MINCAPTION (Control.WINDOW, 3),
|
WP_MAXCAPTION(Control.WINDOW, 5),
|
||||||
WP_MAXCAPTION (Control.WINDOW, 5),
|
WP_FRAMELEFT(Control.WINDOW, 7),
|
||||||
WP_FRAMELEFT (Control.WINDOW, 7),
|
WP_FRAMERIGHT(Control.WINDOW, 8),
|
||||||
WP_FRAMERIGHT (Control.WINDOW, 8),
|
WP_FRAMEBOTTOM(Control.WINDOW, 9),
|
||||||
WP_FRAMEBOTTOM (Control.WINDOW, 9),
|
WP_SYSBUTTON(Control.WINDOW, 13),
|
||||||
WP_SYSBUTTON (Control.WINDOW, 13),
|
WP_MDISYSBUTTON(Control.WINDOW, 14),
|
||||||
WP_MDISYSBUTTON (Control.WINDOW, 14),
|
WP_MINBUTTON(Control.WINDOW, 15),
|
||||||
WP_MINBUTTON (Control.WINDOW, 15),
|
WP_MDIMINBUTTON(Control.WINDOW, 16),
|
||||||
WP_MDIMINBUTTON (Control.WINDOW, 16),
|
WP_MAXBUTTON(Control.WINDOW, 17),
|
||||||
WP_MAXBUTTON (Control.WINDOW, 17),
|
WP_CLOSEBUTTON(Control.WINDOW, 18),
|
||||||
WP_CLOSEBUTTON (Control.WINDOW, 18),
|
WP_MDICLOSEBUTTON(Control.WINDOW, 20),
|
||||||
WP_MDICLOSEBUTTON (Control.WINDOW, 20),
|
WP_RESTOREBUTTON(Control.WINDOW, 21),
|
||||||
WP_RESTOREBUTTON (Control.WINDOW, 21),
|
|
||||||
WP_MDIRESTOREBUTTON(Control.WINDOW, 22);
|
WP_MDIRESTOREBUTTON(Control.WINDOW, 22);
|
||||||
|
|
||||||
private final Control control;
|
private final Control control;
|
||||||
@ -217,21 +200,19 @@ public class TMSchema {
|
|||||||
public String getControlName(Component component) {
|
public String getControlName(Component component) {
|
||||||
String str = "";
|
String str = "";
|
||||||
if (component instanceof JComponent) {
|
if (component instanceof JComponent) {
|
||||||
JComponent c = (JComponent)component;
|
JComponent c = (JComponent) component;
|
||||||
String subAppName = (String)c.getClientProperty("XPStyle.subAppName");
|
String subAppName = (String) c.getClientProperty("XPStyle.subAppName");
|
||||||
if (subAppName != null) {
|
if (subAppName != null)
|
||||||
str = subAppName + "::";
|
str = subAppName + "::";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return str + control.toString();
|
return str + control.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return control.toString()+"."+name();
|
return control.toString() + "." + name();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An enumeration of the possible component states
|
* An enumeration of the possible component states
|
||||||
*/
|
*/
|
||||||
@ -258,8 +239,8 @@ public class TMSchema {
|
|||||||
DOWNNORMAL,
|
DOWNNORMAL,
|
||||||
DOWNPRESSED,
|
DOWNPRESSED,
|
||||||
FOCUSED,
|
FOCUSED,
|
||||||
HOT,
|
ROLLOVER,
|
||||||
HOTCHECKED,
|
ROLLOVERCHECKED,
|
||||||
ICONHOT,
|
ICONHOT,
|
||||||
ICONNORMAL,
|
ICONNORMAL,
|
||||||
ICONPRESSED,
|
ICONPRESSED,
|
||||||
@ -267,10 +248,10 @@ public class TMSchema {
|
|||||||
ICONSORTEDNORMAL,
|
ICONSORTEDNORMAL,
|
||||||
ICONSORTEDPRESSED,
|
ICONSORTEDPRESSED,
|
||||||
INACTIVE,
|
INACTIVE,
|
||||||
INACTIVENORMAL, // See note 1
|
INACTIVENORMAL, // See note 1
|
||||||
INACTIVEHOT, // See note 1
|
INACTIVEHOT, // See note 1
|
||||||
INACTIVEPUSHED, // See note 1
|
INACTIVEPUSHED, // See note 1
|
||||||
INACTIVEDISABLED, // See note 1
|
INACTIVEDISABLED, // See note 1
|
||||||
LEFTDISABLED,
|
LEFTDISABLED,
|
||||||
LEFTHOT,
|
LEFTHOT,
|
||||||
LEFTNORMAL,
|
LEFTNORMAL,
|
||||||
@ -308,7 +289,6 @@ public class TMSchema {
|
|||||||
SORTEDPRESSED,
|
SORTEDPRESSED,
|
||||||
SORTEDUP;
|
SORTEDUP;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A map of allowed states for each Part
|
* A map of allowed states for each Part
|
||||||
*/
|
*/
|
||||||
@ -318,27 +298,27 @@ public class TMSchema {
|
|||||||
stateMap = new EnumMap<Part, State[]>(Part.class);
|
stateMap = new EnumMap<Part, State[]>(Part.class);
|
||||||
|
|
||||||
stateMap.put(Part.EP_EDITTEXT,
|
stateMap.put(Part.EP_EDITTEXT,
|
||||||
new State[] {
|
new State[] {
|
||||||
NORMAL, HOT, SELECTED, DISABLED, FOCUSED, READONLY, ASSIST
|
NORMAL, ROLLOVER, SELECTED, DISABLED, FOCUSED, READONLY, ASSIST
|
||||||
});
|
});
|
||||||
|
|
||||||
stateMap.put(Part.BP_PUSHBUTTON,
|
stateMap.put(Part.BP_PUSHBUTTON,
|
||||||
new State[] { NORMAL, HOT, PRESSED, DISABLED, DEFAULTED });
|
new State[] { NORMAL, ROLLOVER, PRESSED, DISABLED, DEFAULTED });
|
||||||
|
|
||||||
stateMap.put(Part.BP_RADIOBUTTON,
|
stateMap.put(Part.BP_RADIOBUTTON,
|
||||||
new State[] {
|
new State[] {
|
||||||
UNCHECKEDNORMAL, UNCHECKEDHOT, UNCHECKEDPRESSED, UNCHECKEDDISABLED,
|
UNCHECKEDNORMAL, UNCHECKEDHOT, UNCHECKEDPRESSED, UNCHECKEDDISABLED,
|
||||||
CHECKEDNORMAL, CHECKEDHOT, CHECKEDPRESSED, CHECKEDDISABLED
|
CHECKEDNORMAL, CHECKEDHOT, CHECKEDPRESSED, CHECKEDDISABLED
|
||||||
});
|
});
|
||||||
|
|
||||||
stateMap.put(Part.BP_CHECKBOX,
|
stateMap.put(Part.BP_CHECKBOX,
|
||||||
new State[] {
|
new State[] {
|
||||||
UNCHECKEDNORMAL, UNCHECKEDHOT, UNCHECKEDPRESSED, UNCHECKEDDISABLED,
|
UNCHECKEDNORMAL, UNCHECKEDHOT, UNCHECKEDPRESSED, UNCHECKEDDISABLED,
|
||||||
CHECKEDNORMAL, CHECKEDHOT, CHECKEDPRESSED, CHECKEDDISABLED,
|
CHECKEDNORMAL, CHECKEDHOT, CHECKEDPRESSED, CHECKEDDISABLED,
|
||||||
MIXEDNORMAL, MIXEDHOT, MIXEDPRESSED, MIXEDDISABLED
|
MIXEDNORMAL, MIXEDHOT, MIXEDPRESSED, MIXEDDISABLED
|
||||||
});
|
});
|
||||||
|
|
||||||
State[] comboBoxStates = new State[] { NORMAL, HOT, PRESSED, DISABLED };
|
State[] comboBoxStates = new State[] { NORMAL, ROLLOVER, PRESSED, DISABLED };
|
||||||
stateMap.put(Part.CP_COMBOBOX, comboBoxStates);
|
stateMap.put(Part.CP_COMBOBOX, comboBoxStates);
|
||||||
stateMap.put(Part.CP_DROPDOWNBUTTON, comboBoxStates);
|
stateMap.put(Part.CP_DROPDOWNBUTTON, comboBoxStates);
|
||||||
stateMap.put(Part.CP_BACKGROUND, comboBoxStates);
|
stateMap.put(Part.CP_BACKGROUND, comboBoxStates);
|
||||||
@ -349,41 +329,39 @@ public class TMSchema {
|
|||||||
stateMap.put(Part.CP_DROPDOWNBUTTONLEFT, comboBoxStates);
|
stateMap.put(Part.CP_DROPDOWNBUTTONLEFT, comboBoxStates);
|
||||||
stateMap.put(Part.CP_CUEBANNER, comboBoxStates);
|
stateMap.put(Part.CP_CUEBANNER, comboBoxStates);
|
||||||
|
|
||||||
stateMap.put(Part.HP_HEADERITEM, new State[] { NORMAL, HOT, PRESSED,
|
stateMap.put(Part.HP_HEADERITEM, new State[] { NORMAL, ROLLOVER, PRESSED,
|
||||||
SORTEDNORMAL, SORTEDHOT, SORTEDPRESSED,
|
SORTEDNORMAL, SORTEDHOT, SORTEDPRESSED,
|
||||||
ICONNORMAL, ICONHOT, ICONPRESSED,
|
ICONNORMAL, ICONHOT, ICONPRESSED,
|
||||||
ICONSORTEDNORMAL, ICONSORTEDHOT, ICONSORTEDPRESSED });
|
ICONSORTEDNORMAL, ICONSORTEDHOT, ICONSORTEDPRESSED });
|
||||||
|
|
||||||
stateMap.put(Part.HP_HEADERSORTARROW,
|
stateMap.put(Part.HP_HEADERSORTARROW,
|
||||||
new State[] {SORTEDDOWN, SORTEDUP});
|
new State[] { SORTEDDOWN, SORTEDUP });
|
||||||
|
|
||||||
State[] scrollBarStates = new State[] { NORMAL, HOT, PRESSED, DISABLED, HOVER };
|
State[] scrollBarStates = new State[] { NORMAL, ROLLOVER, PRESSED, DISABLED, HOVER };
|
||||||
stateMap.put(Part.SBP_SCROLLBAR, scrollBarStates);
|
stateMap.put(Part.SBP_SCROLLBAR, scrollBarStates);
|
||||||
stateMap.put(Part.SBP_THUMBBTNVERT, scrollBarStates);
|
stateMap.put(Part.SBP_THUMBBTNVERT, scrollBarStates);
|
||||||
stateMap.put(Part.SBP_THUMBBTNHORZ, scrollBarStates);
|
stateMap.put(Part.SBP_THUMBBTNHORZ, scrollBarStates);
|
||||||
stateMap.put(Part.SBP_GRIPPERVERT, scrollBarStates);
|
stateMap.put(Part.SBP_GRIPPERVERT, scrollBarStates);
|
||||||
stateMap.put(Part.SBP_GRIPPERHORZ, scrollBarStates);
|
stateMap.put(Part.SBP_GRIPPERHORZ, scrollBarStates);
|
||||||
|
|
||||||
stateMap.put(Part.SBP_ARROWBTN,
|
stateMap.put(Part.SBP_ARROWBTN,
|
||||||
new State[] {
|
new State[] {
|
||||||
UPNORMAL, UPHOT, UPPRESSED, UPDISABLED,
|
UPNORMAL, UPHOT, UPPRESSED, UPDISABLED,
|
||||||
DOWNNORMAL, DOWNHOT, DOWNPRESSED, DOWNDISABLED,
|
DOWNNORMAL, DOWNHOT, DOWNPRESSED, DOWNDISABLED,
|
||||||
LEFTNORMAL, LEFTHOT, LEFTPRESSED, LEFTDISABLED,
|
LEFTNORMAL, LEFTHOT, LEFTPRESSED, LEFTDISABLED,
|
||||||
RIGHTNORMAL, RIGHTHOT, RIGHTPRESSED, RIGHTDISABLED,
|
RIGHTNORMAL, RIGHTHOT, RIGHTPRESSED, RIGHTDISABLED,
|
||||||
UPHOVER, DOWNHOVER, LEFTHOVER, RIGHTHOVER
|
UPHOVER, DOWNHOVER, LEFTHOVER, RIGHTHOVER
|
||||||
});
|
});
|
||||||
|
|
||||||
|
State[] spinnerStates = new State[] { NORMAL, ROLLOVER, PRESSED, DISABLED };
|
||||||
State[] spinnerStates = new State[] { NORMAL, HOT, PRESSED, DISABLED };
|
stateMap.put(Part.SPNP_UP, spinnerStates);
|
||||||
stateMap.put(Part.SPNP_UP, spinnerStates);
|
|
||||||
stateMap.put(Part.SPNP_DOWN, spinnerStates);
|
stateMap.put(Part.SPNP_DOWN, spinnerStates);
|
||||||
|
|
||||||
stateMap.put(Part.TVP_GLYPH, new State[] { CLOSED, OPENED });
|
stateMap.put(Part.TVP_GLYPH, new State[] { CLOSED, OPENED });
|
||||||
|
|
||||||
State[] frameButtonStates = new State[] {
|
State[] frameButtonStates = new State[] {
|
||||||
NORMAL, HOT, PUSHED, DISABLED, // See note 1
|
NORMAL, ROLLOVER, PUSHED, DISABLED, // See note 1
|
||||||
INACTIVENORMAL, INACTIVEHOT, INACTIVEPUSHED, INACTIVEDISABLED,
|
INACTIVENORMAL, INACTIVEHOT, INACTIVEPUSHED, INACTIVEDISABLED, };
|
||||||
};
|
|
||||||
// Note 1: The INACTIVE frame button states apply when the frame
|
// Note 1: The INACTIVE frame button states apply when the frame
|
||||||
// is inactive. They are not defined in tmschema.h
|
// is inactive. They are not defined in tmschema.h
|
||||||
|
|
||||||
@ -396,125 +374,118 @@ public class TMSchema {
|
|||||||
INACTIVENORMAL, INACTIVEHOT, INACTIVEPUSHED, INACTIVEDISABLED, null
|
INACTIVENORMAL, INACTIVEHOT, INACTIVEPUSHED, INACTIVEDISABLED, null
|
||||||
};
|
};
|
||||||
}*/
|
}*/
|
||||||
|
stateMap.put(Part.WP_MINBUTTON, frameButtonStates);
|
||||||
stateMap.put(Part.WP_MINBUTTON, frameButtonStates);
|
stateMap.put(Part.WP_MAXBUTTON, frameButtonStates);
|
||||||
stateMap.put(Part.WP_MAXBUTTON, frameButtonStates);
|
|
||||||
stateMap.put(Part.WP_RESTOREBUTTON, frameButtonStates);
|
stateMap.put(Part.WP_RESTOREBUTTON, frameButtonStates);
|
||||||
stateMap.put(Part.WP_CLOSEBUTTON, frameButtonStates);
|
stateMap.put(Part.WP_CLOSEBUTTON, frameButtonStates);
|
||||||
|
|
||||||
// States for Slider (trackbar)
|
// States for Slider (trackbar)
|
||||||
stateMap.put(Part.TKP_TRACK, new State[] { NORMAL });
|
stateMap.put(Part.TKP_TRACK, new State[] { NORMAL });
|
||||||
stateMap.put(Part.TKP_TRACKVERT, new State[] { NORMAL });
|
stateMap.put(Part.TKP_TRACKVERT, new State[] { NORMAL });
|
||||||
|
|
||||||
State[] sliderThumbStates =
|
State[] sliderThumbStates
|
||||||
new State[] { NORMAL, HOT, PRESSED, FOCUSED, DISABLED };
|
= new State[] { NORMAL, ROLLOVER, PRESSED, FOCUSED, DISABLED };
|
||||||
stateMap.put(Part.TKP_THUMB, sliderThumbStates);
|
stateMap.put(Part.TKP_THUMB, sliderThumbStates);
|
||||||
stateMap.put(Part.TKP_THUMBBOTTOM, sliderThumbStates);
|
stateMap.put(Part.TKP_THUMBBOTTOM, sliderThumbStates);
|
||||||
stateMap.put(Part.TKP_THUMBTOP, sliderThumbStates);
|
stateMap.put(Part.TKP_THUMBTOP, sliderThumbStates);
|
||||||
stateMap.put(Part.TKP_THUMBVERT, sliderThumbStates);
|
stateMap.put(Part.TKP_THUMBVERT, sliderThumbStates);
|
||||||
stateMap.put(Part.TKP_THUMBRIGHT, sliderThumbStates);
|
stateMap.put(Part.TKP_THUMBRIGHT, sliderThumbStates);
|
||||||
|
|
||||||
// States for Tabs
|
// States for Tabs
|
||||||
State[] tabStates = new State[] { NORMAL, HOT, SELECTED, DISABLED, FOCUSED };
|
State[] tabStates = new State[] { NORMAL, ROLLOVER, SELECTED, DISABLED, FOCUSED };
|
||||||
stateMap.put(Part.TABP_TABITEM, tabStates);
|
stateMap.put(Part.TABP_TABITEM, tabStates);
|
||||||
stateMap.put(Part.TABP_TABITEMLEFTEDGE, tabStates);
|
stateMap.put(Part.TABP_TABITEMLEFTEDGE, tabStates);
|
||||||
stateMap.put(Part.TABP_TABITEMRIGHTEDGE, tabStates);
|
stateMap.put(Part.TABP_TABITEMRIGHTEDGE, tabStates);
|
||||||
|
|
||||||
|
|
||||||
stateMap.put(Part.TP_BUTTON,
|
stateMap.put(Part.TP_BUTTON,
|
||||||
new State[] {
|
new State[] {
|
||||||
NORMAL, HOT, PRESSED, DISABLED, CHECKED, HOTCHECKED
|
NORMAL, ROLLOVER, PRESSED, DISABLED, CHECKED, ROLLOVERCHECKED
|
||||||
});
|
});
|
||||||
|
|
||||||
State[] frameStates = new State[] { ACTIVE, INACTIVE };
|
State[] frameStates = new State[] { ACTIVE, INACTIVE };
|
||||||
stateMap.put(Part.WP_WINDOW, frameStates);
|
stateMap.put(Part.WP_WINDOW, frameStates);
|
||||||
stateMap.put(Part.WP_FRAMELEFT, frameStates);
|
stateMap.put(Part.WP_FRAMELEFT, frameStates);
|
||||||
stateMap.put(Part.WP_FRAMERIGHT, frameStates);
|
stateMap.put(Part.WP_FRAMERIGHT, frameStates);
|
||||||
stateMap.put(Part.WP_FRAMEBOTTOM, frameStates);
|
stateMap.put(Part.WP_FRAMEBOTTOM, frameStates);
|
||||||
|
|
||||||
State[] captionStates = new State[] { ACTIVE, INACTIVE, DISABLED };
|
State[] captionStates = new State[] { ACTIVE, INACTIVE, DISABLED };
|
||||||
stateMap.put(Part.WP_CAPTION, captionStates);
|
stateMap.put(Part.WP_CAPTION, captionStates);
|
||||||
stateMap.put(Part.WP_MINCAPTION, captionStates);
|
stateMap.put(Part.WP_MINCAPTION, captionStates);
|
||||||
stateMap.put(Part.WP_MAXCAPTION, captionStates);
|
stateMap.put(Part.WP_MAXCAPTION, captionStates);
|
||||||
|
|
||||||
stateMap.put(Part.MP_BARBACKGROUND,
|
stateMap.put(Part.MP_BARBACKGROUND,
|
||||||
new State[] { ACTIVE, INACTIVE });
|
new State[] { ACTIVE, INACTIVE });
|
||||||
stateMap.put(Part.MP_BARITEM,
|
stateMap.put(Part.MP_BARITEM,
|
||||||
new State[] { NORMAL, HOT, PUSHED,
|
new State[] { NORMAL, ROLLOVER, PUSHED,
|
||||||
DISABLED, DISABLEDHOT, DISABLEDPUSHED });
|
DISABLED, DISABLEDHOT, DISABLEDPUSHED });
|
||||||
stateMap.put(Part.MP_POPUPCHECK,
|
stateMap.put(Part.MP_POPUPCHECK,
|
||||||
new State[] { CHECKMARKNORMAL, CHECKMARKDISABLED,
|
new State[] { CHECKMARKNORMAL, CHECKMARKDISABLED,
|
||||||
BULLETNORMAL, BULLETDISABLED });
|
BULLETNORMAL, BULLETDISABLED });
|
||||||
stateMap.put(Part.MP_POPUPCHECKBACKGROUND,
|
stateMap.put(Part.MP_POPUPCHECKBACKGROUND,
|
||||||
new State[] { DISABLEDPUSHED, NORMAL, BITMAP });
|
new State[] { DISABLEDPUSHED, NORMAL, BITMAP });
|
||||||
stateMap.put(Part.MP_POPUPITEM,
|
stateMap.put(Part.MP_POPUPITEM,
|
||||||
new State[] { NORMAL, HOT, DISABLED, DISABLEDHOT });
|
new State[] { NORMAL, ROLLOVER, DISABLED, DISABLEDHOT });
|
||||||
stateMap.put(Part.MP_POPUPSUBMENU,
|
stateMap.put(Part.MP_POPUPSUBMENU,
|
||||||
new State[] { NORMAL, DISABLED });
|
new State[] { NORMAL, DISABLED });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static synchronized int getValue(Part part, State state) {
|
public static synchronized int getValue(Part part, State state) {
|
||||||
if (stateMap == null) {
|
if (stateMap == null)
|
||||||
initStates();
|
initStates();
|
||||||
}
|
|
||||||
|
|
||||||
Enum[] states = stateMap.get(part);
|
Enum[] states = stateMap.get(part);
|
||||||
if (states != null) {
|
if (states != null)
|
||||||
for (int i = 0; i < states.length; i++) {
|
for (int i = 0; i < states.length; i++)
|
||||||
if (state == states[i]) {
|
if (state == states[i])
|
||||||
return i + 1;
|
return i + 1;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state == null || state == State.NORMAL) {
|
if (state == null || state == State.NORMAL)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An enumeration of the possible component attributes and the
|
* An enumeration of the possible component attributes and the
|
||||||
* corresponding value type
|
* corresponding value type
|
||||||
*/
|
*/
|
||||||
public static enum Prop {
|
public static enum Prop {
|
||||||
COLOR(Color.class, 204),
|
COLOR(Color.class, 204),
|
||||||
SIZE(Dimension.class, 207),
|
SIZE(Dimension.class, 207),
|
||||||
|
FLATMENUS(Boolean.class, 1001),
|
||||||
|
BORDERONLY(Boolean.class, 2203), // only draw the border area of the image
|
||||||
|
|
||||||
FLATMENUS(Boolean.class, 1001),
|
IMAGECOUNT(Integer.class, 2401), // the number of state images in an imagefile
|
||||||
|
BORDERSIZE(Integer.class, 2403), // the size of the border line for bgtype=BorderFill
|
||||||
BORDERONLY(Boolean.class, 2203), // only draw the border area of the image
|
|
||||||
|
|
||||||
IMAGECOUNT(Integer.class, 2401), // the number of state images in an imagefile
|
|
||||||
BORDERSIZE(Integer.class, 2403), // the size of the border line for bgtype=BorderFill
|
|
||||||
|
|
||||||
PROGRESSCHUNKSIZE(Integer.class, 2411), // size of progress control chunks
|
PROGRESSCHUNKSIZE(Integer.class, 2411), // size of progress control chunks
|
||||||
PROGRESSSPACESIZE(Integer.class, 2412), // size of progress control spaces
|
PROGRESSSPACESIZE(Integer.class, 2412), // size of progress control spaces
|
||||||
|
|
||||||
TEXTSHADOWOFFSET(Point.class, 3402), // where char shadows are drawn, relative to orig. chars
|
TEXTSHADOWOFFSET(Point.class, 3402), // where char shadows are drawn, relative to orig. chars
|
||||||
|
|
||||||
NORMALSIZE(Dimension.class, 3409), // size of dest rect that exactly source
|
NORMALSIZE(Dimension.class, 3409), // size of dest rect that exactly source
|
||||||
|
|
||||||
|
SIZINGMARGINS(Insets.class, 3601), // margins used for 9-grid sizing
|
||||||
|
CONTENTMARGINS(Insets.class, 3602), // margins that define where content can be placed
|
||||||
|
CAPTIONMARGINS(Insets.class, 3603), // margins that define where caption text can be placed
|
||||||
|
|
||||||
SIZINGMARGINS ( Insets.class, 3601), // margins used for 9-grid sizing
|
BORDERCOLOR(Color.class, 3801), // color of borders for BorderFill
|
||||||
CONTENTMARGINS(Insets.class, 3602), // margins that define where content can be placed
|
FILLCOLOR(Color.class, 3802), // color of bg fill
|
||||||
CAPTIONMARGINS(Insets.class, 3603), // margins that define where caption text can be placed
|
TEXTCOLOR(Color.class, 3803), // color text is drawn in
|
||||||
|
|
||||||
BORDERCOLOR(Color.class, 3801), // color of borders for BorderFill
|
TEXTSHADOWCOLOR(Color.class, 3818), // color of text shadow
|
||||||
FILLCOLOR ( Color.class, 3802), // color of bg fill
|
|
||||||
TEXTCOLOR ( Color.class, 3803), // color text is drawn in
|
|
||||||
|
|
||||||
TEXTSHADOWCOLOR(Color.class, 3818), // color of text shadow
|
BGTYPE(Integer.class, 4001), // basic drawing type for each part
|
||||||
|
|
||||||
BGTYPE(Integer.class, 4001), // basic drawing type for each part
|
TEXTSHADOWTYPE(Integer.class, 4010), // type of shadow to draw with text
|
||||||
|
|
||||||
TEXTSHADOWTYPE(Integer.class, 4010), // type of shadow to draw with text
|
|
||||||
|
|
||||||
TRANSITIONDURATIONS(Integer.class, 6000);
|
TRANSITIONDURATIONS(Integer.class, 6000);
|
||||||
|
|
||||||
@ -522,8 +493,8 @@ public class TMSchema {
|
|||||||
private final int value;
|
private final int value;
|
||||||
|
|
||||||
private Prop(Class type, int value) {
|
private Prop(Class type, int value) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getValue() {
|
public int getValue() {
|
||||||
@ -531,23 +502,20 @@ public class TMSchema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name()+"["+type.getName()+"] = "+value;
|
return name() + "[" + type.getName() + "] = " + value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An enumeration of attribute values for some Props
|
* An enumeration of attribute values for some Props
|
||||||
*/
|
*/
|
||||||
public static enum TypeEnum {
|
public static enum TypeEnum {
|
||||||
BT_IMAGEFILE (Prop.BGTYPE, "imagefile", 0),
|
BT_IMAGEFILE(Prop.BGTYPE, "imagefile", 0),
|
||||||
BT_BORDERFILL(Prop.BGTYPE, "borderfill", 1),
|
BT_BORDERFILL(Prop.BGTYPE, "borderfill", 1),
|
||||||
|
|
||||||
TST_NONE(Prop.TEXTSHADOWTYPE, "none", 0),
|
TST_NONE(Prop.TEXTSHADOWTYPE, "none", 0),
|
||||||
TST_SINGLE(Prop.TEXTSHADOWTYPE, "single", 1),
|
TST_SINGLE(Prop.TEXTSHADOWTYPE, "single", 1),
|
||||||
TST_CONTINUOUS(Prop.TEXTSHADOWTYPE, "continuous", 2);
|
TST_CONTINUOUS(Prop.TEXTSHADOWTYPE, "continuous", 2);
|
||||||
|
|
||||||
|
|
||||||
private TypeEnum(Prop prop, String enumName, int value) {
|
private TypeEnum(Prop prop, String enumName, int value) {
|
||||||
this.prop = prop;
|
this.prop = prop;
|
||||||
this.enumName = enumName;
|
this.enumName = enumName;
|
||||||
@ -559,22 +527,18 @@ public class TMSchema {
|
|||||||
private final int value;
|
private final int value;
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return prop+"="+enumName+"="+value;
|
return prop + "=" + enumName + "=" + value;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getName() {
|
String getName() {
|
||||||
return enumName;
|
return enumName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TypeEnum getTypeEnum(Prop prop, int enumval) {
|
static TypeEnum getTypeEnum(Prop prop, int enumval) {
|
||||||
for (TypeEnum e : TypeEnum.values()) {
|
for (TypeEnum e : TypeEnum.values())
|
||||||
if (e.prop == prop && e.value == enumval) {
|
if (e.prop == prop && e.value == enumval)
|
||||||
return e;
|
return e;
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user