tmschema.java
来自「JAVA 所有包」· Java 代码 · 共 531 行 · 第 1/2 页
JAVA
531 行
/** * A map of allowed states for each Part */ private static EnumMap<Part, State[]> stateMap; private static synchronized void initStates() { stateMap = new EnumMap<Part, State[]>(Part.class); stateMap.put(Part.EP_EDITTEXT, new State[] { NORMAL, HOT, SELECTED, DISABLED, FOCUSED, READONLY, ASSIST }); stateMap.put(Part.BP_PUSHBUTTON, new State[] { NORMAL, HOT, PRESSED, DISABLED, DEFAULTED }); stateMap.put(Part.BP_RADIOBUTTON, new State[] { UNCHECKEDNORMAL, UNCHECKEDHOT, UNCHECKEDPRESSED, UNCHECKEDDISABLED, CHECKEDNORMAL, CHECKEDHOT, CHECKEDPRESSED, CHECKEDDISABLED }); stateMap.put(Part.BP_CHECKBOX, new State[] { UNCHECKEDNORMAL, UNCHECKEDHOT, UNCHECKEDPRESSED, UNCHECKEDDISABLED, CHECKEDNORMAL, CHECKEDHOT, CHECKEDPRESSED, CHECKEDDISABLED, MIXEDNORMAL, MIXEDHOT, MIXEDPRESSED, MIXEDDISABLED }); State[] comboBoxStates = new State[] { NORMAL, HOT, PRESSED, DISABLED }; stateMap.put(Part.CP_COMBOBOX, comboBoxStates); stateMap.put(Part.CP_DROPDOWNBUTTON, comboBoxStates); stateMap.put(Part.CP_BACKGROUND, comboBoxStates); stateMap.put(Part.CP_TRANSPARENTBACKGROUND, comboBoxStates); stateMap.put(Part.CP_BORDER, comboBoxStates); stateMap.put(Part.CP_READONLY, comboBoxStates); stateMap.put(Part.CP_DROPDOWNBUTTONRIGHT, comboBoxStates); stateMap.put(Part.CP_DROPDOWNBUTTONLEFT, comboBoxStates); stateMap.put(Part.CP_CUEBANNER, comboBoxStates); stateMap.put(Part.HP_HEADERITEM, new State[] { NORMAL, HOT, PRESSED }); State[] scrollBarStates = new State[] { NORMAL, HOT, PRESSED, DISABLED, HOVER }; stateMap.put(Part.SBP_SCROLLBAR, scrollBarStates); stateMap.put(Part.SBP_THUMBBTNVERT, scrollBarStates); stateMap.put(Part.SBP_THUMBBTNHORZ, scrollBarStates); stateMap.put(Part.SBP_GRIPPERVERT, scrollBarStates); stateMap.put(Part.SBP_GRIPPERHORZ, scrollBarStates); stateMap.put(Part.SBP_ARROWBTN, new State[] { UPNORMAL, UPHOT, UPPRESSED, UPDISABLED, DOWNNORMAL, DOWNHOT, DOWNPRESSED, DOWNDISABLED, LEFTNORMAL, LEFTHOT, LEFTPRESSED, LEFTDISABLED, RIGHTNORMAL, RIGHTHOT, RIGHTPRESSED, RIGHTDISABLED, UPHOVER, DOWNHOVER, LEFTHOVER, RIGHTHOVER }); State[] spinnerStates = new State[] { NORMAL, HOT, PRESSED, DISABLED }; stateMap.put(Part.SPNP_UP, spinnerStates); stateMap.put(Part.SPNP_DOWN, spinnerStates); stateMap.put(Part.TVP_GLYPH, new State[] { CLOSED, OPENED }); State[] frameButtonStates = new State[] { NORMAL, HOT, PUSHED, DISABLED, // See note 1 INACTIVENORMAL, INACTIVEHOT, INACTIVEPUSHED, INACTIVEDISABLED, }; // Note 1: The INACTIVE frame button states apply when the frame // is inactive. They are not defined in tmschema.h // Fix for 6316538: Vista has five frame button states if (ThemeReader.getInt(Control.WINDOW.toString(), Part.WP_CLOSEBUTTON.getValue(), 1, Prop.IMAGECOUNT.getValue()) == 10) { frameButtonStates = new State[] { NORMAL, HOT, PUSHED, DISABLED, null, INACTIVENORMAL, INACTIVEHOT, INACTIVEPUSHED, INACTIVEDISABLED, null }; } stateMap.put(Part.WP_MINBUTTON, frameButtonStates); stateMap.put(Part.WP_MAXBUTTON, frameButtonStates); stateMap.put(Part.WP_RESTOREBUTTON, frameButtonStates); stateMap.put(Part.WP_CLOSEBUTTON, frameButtonStates); // States for Slider (trackbar) stateMap.put(Part.TKP_TRACK, new State[] { NORMAL }); stateMap.put(Part.TKP_TRACKVERT, new State[] { NORMAL }); State[] sliderThumbStates = new State[] { NORMAL, HOT, PRESSED, FOCUSED, DISABLED }; stateMap.put(Part.TKP_THUMB, sliderThumbStates); stateMap.put(Part.TKP_THUMBBOTTOM, sliderThumbStates); stateMap.put(Part.TKP_THUMBTOP, sliderThumbStates); stateMap.put(Part.TKP_THUMBVERT, sliderThumbStates); stateMap.put(Part.TKP_THUMBRIGHT, sliderThumbStates); // States for Tabs State[] tabStates = new State[] { NORMAL, HOT, SELECTED, DISABLED, FOCUSED }; stateMap.put(Part.TABP_TABITEM, tabStates); stateMap.put(Part.TABP_TABITEMLEFTEDGE, tabStates); stateMap.put(Part.TABP_TABITEMRIGHTEDGE, tabStates); stateMap.put(Part.TP_BUTTON, new State[] { NORMAL, HOT, PRESSED, DISABLED, CHECKED, HOTCHECKED }); State[] frameStates = new State[] { ACTIVE, INACTIVE }; stateMap.put(Part.WP_WINDOW, frameStates); stateMap.put(Part.WP_FRAMELEFT, frameStates); stateMap.put(Part.WP_FRAMERIGHT, frameStates); stateMap.put(Part.WP_FRAMEBOTTOM, frameStates); State[] captionStates = new State[] { ACTIVE, INACTIVE, DISABLED }; stateMap.put(Part.WP_CAPTION, captionStates); stateMap.put(Part.WP_MINCAPTION, captionStates); stateMap.put(Part.WP_MAXCAPTION, captionStates); stateMap.put(Part.MP_BARBACKGROUND, new State[] { ACTIVE, INACTIVE }); stateMap.put(Part.MP_BARITEM, new State[] { NORMAL, HOT, PUSHED, DISABLED, DISABLEDHOT, DISABLEDPUSHED }); stateMap.put(Part.MP_POPUPCHECK, new State[] { CHECKMARKNORMAL, CHECKMARKDISABLED, BULLETNORMAL, BULLETDISABLED }); stateMap.put(Part.MP_POPUPCHECKBACKGROUND, new State[] { DISABLEDPUSHED, NORMAL, BITMAP }); stateMap.put(Part.MP_POPUPITEM, new State[] { NORMAL, HOT, DISABLED, DISABLEDHOT }); stateMap.put(Part.MP_POPUPSUBMENU, new State[] { NORMAL, DISABLED }); } public static synchronized int getValue(Part part, State state) { if (stateMap == null) { initStates(); } Enum[] states = stateMap.get(part); if (states != null) { for (int i = 0; i < states.length; i++) { if (state == states[i]) { return i + 1; } } } if (state == null || state == State.NORMAL) { return 1; } return 0; } } /** * An enumeration of the possible component attributes and the * corresponding value type */ public static enum Prop { COLOR(Color.class, 204), SIZE(Dimension.class, 207), FLATMENUS(Boolean.class, 1001), 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 PROGRESSSPACESIZE(Integer.class, 2412), // size of progress control spaces TEXTSHADOWOFFSET(Point.class, 3402), // where char shadows are drawn, relative to orig. chars 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 BORDERCOLOR(Color.class, 3801), // color of borders for BorderFill 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 TEXTSHADOWTYPE(Integer.class, 4010), // type of shadow to draw with text TRANSITIONDURATIONS(Integer.class, 6000); private final Class type; private final int value; private Prop(Class type, int value) { this.type = type; this.value = value; } public int getValue() { return value; } public String toString() { return name()+"["+type.getName()+"] = "+value; } } /** * An enumeration of attribute values for some Props */ public static enum TypeEnum { BT_IMAGEFILE (Prop.BGTYPE, "imagefile", 0), BT_BORDERFILL(Prop.BGTYPE, "borderfill", 1), TST_NONE(Prop.TEXTSHADOWTYPE, "none", 0), TST_SINGLE(Prop.TEXTSHADOWTYPE, "single", 1), TST_CONTINUOUS(Prop.TEXTSHADOWTYPE, "continuous", 2); private TypeEnum(Prop prop, String enumName, int value) { this.prop = prop; this.enumName = enumName; this.value = value; } private final Prop prop; private final String enumName; private final int value; public String toString() { return prop+"="+enumName+"="+value; } String getName() { return enumName; } static TypeEnum getTypeEnum(Prop prop, int enumval) { for (TypeEnum e : TypeEnum.values()) { if (e.prop == prop && e.value == enumval) { return e; } } return null; } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?