basicgraphicaltheme.java

来自「moblie syncml mail javame」· Java 代码 · 共 190 行

JAVA
190
字号
/*
 * Funambol is a mobile platform developed by Funambol, Inc. 
 * Copyright (C) 2003 - 2007 Funambol, Inc.
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by
 * the Free Software Foundation with the addition of the following permission 
 * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
 * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE 
 * WARRANTY OF NON INFRINGEMENT  OF THIRD PARTY RIGHTS.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Affero General Public License 
 * along with this program; if not, see http://www.gnu.org/licenses or write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301 USA.
 * 
 * You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite 
 * 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License
 * version 3, these Appropriate Legal Notices must retain the display of the
 * "Powered by Funambol" logo. If the display of the logo is not reasonably 
 * feasible for technical reasons, the Appropriate Legal Notices must display
 * the words "Powered by Funambol".
 *
 *
 */
package com.funambol.mailclient.ui.view;

import com.funambol.mailclient.ui.controller.UIController;

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Font;

public class BasicGraphicalTheme implements GraphicalTheme {

    protected int backgroundColor = UIController.display.getColor(
            Display.COLOR_BACKGROUND);
    protected int highlightedBackgroundColor = UIController.display.getColor(
            Display.COLOR_HIGHLIGHTED_BACKGROUND);
    protected int foregroundColor = UIController.display.getColor(
            Display.COLOR_FOREGROUND);
    protected int highlightedForegroundColor = UIController.display.getColor(
            Display.COLOR_HIGHLIGHTED_FOREGROUND);
    protected int borderColor = UIController.display.getColor(
            Display.COLOR_BORDER);
    protected int highlightedBorderColor = UIController.display.getColor(
            Display.COLOR_HIGHLIGHTED_BORDER);
    //scrollbar background is gray
    protected int scrollbarBackgroundColor = 0xb2b2b2;

    // use white as color for title text
    protected int titleColor = 0xFFFFFF;

    // use blue that matches funambol logo color
    protected int titleBackgroundColor = 0x0878a1;

    /** Creates a new instance of Graphicaltheme with platform-coherent colors */
    public BasicGraphicalTheme() {

    }

    public int getBackgroundColor() {
        // checking if bgcol and fgCol are the same 
        // (it happens on a1000 and other phones)
        return backgroundColor == foregroundColor ? 0xFFFFFF : backgroundColor;

    }

    public void setBackgroundColor(int backgroundColor) {
        this.backgroundColor = backgroundColor;
    }

    public int getHighlightedBackgroundColor() {
        // checking if bgcol and fgCol are the same 
        // (it happens on a1000 and other phones)
        return highlightedBackgroundColor == highlightedForegroundColor ? 0x000000 : highlightedBackgroundColor;
    }

    public void setHighlightedBackgroundColor(int highlightedBackgroundColor) {
        this.highlightedBackgroundColor = highlightedBackgroundColor;
    }

    /*
     * using light gray for background scrollbar
     */
    public int getScrollbarBackgroundColor() {
        return scrollbarBackgroundColor;
    }

    public int getForegroundColor() {
        // checking if bgcol and fgCol are the same 
        // (it happens on a1000 and other phones)
        return backgroundColor == foregroundColor ? 0x000000 : foregroundColor;
    }

    public void setForegroundColor(int foregroundColor) {
        this.foregroundColor = foregroundColor;
    }

    public int getHighlightedForegroundColor() {
        // checking if bgcol and fgCol are the same 
        // (it happens on a1000 and other phones)

        return highlightedBackgroundColor == highlightedForegroundColor ? 0xFFFFFF : highlightedForegroundColor;
    }

    public void setHighlightedForegroundColor(int higlightedForegroundColor) {
        this.highlightedForegroundColor = higlightedForegroundColor;
    }

    public int getBorderColor() {
        return borderColor;
    }

    public void setBorderColor(int borderColor) {
        this.borderColor = borderColor;
    }

    public int getHighlightedBorderColor() {
        return highlightedBorderColor;
    }

    public void setHighlightedBorderColor(int higlightedBorderColor) {
        this.highlightedBorderColor = higlightedBorderColor;
    }
    
    public int getTitleBackgroundColor() {
        //return getForegroundColor();
        return titleBackgroundColor;
    }

    public int getTitleBorderColor() {
        return getHighlightedBorderColor();
    }

    public int getTitleColor() {
        //return getBackgroundColor();
        return titleColor;
    }

    public Font getDefaultFont() {
        //return Font.getDefaultFont();
        return getSmallFont();
    }

    public Font getSmallFont() {
        //#ifdef BigChars
        //# return Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_LARGE);
        //#else
        return Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL);
        //#endif
    }

    public Font getBoldFont() {
        //return Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
        return getSmallBoldFont();
    }

    public Font getTitleFont() {
        
        //#ifdef isBlackberry
        // using small font for bb devices
        //# return Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_SMALL);
        //#elifdef BigChars
        //# return Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE);
        //#else
        return Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
        //#endif

    }

    public Font getSmallBoldFont() {
        //#ifdef BigChars
        //# return Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE);
        //#else
        return Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_SMALL);
        //#endif
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?