javauis/lcdui_akn/javalcdui/javasrc.nokialcdui/com/nokia/mid/ui/TextEditorImpl.java
branchRCL_3
changeset 23 e5618cc85d74
parent 21 4376525cdefb
equal deleted inserted replaced
21:4376525cdefb 23:e5618cc85d74
    80     // Mask of all bits defined
    80     // Mask of all bits defined
    81     private static final int MASK =
    81     private static final int MASK =
    82         TOUCH_INPUT_HWR | TOUCH_INPUT_VKB | TOUCH_INPUT_FSQ |
    82         TOUCH_INPUT_HWR | TOUCH_INPUT_VKB | TOUCH_INPUT_FSQ |
    83         TOUCH_INPUT_ITUT | TOUCH_INPUT_FSC | TOUCH_INPUT_MINI_ITUT;
    83         TOUCH_INPUT_ITUT | TOUCH_INPUT_FSC | TOUCH_INPUT_MINI_ITUT;
    84 
    84 
       
    85     // Indicates receiving of pointer events by the editor
       
    86     private boolean iTouchEnabled;
       
    87 
    85     /*
    88     /*
    86      * <P>
    89      * <P>
    87      * Creates a new <code>TextEditor</code> object with the given initial contents,
    90      * Creates a new <code>TextEditor</code> object with the given initial contents,
    88      * maximum size in characters, constraints and editor size in pixels.
    91      * maximum size in characters, constraints and editor size in pixels.
    89      * </P>
    92      * </P>
   130      */
   133      */
   131     TextEditorImpl(String aText, int aMaxSize, int aConstraints, int aWidth,
   134     TextEditorImpl(String aText, int aMaxSize, int aConstraints, int aWidth,
   132                    int aHeight)
   135                    int aHeight)
   133     {
   136     {
   134         super(aText, aMaxSize, aConstraints, aWidth, aHeight, false);
   137         super(aText, aMaxSize, aConstraints, aWidth, aHeight, false);
       
   138         // Enabling receiving pointer events
       
   139         iTouchEnabled = true;
   135     }
   140     }
   136 
   141 
   137     /*
   142     /*
   138      * <P>
   143      * <P>
   139      * Creates a new empty <code>TextEditor</code> with the given maximum size in
   144      * Creates a new empty <code>TextEditor</code> with the given maximum size in
   174      *             if the width is less than one pixel
   179      *             if the width is less than one pixel
   175      */
   180      */
   176     TextEditorImpl(int aMaxSize, int aConstraints, int aWidth, int aRows)
   181     TextEditorImpl(int aMaxSize, int aConstraints, int aWidth, int aRows)
   177     {
   182     {
   178         super(null, aMaxSize, aConstraints, aWidth, aRows, true);
   183         super(null, aMaxSize, aConstraints, aWidth, aRows, true);
       
   184         // Enabling receiving pointer events
       
   185         iTouchEnabled = true;
   179     }
   186     }
   180 
   187 
   181     /*
   188     /*
   182      * Set the parent object of this TextEditor. Typically in LCDUI the parent
   189      * Set the parent object of this TextEditor. Typically in LCDUI the parent
   183      * object would be Canvas or CustomItem. Setting the parameter to null
   190      * object would be Canvas or CustomItem. Setting the parameter to null
   488                                           iHandle, x, y));
   495                                           iHandle, x, y));
   489         }
   496         }
   490     }
   497     }
   491 
   498 
   492     /*
   499     /*
       
   500      * Specifies whether or not the editor will receive touch-events.
       
   501      * <p>
       
   502      * This is enabled by default.
       
   503      * An editor with touch-event disabled won't be able to perform any
       
   504      * touch-related functionality such as scrolling or positioning the
       
   505      * cursor. It may however still be controlled via the
       
   506      * virtual keypad/control-panel if that is enabled, or receive other +
       
   507      * input e.g. via physical keys
       
   508      * <p>
       
   509      * @param enabled
       
   510      *              true to enabled touch-event, false to disable
       
   511      */
       
   512     public void setTouchEnabled(boolean enabled)
       
   513     {
       
   514         if (iTouchEnabled != enabled)
       
   515         {
       
   516             synchronized (iToolkit)
       
   517             {
       
   518                 _setTouchEnabled(getToolkitHandle(), iHandle, enabled);
       
   519                 iTouchEnabled = enabled;
       
   520             }
       
   521         }
       
   522     }
       
   523 
       
   524     /*
       
   525      * Gets the current touch-enabled state
       
   526      * <p>
       
   527      * @return true if the editor is touch-enabled, false otherwise
       
   528      */
       
   529     public boolean isTouchEnabled()
       
   530     {
       
   531         return iTouchEnabled;
       
   532     }
       
   533 
       
   534     /*
   493      * Hidden default constructor.
   535      * Hidden default constructor.
   494      */
   536      */
   495     private TextEditorImpl()
   537     private TextEditorImpl()
   496     {
   538     {
   497     }
   539     }
   650     public native int _setCaretXY(
   692     public native int _setCaretXY(
   651         int aToolkitHandle,
   693         int aToolkitHandle,
   652         int aNativePeerHandle,
   694         int aNativePeerHandle,
   653         int x,
   695         int x,
   654         int y);
   696         int y);
       
   697 
       
   698     /*
       
   699      * Specifies whether or not the editor will receive touch-events.
       
   700      *
       
   701      * This is enabled by default.
       
   702      * An editor with touch-event disabled won't be able to perform any
       
   703      * touch-related functionality such as scrolling or positioning the
       
   704      * cursor. It may however still be controlled via the
       
   705      * virtual keypad/control-panel if that is enabled, or receive other +
       
   706      * input e.g. via physical keys
       
   707      *
       
   708      * @param aEnabled
       
   709      *              true to enabled touch-event, false to disable
       
   710      */
       
   711     private native int _setTouchEnabled(int aToolkitHandle,
       
   712                                         int aNativePeerHandle, boolean aEnabled);
   655 }
   713 }
   656 
   714 
   657 // End of file
   715 // End of file