javauis/lcdui_qt/src/com/nokia/mj/impl/nokialcdui/LCDUIInvoker.java
changeset 23 98ccebc37403
parent 21 2a9601315dfc
child 35 85266cc22c7f
--- a/javauis/lcdui_qt/src/com/nokia/mj/impl/nokialcdui/LCDUIInvoker.java	Mon May 03 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/src/com/nokia/mj/impl/nokialcdui/LCDUIInvoker.java	Fri May 14 15:47:24 2010 +0300
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 package com.nokia.mj.impl.nokialcdui;
@@ -25,7 +25,8 @@
 /**
  * Abstract class providing the interface to internal LCDUI resources.
  */
-public abstract class LCDUIInvoker {
+public abstract class LCDUIInvoker
+{
 
     /**
      * Invoker instance.
@@ -37,7 +38,8 @@
      *
      * @param invoker In
      */
-    public static void setInvoker(LCDUIInvoker invoker) {
+    public static void setInvoker(LCDUIInvoker invoker)
+    {
         invokerInstance = invoker;
     }
 
@@ -46,10 +48,11 @@
      *
      * @param runnable a runnable
      */
-    public static void eSWTUIThreadRunnerSyncExec(Runnable runnable) {
+    public static void eSWTUIThreadRunnerSyncExec(Runnable runnable)
+    {
         invokerInstance.doESWTUIThreadRunnerSyncExec(runnable);
-     }
-    
+    }
+
     /**
      * Returns main eSWT Control that is used by LCDUI Displayable or Item.
      *
@@ -57,35 +60,67 @@
      * @return eSWT Control that is used by Displayable/Item or null if no
      *         Control is available.
      */
-    public static org.eclipse.swt.widgets.Control getEswtControl(Object lcduiObject) {
+    public static org.eclipse.swt.widgets.Control getEswtControl(Object lcduiObject)
+    {
         return invokerInstance.doGetEswtControl(lcduiObject);
     }
 
+    public static void setItemControlStateChangeListener(ItemControlStateChangeListener listener,Item item)
+    {
+        invokerInstance.doSetItemControlStateChangeListener(listener,item);
+    }
+
     /**
      * Returns eSWT Display that is used by LCDUI.
      *
      * @return eSWT Display that is used by LCDUI.
      */
-    public static org.eclipse.swt.widgets.Display getEswtDisplay() {
+    public static org.eclipse.swt.widgets.Display getEswtDisplay()
+    {
         return invokerInstance.doGetEswtDisplay();
     }
 
-    public static org.eclipse.swt.graphics.Image getEswtImage(Image img) {
-    	return invokerInstance.doGetEswtImage(img);
+    /**
+     * Returns eSWT Image from an LCDUI Image. The returned object is an already
+     * existing eSWT Image object contained within the LCDUI Image, so calling
+     * this function is efficient.
+     *
+     * @param img - LCDUI Image object.
+     * @return eSWT Image.
+     */
+    public static org.eclipse.swt.graphics.Image getEswtImage(Image img)
+    {
+        return invokerInstance.doGetEswtImage(img);
     }
 
     /**
+     * Creates LCDUI Image from an eSWT Image. The returned object is a new
+     * LCDUI Image object created from the eSWT Image, so this method is not
+     * as efficient as getEswtImage.
+     *
+     * @param img - eSWT Image object.
+     * @return LCDUI Image.
+     */
+    public static Image createLcduiImage(org.eclipse.swt.graphics.Image img)
+    {
+        return invokerInstance.doGetLcduiImage(img);
+    }
+
+
+    /**
      * Get the DirectGraphics object associated with this Graphics object.
      *
      * @param g Graphics object
      * @return DirectGraphics object
      */
-    public static DirectGraphics getDirectGraphics(Graphics g) {
+    public static DirectGraphics getDirectGraphics(Graphics g)
+    {
         return invokerInstance.doGetDirectGraphics(g);
     }
 
-    public static GraphicsContext getGc(Graphics g) {
-    	return invokerInstance.doGetGc(g);
+    public static GraphicsContext getGc(Graphics g)
+    {
+        return invokerInstance.doGetGc(g);
     }
 
     /**
@@ -96,7 +131,8 @@
      * @param height font height
      * @return the requested Font
      */
-    public static Font getFreeSizedFont(int face, int style, int height) {
+    public static Font getFreeSizedFont(int face, int style, int height)
+    {
         return invokerInstance.doGetFreeSizedFont(face, style, height);
     }
 
@@ -107,7 +143,8 @@
      * @param suppressKeys suppress game keys
      * @return framebuffer image
      */
-    public static void initGameCanvas(Object canvas, boolean suppressKeys) {
+    public static void initGameCanvas(Object canvas, boolean suppressKeys)
+    {
         invokerInstance.doInitGameCanvas(canvas, suppressKeys);
     }
 
@@ -117,21 +154,24 @@
      * @param canvas GameCanvas object
      * @return Graphics object
      */
-    public static Object getGraphics(Object canvas) {
+    public static Object getGraphics(Object canvas)
+    {
         return invokerInstance.doGetGraphics(canvas);
     }
 
-    public static Object getFlushLock(Object graphics) {
-    	return invokerInstance.doGetFlushLock(graphics);
+    public static Object getFlushLock(Object graphics)
+    {
+        return invokerInstance.doGetFlushLock(graphics);
     }
-    
+
     /**
      * Get game key states.
      *
      * @param canvas GameCanvas object
      * @return key states
      */
-    public static int getKeyStates(Object canvas) {
+    public static int getKeyStates(Object canvas)
+    {
         return invokerInstance.doGetKeyStates(canvas);
     }
 
@@ -141,7 +181,8 @@
      * @param canvas GameCanvas object
      * @param graphics Graphics object
      */
-    public static void renderGraphics(Object canvas, Object graphics) {
+    public static void renderGraphics(Object canvas, Object graphics)
+    {
         invokerInstance.doRenderGraphics(canvas, graphics);
     }
 
@@ -155,7 +196,8 @@
      * @param height clip height
      */
     public static void flushGraphics(Object canvas,
-            int x, int y, int width, int height) {
+                                     int x, int y, int width, int height)
+    {
         invokerInstance.doFlushGraphics(canvas, x, y, width, height);
     }
 
@@ -165,7 +207,8 @@
      * @param key property key
      * @return property value
      */
-    public static String getDynamicProperty(String key) {
+    public static String getDynamicProperty(String key)
+    {
         return invokerInstance.doGetDynamicProperty(key);
     }
 
@@ -175,23 +218,27 @@
     public static boolean detectCollision(Image image1, int transform1, int p1x, int p1y,
                                           int r1x1, int r1y1, int r1x2, int r1y2,
                                           Image image2, int transform2, int p2x, int p2y,
-                                          int r2x1, int r2y1, int r2x2, int r2y2) {
+                                          int r2x1, int r2y1, int r2x2, int r2y2)
+    {
         return invokerInstance.doDetectCollision(image1, transform1, p1x, p1y,
-                                                 r1x1, r1y1, r1x2, r1y2,
-                                                 image2, transform2, p2x, p2y,
-                                                 r2x1, r2y1, r2x2, r2y2);
+                r1x1, r1y1, r1x2, r1y2,
+                image2, transform2, p2x, p2y,
+                r2x1, r2y1, r2x2, r2y2);
     }
 
 
     // MMAPI support
 
     protected abstract org.eclipse.swt.widgets.Control doGetEswtControl(
-            Object lcduiObj);
+        Object lcduiObj);
 
     protected abstract org.eclipse.swt.widgets.Display doGetEswtDisplay();
 
     protected abstract org.eclipse.swt.graphics.Image doGetEswtImage(Image img);
 
+    protected abstract Image doGetLcduiImage(org.eclipse.swt.graphics.Image img);
+
+    protected abstract void doSetItemControlStateChangeListener(ItemControlStateChangeListener listener,Item item);
 
     // DirectGraphics support
 
@@ -207,7 +254,7 @@
             boolean suppressKeys);
 
     protected abstract Object doGetGraphics(Object canvas);
-    
+
     protected abstract Object doGetFlushLock(Object graphics);
 
     protected abstract int doGetKeyStates(Object canvas);
@@ -215,7 +262,7 @@
     protected abstract void doRenderGraphics(Object canvas, Object graphics);
 
     protected abstract void doFlushGraphics(Object canvas,
-            int x, int y, int width, int height);
+                                            int x, int y, int width, int height);
 
     protected abstract String doGetDynamicProperty(String key);
 
@@ -223,9 +270,9 @@
             int r1x1, int r1y1, int r1x2, int r1y2,
             Image image2, int transform2, int p2x, int p2y,
             int r2x1, int r2y1, int r2x2, int r2y2);
-    
+
     // TactileFeedback support
     protected abstract void doESWTUIThreadRunnerSyncExec(Runnable runnable);
-   
+
 
 }