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.ScreenSkin;
031: import com.sun.midp.log.*;
032:
033: import javax.microedition.lcdui.Image;
034: import javax.microedition.lcdui.Font;
035: import javax.microedition.lcdui.Display;
036:
037: import com.sun.midp.configurator.Constants;
038:
039: public class ScreenResources {
040: private static boolean init;
041:
042: private ScreenResources() {
043: }
044:
045: public static void load() {
046: load(false);
047: }
048:
049: public static void load(boolean reload) {
050: if (init && !reload) {
051: return;
052: }
053:
054: if ((ScreenSkin.WIDTH <= 0) || (ScreenSkin.HEIGHT <= 0)) {
055: if (Logging.REPORT_LEVEL <= Logging.WARNING) {
056: Logging.report(Logging.WARNING, LogChannels.LC_HIGHUI,
057: "Screen dimentions not set.");
058: }
059: }
060:
061: int textOrient = SkinResources
062: .getInt(SkinPropertiesIDs.SCREEN_TEXT_ORIENT);
063: ScreenSkin.TEXT_ORIENT = SkinResources
064: .resourceConstantsToGraphics(textOrient);
065:
066: ScreenSkin.PAD_FORM_ITEMS = SkinResources
067: .getInt(SkinPropertiesIDs.SCREEN_PAD_FORM_ITEMS);
068: ScreenSkin.PAD_LABEL_VERT = SkinResources
069: .getInt(SkinPropertiesIDs.SCREEN_PAD_LABEL_VERT);
070: ScreenSkin.PAD_LABEL_HORIZ = SkinResources
071: .getInt(SkinPropertiesIDs.SCREEN_PAD_LABEL_HORIZ);
072: ScreenSkin.COLOR_BG = SkinResources
073: .getInt(SkinPropertiesIDs.SCREEN_COLOR_BG);
074: ScreenSkin.COLOR_HS_BG = SkinResources
075: .getInt(SkinPropertiesIDs.SCREEN_COLOR_HS_BG);
076: ScreenSkin.COLOR_FG = SkinResources
077: .getInt(SkinPropertiesIDs.SCREEN_COLOR_FG);
078: ScreenSkin.COLOR_BG_HL = SkinResources
079: .getInt(SkinPropertiesIDs.SCREEN_COLOR_BG_HL);
080: ScreenSkin.COLOR_FG_HL = SkinResources
081: .getInt(SkinPropertiesIDs.SCREEN_COLOR_FG_HL);
082: ScreenSkin.COLOR_BORDER = SkinResources
083: .getInt(SkinPropertiesIDs.SCREEN_COLOR_BORDER);
084: ScreenSkin.COLOR_BORDER_HL = SkinResources
085: .getInt(SkinPropertiesIDs.SCREEN_COLOR_BORDER_HL);
086: ScreenSkin.COLOR_TRAVERSE_IND = SkinResources
087: .getInt(SkinPropertiesIDs.SCREEN_COLOR_TRAVERSE_IND);
088:
089: int borderStyle = SkinResources
090: .getInt(SkinPropertiesIDs.SCREEN_BORDER_STYLE);
091: ScreenSkin.BORDER_STYLE = SkinResources
092: .resourceConstantsToGraphics(borderStyle);
093:
094: ScreenSkin.SCROLL_AMOUNT = SkinResources
095: .getInt(SkinPropertiesIDs.SCREEN_SCROLL_AMOUNT);
096: ScreenSkin.FONT_LABEL = SkinResources
097: .getFont(SkinPropertiesIDs.SCREEN_FONT_LABEL);
098: ScreenSkin.FONT_INPUT_TEXT = SkinResources
099: .getFont(SkinPropertiesIDs.SCREEN_FONT_INPUT_TEXT);
100: ScreenSkin.FONT_STATIC_TEXT = SkinResources
101: .getFont(SkinPropertiesIDs.SCREEN_FONT_STATIC_TEXT);
102:
103: ScreenSkin.IMAGE_WASH = SkinResources
104: .getImage(SkinPropertiesIDs.SCREEN_IMAGE_WASH);
105: ScreenSkin.IMAGE_BG = SkinResources
106: .getImage(SkinPropertiesIDs.SCREEN_IMAGE_BG);
107:
108: /*
109: Uncomment if 9 pc screen background images are used
110: ScreenSkin.IMAGE_BG_W_TITLE = SkinResources.getCompositeImage(
111: SkinPropertiesIDs.SCREEN_IMAGE_BG_W_TITLE, 9);
112: ScreenSkin.IMAGE_BG_WO_TITLE = SkinResources.getCompositeImage(
113: SkinPropertiesIDs.SCREEN_IMAGE_BG_WO_TITLE, 9);
114: */
115:
116: // IMPL NOTE: There shouldn't be any "Homescreen" resources in
117: // ScreenResources. There should be a new window altogether which
118: // handles the app manager stuff and its resources should be in a
119: // separate resource class all together.
120: /*
121: Uncomment if background images for "home" screen are used
122: ScreenSkin.IMAGE_HS_BG_TILE = SkinResources.getImage(
123: SkinPropertiesIDs.SCREEN_IMAGE_HS_BG_TILE);
124: ScreenSkin.IMAGE_HS_BG_W_TITLE = SkinResources.getCompositeImage(
125: SkinPropertiesIDs.SCREEN_IMAGE_HS_BG_W_TITLE, 9);
126: ScreenSkin.IMAGE_HS_BG_WO_TITLE = SkinResources.getCompositeImage(
127: SkinPropertiesIDs.SCREEN_IMAGE_HS_BG_WO_TITLE, 9);
128: */
129:
130: init = true;
131: }
132:
133: }
|