htiextension/com.nokia.s60tools.hticonnection/src/com/nokia/s60tools/hticonnection/services/HTIScreenMode.java
changeset 0 61163b28edca
child 9 e67492608de0
equal deleted inserted replaced
-1:000000000000 0:61163b28edca
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 package com.nokia.s60tools.hticonnection.services;
       
    19 
       
    20 /**
       
    21  * This class contains information screen.
       
    22  * This includes screen rotation, color mode, focus index, and size.
       
    23  */
       
    24 public class HTIScreenMode {
       
    25 	
       
    26 	// Rotation
       
    27 	
       
    28 	/**
       
    29 	 * Screen is rotation 0 degrees.
       
    30 	 */
       
    31 	public static final int ROTATION_NONE = 0;
       
    32 	/**
       
    33 	 * Screen is rotation 90 degrees.
       
    34 	 */
       
    35 	public static final int ROTATION_90 = 1;
       
    36 	/**
       
    37 	 * Screen is rotation 180 degrees.
       
    38 	 */
       
    39 	public static final int ROTATION_180 = 2;
       
    40 	/**
       
    41 	 * Screen is rotation 270 degrees.
       
    42 	 */
       
    43 	public static final int ROTATION_270 = 3;
       
    44 	
       
    45 	// Color mode
       
    46 	
       
    47 	/**
       
    48 	 * Color mode no colors.
       
    49 	 */
       
    50 	public static final int MODE_ENONE = 0;
       
    51 	/**
       
    52 	 * Color mode grey, 2 colors.
       
    53 	 */
       
    54 	public static final int MODE_EGRAY2 = 1;
       
    55 	/**
       
    56 	 * Color mode grey, 4 colors.
       
    57 	 */
       
    58 	public static final int MODE_EGRAY4 = 2;
       
    59 	/**
       
    60 	 * Color mode grey 16 colors.
       
    61 	 */
       
    62 	public static final int MODE_EGRAY16 = 3;
       
    63 	/**
       
    64 	 * Color mode grey, 256 colors.
       
    65 	 */
       
    66 	public static final int MODE_EGRAY256 = 4;
       
    67 	/**
       
    68 	 * Color mode 16 colors.
       
    69 	 */
       
    70 	public static final int MODE_ECOLOR16 = 5;
       
    71 	/**
       
    72 	 * Color mode 256 colors.
       
    73 	 */
       
    74 	public static final int MODE_ECOLOR256 = 6;
       
    75 	/**
       
    76 	 * Color mode 64K colors.
       
    77 	 */
       
    78 	public static final int MODE_ECOLOR64K = 7;
       
    79 	/**
       
    80 	 * Color mode 16M colors.
       
    81 	 */
       
    82 	public static final int MODE_ECOLOR16M = 8;
       
    83 	/**
       
    84 	 * Color mode RGB colors.
       
    85 	 */
       
    86 	public static final int MODE_ERGB = 9;
       
    87 	/**
       
    88 	 * Color mode 4k colors.
       
    89 	 */
       
    90 	public static final int MODE_ECOLOR4K = 0xa;
       
    91 	/**
       
    92 	 * Color mode 16M colors.
       
    93 	 */
       
    94 	public static final int MODE_ECOLOR16MU = 0xb;
       
    95 	/**
       
    96 	 * Color mode 16M colors.
       
    97 	 */
       
    98 	public static final int MODE_ECOLOR16MA = 0xc;
       
    99 
       
   100 	/**
       
   101 	 * Screen is rotation values.
       
   102 	 */
       
   103 	public static final String ROTATION[] = new String[] {
       
   104 			"0°",  //$NON-NLS-1$
       
   105 			"90°",  //$NON-NLS-1$
       
   106 			"180°",  //$NON-NLS-1$
       
   107 			"270°"  //$NON-NLS-1$
       
   108 		};
       
   109 		
       
   110 	/**
       
   111 	 * Color mode values.
       
   112 	 */
       
   113 	public static final String MODE[] = new String[] {
       
   114 			"ENone", //$NON-NLS-1$
       
   115 			"EGray2", //$NON-NLS-1$
       
   116 			"EGray4", //$NON-NLS-1$
       
   117 			"EGray16", //$NON-NLS-1$
       
   118 			"EGray256", //$NON-NLS-1$
       
   119 			"EColor16", //$NON-NLS-1$
       
   120 			"EColor256", //$NON-NLS-1$
       
   121 			"EColor64K", //$NON-NLS-1$
       
   122 			"EColor16M", //$NON-NLS-1$
       
   123 			"ERgb", //$NON-NLS-1$
       
   124 			"EColor4K", //$NON-NLS-1$
       
   125 			"EColor16MU", //$NON-NLS-1$
       
   126 			"EColor16MA", //$NON-NLS-1$
       
   127 		};
       
   128 
       
   129 	
       
   130 	/**
       
   131 	 * The index number of the screen whose attributes are returned.
       
   132 	 */
       
   133 	private int index;
       
   134 	/**
       
   135 	 * The width of the screen in pixels.
       
   136 	 */
       
   137 	private int width;
       
   138 	/**
       
   139 	 * The height of the screen in pixels.
       
   140 	 */
       
   141 	private int height;
       
   142 	/**
       
   143 	 * The rotation of the screen. 0 = normal, 1 = 90, 2 = 180, 3 = 270.
       
   144 	 */
       
   145 	private int rotation;
       
   146 	/**
       
   147 	 * The display mode of the screen. 
       
   148 	 */
       
   149 	private int mode;
       
   150 	/**
       
   151 	 * The index number of the screen that currently has focus.
       
   152 	 * Note that this can be different than the currently selected screen.
       
   153 	 */
       
   154 	private int focusIndex;
       
   155 	
       
   156 	/**
       
   157 	 * Constructor.
       
   158 	 * @param index The index number of the screen whose attributes are returned.
       
   159 	 * @param width The width of the screen in pixels.
       
   160 	 * @param height The height of the screen in pixels.
       
   161 	 * @param rotation The rotation of the screen. 0 = normal, 1 = 90, 2 = 180, 3 = 270.
       
   162 	 * @param mode The display mode of the screen. 
       
   163 	 * @param focusIndex The index number of the screen that currently has focus.
       
   164 	 */
       
   165 	public HTIScreenMode(int index, int width, int height, int rotation, int mode, int focusIndex) {
       
   166 		this.index = index;
       
   167 		this.width = width;
       
   168 		this.height = height;
       
   169 		this.rotation = rotation;
       
   170 		this.mode = mode;
       
   171 		this.focusIndex = focusIndex;
       
   172 	}
       
   173 	
       
   174 	/**
       
   175 	 * Gets the index number of the screen whose attributes are returned.
       
   176 	 * @return index number of the screen whose attributes are returned.
       
   177 	 */
       
   178 	public int getIndex() {
       
   179 		return index;
       
   180 	}
       
   181 	
       
   182 	/**
       
   183 	 * Gets the width of the screen in pixels.
       
   184 	 * @return the width of the screen in pixels.
       
   185 	 */
       
   186 	public int getWidth() {
       
   187 		return width;
       
   188 	}
       
   189 	
       
   190 	/**
       
   191 	 * Gets the height of the screen in pixels.
       
   192 	 * @return the height of the screen in pixels.
       
   193 	 */
       
   194 	public int getHeight() {
       
   195 		return height;
       
   196 	}
       
   197 	
       
   198 	/**
       
   199 	 * Gets the rotation of the screen in degrees. 0 = normal, 1 = 90, 2 = 180, 3 = 270.
       
   200 	 * @return the rotation of the screen.
       
   201 	 */
       
   202 	public int getRotation() {
       
   203 		return rotation;
       
   204 	}
       
   205 	
       
   206 	/**
       
   207 	 * Gets the display mode of the screen. 
       
   208 	 * @return the display mode of the screen. 
       
   209 	 */
       
   210 	public int getMode() {
       
   211 		return mode;
       
   212 	}
       
   213 	
       
   214 	/**
       
   215 	 * Gets the index number of the screen that currently has focus.
       
   216 	 * Note that this can be different than the currently selected screen.
       
   217 	 * @return the index number of the screen that currently has focus.
       
   218 	 */
       
   219 	public int getFocusIndex() {
       
   220 		return focusIndex;
       
   221 	}
       
   222 	
       
   223 	/**
       
   224 	 * Returns a string representation of the screen mode.
       
   225 	 */
       
   226 	public String toString() {
       
   227 		return "[screen " + index + ": " + width + "x" + height + " @ " + MODE[mode] + ROTATION[rotation] + ", focus: " + focusIndex + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
       
   228 	}
       
   229 }