javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/swt/internal/extension/DisplayExtension.java
branchRCL_3
changeset 19 04becd199f91
child 60 6c158198356e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/src/org/eclipse/swt/internal/extension/DisplayExtension.java	Tue Apr 27 16:30:29 2010 +0300
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Nokia Corporation - initial implementation
+ *******************************************************************************/
+
+package org.eclipse.swt.internal.extension;
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.internal.symbian.OS;
+import org.eclipse.swt.widgets.Display;
+
+public final class DisplayExtension extends Display
+{
+
+    /* Image types, same values as MIDP */
+    public static final int LIST_ELEMENT = 1;
+    public static final int CHOICE_GROUP_ELEMENT = 2;
+    public static final int ALERT = 3;
+
+    public DisplayExtension()
+    {
+        super();
+    }
+
+    /**
+     * Determine the best width for the given image type.
+     * @param imageType
+     * @return Best height or -1 if invalid image type given.
+     */
+    public int getBestImageWidth(int imageType)
+    {
+        checkDevice();
+        return getBestImageSize(imageType).x;
+    }
+
+    /**
+     * Determine the best height for the given image type.
+     * @param imageType
+     * @return Best height or -1 if invalid image type given.
+     */
+    public int getBestImageHeight(int imageType)
+    {
+        checkDevice();
+        return getBestImageSize(imageType).y;
+    }
+
+    private Point getBestImageSize(int imageType)
+    {
+        return OS.DisplayExtension_getBestImageSize(imageType);
+    }
+
+}