javauis/lcdui_akn/javalcdui/inc/lcdui.h
branchRCL_3
changeset 66 2455ef1f5bbc
child 77 7cee158cb8cd
equal deleted inserted replaced
65:ae942d28ec0e 66:2455ef1f5bbc
       
     1 /*
       
     2 * Copyright (c) 1999 - 2003 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 
       
    19 #ifndef LCDUI_H
       
    20 #define LCDUI_H
       
    21 
       
    22 
       
    23 /**
       
    24  * @file
       
    25  * @publishedPartner
       
    26  * @released
       
    27  *
       
    28  * This header defines the interfaces that must be implemented for LCDUI.
       
    29  * It should be read in conjunction with the MIDP 2.0 specification which
       
    30  * will contain more information about the enumerations, for example.
       
    31  *
       
    32  * The MMIDComponentFactory interface, defined at the end of this file, is
       
    33  * the logical starting point to read this file.
       
    34  *
       
    35  * Most methods can be assumed to be invoked in the "server thread" where a
       
    36  * UI environment and its active scheduler will be present. Any method
       
    37  * marked as "client side" may also be invoked from a thread that does not have
       
    38  * a UI environment or activescheduler. These methods should ensure any shared
       
    39  * data strucutures that could be accessed by both the server thread and client
       
    40  * thread(s) are protected by suitable locking or atomic update strategies.
       
    41  *
       
    42  * "Framework" refers to the underlying Java Runtime Environment which invokes
       
    43  * the methods defined in these interfaces at the appropriate time and which the
       
    44  * the implementor of these interfaces need have no knowledge of.
       
    45  * "Implementation" refers to the implementation of these interfaces in the client DLL.
       
    46  */
       
    47 
       
    48 #include <e32def.h>
       
    49 #include <badesca.h>
       
    50 #include <gdi.h>
       
    51 #include <w32std.h>
       
    52 
       
    53 #ifdef RD_JAVA_NGA_ENABLED
       
    54 #include <EGL/egltypes.h>
       
    55 #include "monitor.h"
       
    56 #endif // RD_JAVA_NGA_ENABLED
       
    57 
       
    58 class MMIDDisplayable;
       
    59 class MMIDAlert;
       
    60 class MMIDForm;
       
    61 class MMIDList;
       
    62 class MMIDTextBox;
       
    63 
       
    64 class MMIDItem;
       
    65 class MMIDImageItem;
       
    66 class MMIDStringItem;
       
    67 class MMIDDateField;
       
    68 class MMIDGauge;
       
    69 class MMIDTextField;
       
    70 class MMIDChoiceGroup;
       
    71 
       
    72 class MMIDTicker;
       
    73 class MMIDCommand;
       
    74 
       
    75 class MMIDUtils;
       
    76 class MMIDEnv;
       
    77 class MMIDBufferProcessor;
       
    78 class MMIDFont;
       
    79 class MMIDImage;
       
    80 
       
    81 class CFont;
       
    82 class CCoeControl;
       
    83 
       
    84 class MMIDToLcduiObserver;
       
    85 class MDirectContainer;
       
    86 class MUiEventConsumer;
       
    87 
       
    88 class MMIDTextEditor;
       
    89 class MMIDCanvasGraphicsItem;
       
    90 class MMIDCanvasGraphicsItemPainter;
       
    91 class MMIDLcduiEventConsumer;
       
    92 
       
    93 /**
       
    94  * @internalComponent
       
    95  */
       
    96 typedef TAny* TJavaPeer;
       
    97 
       
    98 
       
    99 
       
   100 /**
       
   101  * Namespaces including constant definitions for MIDlet suite attribute names and attributes values.
       
   102  */
       
   103 namespace LcduiMidletAttributes
       
   104 {
       
   105 _LIT(KAttribMIDletName,                      "MIDlet-Name");
       
   106 _LIT(KAttribMIDletVersion,                   "MIDlet-Version");
       
   107 _LIT(KAttribMIDletVendor,                    "MIDlet-Vendor");
       
   108 _LIT(KAttribUIEnhancement,                   "Nokia-UI-Enhancement");
       
   109 _LIT(KAttribOrigDisplaySize,                 "Nokia-MIDlet-Original-Display-Size");
       
   110 _LIT(KAttribTargetDisplaySize,               "Nokia-MIDlet-Target-Display-Size");
       
   111 _LIT(KAttribNoExitKey,                       "Nokia-MIDlet-No-Exit");
       
   112 _LIT(KAttribFlipClose,                       "Nokia-MIDlet-Flip-Close");
       
   113 _LIT(KAttribBackgroundEvent,                 "Nokia-MIDlet-Background-Event");
       
   114 _LIT(KAttribAllowScalingOnOrientationSwitch, "Nokia-MIDlet-Canvas-Scaling-Orientation-Switch");
       
   115 _LIT(KAttribS60SelectionKeyCompatibility,    "Nokia-MIDlet-S60-Selection-Key-Compatibility");
       
   116 _LIT(KAttribAppOrientation,                  "Nokia-MIDlet-App-Orientation");
       
   117 _LIT(KAttribPointerEventSuppressorValues,    "Nokia-MIDlet-Tap-Detection-Options");
       
   118 _LIT(KAttribOskSoftkeysInQwerty,             "Nokia-MIDlet-On-Screen-Softkeys-Position");
       
   119 }
       
   120 
       
   121 namespace LcduiMidletAttributeValues
       
   122 {
       
   123 _LIT(KUIEnhMediaKeys,          "musickeyssupported");
       
   124 _LIT(KUIEnhCanvasBackground,   "canvashasbackground");
       
   125 _LIT(KUIEnhPopUpTextBox,       "popuptextbox");
       
   126 _LIT(KUIEnhFullScreenTextBox,  "fullscreentextbox");
       
   127 _LIT(KTrueValue,               "true");
       
   128 _LIT(KPauseValue,              "pause");
       
   129 _LIT(KRunValue,                "run");
       
   130 _LIT(KPortraitValue,           "portrait");
       
   131 _LIT(KLandscapeValue,          "landscape");
       
   132 _LIT(KPositionBottom,          "bottom");
       
   133 _LIT(KPositionRight,           "right");
       
   134 }
       
   135 
       
   136 
       
   137 
       
   138 /**
       
   139  *
       
   140  * Base class of all LCDUI objects. Concrete classes always implement a
       
   141  * subclass of this interface.
       
   142  *
       
   143  */
       
   144 class MMIDComponent
       
   145 {
       
   146     friend class CMIDToolkit;
       
   147 public:
       
   148     /**
       
   149      * Enumeration of the component type
       
   150      */
       
   151     enum TType
       
   152     {
       
   153         EUnknown,
       
   154         EImageItem,
       
   155         EStringItem,
       
   156         EGauge,
       
   157         ETextField,
       
   158         EChoiceGroup,
       
   159         EDateField,
       
   160         ECustomItem,
       
   161         ESpacer,
       
   162         ECanvas,
       
   163         EGameCanvas,
       
   164         EGraphics,
       
   165         EAlert,
       
   166         EForm,
       
   167         EList,
       
   168         ETextBox,
       
   169         ETicker,
       
   170         EFont,
       
   171         ECmd,
       
   172         EDisplayableContainer,
       
   173         EImage,
       
   174         ESprite,
       
   175         ETiledLayer,
       
   176         EDefaultBackground,
       
   177         ECanvasTextEditor,
       
   178         ECanvasGraphicsItem,
       
   179         ECanvasGraphicsItemPainter,
       
   180         ENumTypes   // Add types before ENumTypes
       
   181     };
       
   182 
       
   183 public:
       
   184     /**
       
   185      * Invoked by the framework to clean up any  resources used by the
       
   186      * implementation. Typically, the implementation will do "delete this"
       
   187      * but is clearly not restricted to this.
       
   188      */
       
   189     virtual void Dispose() = 0;
       
   190 
       
   191     /**
       
   192      * This is an aid to the implementation - it is not used by the framework.
       
   193      * Not particularly good O-O, but the example implementation makes
       
   194      * considerable use of this method to good simplification.
       
   195      */
       
   196     virtual TType Type() const
       
   197     {
       
   198         return EUnknown;
       
   199     }
       
   200 
       
   201     /**
       
   202      * Returns buffer processor associated with this component (if any).
       
   203      */
       
   204     virtual MMIDBufferProcessor* Processor()
       
   205     {
       
   206         return NULL;
       
   207     }
       
   208 
       
   209 private:
       
   210     /**
       
   211      * Inaccessible to the implementation, used by the framework for keeping
       
   212      * track of the associated Java object.
       
   213      */
       
   214     TJavaPeer iPeer;
       
   215 };
       
   216 
       
   217 #ifdef RD_JAVA_NGA_ENABLED
       
   218 /**
       
   219  * NGA tension to the Component interface
       
   220  * @since S60 9.2
       
   221  */
       
   222 class MMIDComponentNgaExtension : public MMIDComponent
       
   223 {
       
   224 public:
       
   225 
       
   226     /**
       
   227      * Update EGL content. Called by M3G to request LCDUI canvas to update
       
   228      * EGL surface with 2D content.
       
   229      * @since S60 9.2
       
   230      */
       
   231     virtual void UpdateEglContent() = 0;
       
   232 
       
   233     /**
       
   234      * Checks if EGL is available.
       
   235      * @return <code>ETrue</code> if EGL exists.
       
   236      * @since S60 9.2
       
   237      */
       
   238     virtual TBool IsEglAvailable() const = 0;
       
   239 
       
   240     /**
       
   241      * Gets and binds EGL surface.
       
   242      * @return surface handle. <code>EGL_NO_SURFACE</code> is
       
   243      * returned if binding is not possible.
       
   244      * @since S60 9.2
       
   245      * @see MMIDComponentNga#ReleaseEglSurface
       
   246      */
       
   247     virtual EGLSurface BindEglSurface() = 0;
       
   248 
       
   249     /**
       
   250      * Release EGL surface
       
   251      * @since S60 9.2
       
   252      */
       
   253     virtual void ReleaseEglSurface() = 0;
       
   254 
       
   255     /**
       
   256      * Update offscreen bitmap i.e. canvas frame buffer
       
   257      * @param aForced   If true, off-screen bitmap is updated without
       
   258      *                  checking Canvas type (Canvas/GameCanvas)
       
   259      * @since S60 9.2
       
   260      */
       
   261     virtual void UpdateOffScreenBitmapL(TBool aForced) = 0;
       
   262 
       
   263     /**
       
   264      * Fills EGL surface
       
   265      * @param aRect The area to be filled
       
   266      * @param aColor The fill color
       
   267      * @since S60 9.2
       
   268      */
       
   269     virtual TBool FillEglSurface(const TRect& aRect, const TRgb& aColor) = 0;
       
   270 
       
   271 };
       
   272 #endif // RD_JAVA_NGA_ENABLED
       
   273 
       
   274 /**
       
   275  *
       
   276  * Interface to Command
       
   277  *
       
   278  */
       
   279 class MMIDCommand : public MMIDComponent
       
   280 {
       
   281 public:
       
   282     /**
       
   283      * This is the type passed into the plugin factory CreateCommand method
       
   284      */
       
   285     enum TCommandType
       
   286     {
       
   287         EScreen=1,
       
   288         EBack,
       
   289         ECancel,
       
   290         EOk,
       
   291         EHelp,
       
   292         EStop,
       
   293         EExit,
       
   294         EItem
       
   295     };
       
   296 
       
   297     /**
       
   298      * Native command peer identifiers.
       
   299      */
       
   300     enum TCommandID
       
   301     {
       
   302         ENullCommand=0,             // null
       
   303         EAlertDismissCommand=1,     // Alert.DISMISS_COMMAND
       
   304         EListSelectCommand=2,       // List.SELECT_COMMAND
       
   305         EUserCommandBase=4          // Base id for application commands.
       
   306     };
       
   307 public:
       
   308     /**
       
   309      * Returns the human readable displayable text associated with the command.
       
   310      * @return  A descriptor containing the text.
       
   311      */
       
   312     virtual const TDesC& Label() const = 0;
       
   313     virtual TCommandType CommandType() const = 0;
       
   314     virtual TInt Priority() const = 0;
       
   315     virtual TInt Id() const = 0;
       
   316 
       
   317 public:
       
   318     /**
       
   319      * Returns the component type.
       
   320      * @return  The component type as a MMIDComponent::TType enum.
       
   321      */
       
   322     TType Type() const
       
   323     {
       
   324         return ECmd;
       
   325     }
       
   326 };
       
   327 
       
   328 /**
       
   329  *
       
   330  * Base class of all Items.
       
   331  *
       
   332  * MMIDForm::RefreshItemL() is generally called following any method calls
       
   333  * which result in the item changing its appearance, e.g. size, label, layout or
       
   334  * content changed which may mean that the Item's min size has changed. Hence
       
   335  * the concrete implementation of Item does not need to refresh the Form's
       
   336  * appearance itself.
       
   337  *
       
   338  */
       
   339 class MMIDItem : public MMIDComponent
       
   340 {
       
   341 public:
       
   342     /**
       
   343      * Used to describe the positioning of Item within the form.
       
   344      * Used by the form layout.
       
   345      */
       
   346     enum TLayout
       
   347     {
       
   348         EDefault = 0,
       
   349         ELeft,
       
   350         ERight,
       
   351         ECenter,
       
   352         //
       
   353         ETop = 0x10,
       
   354         EBottom = 0x20,
       
   355         EVerticalCenter = 0x30,
       
   356         //
       
   357         ENewLineBefore = 0x100,
       
   358         ENewLineAfter = 0x200,
       
   359         //
       
   360         EShrink = 0x400,
       
   361         EExpand = 0x800,
       
   362         EVerticalShrink = 0x1000,
       
   363         EVerticalExpand = 0x2000,
       
   364         ELayout2 = 0x4000
       
   365     };
       
   366     /**
       
   367      * Used only in StringItem & ImageItem
       
   368      */
       
   369     enum TAppearance
       
   370     {
       
   371         EPlain,     /** Item has normal appearance */
       
   372         EHyperLink, /** Item appears as a hyperlink */
       
   373         EButton     /** Item appears as a button */
       
   374     };
       
   375 public:
       
   376     /**
       
   377      * Since the following methods are followed by MMIDForm::RefreshItemL(),
       
   378      * a reasonable implementation strategy could be to just cache the values
       
   379      * and calculate/redisplay on the refresh. These methods are invoked server
       
   380      * side, nonetheless, so the alternative strategy can be followed.
       
   381      */
       
   382 
       
   383     /**
       
   384      * Sets the Item's label.
       
   385      * @param   aLabel
       
   386      *          A descriptor containing the label text.
       
   387      */
       
   388     virtual void SetLabelL(const TDesC& aLabel) = 0;
       
   389 
       
   390     /**
       
   391      * Sets the Item's layout.
       
   392      * @param   aLayout
       
   393      *          A TLayout enumeration describing the desired layout.
       
   394      */
       
   395     virtual void SetLayoutL(TLayout aLayout) = 0;
       
   396 
       
   397     /**
       
   398      * Commands are always referred to by their index. This is their position in
       
   399      * an array where 0 is the first command added and (number of commands -1)
       
   400      * is the last added. Removing commands has the obvious re-numbering of commands
       
   401      * which follow in order. In effect, the implementation should store them in a
       
   402      * similar structure regardless of how they are ordered on the display.
       
   403      *
       
   404      * If the item is actually visible on the display (e.g. CBA button), and
       
   405      * this call affects the set of visible commands, the implementation
       
   406      * should update the display as soon as it is feasible to do so.
       
   407      */
       
   408 
       
   409     /**
       
   410      * Adds a command to the list at the specified index. If aIndex is zero,
       
   411      * the command is added at the head of the list.
       
   412      * @param   aIndex
       
   413      *          The position at which to insert the command.
       
   414      * @param   aCommand
       
   415      *          The command to add.
       
   416      */
       
   417     virtual void AddCommandL(MMIDCommand* aCommand) = 0;
       
   418 
       
   419     /**
       
   420      * Removes the command specified by the given index.
       
   421      * @param   aIndex
       
   422      *          The position from which to remove the command.
       
   423      */
       
   424     virtual void RemoveCommand(MMIDCommand* aCommand) = 0;
       
   425 
       
   426     /**
       
   427      * Sets the default command to be aIndex, where aIndex is the index of a command
       
   428      * which has already been added via AddCommandL(). If aIndex = -1, then
       
   429      * there should be no default command set.
       
   430      * @param   aIndex
       
   431      *          The index of the command to set.
       
   432      */
       
   433     virtual void SetDefaultCommand(MMIDCommand*) = 0;
       
   434 
       
   435     /**
       
   436      * aSize could have either/both iWidth and iHeight = -1.
       
   437      * This means that the width/height should be computed based
       
   438      * on the item's contents .
       
   439      * @param   aSize
       
   440      *          Structure representing the preferred size.
       
   441      */
       
   442     virtual void SetPreferredSizeL(const TSize& aSize) = 0;
       
   443 
       
   444     /*
       
   445      * Return the sizes as per MIDP 2.0 spec
       
   446      */
       
   447 
       
   448     /**
       
   449      * Returns the Item's preferred size.
       
   450      * @return  The preferred size.
       
   451      */
       
   452     virtual TSize PreferredSize() const = 0;
       
   453 
       
   454     /**
       
   455      * Returns the Item's minimum size.
       
   456      * @return  The minimum size.
       
   457      */
       
   458     virtual TSize MinimumSize() const = 0;
       
   459 };
       
   460 
       
   461 /**
       
   462  * Displayable container window created before the actual content (e.g. List/Canvas etc)
       
   463  * is called before CreateListL() in the factory).
       
   464  *
       
   465  * It is envisioned that the concrete implementation of MMIDDisplayable
       
   466  * is a container for the actual Displayable in which to hang commands, title bar
       
   467  * etc.
       
   468  *
       
   469  * Do not subclass from both MMIDDisplayable and one of the content types (e.g. MMIDList, MMIDForm)
       
   470  * in the same implementation class.
       
   471  *
       
   472  */
       
   473 class MMIDDisplayable : public MMIDComponent
       
   474 {
       
   475 public:
       
   476     /**
       
   477      * Sets the Displayable's title.
       
   478      * @param   aTitle
       
   479      *          A descriptor containing the title text, may be NULL indicating
       
   480      *          that the displayable should hide the titlebar.
       
   481      */
       
   482     virtual void SetTitleL(const TDesC* aTitle) = 0;
       
   483 
       
   484     /**
       
   485      * Sets the Displayable's ticker, replacing any previous ticker.
       
   486      * The Ticker could be null, in which case no ticker is displayed.
       
   487      * @param   aTicker
       
   488      *          The ticker to associate with the Displayable.
       
   489      */
       
   490     virtual void SetTickerL(MMIDTicker* aTicker) = 0;
       
   491 
       
   492     /**
       
   493      * Returns the current ticker, or null if there is none set
       
   494      * @return  The ticker.
       
   495      */
       
   496     virtual MMIDTicker* Ticker() const = 0;
       
   497 
       
   498     /*
       
   499      * Commands are always referred to by their index. This is their position in
       
   500      * an array. The Commands will be inserted into the array in order of priority.
       
   501      * Removing commands has the obvious re-numbering of commands which follow in
       
   502      * order. In effect, the implementation should store them in a similar structure.
       
   503      *
       
   504      * If the item is actually visible on the display (e.g. CBA button), and
       
   505      * this call affects the set of visible commands, the implementation
       
   506      * should update the display as soon as it is feasible to do so.
       
   507      *
       
   508      * Adds a command to the list at the specified index. If aIndex is zero,
       
   509      * the command is added at the head of the list.
       
   510      * @param   aIndex
       
   511      *          The position at which to insert the command.
       
   512      * @param   aCommand
       
   513      *          The command to add.
       
   514      */
       
   515     virtual void AddCommandL(MMIDCommand* aCommand) = 0;
       
   516 
       
   517     /**
       
   518      * Removes the command specified by the given index.
       
   519      * @param   aIndex
       
   520      *          The position from which to remove the command.
       
   521      */
       
   522     virtual void RemoveCommand(MMIDCommand* aCommand) = 0;
       
   523 
       
   524     /**
       
   525      * Returns the size of the displayable content.
       
   526      * @return  The size of the displayable content.
       
   527      */
       
   528     virtual TSize ContentSize() const = 0;
       
   529 
       
   530     /**
       
   531      * Called when the receiving object has either just become or just
       
   532      * ceased to be the current Displayable. The receiving object is
       
   533      * expected to do the following:
       
   534      *
       
   535      * @param   aCurrent
       
   536      * If aCurrent is ETrue, the receiving object should allocate any
       
   537      * resources it needs to display its content and commands. It should
       
   538      * also enable event sources.
       
   539      * Enabling event sources may include adding a control to the control
       
   540      * stack, creating menus or toolbars to generate command events  and
       
   541      * making a control visible.
       
   542      * If this method leaves the framework will abort making the
       
   543      * receiving object current.
       
   544      * If aCurrent is EFalse, the receiving object should disable events
       
   545      * and make itself invisible. Leaves are ignored by the framework when
       
   546      * aCurrent is EFalse.
       
   547      * Regardless of the value of aCurrent, the receiving object is responsible
       
   548      * for returning itself to a consistent state should this method leave.
       
   549      *
       
   550      */
       
   551     virtual void HandleCurrentL(TBool aCurrent) = 0;
       
   552 
       
   553     /**
       
   554      * Set the component that is the displayable content.
       
   555      * The component here is the actual displayable which resides within this
       
   556      * container.
       
   557      * @param   aComponent
       
   558      *          Reference to the component to set.
       
   559      */
       
   560     virtual void SetComponentL(MMIDComponent& aComponent) = 0;
       
   561 
       
   562     /**
       
   563      * Get the component that is the displayable content.
       
   564      * The component here is the actual displayable which resides within this
       
   565      * container.
       
   566      * @return  A pointer to the returned component.
       
   567      */
       
   568     virtual MMIDComponent* Component() const = 0;
       
   569 
       
   570     /**
       
   571      * Controls whether the displayable should be in full-screen mode or in normal mode.
       
   572      * Only gets called for Canvases. Typically, the implementation would remove the
       
   573      * title bar in full screen mode.
       
   574      * @param   aFullScreen
       
   575      *          If ETrue, sets the Displayable to full screen mode, otherwise
       
   576      *          sets it to normal mode.
       
   577      */
       
   578     virtual void SetFullScreenModeL(TBool aFullScreen) = 0;
       
   579 
       
   580     /**
       
   581      * Controls whether the displayable has or has no CommandListener.
       
   582      * Only gets called for Canvases. Typically, the implementation sets a bool.
       
   583      * @param   aExistence
       
   584      *          If ETrue, The CommandListener is set, otherwise there is no
       
   585      *          CommandListener
       
   586      */
       
   587     virtual void SetCommandListenerExistence(TBool /*aExistence*/)
       
   588     {
       
   589         ;
       
   590     }
       
   591 
       
   592     /**
       
   593        * Gets a soft key label location and size for displayable, which does support it
       
   594        * @param   aSoftKeyId - a constant identifying the softkey
       
   595        * @param   aPosition - returned top left position of soft key label
       
   596        * @param aSize - returned size of soft ket label
       
   597        * @return  false if soft key label is not available, otherwise true
       
   598        * @since S60 5.0
       
   599        */
       
   600     virtual TBool SoftKeyLabelLocation(TInt aSoftKeyId, TPoint& aPosition, TSize& aSize) = 0;
       
   601 
       
   602     /**
       
   603      * Gets a soft key label anchor
       
   604      * @param   aSoftKeyId - a constant identifying the softkey
       
   605      * @return sk label anchor, an existence of sk can be checked by SoftKeyLabelLocation()
       
   606      * @since S60 5.0
       
   607      */
       
   608     virtual TInt SoftKeyLabelAnchor(TInt aSoftKeyId) = 0;
       
   609 
       
   610     /** Get a rect of a canvas without Keypad rect
       
   611      * @since S60 TB9.2
       
   612      */
       
   613     virtual TRect GetCanvasRectFromLaf() = 0;
       
   614 
       
   615     /**
       
   616      * Returns the component type.
       
   617      * @return  The component type as a MMIDComponent::TType enum.
       
   618      */
       
   619     TType Type() const
       
   620     {
       
   621         return EDisplayableContainer;
       
   622     }
       
   623 
       
   624     /**
       
   625      * @ DEPRECATED
       
   626      */
       
   627     virtual void SetHasCommandListener(TBool /*aHasCommandListener*/)
       
   628     {
       
   629         ;
       
   630     }
       
   631     /**
       
   632     * Returns boolean value indicating whether this displayable is pop-up TextBox.
       
   633     *
       
   634     * @return TBool
       
   635     *
       
   636     * @since S60 5.0
       
   637     */
       
   638     virtual TBool IsPopupTextBox() = 0;
       
   639     /*
       
   640      *@ DEPRECATED
       
   641     virtual CCoeControl& ContentWindow() = 0;
       
   642     */
       
   643 
       
   644     /**
       
   645      * Information about destroying old full screen Displayable.
       
   646      * @since Java 2.0
       
   647      */
       
   648     virtual void DisplayableBehindPopupIsDestroyed() = 0;
       
   649 
       
   650     /**
       
   651      * Force sync draw.
       
   652      */
       
   653     virtual void DrawNow() = 0;
       
   654 
       
   655     /**
       
   656        * Changes osk background state
       
   657        * @param   aOSKBackgroundState - osk background state
       
   658        */
       
   659     virtual void ChangeOSKBackgroundState(TBool aOSKBackgroundState) = 0;
       
   660 };
       
   661 
       
   662 
       
   663 /**
       
   664 *
       
   665 *
       
   666 *   Interface for Tactile Feedback Component
       
   667 *
       
   668 */
       
   669 #ifdef RD_TACTILE_FEEDBACK
       
   670 class MMIDTactileFeedbackComponent
       
   671 {
       
   672 public:
       
   673     virtual void UpdateTactileFeedback() = 0;
       
   674     virtual void RegisterFeedbackArea(TInt aId, TRect aRect, TInt aStyle) = 0;
       
   675     virtual void UnregisterFeedbackArea(TInt aId) = 0;
       
   676     virtual void UnregisterFeedbackForControl() = 0;
       
   677     virtual void MoveAreaToFirstPriority(TInt aId) = 0;
       
   678 };
       
   679 #endif
       
   680 
       
   681 
       
   682 /**
       
   683  * Interface to Canvas
       
   684  */
       
   685 #ifdef RD_JAVA_NGA_ENABLED
       
   686 class MMIDCanvas : public MMIDComponentNgaExtension
       
   687 #else // !RD_JAVA_NGA_ENABLED
       
   688 class MMIDCanvas : public MMIDComponent
       
   689 #endif // RD_JAVA_NGA_ENABLED
       
   690 {
       
   691 public:
       
   692     /**
       
   693      * Specifies how the drawing of the canvas will take place.
       
   694      */
       
   695     enum TDrawOp
       
   696     {
       
   697         /**
       
   698          * Draw the entire canvas to the screen.
       
   699          * This command has no data.
       
   700          */
       
   701         EDrwOpcBitBlt = 0,
       
   702 
       
   703 #ifdef RD_JAVA_NGA_ENABLED
       
   704         /**
       
   705          * Draw a rectangular region of the canvas to the screen. The rectangle to be drawn
       
   706          * is provided with the command as (x1,y1)-(x2,y2) inclusive-exclusive integer
       
   707          * coordinates following the command header.
       
   708          */
       
   709         EDrwOpcBitBltRect = 1,
       
   710 
       
   711         /**
       
   712          * Marks m3g content start point.
       
   713          * @since S60 9.2
       
   714          */
       
   715         EDrwOpcM3GContentStart = 2
       
   716 #else // !RD_JAVA_NGA_ENABLED
       
   717         /**
       
   718          * Draw a rectangular region of the canvas to the screen. The rectangle to be drawn
       
   719          * is provided with the command as (x1,y1)-(x2,y2) inclusive-exclusive integer
       
   720          * coordinates following the command header.
       
   721          */
       
   722         EDrwOpcBitBltRect = 1
       
   723 #endif // RD_JAVA_NGA_ENABLED
       
   724     };
       
   725 public:
       
   726     /**
       
   727      * Returns the component type.
       
   728      * @return  The component type as a MMIDComponent::TType enum.
       
   729      */
       
   730     virtual TType Type() const
       
   731     {
       
   732         return ECanvas;
       
   733     }
       
   734 
       
   735     /**
       
   736      * Returns a reference to the CCoeControl corresponding to this canvas.
       
   737      * @return  Reference to the CCoeControl corresponding to this canvas.
       
   738      */
       
   739     virtual CCoeControl&    Control() = 0;
       
   740 
       
   741     /**
       
   742      * Returns the frame buffer. Double buffering must be supported so this method
       
   743      * must not return NULL. There is no ownership transfer.
       
   744      * @return  A pointer to the frame buffer.
       
   745      */
       
   746     virtual CFbsBitmap* FrameBuffer() const = 0;
       
   747 
       
   748     /**
       
   749      * Returns the size of the canvas content.
       
   750      * @return  The size of the displayable content.
       
   751      */
       
   752     virtual TSize ContentSize() const = 0;
       
   753 
       
   754     /**
       
   755      * Direct screen access support.
       
   756      *
       
   757      * This method should be called to disable direct screen access when
       
   758      * a popup menu is about to be displayed. This is a workaround for
       
   759      * menu's failing to correctly draw their shadows on Techview and
       
   760      * other UI's that have floating menubars.
       
   761      */
       
   762     virtual void PauseDirectAccess() = 0;
       
   763 
       
   764     /**
       
   765      * Re-enables direct access. To be called when the menu has disappeared.
       
   766      */
       
   767     virtual void ResumeDirectAccess() = 0;
       
   768 
       
   769     /**
       
   770      * Switch off key event posting. Game keys will still be tracked, but
       
   771      * keyPressed()/keyReleased() callbacks will not be called.
       
   772      */
       
   773     virtual void    SuppressKeys() = 0;
       
   774 
       
   775     /**
       
   776      * Returns the latched state of the game action keys.
       
   777      * @return  The latched state of the game action keys.
       
   778      */
       
   779     virtual TUint32 GameActions() = 0;
       
   780 
       
   781 public:
       
   782     /**
       
   783      *@return A container on which video can be rendered
       
   784      */
       
   785     virtual MDirectContainer& DirectContainer() = 0;
       
   786 
       
   787     /**
       
   788      * Draw a background image.
       
   789      * @param   aGc Target context
       
   790      * @param   aPosition Position
       
   791      * @param   aSize Size
       
   792      * @since S60 5.0
       
   793      */
       
   794     virtual void DrawBackground(CBitmapContext& aGc, const TPoint& aPosition, const TSize& aSize) = 0;
       
   795 
       
   796     /**
       
   797      * Returns the type of Canvas object
       
   798      * @return  <code>ETrue</code> if the type is <code>MMIDComponent::EGameCanvas</code> and
       
   799      *          <code>EFalse</code> when the type is <code>MMIDComponent::ECanvas</code>.
       
   800      * @since S60 5.0
       
   801      */
       
   802     virtual TBool IsGameCanvas() const = 0;
       
   803 
       
   804     /**
       
   805        * Gets a network indicator location and size on fullscreen Canvas
       
   806        * @param aPosition - returned top left position of nw indicator
       
   807        * @param aSize - returned size of nw indicator
       
   808        * @return false if Canvas is not able to display nw indicator (not fullscreen), otherwise true
       
   809        * @since S60 5.0
       
   810        */
       
   811     virtual TBool NetworkIndicatorLocation(TPoint& aPosition, TSize& aSize) const = 0;
       
   812 
       
   813 #ifdef RD_TACTILE_FEEDBACK
       
   814     virtual  MMIDTactileFeedbackComponent* TactileFeedbackComponent() = 0;
       
   815 #endif
       
   816 
       
   817 #ifdef RD_JAVA_NGA_ENABLED
       
   818     /**
       
   819      * Notifies Canvas about areas that have been updated with 2D drawing.
       
   820      * Used for optimising texture upload to OpenGL when EGL surface is used.
       
   821      * @param aRect
       
   822      *      - the area that has been updated in canvas coordinates.
       
   823      * @since S60 9.2
       
   824      */
       
   825     virtual void UpdateRect(const TRect& aRect) = 0;
       
   826 
       
   827     /**
       
   828      * Notifies canvas about MIDlet exit. In exit Canvas must draw content to CWindowGc
       
   829      * to enable system transition effects.
       
   830      * @since S60 9.2
       
   831      */
       
   832     virtual void MidletExiting() = 0;
       
   833 #endif // RD_JAVA_NGA_ENABLED
       
   834 
       
   835     virtual TBool ReadyToBlit() const = 0;
       
   836 };
       
   837 
       
   838 /**
       
   839  *
       
   840  * Interface to Alert
       
   841  *
       
   842  */
       
   843 class MMIDAlert : public MMIDComponent
       
   844 {
       
   845 public:
       
   846     /**
       
   847      * Enumeration of the different Alert behaviours.
       
   848      */
       
   849     enum TAlertType
       
   850     {
       
   851         ENone = -1,
       
   852         EAlarm,
       
   853         EConfirmation,
       
   854         EError,
       
   855         EInfo,
       
   856         EWarning,
       
   857     };
       
   858 
       
   859     /**
       
   860      * Enumeration used by SetTimeoutL()/DefaultTimeout();
       
   861      * @see void SetTimeoutL(TInt aTime);
       
   862      * @see TInt DefaultTimeout();
       
   863      */
       
   864     enum
       
   865     {
       
   866         EForever = -2
       
   867     };
       
   868 public:
       
   869 
       
   870     /**
       
   871      * Sets the Alert's text.
       
   872      * Framework does not call SetModalL if there are now scrollbars.
       
   873      * @param   aString
       
   874      *          A descriptor containing the text. May be empty, to display no text.
       
   875      */
       
   876     virtual void SetStringL(const TDesC& aString) = 0;
       
   877 
       
   878     /**
       
   879      * Sets the Alert's image.
       
   880      * Framework does not call SetModalL if there are now scrollbars
       
   881      * @param   aImage
       
   882      *          A pointer to the image. May be NULL, to display no image.
       
   883      */
       
   884     virtual void SetImageL(MMIDImage* aImage) = 0;
       
   885 
       
   886     /**
       
   887      * Sets the Alert's gauge.
       
   888      * Framework does not call SetModalL if there are now scrollbars
       
   889      * @param   aGauge
       
   890      *          A pointer to the gauge. May be NULL, to display no gauge.
       
   891      */
       
   892     virtual void SetIndicatorL(MMIDGauge* aGauge) = 0;
       
   893 
       
   894     /**
       
   895      * Set the behavioural type of the Alert.
       
   896      * @param   aType
       
   897      *          Enumeration of the desired behaviour type
       
   898      */
       
   899     virtual void SetTypeL(TAlertType aType) = 0;
       
   900 
       
   901     /**
       
   902      * Return the default timeout.
       
   903      * @return  The default timeout in milliseconds, or EForever.
       
   904      */
       
   905     virtual TInt DefaultTimeout() = 0;
       
   906 
       
   907     /**
       
   908      * Set the display timeout for the Alert.
       
   909      * If Alert is non-modal, the implementation is responsible for setting
       
   910      * a timer and should post an event when the timer completes.
       
   911      * @param   aTime
       
   912      *          The timeout in milliseconds, or EForever for modal alerts.
       
   913      */
       
   914     virtual void SetTimeoutL(TInt aTime) = 0;
       
   915 
       
   916     /**
       
   917      * Used to set the Alert's modal property.
       
   918      * Called by the framework when two or more Commands are added.
       
   919      */
       
   920     virtual void SetModalL() = 0;
       
   921 
       
   922     /**
       
   923      * Return if modal or not.
       
   924      * @return  ETrue or EFalse.
       
   925      */
       
   926     virtual TBool IsModal() = 0;
       
   927 public:
       
   928     /**
       
   929      * Returns the component type.
       
   930      * @return  The component type as a MMIDComponent::TType enum.
       
   931      */
       
   932     TType Type() const
       
   933     {
       
   934         return EAlert;
       
   935     }
       
   936 };
       
   937 
       
   938 /**
       
   939  *
       
   940  * Interface to Form
       
   941  *
       
   942  */
       
   943 class MMIDForm : public MMIDComponent
       
   944 {
       
   945 public:
       
   946     /**
       
   947      * Adds a list of Items to the Form, replacing the previous contents.
       
   948      * @param   aItems
       
   949      *          Reference to an array containing the Items to add.
       
   950      */
       
   951     virtual void SetAllItemsL(const RArray<MMIDItem*>& aItems) = 0;
       
   952 
       
   953     /**
       
   954      * Sets the Form Item referenced by aIndex to the specified Item,
       
   955      * replacing the previous Item.
       
   956      * @param   aItem
       
   957      *          Reference to the new Item to add.
       
   958      * @param   aIndex
       
   959      *          The index representing the old Item on the Form.
       
   960      */
       
   961     virtual void SetItemL(MMIDItem& aItem,TInt aIndex) = 0;
       
   962 
       
   963     /**
       
   964      * Adds the given Item to the form before the specified index.
       
   965      * @param   aItem
       
   966      *          Reference to the Item to add.
       
   967      * @param   aIndex
       
   968      *          The index before which to insert the Item.
       
   969      */
       
   970     virtual void InsertItemL(MMIDItem& aItem,TInt aIndex) = 0;
       
   971 
       
   972     /**
       
   973      * Removes the Item with the given index from the Form.
       
   974      * @param   aIndex
       
   975      *          The index representing the Item to remove.
       
   976      */
       
   977     virtual void DeleteItemL(TInt aIndex) = 0;
       
   978 
       
   979     /**
       
   980      * Removes all the Items from the Form.
       
   981      */
       
   982     virtual void DeleteAllItemsL() = 0;
       
   983 
       
   984     /**
       
   985      * Called following any Item method calls which result in the item
       
   986      * changing its appearance in some way, e.g. size, label and content
       
   987      * changed which may mean that the Item's min size has changed.
       
   988      * @param   aIndex
       
   989      *          The index representing the item on the form.
       
   990      */
       
   991     virtual void RefreshItemL(TInt aIndex) = 0;
       
   992 
       
   993     /**
       
   994      * Returns whether the item is actually visible to the user. Must therefore take into
       
   995      * account the visibility of the entire form, and whether the specific item is scrolled
       
   996      * in/out of the viewable area.
       
   997      * @param   aIndex
       
   998      *          The index representing the item on the form.
       
   999      * @return  ETrue or EFalse
       
  1000      */
       
  1001     virtual TBool IsItemVisible(TInt aIndex) = 0;
       
  1002 
       
  1003     /**
       
  1004      * This will be called prior to the Form itself being made the current Displayable.
       
  1005      * It provides an opportunity to prepare the Form such that this item will
       
  1006      * be visible and focused when the form is eventually made current.
       
  1007      * @param   aIndex
       
  1008      *          The index representing the item on the form.
       
  1009      */
       
  1010     virtual void SetCurrentItemL(TInt aIndex) = 0;
       
  1011 
       
  1012     /**
       
  1013      * Return width of displayable area available for items.
       
  1014      * @return  Width of displayable area.
       
  1015      */
       
  1016     virtual TInt Width() = 0;
       
  1017 
       
  1018     /**
       
  1019      * Return height of displayable area available for items.
       
  1020      * @return  Height of displayable area.
       
  1021      */
       
  1022     virtual TInt Height() = 0;
       
  1023 
       
  1024 public:
       
  1025     /**
       
  1026      * Returns the component type.
       
  1027      * @return  The component type as a MMIDComponent::TType enum.
       
  1028      */
       
  1029     TType Type() const
       
  1030     {
       
  1031         return EForm;
       
  1032     }
       
  1033 };
       
  1034 
       
  1035 
       
  1036 /**
       
  1037  *
       
  1038  * Interface for List.
       
  1039  *
       
  1040  * Implicit lists should notify the java side when the select operation
       
  1041  * has been performed by calling MMIDEnv::PostJavaEvent with a reference
       
  1042  * to the MMIDList implementing class and TSourceType == EDisplayable.
       
  1043  */
       
  1044 class MMIDList : public MMIDComponent
       
  1045 {
       
  1046 public:
       
  1047     /**
       
  1048      * Insert a List item before the specified index.
       
  1049      * @param   aIndex
       
  1050      *          The index representing insertion position.
       
  1051      * @param   aText
       
  1052      *          Desriptor reference containing the text.
       
  1053      * @param   aImage
       
  1054      *          A pointer to an associated image. NULL if there
       
  1055      *          is no image associated with this list element.
       
  1056      */
       
  1057     virtual void InsertElementL(TInt aIndex,const TDesC& aText,MMIDImage* aImage) = 0;
       
  1058 
       
  1059     /**
       
  1060      * Replace the List item at the specified index with the new text.
       
  1061      * @param   aIndex
       
  1062      *          The index representing the item to replace.
       
  1063      * @param   aText
       
  1064      *          Desriptor reference containing the new text.
       
  1065      * @param   aImage
       
  1066      *          A pointer to the new associated image. NULL if there
       
  1067      *          is no image associated with this list element.
       
  1068      */
       
  1069     virtual void SetElementL(TInt aIndex,const TDesC& aText,MMIDImage* aImage) = 0;
       
  1070 
       
  1071     /**
       
  1072      * Delete the List item at the specified index.
       
  1073      * @param   aIndex
       
  1074      *          The index representing the item to delete.
       
  1075      */
       
  1076     virtual void DeleteElementL(TInt aIndex) = 0;
       
  1077 
       
  1078     /**
       
  1079      * Delete the all the items in the List.
       
  1080      */
       
  1081     virtual void DeleteAllL() = 0;
       
  1082 
       
  1083     /**
       
  1084      * Set the List item at the specified index to selected or unselected.
       
  1085      * @param   aIndex
       
  1086      *          The index representing the item.
       
  1087      * @param   aSelected
       
  1088      *          ETrue to set the item selected, EFalse to deselect the item.
       
  1089      */
       
  1090     virtual void SelectElementL(TInt aIndex,TBool aSelected) = 0;
       
  1091 
       
  1092     /**
       
  1093      * Returns whether the item specified by index is selected or unselected.
       
  1094      * @param   aIndex
       
  1095      *          The index representing the item.
       
  1096      * @return  ETrue if the item is selected, EFalse otherwise.
       
  1097      */
       
  1098     virtual TBool IsSelected(TInt aIndex) = 0;
       
  1099 
       
  1100     /**
       
  1101      * Set the font for the item represented by the given index.
       
  1102      * @param   aIndex
       
  1103      *          The index representing the item.
       
  1104      * @param   aFont
       
  1105      *          Pointer to the font to use.
       
  1106      */
       
  1107     virtual void SetFontL(TInt aIndex, MMIDFont* aFont) = 0;
       
  1108 
       
  1109     /**
       
  1110      * Sets the application's preferred policy for fitting element
       
  1111      * contents to the available screen space.
       
  1112      * @param   aFitPolicy
       
  1113      *          The fit policy to use.
       
  1114      */
       
  1115     virtual void SetFitPolicyL(TInt aFitPolicy) = 0;
       
  1116 
       
  1117     /**
       
  1118      * Notifies this MMIDList that the select command has changed.
       
  1119      * This is only called on IMPLICIT Lists.
       
  1120      *
       
  1121      * This is only relevant to MMIDList implementing classes that provide a
       
  1122      * visual means of invoking the select operation, e.g. a soft key.
       
  1123      * If this is the case, the visual means should be removed when the select
       
  1124      * command is set to null or to an application provided command.
       
  1125      *
       
  1126      * @param   aCommandID
       
  1127      *      One of:
       
  1128      *          The ID of a command that has been added to the list via AddCommandL
       
  1129      *          - in this case the List should look up the command in its collection
       
  1130      *            and use the label for its selection mechanism.
       
  1131      *
       
  1132      *          MMIDCommand::EListSelectCommand
       
  1133      *          - in this case the List should use the default label for its
       
  1134      *            selection mechanism.
       
  1135      *
       
  1136      *          MMIDCommand::ENullCommand
       
  1137      *
       
  1138      *          - in this case the list should not support selection. This value will
       
  1139      *          be passed in response to the application calling:
       
  1140      *              List.setSelectCommand(null);
       
  1141      *
       
  1142      */
       
  1143     virtual void SetSelectCommand(TInt aCommandID) = 0;
       
  1144 
       
  1145 public:
       
  1146     /**
       
  1147      * Returns the component type.
       
  1148      * @return  The component type as a MMIDComponent::TType enum.
       
  1149      */
       
  1150     TType Type() const
       
  1151     {
       
  1152         return EList;
       
  1153     }
       
  1154 };
       
  1155 
       
  1156 /**
       
  1157  *
       
  1158  * Interface for TextBox
       
  1159  *
       
  1160  */
       
  1161 class MMIDTextBox : public MMIDComponent
       
  1162 {
       
  1163 public:
       
  1164     /**
       
  1165      * Deletes the given number of characters starting at the specified offset.
       
  1166      * @param   aOffset
       
  1167      *          The offset from which to start the deletion.
       
  1168      * @param   aLength
       
  1169      *          The number of characters to delete.
       
  1170      */
       
  1171     virtual void DeleteTextL(TInt aOffset,TInt aLength) = 0;
       
  1172 
       
  1173     /**
       
  1174      * Sets the text to that supplied, replacing the previous contents.
       
  1175      * @param   aText
       
  1176      *          Reference to a descriptor containing the new text.
       
  1177      */
       
  1178     virtual void SetTextL(const TDesC& aText) = 0;
       
  1179 
       
  1180     /**
       
  1181      * Inserts the supplied text starting at the given position.
       
  1182      * @param   aText
       
  1183      *          Reference to a descriptor containing the new text.
       
  1184      * @param   aPosition
       
  1185      *          The positon at which to insert the new text.
       
  1186      */
       
  1187     virtual void InsertTextL(const TDesC& aText,TInt aPosition) = 0;
       
  1188 
       
  1189     /**
       
  1190      * Sets the input constraints of the TextBox.
       
  1191      * @param   aConstraints
       
  1192      *          The new constraints.
       
  1193      */
       
  1194     virtual void SetConstraintsL(TUint aConstraints) = 0;
       
  1195 
       
  1196     /**
       
  1197      * Sets the maximum number of characters that can be stored in
       
  1198      * this texbox. Returns assigned maximum capacity.
       
  1199      * The max size returned by this method will be used for exception checking
       
  1200      * on the java side.
       
  1201      * @param   aMaxSize
       
  1202      *          The maximum number of characters.
       
  1203      * @return  The assigned maximum number of characters.
       
  1204      */
       
  1205     virtual TInt SetMaxSizeL(TInt aMaxSize) = 0;
       
  1206 
       
  1207     /**
       
  1208      * Returns the maximum number of characters that can be stored in
       
  1209      * this texbox. Called once by the framework after construction.
       
  1210      * The max size returned by this method will be used for exception checking
       
  1211      * on the java side.
       
  1212      * @return  The maximum number of characters.
       
  1213      */
       
  1214     virtual TInt GetMaxSize() = 0;
       
  1215 
       
  1216     /**
       
  1217      * Gets the number of characters that are currently stored in this TextBox.
       
  1218      * @return  The number of characters.
       
  1219      */
       
  1220     virtual TInt Size() = 0;
       
  1221 
       
  1222     /**
       
  1223      * Gets the current input position.
       
  1224      * @return  The current input position.
       
  1225      */
       
  1226     virtual TInt GetCaretPosition() = 0;
       
  1227 
       
  1228     /**
       
  1229      * Gets the contents of the TextBox.
       
  1230      * @return  The text is returned as a heap cell, and ownership is transferred.
       
  1231      */
       
  1232     virtual HBufC* GetTextL() = 0;
       
  1233 
       
  1234     /**
       
  1235      * Sets a hint to the implementation as to the input mode that should
       
  1236      * be used when the user initiates editing of this TextBox.
       
  1237      * @param   aCharacterSubset
       
  1238      *          The unicode character subset.
       
  1239      */
       
  1240     virtual void SetInitialInputModeL(const TDesC& aCharacterSubset) = 0;
       
  1241 
       
  1242 public:
       
  1243     /**
       
  1244      * Returns the component type.
       
  1245      * @return  The component type as a MMIDComponent::TType enum.
       
  1246      */
       
  1247     TType Type() const
       
  1248     {
       
  1249         return ETextBox;
       
  1250     }
       
  1251 };
       
  1252 
       
  1253 
       
  1254 /**
       
  1255  *
       
  1256  * Interface to ImageItem
       
  1257  *
       
  1258  */
       
  1259 class MMIDImageItem : public MMIDItem
       
  1260 {
       
  1261 public:
       
  1262     /**
       
  1263      * Sets the Image contained within the ImageItem.
       
  1264      * Snap shot of image has already been taken java side.
       
  1265      * @param   aImage
       
  1266      *          A pointer to the image to use.
       
  1267      */
       
  1268     virtual void SetImageL(MMIDImage* aImage) = 0;
       
  1269 
       
  1270     /**
       
  1271      * Sets the text string to be used if the image exceeds the device's
       
  1272      * capacity to display it.
       
  1273      * @param   aAltText
       
  1274      *          Descriptor reference containing the text.
       
  1275      */
       
  1276     virtual void SetAltTextL(const TDesC& aAltText) = 0;
       
  1277 public:
       
  1278     /**
       
  1279      * Returns the component type.
       
  1280      * @return  The component type as a MMIDComponent::TType enum.
       
  1281      */
       
  1282     TType Type() const
       
  1283     {
       
  1284         return EImageItem;
       
  1285     }
       
  1286 };
       
  1287 
       
  1288 /**
       
  1289  *
       
  1290  * Interface to Spacer.
       
  1291  *
       
  1292  * The Item methods setLabel(String aLabel), addCommand(Command aCommand)
       
  1293  * and setDefaultCommand(Command aCommand) will never be called
       
  1294  *
       
  1295  */
       
  1296 class MMIDSpacer : public MMIDItem
       
  1297 {
       
  1298 public:
       
  1299     /**
       
  1300      * Sets the minimum size for this spacer.
       
  1301      * @param   aSize
       
  1302      *          The size to use.
       
  1303      */
       
  1304     virtual void SetMinimumSizeL(const TSize& aSize) = 0;
       
  1305 public:
       
  1306     /**
       
  1307      * Returns the component type.
       
  1308      * @return  The component type as a MMIDComponent::TType enum.
       
  1309      */
       
  1310     TType Type() const
       
  1311     {
       
  1312         return ESpacer;
       
  1313     }
       
  1314 };
       
  1315 
       
  1316 /**
       
  1317  *
       
  1318  * Interface to StringItem. The default font, i.e the one that should be used if
       
  1319  * no font is set, should be the one returned by Font.getDefaultFont(), i.e. with
       
  1320  * attributes ESystem,EPlain,EMedium
       
  1321  *
       
  1322  */
       
  1323 class MMIDStringItem : public MMIDItem
       
  1324 {
       
  1325 public:
       
  1326     /**
       
  1327      * Sets the text contents of the StringItem.
       
  1328      * @param   aText
       
  1329      *          Descriptor reference containing the text.
       
  1330      */
       
  1331     virtual void SetTextL(const TDesC& aText) = 0;
       
  1332 
       
  1333     /**
       
  1334      * Sets the preferred font for rendering this StringItem.
       
  1335      * @param   aFont
       
  1336      *          A pointer to the font to use.
       
  1337      */
       
  1338     virtual void SetFontL(MMIDFont* aFont) = 0;
       
  1339 public:
       
  1340     /**
       
  1341      * Returns the component type.
       
  1342      * @return  The component type as a MMIDComponent::TType enum.
       
  1343      */
       
  1344     TType Type() const
       
  1345     {
       
  1346         return EStringItem;
       
  1347     }
       
  1348 };
       
  1349 
       
  1350 /**
       
  1351  *
       
  1352  * Interface to DateField. This should be constructed in a "not initialized state" which
       
  1353  * should be clearly identifiable. Only after user interaction or programmatically with
       
  1354  * setDate() should it change.
       
  1355  *
       
  1356  */
       
  1357 class MMIDDateField : public MMIDItem
       
  1358 {
       
  1359 public:
       
  1360     /**
       
  1361      * Enumeration to indicate whether the DataField object contains
       
  1362      * information about the time, the date, or both.
       
  1363      */
       
  1364     enum TInputMode
       
  1365     {
       
  1366         EDate = 1,
       
  1367         ETime,
       
  1368         EDateTime
       
  1369     };
       
  1370 
       
  1371     /**
       
  1372      * Compatability typedef.
       
  1373      * @deprecated
       
  1374      */
       
  1375     typedef TInputMode TFieldType;
       
  1376 public:
       
  1377     /**
       
  1378      * Returns the current value as a date or time or both.
       
  1379      * @return  The date/time
       
  1380      */
       
  1381     virtual TTime Date() const = 0;
       
  1382 
       
  1383     /**
       
  1384      * Sets a new value for this field.
       
  1385      * @param   aTime
       
  1386      *          The new value.
       
  1387      */
       
  1388     virtual void SetDate(const TTime& aTime) = 0;
       
  1389 
       
  1390     /**
       
  1391      * This method is called in response to DateField.setDate(null). The implementation
       
  1392      * should respond by presenting the control as clearly being in a non-intialized state
       
  1393      */
       
  1394     virtual void SetUninitialized() = 0;
       
  1395 
       
  1396     /**
       
  1397      * Change the date field type
       
  1398      */
       
  1399     virtual void SetInputModeL(TInputMode aInputMode) = 0;
       
  1400 
       
  1401 public:
       
  1402     /**
       
  1403      * Returns the component type.
       
  1404      * @return  The component type as a MMIDComponent::TType enum.
       
  1405      */
       
  1406     TType Type() const
       
  1407     {
       
  1408         return EDateField;
       
  1409     }
       
  1410 };
       
  1411 
       
  1412 /**
       
  1413  *
       
  1414  * Interface to Gauge.
       
  1415  *
       
  1416  */
       
  1417 class MMIDGauge : public MMIDItem
       
  1418 {
       
  1419 public:
       
  1420     /**
       
  1421      * Enumeration of various gauge behaviour patterns.
       
  1422      */
       
  1423     enum
       
  1424     {
       
  1425         EIndefinite = -1,
       
  1426         EContinuousIdle,
       
  1427         EIncrementalIdle,
       
  1428         EContinuousRunning,
       
  1429         EIncrementalUpdating
       
  1430     };
       
  1431 public:
       
  1432     /**
       
  1433      * Sets the current value of this Gauge object.
       
  1434      * If the gauge is in the indefinite mode, then aValue will take one of the values
       
  1435      * EContinuousIdle, EIncrementalIdle, EContinuousRunning or EIncrementalUpdating.
       
  1436      * @param   aValue
       
  1437      *          The new value.
       
  1438      */
       
  1439     virtual void SetValueL(TInt aValue) = 0;
       
  1440 
       
  1441     /**
       
  1442      * Get the current value of this Gauge object.
       
  1443      * @return  The current value.
       
  1444      */
       
  1445     virtual TInt GetValue() = 0;
       
  1446 
       
  1447     /**
       
  1448      * Sets the maximum value of this Gauge object.
       
  1449      * aValue could take the special value EIndefinite in order to indicate that the Gauge
       
  1450      * has indefinite range.
       
  1451      * @param   aValue
       
  1452      *          The maximum value.
       
  1453      */
       
  1454     virtual void SetMaxValueL(TInt aValue) = 0;
       
  1455 public:
       
  1456     /**
       
  1457      * Returns the component type.
       
  1458      * @return  The component type as a MMIDComponent::TType enum.
       
  1459      */
       
  1460     TType Type() const
       
  1461     {
       
  1462         return EGauge;
       
  1463     }
       
  1464 };
       
  1465 
       
  1466 /**
       
  1467  *
       
  1468  * Interface for TextField
       
  1469  *
       
  1470  */
       
  1471 class MMIDTextField : public MMIDItem
       
  1472 {
       
  1473 public:
       
  1474     enum
       
  1475     {
       
  1476         /**
       
  1477          * Constraints
       
  1478          */
       
  1479         EAny,
       
  1480         EMailAddr,
       
  1481         ENumeric,
       
  1482         EPhoneNumber,
       
  1483         EUrl,
       
  1484         EDecimal,
       
  1485         /**
       
  1486          * Modifiers
       
  1487          */
       
  1488         EPassword=0x10000,
       
  1489         EUneditable=0x20000,
       
  1490         ESensitive=0x40000,
       
  1491         ENonPredictive=0x80000,
       
  1492         EInitialCapsWord=0x100000,
       
  1493         EInitialCapsWordSentence=0x200000,
       
  1494         EConstraintMask=0xFFFF
       
  1495     };
       
  1496 public:
       
  1497     /**
       
  1498      * Deletes the given number of characters starting at the specified offset.
       
  1499      * @param   aOffset
       
  1500      *          The offset from which to start the deletion.
       
  1501      * @param   aLength
       
  1502      *          The number of characters to delete.
       
  1503      */
       
  1504     virtual void DeleteTextL(TInt aOffset,TInt aLength) = 0;
       
  1505 
       
  1506     /**
       
  1507      * Sets the text to that supplied, replacing the previous contents.
       
  1508      * @param   aText
       
  1509      *          Reference to a descriptor containing the new text.
       
  1510      */
       
  1511     virtual void SetTextL(const TDesC& aText) = 0;
       
  1512 
       
  1513     /**
       
  1514      * Inserts the supplied text starting at the given position.
       
  1515      * @param   aText
       
  1516      *          Reference to a descriptor containing the new text.
       
  1517      * @param   aPosition
       
  1518      *          The positon at which to insert the new text.
       
  1519      */
       
  1520     virtual void InsertTextL(const TDesC& aText,TInt aPosition) = 0;
       
  1521 
       
  1522     /**
       
  1523      * Sets the input constraints of the TextBox.
       
  1524      * @param   aConstraints
       
  1525      *          The new constraints.
       
  1526      */
       
  1527     virtual void SetConstraintsL(TUint aConstraints) = 0;
       
  1528 
       
  1529     /**
       
  1530      * Returns assigned maximum capacity. The max size returned by this
       
  1531      * method will be used for exception checking on the java side.
       
  1532      */
       
  1533     virtual TInt SetMaxSizeL(TInt aMaxSize) = 0;
       
  1534 
       
  1535     /**
       
  1536      * Returns the maximum number of characters that can be stored in
       
  1537      * this texbox. Called once by the framework after construction.
       
  1538      * The max size returned by this method will be used for exception checking
       
  1539      * on the java side.
       
  1540      * @return  The maximum number of characters.
       
  1541      */
       
  1542     virtual TInt GetMaxSize() = 0;
       
  1543 
       
  1544     // client side method
       
  1545 
       
  1546     /**
       
  1547      * Gets the number of characters that are currently stored in this TextBox.
       
  1548      * @return  The number of characters.
       
  1549      */
       
  1550     virtual TInt Size() = 0;
       
  1551 
       
  1552     /**
       
  1553      * Gets the current input position.
       
  1554      * @return  The current input position.
       
  1555      */
       
  1556     virtual TInt GetCaretPosition() = 0;
       
  1557 
       
  1558     /**
       
  1559      * Gets the contents of the TextBox.
       
  1560      * @return  The text is returned as a HBufC*, and ownership is transferred.
       
  1561      */
       
  1562     virtual HBufC* GetTextL() = 0;
       
  1563 
       
  1564     /**
       
  1565      * Sets a hint to the implementation as to the input mode that should
       
  1566      * be used when the user initiates editing of this TextBox.
       
  1567      * @param   aCharacterSubset
       
  1568      *          The unicode character subset.
       
  1569      */
       
  1570     virtual void SetInitialInputModeL(const TDesC& aCharacterSubset) = 0;
       
  1571 public:
       
  1572     /**
       
  1573      * Returns the component type.
       
  1574      * @return  The component type as a MMIDComponent::TType enum.
       
  1575      */
       
  1576     TType Type() const
       
  1577     {
       
  1578         return ETextField;
       
  1579     }
       
  1580 };
       
  1581 
       
  1582 /**
       
  1583  *
       
  1584  * Interface for ChoiceGroup
       
  1585  *
       
  1586  */
       
  1587 class MMIDChoiceGroup : public MMIDItem
       
  1588 {
       
  1589 public:
       
  1590     /**
       
  1591      * Enueration of selection behaviour types.
       
  1592      */
       
  1593     enum TChoiceType
       
  1594     {
       
  1595         EExclusive=1,
       
  1596         EMultiple,
       
  1597         EImplicit,
       
  1598         EPopup
       
  1599     };
       
  1600     /**
       
  1601      * Enueration of display behaviour types.
       
  1602      */
       
  1603     enum TFitPolicy
       
  1604     {
       
  1605         EWrapDefault = 0,
       
  1606         EWrapOn,
       
  1607         EWrapOff
       
  1608     };
       
  1609 public:
       
  1610     /**
       
  1611      * Insert a ChoiceGroup item before the specified index.
       
  1612      * @param   aIndex
       
  1613      *          The index representing insertion position.
       
  1614      * @param   aText
       
  1615      *          Desriptor reference containing the text.
       
  1616      * @param   aImage
       
  1617      *          A pointer to an associated image. NULL if there
       
  1618      *          is no image associated with this element.
       
  1619      */
       
  1620     virtual void InsertElementL(TInt aIndex,const TDesC& aText,MMIDImage* aImage) = 0;
       
  1621 
       
  1622     /**
       
  1623      * Delete the ChoiceGroup item at the specified index.
       
  1624      * @param   aIndex
       
  1625      *          The index representing the item to delete.
       
  1626      */
       
  1627     virtual void DeleteElementL(TInt aIndex) = 0;
       
  1628 
       
  1629     /**
       
  1630      * Delete the all the items in the ChoiceGroup.
       
  1631      */
       
  1632     virtual void DeleteAllL() = 0;
       
  1633 
       
  1634     /**
       
  1635      * Replace the ChoiceGroup item at the specified index with the new text.
       
  1636      * @param   aIndex
       
  1637      *          The index representing the item to replace.
       
  1638      * @param   aText
       
  1639      *          Desriptor reference containing the new text.
       
  1640      * @param   aImage
       
  1641      *          A pointer to the new associated image. NULL if there
       
  1642      *          is no image associated with this list element.
       
  1643      */
       
  1644     virtual void SetElementL(TInt aIndex,const TDesC& aText,MMIDImage* aImage) = 0;
       
  1645 
       
  1646     /**
       
  1647      * Set the ChoiceGroup item at the specified index to selected or unselected.
       
  1648      * @param   aIndex
       
  1649      *          The index representing the item.
       
  1650      * @param   aSelected
       
  1651      *          ETrue to set the item selected, EFalse to deselect the item.
       
  1652      */
       
  1653     virtual void SelectElementL(TInt aIndex,TBool aSelected) = 0;
       
  1654 
       
  1655     /**
       
  1656      * Returns whether the item specified by index is selected or unselected.
       
  1657      * @param   aIndex
       
  1658      *          The index representing the item.
       
  1659      * @return  ETrue if the item is selected, EFalse otherwise.
       
  1660      */
       
  1661     virtual TBool IsSelected(TInt aIndex) = 0;
       
  1662 
       
  1663     /**
       
  1664      * Set the font for the item represented by the given index.
       
  1665      * @param   aIndex
       
  1666      *          The index representing the item.
       
  1667      * @param   aFont
       
  1668      *          Pointer to the font to use.
       
  1669      */
       
  1670     virtual void SetFontL(TInt aIndex, MMIDFont* aFont) = 0;
       
  1671 
       
  1672     /**
       
  1673      * Sets the application's preferred policy for fitting element
       
  1674      * contents to the available screen space.
       
  1675      * @param   aFitPolicy
       
  1676      *          The fit policy to use. One of the values of TFitPolicy.
       
  1677      */
       
  1678     virtual void SetFitPolicyL(TInt aFitPolicy) = 0;
       
  1679 public:
       
  1680     /**
       
  1681      * Returns the component type.
       
  1682      * @return  The component type as a MMIDComponent::TType enum.
       
  1683      */
       
  1684     TType Type() const
       
  1685     {
       
  1686         return EChoiceGroup;
       
  1687     }
       
  1688 };
       
  1689 
       
  1690 
       
  1691 /**
       
  1692  *
       
  1693  * Interface for CustomItem
       
  1694  *
       
  1695  */
       
  1696 class MMIDCustomItem : public MMIDItem
       
  1697 {
       
  1698 public:
       
  1699     /**
       
  1700      * Enumeration of various behaviour types relating to
       
  1701      * support for traversal, pointer events and keypresses.
       
  1702      */
       
  1703     enum TInteractionMode
       
  1704     {
       
  1705         ENone,
       
  1706         ETraverseHorizontal,
       
  1707         ETraverseVertical,
       
  1708         EKeyPress=4,
       
  1709         EKeyRelease=8,
       
  1710         EKeyRepeat=0x10,
       
  1711         EPointerPress=0x20,
       
  1712         EPointerRelease=0x40,
       
  1713         EPointerDrag=0x80
       
  1714     };
       
  1715 public:
       
  1716     /**
       
  1717      * Gets the available interaction modes.
       
  1718      * Client side method returning combination of flags supported
       
  1719      * by device.
       
  1720      * This will be called by a java thread and as such it must
       
  1721      * not call any FS, FBS, CONE, UIKON or WSERV API's.
       
  1722      * @return  The interaction modes.
       
  1723      */
       
  1724     virtual TInt InteractionModes() const = 0;
       
  1725 
       
  1726     /**
       
  1727      * Sets the focus as specified.
       
  1728      * @param   aFocus
       
  1729      * @param   aScroll
       
  1730      * @param   aDirection
       
  1731      */
       
  1732     virtual void SetFocusAndScroll(TBool aFocus,const TRect* aScroll,TInt aDirection) = 0;
       
  1733 
       
  1734     /**
       
  1735      * Signals that the CustomItem's size and traversal location need to be updated.
       
  1736      * Updates CustomItem with new MinContentSize and PrefContentSize received
       
  1737      * from CustomItem.
       
  1738      * @param   aMinSize
       
  1739      *          The new minimum content size.
       
  1740      * @param   aPrefSize
       
  1741      *          The new preferred content size.
       
  1742      */
       
  1743     virtual void Invalidate(const TSize& aMinSize, const TSize& aPrefSize) = 0;
       
  1744 
       
  1745     /**
       
  1746      * Returns the backing bitmap onto which Graphics may draw.
       
  1747      * Does not transfer ownership.
       
  1748      * @returns A pointer to the bitmap.
       
  1749      */
       
  1750     virtual CFbsBitmap* FrameBuffer() const = 0;
       
  1751 
       
  1752 public:
       
  1753     /**
       
  1754      * Returns the component type.
       
  1755      * @return  The component type as a MMIDComponent::TType enum.
       
  1756      */
       
  1757     TType Type() const
       
  1758     {
       
  1759         return ECustomItem;
       
  1760     }
       
  1761 
       
  1762     /**
       
  1763      *@return A container on which video can be rendered
       
  1764      */
       
  1765     virtual MDirectContainer& DirectContainer() = 0;
       
  1766 
       
  1767 #ifdef RD_TACTILE_FEEDBACK
       
  1768     virtual  MMIDTactileFeedbackComponent* TactileFeedbackComponent() = 0;
       
  1769 #endif
       
  1770 };
       
  1771 
       
  1772 
       
  1773 /**
       
  1774  *
       
  1775  * Interface to Font. The font returned by Font.getDefaultFont() has attributes
       
  1776  * ESystem,EPlain,EMedium
       
  1777  *
       
  1778  */
       
  1779 class MMIDFont : public MMIDComponent
       
  1780 {
       
  1781 public:
       
  1782     /**
       
  1783      * Font face
       
  1784      */
       
  1785     enum TFace
       
  1786     {
       
  1787         ESystem=0,
       
  1788         EMonospaced=32,
       
  1789         EProportional=64
       
  1790     };
       
  1791     /**
       
  1792      * Font style
       
  1793      */
       
  1794     enum TStyle
       
  1795     {
       
  1796         EPlain=0,
       
  1797         EBold=0x1,
       
  1798         EItalic=0x2,
       
  1799         EUnderlined=0x4,
       
  1800     };
       
  1801     /**
       
  1802      * Font size
       
  1803      */
       
  1804     enum TSize
       
  1805     {
       
  1806         ESmall=8,
       
  1807         EMedium=0,
       
  1808         ELarge=16
       
  1809     };
       
  1810     /**
       
  1811      * Font specifier
       
  1812      */
       
  1813     enum TFontSpecifier
       
  1814     {
       
  1815         EStaticText,
       
  1816         EInputText
       
  1817     };
       
  1818 public:
       
  1819     /**
       
  1820      * Returns a pointer to a font having the face, style, and size of this Font.
       
  1821      *
       
  1822      * Special note about Nokia scaling jad attribute: Nokia-MIDlet-Original-Display-Size
       
  1823      * Returns a pointer to a font which is scaled according to the jad attribute.
       
  1824      * When called with parameter ETrue scaling attribute is not taken into account.
       
  1825      *
       
  1826      * @return A pointer to the font.
       
  1827      */
       
  1828     virtual CFont* Font(TBool aHighLevelComponent = EFalse) = 0;
       
  1829 
       
  1830     /**
       
  1831      * Returns the height in pixels of text drawn with this Font.
       
  1832      * @return The height.
       
  1833      */
       
  1834     virtual TInt Height() = 0;
       
  1835 
       
  1836     /**
       
  1837      * Gets the distance in pixels from the top of the text to the text's baseline.
       
  1838      * @return The distance in pixels from the top of the text to the text's baseline.
       
  1839      */
       
  1840     virtual TInt Baseline() = 0;
       
  1841 
       
  1842     /**
       
  1843      * Gets the total advance width for showing the specified string using this Font.
       
  1844      * @param   aString
       
  1845      *          Reference to a descriptor containing the text.
       
  1846      * @return  The display width.
       
  1847      */
       
  1848     virtual TInt Width(const TDesC& aString) = 0;
       
  1849 
       
  1850     /**
       
  1851      * Returns whether text draw using this Font is underlined.
       
  1852      * @return ETrue or EFalse
       
  1853      */
       
  1854     virtual TBool IsUnderlined() const = 0;
       
  1855 public:
       
  1856     /**
       
  1857      * Returns the component type.
       
  1858      * @return  The component type as a MMIDComponent::TType enum.
       
  1859      */
       
  1860     TType Type() const
       
  1861     {
       
  1862         return EFont;
       
  1863     }
       
  1864 };
       
  1865 
       
  1866 /**
       
  1867  * Structure combining the various font attributes.
       
  1868  */
       
  1869 struct SFontSpec
       
  1870 {
       
  1871     MMIDFont::TStyle iStyle;
       
  1872     MMIDFont::TFace iFace;
       
  1873     MMIDFont::TSize iSize;
       
  1874 };
       
  1875 
       
  1876 /**
       
  1877  *
       
  1878  * Interface to Ticker
       
  1879  *
       
  1880  */
       
  1881 class MMIDTicker : public MMIDComponent
       
  1882 {
       
  1883 public:
       
  1884     /**
       
  1885      * Sets the text to that supplied, replacing the previous contents.
       
  1886      * @param   aText
       
  1887      *          Reference to a descriptor containing the new text.
       
  1888      */
       
  1889     virtual void SetTextL(const TDesC& aText) = 0;
       
  1890 public:
       
  1891     /**
       
  1892      * Returns the component type.
       
  1893      * @return  The component type as a MMIDComponent::TType enum.
       
  1894      */
       
  1895     TType Type() const
       
  1896     {
       
  1897         return ETicker;
       
  1898     }
       
  1899 };
       
  1900 
       
  1901 /**
       
  1902  *
       
  1903  * Class for general utilities. Gives the framework general query methods
       
  1904  * for querying the implementation
       
  1905  *
       
  1906  */
       
  1907 class MMIDUtils
       
  1908 {
       
  1909 public:
       
  1910     enum
       
  1911     {
       
  1912         EActionUp=1,
       
  1913         EActionDown=6,
       
  1914         EActionLeft=2,
       
  1915         EActionRight=5,
       
  1916         EActionFire=8,
       
  1917         EActionGameA=9,
       
  1918         EActionGameB=10,
       
  1919         EActionGameC=11,
       
  1920         EActionGameD=12
       
  1921     };
       
  1922     enum TImageType
       
  1923     {
       
  1924         EListImage = 1,
       
  1925         EChoiceImage,
       
  1926         EAlertImage
       
  1927     };
       
  1928     enum TColorType
       
  1929     {
       
  1930         EColorBackground=0,
       
  1931         EColorForeground=1,
       
  1932         EColorHighlightedBackground=2,
       
  1933         EColorHighlightedForeground=3,
       
  1934         EColorBorder=4,
       
  1935         EColorHighlightedBorder=5
       
  1936     };
       
  1937     enum TGraphicsType
       
  1938     {
       
  1939         ESolid=0,
       
  1940         EDotted=1
       
  1941     };
       
  1942 public:
       
  1943 
       
  1944     /**
       
  1945      * Alert the user by playing the sound for this AlertType.
       
  1946      * @param   aType
       
  1947      *          The alert type for which to play the sound.
       
  1948      * @return ETrue if the user was alerted, EFalse otherwise.
       
  1949      */
       
  1950     virtual TBool PlaySound(TInt aType) = 0;
       
  1951 
       
  1952     /**
       
  1953      * Return whether the framework should attempt to translate
       
  1954      * the scancode and post an event up to Java.
       
  1955      * This method may be unneccessary as the filtering
       
  1956      * can be done in MapScanCode(MapSpecialKey)below.
       
  1957      * @param   aScanCode
       
  1958      *          The scancode to be translated.
       
  1959      * @return  ETrue or EFalse
       
  1960      */
       
  1961     virtual TBool IsJavaKey(TInt aScanCode) = 0;
       
  1962 
       
  1963     /**
       
  1964      * Translate scan code to MIDP key code. Only called for
       
  1965      * 'special' codes that could not be mapped to unicode
       
  1966      * characters. Must return a negative key code or zero
       
  1967      * if no key event should be sent to Java.
       
  1968      * @param   aScanCode
       
  1969      *          The scancode to be translated.
       
  1970      * @return  The MIDP key code.
       
  1971      */
       
  1972     virtual TInt MapNonUnicodeKey(TUint aScanCode) = 0;
       
  1973 
       
  1974     /**
       
  1975      * Gets an informative key string for aKeyCode
       
  1976      * @param   aText
       
  1977      *          Descriptor references to receive the key string.
       
  1978      * @param   aKeyCode
       
  1979      *          The keycode to retrieve.
       
  1980      */
       
  1981     virtual void GetKeyName(TDes& aText,TInt aKeyCode) = 0;
       
  1982 
       
  1983     /**
       
  1984      * Return the MIDP Canvas game action corresponding to
       
  1985      * MIDP key code aKeyCode, or zero if no game action is
       
  1986      * associated with this key code.
       
  1987      * @param   aKeyCode
       
  1988      *          The keycode to retrieve.
       
  1989      * @return  The MIDP Canvas game action.
       
  1990      */
       
  1991     virtual TInt GetGameAction(TInt aKeyCode) = 0;
       
  1992 
       
  1993     /**
       
  1994      * Return the cannonical key code corresponding to the
       
  1995      * Canvas game action aGameAction.
       
  1996      * Must provide a mapping for every game action.
       
  1997      * Return zero if aGameAction is not a valid game action.
       
  1998      * @param   aGameAction
       
  1999      *          The game action.
       
  2000      * @return  The keycode corresponding to the game action.
       
  2001      */
       
  2002     virtual TInt GetKeyCode(TInt aGameAction) = 0;
       
  2003 
       
  2004     /**
       
  2005      * Map one of the standard font types INPUT/STATIC to a font specifier.
       
  2006      * This mapping is platform dependent.
       
  2007      *
       
  2008      * An INPUT Text Specifier will use:-
       
  2009      *      Face: EMonospaced, Style: EBold, Size: EMedium
       
  2010      * A STATIC Text Specifier will use:-
       
  2011      *      Face: EProportional, Style: EPlain, Size: ESmall
       
  2012      * Otherwise a default specifer will be chosen:-
       
  2013      *      Face: ESystem, Style: EPlain, Size: ESmall
       
  2014      * @param   aSpecifier
       
  2015      *          The font type
       
  2016      * @return  The font specifier
       
  2017      */
       
  2018     virtual SFontSpec FontSpecifierSpecs(MMIDFont::TFontSpecifier aSpecifier) = 0;
       
  2019 
       
  2020     /**
       
  2021      * Requests a flashing effect for the device's backlight.
       
  2022      * @param   aDuration
       
  2023      *          The length of time to flash.
       
  2024      * @return  ETrue if the request was satisfied, EFalse otherwise.
       
  2025      */
       
  2026     virtual TBool FlashBacklightL(const TTimeIntervalMicroSeconds32& aDuration) = 0;
       
  2027 
       
  2028     /**
       
  2029      * Requests operation of the device's vibrator.
       
  2030      * @param   aDuration
       
  2031      *          The length of time to vibrate.
       
  2032      * @return  ETrue if the request was satisfied, EFalse otherwise.
       
  2033      */
       
  2034     virtual TBool Vibrate(const TTimeIntervalMicroSeconds32& aDuration) = 0;
       
  2035 
       
  2036     /**
       
  2037      * Mapping Uikon TLogical Color to Java ColorSpecifier
       
  2038      * @param   aColorSpecifier
       
  2039      *          The Java colour specifier.
       
  2040      * @return  The Uikon colour.
       
  2041      */
       
  2042     virtual TInt Color(TColorType aColorSpecifier) = 0;
       
  2043 
       
  2044     /**
       
  2045      * Returns if the platform supports pointer press and release events.
       
  2046      * @return  ETrue or EFalse.
       
  2047      */
       
  2048     virtual TBool HasPointerEvents() = 0;
       
  2049 
       
  2050     /**
       
  2051      * Returns if the platform supports pointer motion events (pointer dragged).
       
  2052      * @return  ETrue or EFalse.
       
  2053      */
       
  2054     virtual TBool HasPointerMotionEvents() = 0;
       
  2055 
       
  2056     /**
       
  2057      * Returns if the platform generates repeat events when key is kept down.
       
  2058      * @return  ETrue or EFalse.
       
  2059      */
       
  2060     virtual TBool HasRepeatEvents() = 0;
       
  2061 
       
  2062     /**
       
  2063      * Returns the stroke style used for border drawing depending
       
  2064      * on the state of the component (highlighted/non-highlighted).
       
  2065      * @param   aHighlighted
       
  2066      *          If ETrue, return highlighted stroke style, otherwise non-highlighted.
       
  2067      * @return  The bstroke style.
       
  2068      */
       
  2069     virtual TGraphicsType BorderStyle(TBool aHighlighted) = 0;
       
  2070 
       
  2071     /**
       
  2072      * Returns the Best image size for a given image type.
       
  2073      * @param   aImageType
       
  2074      *          The image type.
       
  2075      * @return  The best image size.
       
  2076      */
       
  2077     virtual TSize BestImageSize(TImageType aImageType) const = 0;
       
  2078 
       
  2079     /**
       
  2080      * Method fills aText parameter with String value of actual keyboard layout.
       
  2081      * @param   aText
       
  2082      *          String value of actual keyboard layout.
       
  2083      */
       
  2084     virtual void GetKeyboardTypeName(TDes* aText) = 0;
       
  2085 
       
  2086     /**
       
  2087      * Method returns value of the scan code of the latest key event.
       
  2088      * @return   Integer value of the scan code of the latest key event.
       
  2089      */
       
  2090     virtual TInt GetKeyScanCode() = 0;
       
  2091 
       
  2092     /**
       
  2093      * Update with last key event.
       
  2094      * @return   Integer value of the scan code of the latest key event.
       
  2095      */
       
  2096     virtual void SetLastKeyEvent(const TKeyEvent& aEvent) = 0;
       
  2097 
       
  2098     /**
       
  2099      * Method returns value of the modifier keys state.
       
  2100      * @return   Integer value of the scan code of the latest key event.
       
  2101      */
       
  2102     virtual TInt GetKeyModifier() = 0;
       
  2103 
       
  2104     /**
       
  2105      * Map key event data with ITI Engine.
       
  2106      */
       
  2107     virtual void MappingDataForKey(TKeyEvent& aEvent, TEventCode aType) = 0;
       
  2108 
       
  2109     /**
       
  2110      * Update Utils implementation with resoruce change.
       
  2111      */
       
  2112     virtual void HandleResourceChangedL() = 0;
       
  2113 
       
  2114     /**
       
  2115      * Update Utils implementation with foreground change.
       
  2116      */
       
  2117     virtual void HandleForegroundL(TBool aForeground) = 0;
       
  2118 
       
  2119     virtual void Dispose() = 0;
       
  2120 };
       
  2121 
       
  2122 /**
       
  2123  *
       
  2124  * Definition of events which can be posted to Java
       
  2125  *
       
  2126  */
       
  2127 enum TSourceType
       
  2128 {
       
  2129     EItem=3,
       
  2130     EDisplayable,
       
  2131     EMIDlet,
       
  2132     ECanvasGraphicsItemPainterEvent=7 //number 6 is used for deprecated item on Java side
       
  2133 };
       
  2134 
       
  2135 /**
       
  2136  * Various event types used throught the VM.
       
  2137  */
       
  2138 enum TEventType
       
  2139 {
       
  2140     ENoType=0,
       
  2141     // Canvas & CustomItem
       
  2142     EPaint=10,
       
  2143     EKeyPressed,
       
  2144     EKeyReleased,
       
  2145     EKeyRepeated,
       
  2146     EPointerPressed,
       
  2147     EPointerReleased,
       
  2148     EPointerDragged,
       
  2149     // Displayable
       
  2150     ESizeChanged,
       
  2151     // MIDlet
       
  2152     EExit=18,
       
  2153     //posted by the framework when the MIDlet switches to the foreground
       
  2154     EForeground,
       
  2155     //posted by the framework when the MIDlet switches to the background
       
  2156     EBackground,
       
  2157     EPause,
       
  2158     EStart,
       
  2159     EDestroy,
       
  2160     // Displayable
       
  2161     ECommand,
       
  2162     // CustomItem
       
  2163     EVisible,
       
  2164     EFocusTraversal,
       
  2165     ERefresh,               // deprecated
       
  2166     // Display
       
  2167     EMakeItemCurrent,       // deprecated
       
  2168     ESetCurrent,
       
  2169     ESerial,
       
  2170     //CanvsGraphicsItem events
       
  2171     ECanvasGraphicsItemRepaint,
       
  2172     // Alert
       
  2173     EDismiss = 0,           // Futuredev: value
       
  2174     // Form/Item
       
  2175     EItemChanged = 0,       // Futuredev: value
       
  2176     // EList
       
  2177     ESelect = 0,             // Futuredev: value
       
  2178     EM3GDraw = 32,           // M3G content is drowned on canvas
       
  2179     EForcedPaint = 33,
       
  2180     EFreeGraphicsMemory = 34
       
  2181 };
       
  2182 
       
  2183 /**
       
  2184  * Reusable notify priority event used to unblock a Java thread
       
  2185  * waiting for completion of a native async operation.
       
  2186  */
       
  2187 class MMIDNotifyEvent
       
  2188 {
       
  2189 public:
       
  2190     /**
       
  2191      * Set the value passed into the VM as the async operation result/error code.
       
  2192      * @param   aResult
       
  2193      *          The result/error code.
       
  2194      */
       
  2195     virtual void SetResult(TInt aResult) = 0;
       
  2196     /**
       
  2197      * Destroy the event. Caller must guarantee that the event is not
       
  2198      * enqueued.
       
  2199      */
       
  2200     virtual void Dispose() = 0;
       
  2201 };
       
  2202 
       
  2203 /**
       
  2204  * MIDP Key Event.
       
  2205  *
       
  2206  * Encapsulates key event information required to translate and post
       
  2207  * key events.
       
  2208  *
       
  2209  * Must be translated from a WSERV TKeyEvent via a call to
       
  2210  * MMIDEnv::TranslateKey() before calling MMIDEnv::PostKeyEvent()
       
  2211  *
       
  2212  */
       
  2213 struct TMIDKeyEvent
       
  2214 {
       
  2215     enum TEvent
       
  2216     {
       
  2217         EPressed =0x01,
       
  2218         EReleased=0x02,
       
  2219         ERepeated=0x04
       
  2220     };
       
  2221 
       
  2222     TUint32 iEvents;
       
  2223     TInt    iKeyCode;
       
  2224     TInt    iRepeats;
       
  2225 };
       
  2226 
       
  2227 /**
       
  2228  *
       
  2229  * A MIDlet environment observer for receiving general events about the environment (i.e. that
       
  2230  * releate to the entire MIDlet as opposed to a particular Displayable etc.). Foreground/
       
  2231  * SwitchOn events are useful, for example, for suspending animations which would otherwise keep
       
  2232  * the machine alive
       
  2233  *
       
  2234  */
       
  2235 class MMIDEnvObserver
       
  2236 {
       
  2237 public:
       
  2238     /**
       
  2239      * HandleSwitchOnL(ETrue) is called in these circumstances:
       
  2240      * - When the device is switched on.
       
  2241      * - If the MIDlet has been paused due to a CSaveNotifier event,
       
  2242      *   HandleSwitchOnL(ETrue) is called when the MIDlet is brought to the foreground.
       
  2243      *
       
  2244      * HandleSwitchOnL(EFalse) is called in these circumstances:
       
  2245      * - The framework uses the CSaveNotifier framework to provide MIDlet state changes.
       
  2246      *   When the following events are received ESaveAll,ESaveQuick,ESaveData,EReleaseRAM
       
  2247      *   the MIDlet is paused and HandleSwitchOnL(EFalse) is called.
       
  2248      */
       
  2249     virtual void HandleSwitchOnL(TBool aSwitchOn) = 0;
       
  2250 
       
  2251     /**
       
  2252      * Handles the case when the MIDlet is brought to the foreground.
       
  2253      */
       
  2254     virtual void HandleForegroundL(TBool aForeground) = 0;
       
  2255 
       
  2256     /**
       
  2257      * Handles a change to resources which are shared accross the environment.
       
  2258      */
       
  2259     virtual void HandleResourceChangeL(TInt aType) = 0;
       
  2260 
       
  2261 #ifdef RD_JAVA_NGA_ENABLED
       
  2262     /**
       
  2263      * Called when MIDlet gains or loses partial/full foreground.
       
  2264      * Application (CAknAppUi::HandleWsEventL()) gets AknFullOrPartialForegroundGained event
       
  2265      * when it becomes at least partially visible even if it would not be the foreground application.
       
  2266      * AknFullOrPartialForegroundLost is received when application is not all visible anymore.
       
  2267      */
       
  2268     virtual void HandleFullOrPartialForegroundL(TBool /*aFullOrPartialFg*/) {}
       
  2269 
       
  2270     /**
       
  2271      * Called when all graphics memory needs to be freed immediately.
       
  2272      */
       
  2273     virtual void HandleFreeGraphicsMemory() {}
       
  2274 #endif //RD_JAVA_NGA_ENABLED
       
  2275 };
       
  2276 
       
  2277 /**
       
  2278  *
       
  2279  * A MIDlet environment, one per MIDlet, providing utility methods for the MIDP implementation.
       
  2280  * A concrete implementation is provided by the framework, passed in through
       
  2281  * MMIDComponentFactory::ConstructL() where the implementation can cache it and use it as
       
  2282  * necessary.
       
  2283  *
       
  2284  */
       
  2285 class MMIDEnv
       
  2286 {
       
  2287 public:
       
  2288     /**
       
  2289      * Use these methods to disptach events back into Java
       
  2290      */
       
  2291     virtual TBool PostJavaEvent(MMIDComponent& aSource,TSourceType aSourceType,TEventType aEventType,TInt aEventData,TInt aEventData1,TInt aEventData2) = 0;
       
  2292     virtual TBool PostJavaEvent(MMIDComponent& aSource,TSourceType aSourceType,TEventType aEventType=ENoType,TInt aEventData=0) = 0;
       
  2293     virtual TBool PostJavaEvent(MMIDComponent& aSource,TSourceType aSourceType,TInt aEventData) = 0;
       
  2294     virtual TBool PostMidletEvent(TEventType aEventType) = 0;
       
  2295 
       
  2296     /**
       
  2297      * Create a notify priority event to send up to the java peer to
       
  2298      * aSource.
       
  2299      */
       
  2300     virtual MMIDNotifyEvent* NewNotifyL(MMIDComponent& aSource) = 0;
       
  2301 
       
  2302     /**
       
  2303      * Post a notify priority event to unblock a java thread.
       
  2304      * MMIDNotifyEvent instances are 'reusable' events. That is the event
       
  2305      * queue does not delete the instance after dispatch. Due to the intrusive
       
  2306      * queue structure used, a resuable event cannot be present on the queue
       
  2307      * twice.
       
  2308      * The client is responsible for ensuring that the event does not get
       
  2309      * posted on to the queue unless there are no pending dispatches for that
       
  2310      * event. i.e. unless the event is not already on the queue.
       
  2311      *
       
  2312      * This is usually acheived with an object monitor in java protecting the
       
  2313      * native method(s) that required an async notification.
       
  2314      */
       
  2315     virtual TBool    PostJavaNotify(MMIDNotifyEvent* aEvent) = 0;
       
  2316 
       
  2317     /**
       
  2318      * Key translation. Maps OS key event to MIDP key event
       
  2319      *
       
  2320      * @param aEvent
       
  2321      * @param aKeyEvent
       
  2322      * @param aType
       
  2323      * @return
       
  2324      *
       
  2325      * @since S60
       
  2326      */
       
  2327     virtual TBool TranslateKeyL(TMIDKeyEvent& aEvent, const TKeyEvent& aKeyEvent, TEventCode aType) = 0;
       
  2328     virtual TBool   PostKeyEvent(MMIDComponent& aSource, TMIDKeyEvent& aEvent) = 0;
       
  2329     virtual void    ResetKeys() = 0;
       
  2330 
       
  2331     /**
       
  2332      * Returns the Displayable which has last been made current, or null if none has
       
  2333      */
       
  2334     virtual MMIDDisplayable* Current() = 0;
       
  2335     /**
       
  2336      * MIDlet properties
       
  2337      */
       
  2338     virtual TPtrC MidletName() const = 0;
       
  2339     virtual TUid MidletUid() const = 0;
       
  2340     virtual TPtrC MidletHome() const = 0;
       
  2341 
       
  2342 #ifdef RD_SCALABLE_UI_V2
       
  2343     // This function can be moved out from RD_SCALABLE_UI_V2 flag if needed.
       
  2344     // It is behind this flag because currently it is used only by Touch.
       
  2345     /**
       
  2346      * Returns MIDlet suite uid of this midlet.
       
  2347      * The midlet suite uid is same for all midlets inside one midlet suite.
       
  2348      *
       
  2349      * @return  MIDlet suite uid
       
  2350      * @since S60 5.0
       
  2351      */
       
  2352     virtual TUid MidletSuiteUid() = 0;
       
  2353 #endif //RD_SCALABLE_UI_V2
       
  2354 
       
  2355     /**
       
  2356      *@return The number of colors available in the
       
  2357      * displaymode used for Images and Graphics.
       
  2358      */
       
  2359     virtual TInt NumColors() = 0;
       
  2360 
       
  2361     /**
       
  2362      *@return The SymbianOS display mode that the VM will use for
       
  2363      * Images, Canvases and CustomItems.
       
  2364      */
       
  2365     virtual TDisplayMode DisplayMode() = 0;
       
  2366 
       
  2367     /**
       
  2368      * Sets the zoomed size of the canvas.
       
  2369      * May be set to TSize(0,0) if no zooming.
       
  2370      */
       
  2371     virtual void  SetCanvasZoomSize(const TSize& aSize) = 0;
       
  2372 
       
  2373     /**
       
  2374      * Returns the zoomed size of the canvas paintable area.
       
  2375      * May return TSize(0,0) if no zooming is in effect.
       
  2376      */
       
  2377     virtual TSize CanvasZoomSize() = 0;
       
  2378 
       
  2379     /**
       
  2380      * Returns assumed canvas size as specified in jad, or TSize(0,0)
       
  2381      * if none was specified. This determines the size of the canvas in
       
  2382      * pixels that is paintable by the java peer. Zooming may alter the
       
  2383      * apparent size on screen.
       
  2384      */
       
  2385     virtual TSize CanvasAssumedSize() = 0;
       
  2386 
       
  2387     /**
       
  2388      * Add/remove observers for receiving events about the environment. It is important that
       
  2389      * observers are removed before being deleted.
       
  2390      */
       
  2391     virtual void AddObserverL(MMIDEnvObserver& aObserver) = 0;
       
  2392     virtual void RemoveObserver(MMIDEnvObserver& aObserver) = 0;
       
  2393 
       
  2394     /**
       
  2395      * Gets a MIDlet Suite attribute value. MIDlet Suite attributes are specified in the
       
  2396      * MIDlet Suite manifest and jad.
       
  2397      *
       
  2398      * @param   aAttributeName
       
  2399      *          The name of the attribute to get.
       
  2400      * @param   aAttributeValue
       
  2401      *          On return, this will be set to the attribute value.
       
  2402      * @return  KErrNone if aAttributeValue has successfully been set.
       
  2403      *          KErrNotFound if there is no attribute whose name is aAttributeName.
       
  2404      */
       
  2405     virtual TInt MidletAttribute(const TDesC& aAttributeName, TPtrC& aAttributeValue)  = 0;
       
  2406 
       
  2407     /**
       
  2408      * Checks if the MIDlet Suite attribute is set to certain value.
       
  2409      *
       
  2410      * @param   aAttributeName
       
  2411      *          The name of the attribute whose content is checked.
       
  2412      * @param   aAttributeValue
       
  2413      *          The value the of the attribute. Method checks whether the attribute
       
  2414      *          specifed by aAttributeName is set to this value. Comparison is case
       
  2415      *          insensitive but otherwise the string much match exactly (e.g. no spaces allowed)
       
  2416      * @return  ETrue if aAttribute is set to value aAttributeValue, EFalse otherwise
       
  2417      *
       
  2418      * @see MMIDEnv::MidletAttribute()
       
  2419      */
       
  2420     virtual TBool MidletAttributeIsSetToVal(const TDesC& aAttributeName, const TDesC& aAttributeValue) = 0;
       
  2421 
       
  2422     /**
       
  2423      * Checks if the MIDlet Suite attribute contains a certain value. If a jad attribute contains several
       
  2424      * values, they must be separated with commas only, spaces between commas and value string are not allowed.
       
  2425      *
       
  2426      * @param   aAttributeName
       
  2427      *          The name of the attribute whose content is checked.
       
  2428      * @param   aAttributeValue
       
  2429      *          The value the of the attribute. Method checks whether the attribute
       
  2430      *          specifed by aAttributeName contains this value. Comparison is case
       
  2431      *          insensitive.
       
  2432      * @return  ETrue if aAttribute contains value aAttributeValue and attribute syntax is correct,
       
  2433      *          EFalse otherwise
       
  2434      *
       
  2435      * @see MMIDEnv::MidletAttribute()
       
  2436      */
       
  2437     virtual TBool MidletAttributeContainsVal(const TDesC& aAttributeName, const TDesC& aAttributeValue) = 0;
       
  2438 
       
  2439     /**
       
  2440      * Change the default screen size.
       
  2441      *
       
  2442      * @param   aSize
       
  2443      *          The size which the screen will become.
       
  2444      */
       
  2445     virtual void SetCanvasAssumedSize(const TSize& aSize) = 0;
       
  2446 
       
  2447     /**
       
  2448      * Reserve a native frame buffer for a <code>MMIDCanvas</code> object.
       
  2449      * MMIDCanvas's counterpart in java side could be <code>Canvas</code> or
       
  2450      * <code>GameCanvas</code>. A MIDlet's <code>Canvas</code> objects should share the
       
  2451      * same native side frame buffer but <code>GameCanvas</code> objects must use their
       
  2452      * own frame buffers.
       
  2453      * @param   aCanvas Target Canvas
       
  2454      * @param   aSz Frame buffer size
       
  2455      * @return  Frame buffer.
       
  2456      * @since S60 5.0
       
  2457      */
       
  2458     virtual CFbsBitmap* ReserveCanvasFrameBufferL(MMIDCanvas& aCanvas, const TSize& aSz) = 0;
       
  2459 
       
  2460     /**
       
  2461      * Release a frame buffer.
       
  2462      * @param   aCanvas Target canvas
       
  2463      * @param   aFrameBuffer If <code>aCanvas</code> object's counterpart in java side is
       
  2464                 <code>GameCanvas</code> then the <code>aFrameBuffer</code> is just deleted.
       
  2465                 However if the counterpart is <code>Canvas</code> then an internal reference
       
  2466                 count is decreased. If the reference count goes to zero then the frame buffer
       
  2467                 (that was shared shared by multiple <code>MMIDCanvas</code> objects) is going
       
  2468                 to be deleted.
       
  2469      * @since S60 5.0
       
  2470      */
       
  2471     virtual void ReleaseCanvasFrameBuffer(MMIDCanvas& aCanvas, CFbsBitmap*& aFrameBuffer) = 0;
       
  2472 
       
  2473     /**
       
  2474      * A Canvas object's background image (e.g image/theme) might be shown or not.
       
  2475      * A backgound image can be shown if the <code>Nokia-UI-Enhancement</code> attribute
       
  2476      * is <code>CanvasHasBackground</code>. The attribute may be placed in the JAD or the manifest.
       
  2477      * @param   aCanvas Target canvas
       
  2478      * @param   Return <code>ETrue</code> if a background image can be shown.
       
  2479      * @since S60 5.0
       
  2480      */
       
  2481     virtual TBool CanvasHasBackground(const MMIDCanvas& aCanvas) const = 0;
       
  2482 
       
  2483 #ifdef RD_JAVA_NGA_ENABLED
       
  2484 
       
  2485     /**
       
  2486      * Hardware accelarator types
       
  2487      * @since S60 9.2
       
  2488      */
       
  2489     typedef enum
       
  2490     {
       
  2491         EHardware3D = (1 << 1),
       
  2492         EHardware2D = (1 << 2)
       
  2493     } THardwareType;
       
  2494 
       
  2495     /**
       
  2496      * Checks if hardware acceleration is available
       
  2497      * @param aHardwareType Defines the type
       
  2498      * @return True if specified hw exists.
       
  2499      * @since S60 9.2
       
  2500      */
       
  2501     virtual TBool IsHardwareAcceleratedL(
       
  2502         MMIDEnv::THardwareType aHardwareType) = 0;
       
  2503 
       
  2504     /**
       
  2505      * Called when MIDlet's partial/full foreground status is changed.
       
  2506      * @since S60 9.2
       
  2507      */
       
  2508     virtual void HandleFullOrPartialForegroundL(TBool aFullOrPartialFg) = 0;
       
  2509 
       
  2510     /**
       
  2511      * Called when graphics memory needs to be freed immediately.
       
  2512      * @since S60 9.2
       
  2513      */
       
  2514     virtual void HandleFreeGraphicsMemory() = 0;
       
  2515 
       
  2516     /**
       
  2517      * Checks if MIDlet is at least partially visible.
       
  2518      * @return ETrue if MIDlet has full or partial foreground.
       
  2519      * @since S60 9.2
       
  2520      */
       
  2521     virtual TBool HasFullOrPartialForeground() const = 0;
       
  2522 #endif // RD_JAVA_NGA_ENABLED
       
  2523 
       
  2524     /**
       
  2525      * Maps low level key event
       
  2526      * @param    aMidKeyEvent key event output data
       
  2527      * @param    aEvent key event input data
       
  2528      * @since S60 3.2.3
       
  2529      */
       
  2530     virtual void MappingDataForKey(TKeyEvent& aEvent, TEventCode aType) = 0;
       
  2531 
       
  2532     /**
       
  2533      * Update with last key event.
       
  2534      * @param aEvetn key event
       
  2535      * @since S60 3.2.3
       
  2536      */
       
  2537     virtual void SetLastKeyEvent(const TKeyEvent& aEvent) = 0;
       
  2538 
       
  2539     /**
       
  2540      * Gets an instance of ToLcduiObserver.
       
  2541      *
       
  2542      * @since S60 5.0
       
  2543      * @return Pointer to ToLcduiObserver instance
       
  2544      */
       
  2545     virtual MMIDToLcduiObserver& ToLcduiObserver() = 0;
       
  2546 
       
  2547     /**
       
  2548      * Inform CMIDEnv about deleting of object implementing MMIDDisplayable.
       
  2549      *
       
  2550      * @param displayable deleting displayble
       
  2551      * @since Java 2.0
       
  2552      */
       
  2553     virtual void DisplayableIsDestructed(const MMIDDisplayable* aDisplayable) = 0;
       
  2554 
       
  2555     /**
       
  2556      * Returns pointer to last fullscreen Displayble.
       
  2557      *
       
  2558      * @return Last fullscreen Displayable
       
  2559      * @since Java 2.1
       
  2560      */
       
  2561     virtual const MMIDDisplayable* LastFullscreenDisplayable() const = 0;
       
  2562 };
       
  2563 
       
  2564 /**
       
  2565  *
       
  2566  * Interface class for provider of asynchronous calls to lcdui
       
  2567  * which may origin in non-lcdui thread.
       
  2568  *
       
  2569  * Some events may invoke a callback into specified callback interface.
       
  2570  * The receiver of this callback must not be deleted before the event
       
  2571  * containing it is processed.
       
  2572  *
       
  2573  * The callback receiver can be for example implemented
       
  2574  * its instance deletion via event using this observer,
       
  2575  * so this deletion event will be the last one for that receiver.
       
  2576  *
       
  2577  * @since  S60 v5.0
       
  2578  */
       
  2579 class MMIDToLcduiObserver
       
  2580 {
       
  2581 public:
       
  2582     /**
       
  2583      * Allows a control to be used during event processing.
       
  2584      *
       
  2585      * @since S60 5.0
       
  2586      * @param aControl Control to be registered.
       
  2587      * @param aCallbackContainer MDirectContainer that is nofied in LCDUI thread
       
  2588      *                           about added MDirectContent. NULL, if notification
       
  2589      *                           is not needed.
       
  2590      */
       
  2591 #ifdef RD_JAVA_NGA_ENABLED
       
  2592     virtual void RegisterControl(CCoeControl& aControl,
       
  2593                                  MDirectContainer* aCallbackContainer = NULL) = 0;
       
  2594 #else
       
  2595     virtual void RegisterControl(CCoeControl& aControl) = 0;
       
  2596 #endif
       
  2597 
       
  2598     /**
       
  2599      * Removes a control from the list of controls allowed
       
  2600      * to be used in event processing.
       
  2601      * Events which works with this control will be ignored.
       
  2602      *
       
  2603      * @since S60 5.0
       
  2604      * @param aControl Control to be unregistered.
       
  2605      */
       
  2606     virtual void UnregisterControl(CCoeControl& aControl) = 0;
       
  2607 
       
  2608     /**
       
  2609      * Flushes the control's graphics content on screen.
       
  2610      * The call may origin in other than LCDUI ES thread.
       
  2611      *
       
  2612      * @since S60 5.0
       
  2613      * @param aControl Control used to get DSA resources from.
       
  2614      * @param aRect An area of the control to flush.
       
  2615      */
       
  2616     virtual void FlushControl(
       
  2617         CCoeControl& aControl,
       
  2618         const TRect &aRect) = 0;
       
  2619 
       
  2620     /**
       
  2621      * Invokes aConsumer->MdcDSAResourcesCallback from LCDUI ES thread.
       
  2622      * The call may origin in other than LCDUI ES thread.
       
  2623      *
       
  2624      * @since S60 5.0
       
  2625      * @param aControl Control used to get DSA resources from.
       
  2626      * @param aConsumer Consumer of the callback. The instance
       
  2627      *                  must not be deleted before the event processed.
       
  2628      */
       
  2629     virtual void InvokeDSAResourcesCallback(
       
  2630         CCoeControl& aControl,
       
  2631         MUiEventConsumer& aConsumer) = 0;
       
  2632 
       
  2633     /**
       
  2634      * Invokes aConsumer->MdcUICallback( aCallbackId ) from LCDUI ES thread.
       
  2635      * The call may origin in other than LCDUI ES thread.
       
  2636      *
       
  2637      * @since S60 5.0
       
  2638      * @param aConsumer Consumer of the callback. The instance
       
  2639      *                  must not be deleted before the event processed.
       
  2640      * @param aCallbackId Id which is provided to the callback
       
  2641      */
       
  2642     virtual void InvokeUICallback(
       
  2643         MUiEventConsumer& aConsumer,
       
  2644         TInt aCallbackId) = 0;
       
  2645 
       
  2646     virtual void InvokeLcduiEvent(MMIDLcduiEventConsumer& aConsumer, TInt aCallbackId) = 0;
       
  2647 };
       
  2648 
       
  2649 /**
       
  2650  *
       
  2651  * Interface class for constructing native peers to LCDUI objects
       
  2652  *
       
  2653  * Canvas and Graphics do not have create methods since they
       
  2654  * are platform independent.
       
  2655  *
       
  2656  */
       
  2657 class MMIDComponentFactory
       
  2658 {
       
  2659 public:
       
  2660     virtual void ConstructL(MMIDEnv& aEnv) = 0;
       
  2661 
       
  2662     /**
       
  2663      * Classes derived from Displayable
       
  2664      */
       
  2665     virtual MMIDDisplayable* CreateDisplayableL() = 0;
       
  2666 
       
  2667     virtual MMIDCanvas* CreateCanvasL(MMIDDisplayable& aDisplayable, MMIDComponent::TType aCanvasType) = 0;
       
  2668 
       
  2669     virtual MMIDAlert* CreateAlertL(MMIDDisplayable& aDisplayable,MMIDAlert::TAlertType aType,const TDesC& aString,MMIDImage* aPicture) = 0;
       
  2670     virtual MMIDForm* CreateFormL(MMIDDisplayable& aDisplayable) = 0;
       
  2671     virtual MMIDList* CreateListL(TInt aType,MMIDDisplayable& aDisplayable,RArray<TPtrC>& aStringArray, RArray<MMIDImage*>& aImageArray) = 0;
       
  2672     virtual MMIDTextBox* CreateTextBoxL(TInt aConstraints,TInt aMaxSize,const TDesC& aText,MMIDDisplayable& aDisplayable) = 0;
       
  2673 
       
  2674     /**
       
  2675      * Classes derived from Item
       
  2676      */
       
  2677     virtual MMIDImageItem* CreateImageItemL(const TDesC& aLabel,MMIDImage* aImage,MMIDItem::TLayout aLayout,MMIDItem::TAppearance aAppearance,const TDesC& aAltText) = 0;
       
  2678     virtual MMIDStringItem* CreateStringItemL(const TDesC& aLabel,const TDesC& aText,MMIDItem::TAppearance aAppearance) = 0;
       
  2679     virtual MMIDDateField* CreateDateFieldL(const TDesC& aLabel, MMIDDateField::TInputMode aInputMode) = 0;
       
  2680 
       
  2681     /**
       
  2682      * aMaxValue could take the special value MMIDGauge::EIndefinite in order to indicate that the Gauge
       
  2683      * has indefinite range. If this is the case, then aInitialValue will take one of the values
       
  2684      * MMIDGauge::EContinousIdle,MMIDGauge::EContinousRunning, MMIDGauge::EIncrementalIdle or
       
  2685      * MMIDGauge::EIncrementalRunning
       
  2686      */
       
  2687     virtual MMIDGauge* CreateGaugeL(const TDesC& aLabel,TBool aInteractive,TInt aMaxValue,TInt aInitialValue) = 0;
       
  2688 
       
  2689     virtual MMIDTextField* CreateTextFieldL(const TDesC& aLabel,const TDesC& aText,TInt aConstraints,TInt aMaxSize) = 0;
       
  2690     virtual MMIDChoiceGroup* CreateChoiceGroupL(const TDesC& aLabel,TInt aType,RArray<TPtrC>& aStrings, RArray<MMIDImage*>& aImages) = 0;
       
  2691     virtual MMIDSpacer* CreateSpacerL(const TSize& aMinimumSize) = 0;
       
  2692     virtual MMIDCustomItem* CreateCustomItemL(const TDesC& aLabel) = 0;
       
  2693 
       
  2694     /**
       
  2695      * Other UI components
       
  2696      */
       
  2697     virtual MMIDFont* CreateFontL(TUint aStyle,TUint aSize,TInt aFace,TBool aIsFreeSizeFont) = 0;
       
  2698     virtual MMIDTicker* CreateTickerL(const TDesC& aText) = 0;
       
  2699     virtual MMIDCommand* CreateCommandL(const TDesC& aShortLabel,const TDesC& aLongLabel,MMIDCommand::TCommandType aCommandType,TInt aPriority,TInt aCommandID) = 0;
       
  2700 
       
  2701     /**
       
  2702      * Create a Utility Class object.
       
  2703      */
       
  2704     virtual MMIDUtils* CreateUtilsL() = 0;
       
  2705 
       
  2706     /**
       
  2707      * Destroy the component factory and free the resources.
       
  2708      */
       
  2709     virtual void Dispose() = 0;
       
  2710 
       
  2711     /**
       
  2712      * Creates a new text editor component. Note that text editor is current a custom
       
  2713      * component and not a standard LCDUI UI component.
       
  2714      *
       
  2715      * The implementation is part of nokialcdui component and s60lcdui plug-in.
       
  2716      *
       
  2717      * The ownership is transferred to the caller.
       
  2718      *
       
  2719      * @param aMaxSize The maximum size of the editor's content.
       
  2720      * @param aWidth The width of the editor in pixels.
       
  2721      * @param aHeight The height of the editor in pixels.
       
  2722      * @param aHeightInRows Defines whether the height of the editor should be
       
  2723      *        represented as in rows or in pixels.
       
  2724      */
       
  2725     virtual MMIDTextEditor* CreateTextEditorL(
       
  2726         TInt aMaxSize,
       
  2727         TInt aWidth,
       
  2728         TInt aHeight,
       
  2729         TBool aHeightInRows) = 0;
       
  2730 
       
  2731     /**
       
  2732      * Creates a new canvas graphics item component. Note that canvas
       
  2733      * graphics item is currently a custom component and not a standard
       
  2734      * LCDUI UI component.
       
  2735      *
       
  2736      * The implementation is part of nokialcdui component and s60lcdui plug-in.
       
  2737      *
       
  2738      * The ownership is transferred to the caller.
       
  2739      *
       
  2740      * @param aItemPainter Pointer to its painter control.
       
  2741      * @since S60 5.0
       
  2742      */
       
  2743     virtual MMIDCanvasGraphicsItem* CreateCanvasGraphicsItemL(
       
  2744         MMIDCanvasGraphicsItemPainter* aItemPainter) = 0;
       
  2745 
       
  2746     /**
       
  2747      * Creates a new canvas graphics item painter control.
       
  2748      *
       
  2749      * The implementation is part of nokialcdui component and s60lcdui plug-in.
       
  2750      *
       
  2751      * The ownership is transferred to the caller.
       
  2752      *
       
  2753      * @param aWidth The width of the editor in pixels.
       
  2754      * @param aHeight The height of the editor in pixels.
       
  2755      * @since S60 5.0
       
  2756      */
       
  2757     virtual MMIDCanvasGraphicsItemPainter* CreateCanvasGraphicsItemPainterL(
       
  2758         TInt aWidth,
       
  2759         TInt aHeight) = 0;
       
  2760 };
       
  2761 
       
  2762 
       
  2763 inline TInt MIDHandle(MMIDComponent* aComponent)
       
  2764 {
       
  2765     return TInt(reinterpret_cast<TUint32>(aComponent) >> 2);
       
  2766 }
       
  2767 
       
  2768 inline MMIDComponent* MIDUnhandComponent(TInt aHandle)
       
  2769 {
       
  2770     ASSERT(aHandle >= 0);
       
  2771     return reinterpret_cast<MMIDComponent*>(aHandle << 2);
       
  2772 }
       
  2773 
       
  2774 template <class T>
       
  2775 inline T*   MIDUnhand(TInt aHandle)
       
  2776 {
       
  2777     return static_cast<T*>(MIDUnhandComponent(aHandle));
       
  2778 }
       
  2779 
       
  2780 #define MIDUnhandObject MIDUnhand
       
  2781 
       
  2782 /**
       
  2783  * Buffered operations passed to MMIDBufferProcessor interfaces
       
  2784  */
       
  2785 struct TMIDBufferOp
       
  2786 {
       
  2787 public:
       
  2788     /**
       
  2789      *@return The opcode written into the buffer by the
       
  2790      * Java peer. Each buffer processor class has its own
       
  2791      * independent opcode space.
       
  2792      */
       
  2793     inline TInt         OpCode() const
       
  2794     {
       
  2795         ASSERT(!IsActivate());
       
  2796         return TInt(Header() >> 16);
       
  2797     }
       
  2798 
       
  2799     /**
       
  2800      *@return size of operation in words including the header.
       
  2801      */
       
  2802     inline TInt         Size() const
       
  2803     {
       
  2804         return TInt(Header() & 0x0000FFFF);
       
  2805     }
       
  2806 
       
  2807     /**
       
  2808      * Debug builds will panic if this method is called on an opcode with no data.
       
  2809      *
       
  2810      *@return Pointer to start of opcode data.
       
  2811      */
       
  2812     inline const TAny*  Data() const
       
  2813     {
       
  2814         ASSERT(Size() > 1);
       
  2815         return (const TAny*)&(iHeader[1]);
       
  2816     }
       
  2817 
       
  2818     /**
       
  2819      * Used by framework to track changes of processor. Processors
       
  2820      * should never receive an TMIDBufferOp for which IsActivate
       
  2821      * returns ETrue.
       
  2822      *
       
  2823      *@return ETrue if this command is an activation command.
       
  2824      */
       
  2825     inline TBool    IsActivate() const
       
  2826     {
       
  2827         return (Header() >> 31);
       
  2828     }
       
  2829 
       
  2830     /**
       
  2831      * Used by framework.
       
  2832      *
       
  2833      *@return op header.
       
  2834      */
       
  2835     inline TUint32  Header() const
       
  2836     {
       
  2837         return iHeader[0];
       
  2838     }
       
  2839 
       
  2840 private:
       
  2841     TUint32 iHeader[1];
       
  2842 };
       
  2843 
       
  2844 /**
       
  2845  * Interface for buffered data processors.
       
  2846  *
       
  2847  * Any MMIDComponent that returns a non-NULL MMIDBufferProcessor pointer
       
  2848  * from MMIDComponent::Processor() may receive buffered data from its
       
  2849  * Java peer.
       
  2850  *
       
  2851  * Note: The MMIDComponent is considered to own the MMIDBufferProcessor it
       
  2852  * returns and is therefore responsible for cleaning up any resources used
       
  2853  * by the processor.
       
  2854  */
       
  2855 class MMIDBufferProcessor
       
  2856 {
       
  2857 public:
       
  2858     enum
       
  2859     {
       
  2860         KMinOpCycles = 1,
       
  2861         KMaxOpCycles = 1024
       
  2862     };
       
  2863 
       
  2864     /**
       
  2865      * Mask of valid opcode bits. Top 4 bits of each opcode must be clear.
       
  2866      */
       
  2867     enum
       
  2868     {
       
  2869         KOpMask = 0x0FFF
       
  2870     };
       
  2871 
       
  2872     /**
       
  2873      * Process a block of commands, updating read pointer as you go.
       
  2874      *
       
  2875      * aBegin is the address of the first command in the buffer for this processor.
       
  2876      *
       
  2877      * aEnd is the address of the command *after* the last command in the buffer for this processor,
       
  2878      * hence (aEnd-aBegin) is the total number of words of opcodes and data.
       
  2879      * Classes that implement this interface must not call any of the TMIDBufferOp
       
  2880      * methods on aEnd - it is merely a sentinel indicating the end of the valid
       
  2881      * range, and intended to be used in loops of the form:
       
  2882      * <CODE>
       
  2883      * TMIDBufferOp& op = aBegin;
       
  2884      * while( op < aEnd )
       
  2885      *  {
       
  2886      *      DecodeOp(op);
       
  2887      *      op += op->Size();
       
  2888      *  }
       
  2889      * </CODE>
       
  2890      * aCycles is the amount of 'compute effort' remaining in the current AO
       
  2891      * RunL. The processor should decrement this value by an amount that refelects
       
  2892      * the amount of work it expects each operation it performs to have consumed.
       
  2893      * The estimate need not be accurate - only give an indication, to improve
       
  2894      * concurrency. Failure to decrement aCycles by a sensible amount can lead to
       
  2895      * the VM threads being starved of events such as key presses.
       
  2896      *
       
  2897      * For example simple graphics primitives like DrawLine are fast so would decrement
       
  2898      * by a small amount, whilst complex graphics primitives, such as drawing a
       
  2899      * rotated image with an alpha channel, would decrement by a large amount.
       
  2900      *
       
  2901      * If before commencing an operation, aCycles is less than that required to
       
  2902      * complete the operation, the processor should defer, by returning immediately
       
  2903      * leaving aBegin pointing at the deferred operation.
       
  2904      *
       
  2905      * returns ETrue if processing will be async.
       
  2906      *
       
  2907      * @param aMonitor  Monitor that needs to be notified by MMIDBufferProcessor
       
  2908      *                  after async processing is finished.
       
  2909      *
       
  2910      */
       
  2911 #ifdef RD_JAVA_NGA_ENABLED
       
  2912     virtual TBool ProcessL(
       
  2913         const TMIDBufferOp*& aBegin, const TMIDBufferOp* aEnd,
       
  2914         TInt& aCycles, java::util::Monitor* aMonitor) = 0;
       
  2915 #else
       
  2916     virtual TBool ProcessL(
       
  2917         const TMIDBufferOp*& aBegin, const TMIDBufferOp* aEnd,
       
  2918         TInt& aCycles, TRequestStatus* aStatus = NULL) = 0;
       
  2919 #endif
       
  2920 
       
  2921     /**
       
  2922      * Called by framework if the processor is doing some async operation
       
  2923      * when the MIDlet is closed down. Processor should cancel the async
       
  2924      * operation and clean up any resources.
       
  2925      */
       
  2926     virtual void  AbortAsync() = 0;
       
  2927 };
       
  2928 
       
  2929 class MMIDLcduiEventConsumer
       
  2930 {
       
  2931 public:
       
  2932     virtual void HandleLcduiEvent(int aType) = 0;
       
  2933 };
       
  2934 
       
  2935 #endif // LCDUI_H