001: /*
002: *
003: *
004: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: */
026:
027: package com.sun.midp.chameleon.skins.resources;
028:
029: import com.sun.midp.chameleon.skins.SkinPropertiesIDs;
030: import com.sun.midp.chameleon.skins.MenuSkin;
031:
032: import javax.microedition.lcdui.Image;
033: import javax.microedition.lcdui.Font;
034:
035: public class MenuResources {
036: private static boolean init;
037:
038: private MenuResources() {
039: }
040:
041: public static void load() {
042: load(false);
043: }
044:
045: public static void load(boolean reload) {
046: if (init && !reload) {
047: return;
048: }
049:
050: MenuSkin.WIDTH = SkinResources
051: .getInt(SkinPropertiesIDs.MENU_WIDTH);
052: MenuSkin.HEIGHT = SkinResources
053: .getInt(SkinPropertiesIDs.MENU_HEIGHT);
054:
055: int alignX = SkinResources
056: .getInt(SkinPropertiesIDs.MENU_ALIGN_X);
057: MenuSkin.ALIGN_X = SkinResources
058: .resourceConstantsToGraphics(alignX);
059:
060: int alignY = SkinResources
061: .getInt(SkinPropertiesIDs.MENU_ALIGN_Y);
062: MenuSkin.ALIGN_Y = SkinResources
063: .resourceConstantsToGraphics(alignY);
064:
065: MenuSkin.TITLE_X = SkinResources
066: .getInt(SkinPropertiesIDs.MENU_TITLE_X);
067: MenuSkin.TITLE_Y = SkinResources
068: .getInt(SkinPropertiesIDs.MENU_TITLE_Y);
069: MenuSkin.TITLE_MAXWIDTH = SkinResources
070: .getInt(SkinPropertiesIDs.MENU_TITLE_MAXWIDTH);
071:
072: int titleAlign = SkinResources
073: .getInt(SkinPropertiesIDs.MENU_TITLE_ALIGN);
074: MenuSkin.TITLE_ALIGN = SkinResources
075: .resourceConstantsToGraphics(titleAlign);
076:
077: MenuSkin.MAX_ITEMS = SkinResources
078: .getInt(SkinPropertiesIDs.MENU_MAX_ITEMS);
079: MenuSkin.ITEM_HEIGHT = SkinResources
080: .getInt(SkinPropertiesIDs.MENU_ITEM_HEIGHT);
081: MenuSkin.ITEM_TOPOFFSET = SkinResources
082: .getInt(SkinPropertiesIDs.MENU_ITEM_TOPOFFSET);
083: MenuSkin.ITEM_INDEX_ANCHOR_X = SkinResources
084: .getInt(SkinPropertiesIDs.MENU_ITEM_INDEX_ANCHOR_X);
085: MenuSkin.ITEM_ANCHOR_X = SkinResources
086: .getInt(SkinPropertiesIDs.MENU_ITEM_ANCHOR_X);
087: MenuSkin.COLOR_BG = SkinResources
088: .getInt(SkinPropertiesIDs.MENU_COLOR_BG);
089: MenuSkin.COLOR_BG_SEL = SkinResources
090: .getInt(SkinPropertiesIDs.MENU_COLOR_BG_SEL);
091: MenuSkin.COLOR_TITLE = SkinResources
092: .getInt(SkinPropertiesIDs.MENU_COLOR_TITLE);
093: MenuSkin.COLOR_INDEX = SkinResources
094: .getInt(SkinPropertiesIDs.MENU_COLOR_INDEX);
095: MenuSkin.COLOR_INDEX_SEL = SkinResources
096: .getInt(SkinPropertiesIDs.MENU_COLOR_INDEX_SEL);
097: MenuSkin.COLOR_ITEM = SkinResources
098: .getInt(SkinPropertiesIDs.MENU_COLOR_ITEM);
099: MenuSkin.COLOR_ITEM_SEL = SkinResources
100: .getInt(SkinPropertiesIDs.MENU_COLOR_ITEM_SEL);
101: MenuSkin.TEXT_TITLE = SkinResources
102: .getString(SkinPropertiesIDs.MENU_TEXT_TITLE);
103: MenuSkin.FONT_TITLE = SkinResources
104: .getFont(SkinPropertiesIDs.MENU_FONT_TITLE);
105: MenuSkin.FONT_ITEM = SkinResources
106: .getFont(SkinPropertiesIDs.MENU_FONT_ITEM);
107: MenuSkin.FONT_ITEM_SEL = SkinResources
108: .getFont(SkinPropertiesIDs.MENU_FONT_ITEM_SEL);
109: MenuSkin.IMAGE_BG = SkinResources.getCompositeImage(
110: SkinPropertiesIDs.MENU_IMAGE_BG, 9);
111: /*
112: Uncomment if background image for selected item is used
113: MenuSkin.IMAGE_ITEM_SEL_BG = SkinResources.getCompositeImage(
114: SkinPropertiesIDs.MENU_IMAGE_ITEM_SEL_BG, 3);
115: */
116: MenuSkin.IMAGE_SUBMENU_ARROW = SkinResources
117: .getImage(SkinPropertiesIDs.MENU_IMAGE_SUBMENU);
118: MenuSkin.IMAGE_SUBMENU_ARROW_HL = SkinResources
119: .getImage(SkinPropertiesIDs.MENU_IMAGE_SUBMENU_HL);
120:
121: init = true;
122: }
123:
124: }
|