javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/inc/eswtwidgetscore.h
branchRCL_3
changeset 66 2455ef1f5bbc
child 83 26b2b12093af
equal deleted inserted replaced
65:ae942d28ec0e 66:2455ef1f5bbc
       
     1 /*******************************************************************************
       
     2  * Copyright (c) 2005, 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved. This program and the accompanying materials
       
     4  * are made available under the terms of the Eclipse Public License v1.0
       
     5  * which accompanies this distribution, and is available at
       
     6  * http://www.eclipse.org/legal/epl-v10.html
       
     7  *
       
     8  * Contributors:
       
     9  *     Nokia Corporation - S60 implementation
       
    10  *******************************************************************************/
       
    11 
       
    12 
       
    13 #ifndef ESWTWIDGETSCORE_H
       
    14 #define ESWTWIDGETSCORE_H
       
    15 
       
    16 
       
    17 #include <eikmenup.h>
       
    18 #include <eikmenub.h>
       
    19 #include <eikmobs.h>
       
    20 #include <eikspane.h>
       
    21 #include "eswtgraphics.h"
       
    22 
       
    23 
       
    24 class CEikScrollBar;
       
    25 #ifdef RD_SCALABLE_UI_V2
       
    26 class CAknStylusPopUpMenu;
       
    27 #endif //RD_SCALABLE_UI_V2
       
    28 class MSwtButton;
       
    29 class MSwtCaptionedControl;
       
    30 class MSwtCommand;
       
    31 class MSwtComposite;
       
    32 class MSwtControl;
       
    33 class MSwtMenu;
       
    34 class MSwtMenuItem;
       
    35 class MSwtShell;
       
    36 class MSwtMobileShell;
       
    37 class MSwtDecorations;
       
    38 class MAknsControlContext;
       
    39 class MSwtBrowser;
       
    40 class MSwtListBase;
       
    41 class MSwtColor;
       
    42 class CSwtFontData;
       
    43 class CGraphicsContext;
       
    44 class MSwtInput;
       
    45 class MSwtScreen;
       
    46 class MSwtMultiPagePager;
       
    47 class MSwtMultiPageTabGroup;
       
    48 class MSwtMultiPageDialog;
       
    49 class MSwtDateEditor;
       
    50 class MSwtConstrainedText;
       
    51 class MSwtLink;
       
    52 class MSwtListBox;
       
    53 class MSwtListView;
       
    54 class MSwtSortedList;
       
    55 class MSwtTextExtension;
       
    56 class MSwtClipboard;
       
    57 class MSwtTableColumn;
       
    58 class MSwtTableItem;
       
    59 class MSwtTable;
       
    60 class MSwtTree;
       
    61 class MSwtFontDialog;
       
    62 class MSwtDirectoryDialog;
       
    63 class MSwtHyperLink;
       
    64 class MSwtScrollable;
       
    65 
       
    66 static const TInt KSwtCommandBaseId = 0x1000;
       
    67 
       
    68 
       
    69 /**
       
    70  * Interface class for the org.eclipse.swt.widgets.ScrollBar class
       
    71  */
       
    72 class MSwtScrollBar
       
    73 {
       
    74 protected:
       
    75     virtual ~MSwtScrollBar() {} // Made protected to prevent destruction through the interface
       
    76 
       
    77 public:
       
    78     /**
       
    79      * Disposes of (i.e. destroys) the scroll-bar
       
    80      * @return The Java peer associated with this object
       
    81      */
       
    82     virtual TSwtPeer Dispose() =0;
       
    83 
       
    84     /**
       
    85      * Returns the scroll-bar'size
       
    86      */
       
    87     virtual TSize GetSize() const =0;
       
    88 
       
    89     /**
       
    90      * Enables or disables the scrollbar
       
    91      */
       
    92     virtual void SetEnabled(TBool aEnabled) =0;
       
    93 
       
    94     /**
       
    95      * Enables or disables the scrollbar visibility
       
    96      */
       
    97     virtual void SetVisible(TBool aVisible) =0;
       
    98 
       
    99     /**
       
   100      * Returns the thumb's position
       
   101      */
       
   102     virtual TInt GetThumbPosition() const =0;
       
   103 
       
   104     /**
       
   105      * Sets the thumb's position
       
   106      * @param aPosition The thumb's new position, if the provided value is out
       
   107      *                  of range, it must be adjusted to fit.
       
   108      */
       
   109     virtual void SetThumbPositionL(TInt aPosition) =0;
       
   110 
       
   111     /**
       
   112      * Returns the thumb's span
       
   113      */
       
   114     virtual TInt GetThumbSpan() const =0;
       
   115 
       
   116     /**
       
   117      * Sets the thumb's span
       
   118      * @param aThumbSpan The thumb's new span, will be >= 1. If the provided value
       
   119      *                   is larger than (maximum-minimum) it must be ignored.
       
   120      */
       
   121     virtual void SetThumbSpanL(TInt aThumbSpan) =0;
       
   122 
       
   123     /**
       
   124      * Returns the minimum value
       
   125      */
       
   126     virtual TInt GetMinimum() const =0;
       
   127 
       
   128     /**
       
   129      * Sets the minimum value of the scroll span
       
   130      * @param aMinimum The new minimum, will be >= 0. If the provided value is
       
   131      *                 greater than or equal to the maximum, it must be ignored.
       
   132      */
       
   133     virtual void SetMinimumL(TInt aMinimum) =0;
       
   134 
       
   135     /**
       
   136      * Returns the maximum value
       
   137      */
       
   138     virtual TInt GetMaximum() const =0;
       
   139 
       
   140     /**
       
   141      * Sets the maximum value of the scroll span
       
   142      * @param aMaximum The new maximum, wil be >= 0. If the provided value is
       
   143      *                 less than or equal to the minimum, it must be ignored.
       
   144      */
       
   145     virtual void SetMaximumL(TInt aMaximum) =0;
       
   146 
       
   147     /**
       
   148      * Returns the increment
       
   149      */
       
   150     virtual TInt GetIncrement() const =0;
       
   151 
       
   152     /**
       
   153      * Sets the increment
       
   154      * @param aIncrement The new increment, will be >= 1.
       
   155      */
       
   156     virtual void SetIncrement(TInt aIncrement) =0;
       
   157 
       
   158     /**
       
   159      * Returns the page increment.
       
   160      */
       
   161     virtual TInt GetPageIncrement() const =0;
       
   162 
       
   163     /**
       
   164      * Sets the page increment
       
   165      * @param aPageIncrement The new page increment, will be >= 1.
       
   166      */
       
   167     virtual void SetPageIncrement(TInt aPageIncrement) =0;
       
   168 
       
   169     /**
       
   170      * Sets all parameters in once
       
   171      */
       
   172     virtual void SetValuesL(TInt aPosition, TInt aMinimum, TInt aMaximum,
       
   173                             TInt aThumbSpan, TInt aIncrement, TInt aPageIncrement) =0;
       
   174 };
       
   175 
       
   176 
       
   177 /**
       
   178  * Type for an array of controls
       
   179  */
       
   180 typedef RPointerArray<MSwtControl> RSwtControlArray;
       
   181 
       
   182 
       
   183 /**
       
   184  * Interface class for the org.eclipse.swt.widgets.Control class
       
   185  */
       
   186 class MSwtControl : public MSwtWindowDrawable
       
   187 {
       
   188 protected:
       
   189     virtual ~MSwtControl() {} // Made protected to prevent destruction through the interface
       
   190 
       
   191 public:
       
   192     /**
       
   193      * Mask values for the utility flags
       
   194      * Flags are such that the default value is 0
       
   195      */
       
   196     enum TFlagMask
       
   197     {
       
   198         EFlagDoNotDraw    = 0x01, // The control must not be drawn
       
   199         EFlagInvisible    = 0x02, // The control is invisible
       
   200         EFlagDisabled     = 0x04, // The control is disabled (grayed, dimmed)
       
   201         EFreeFlagStart    = 0x08  // The first flag available for custom use
       
   202     };
       
   203 
       
   204     enum TFocusBackgroundPolicy
       
   205     {
       
   206         // Composite use case, no visual indication of focus
       
   207         ENoFocusBackground = 0,
       
   208 
       
   209         // Normal use case, draw focus background if the Control has focus
       
   210         // and there is at least another focusable Control in same Shell.
       
   211         EDefaultFocusBackground,
       
   212 
       
   213         // Button use case, the Control's focus background is owned by Avkon
       
   214         EEmbeddedFocusBackground,
       
   215 
       
   216         // Captioned Controls use case, default focus background policy
       
   217         // applies to itself and children
       
   218         ECaptionedCtrlFocusBackground,
       
   219 
       
   220         // This policy is similar to EEmbeddedFocusBackground.
       
   221         // Its use case is for lists, listviews, tables, trees and listboxes.
       
   222         // They don't have focus background at all even when placed
       
   223         // to captioned control (only captioned control has highlight)
       
   224         ENoFocusBackgroundInCaptionedControl
       
   225     };
       
   226 
       
   227     enum TPressBackgroundPolicy
       
   228     {
       
   229         // No need for pressed highlight.
       
   230         ENoPressBackground = 0,
       
   231 
       
   232         // Highlight is applied whenever the control is pressed.
       
   233         EPressBackground = 1,
       
   234 
       
   235         // The control has it's own pressed highlight.
       
   236         EEmbeddedPressBackground = 2
       
   237     };
       
   238 
       
   239 public:
       
   240     /**
       
   241      * Disposes of (i.e. destroys) the control
       
   242      * @return The Java peer associated with this object
       
   243      */
       
   244     virtual TSwtPeer Dispose() =0;
       
   245 
       
   246     /**
       
   247      * Returns the Java peer associated with this object
       
   248      */
       
   249     virtual TSwtPeer JavaPeer() const =0;
       
   250 
       
   251     /**
       
   252      * Returns a pointer to the underlying Cone control used for the
       
   253      * actual implementation.
       
   254      */
       
   255     virtual CCoeControl& CoeControl() =0;
       
   256 
       
   257     /**
       
   258      * Returns a const pointer to the underlying Cone control used for the
       
   259      * actual implementation.
       
   260      */
       
   261     virtual const CCoeControl& CoeControl() const =0;
       
   262 
       
   263     /**
       
   264      * Returns the control's utility flags
       
   265      * <b>Note</b>: this method is a convenience aimed to be used for the
       
   266      * implementation of MSwtComposite. If the implementation on a
       
   267      * given platform does use utility flags, this method can return any value.
       
   268      */
       
   269     virtual TUint Flags() const =0;
       
   270 
       
   271     /**
       
   272      * Indicate if the control has the flag EFlagDoNotDraw.
       
   273      * @return True if the Control has the EFlagDoNotDraw flag, else EFalse.
       
   274      */
       
   275     virtual TBool HasDoNotDrawFlag() const =0;
       
   276 
       
   277     /**
       
   278      * Instructs the control to paint itself
       
   279      *
       
   280      * @param aRect The rectangle to draw, in screen coordinates.
       
   281      * @param aPaintNatively Whether the native CCoeControl::Draw should be called before flushing
       
   282      *                       the buffered operations
       
   283      * @param aGc The GC that was passed into the paint listener
       
   284      * @param aIntParam An array of buffered opcodes and integer parameters from gc operations
       
   285      *                  done in the paint listener
       
   286      * @param aIntCount The Number of items in aIntParams array
       
   287      * @param aStrParam Buffered string parameters from gc operations done in the paint listener
       
   288      */
       
   289     virtual void Paint(const TRect& aRect,
       
   290                        TBool aPaintNatively = ETrue,
       
   291                        MSwtGc* aGc = NULL,
       
   292                        TInt* aIntParams = NULL,
       
   293                        TInt aIntCount = 0,
       
   294                        HBufC* aStrParams = NULL) const =0;
       
   295 
       
   296     /**
       
   297      * Emergency native paint. Ignores Java GCs.
       
   298      * Window redraw must be started before calling this and stopped after.
       
   299      *
       
   300      * @param aRect The rectangle to draw, in window coordinates.
       
   301      */
       
   302     virtual void PaintUrgently(const TRect& aRect, TBool aInitDraw = ETrue) const =0;
       
   303 
       
   304     /**
       
   305      * Ignoring the Java paint requests and draws directly for the time being.
       
   306      */
       
   307     virtual TBool IsPaintingUrgently() const = 0;
       
   308 
       
   309     /**
       
   310      * Processes a key event
       
   311      */
       
   312     virtual void ProcessKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) =0;
       
   313 
       
   314     /**
       
   315      * Handles the pointer events.
       
   316      * @param aPointerEvent pointer event to process
       
   317      */
       
   318     virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent)=0;
       
   319 
       
   320     /**
       
   321      * Determines if a control is suitable for receiving focus.
       
   322      * Invisible or disabled controls can never be focused, not even with
       
   323      * KSwtFocusByForce. Shells cannot be focused just activated.
       
   324      */
       
   325     virtual TBool IsFocusable(TInt aReason = KSwtFocusByApi) const =0;
       
   326 
       
   327     /**
       
   328      * Attempts to make this control the one that receives focus.
       
   329      * If this control or a descendant takes focus, true is returned. Composites
       
   330      * attempt to assign focus to their children before taking focus themselves.
       
   331      * Some controls, such as labels, do not normally take focus. A control will
       
   332      * not take focus if it is disabled or hidden or when input is blocked due to
       
   333      * modality.
       
   334      * In case of KSwtFocusByForce, forces the control to receive keyboard events.
       
   335      * Controls that do not normally accept keyboard input will take focus
       
   336      * using this KSwtFocusByForce.
       
   337      * @return Whether this control has focus upon method exit.
       
   338      */
       
   339     virtual TBool SetSwtFocus(TInt aReason = KSwtFocusByApi) =0;
       
   340 
       
   341     /**
       
   342      * Returns the policy of the focus background.
       
   343      * See TFocusBackgroundPolicy.
       
   344      */
       
   345     virtual TInt FocusBackgroundPolicy() const =0;
       
   346 
       
   347     /**
       
   348      * Returns the policy of the pressed background.
       
   349      * See TPressBackgroundPolicy.
       
   350      */
       
   351     virtual TInt PressBackgroundPolicy() const =0;
       
   352 
       
   353     /**
       
   354      * Returns true if the control is selectable by the user and is not dimmed
       
   355      */
       
   356     virtual TBool GetEnabled() const =0;
       
   357 
       
   358     /**
       
   359      * If this function returns true it does not mean that the control should
       
   360      * be visible for the user. The parent migh be invisible in which case this
       
   361      * control should not be visible to the user or draw itself. So this function
       
   362      * returns only the internal visibility state of this controll without paying
       
   363      * attention to the combined visibility of its ancestors.
       
   364      * Use GetVisibleRecursively() to determine if the control is really visible.
       
   365      */
       
   366     virtual TBool GetVisible() const =0;
       
   367 
       
   368     /**
       
   369      * Except Shells, controls are shown if themeselves and their parent are visible.
       
   370      */
       
   371     virtual TBool GetVisibleRecursively() const =0;
       
   372 
       
   373     /**
       
   374      * Indicate if the default system colour was use for the background.
       
   375      * @return Returns Etrue if the default system colour was use for the background,
       
   376      * otherwise EFalse if a color background setted.
       
   377      */
       
   378     virtual TBool IsDefaultBackgroundUse() const = 0;
       
   379 
       
   380     /**
       
   381      * Returns the control context of the Control.
       
   382      * @return Returns the control context of the Control define by the control
       
   383      * or NULL or there is no specific control context..
       
   384      */
       
   385     virtual MAknsControlContext* GetControlContext() const =0;
       
   386 
       
   387     /**
       
   388      * Returns the control background color
       
   389      * @return The control background color
       
   390      */
       
   391     virtual TRgb GetBackground() const = 0;
       
   392 
       
   393     /**
       
   394      * Returns the control foreground color
       
   395      * @return The control foreground color
       
   396      */
       
   397     virtual TRgb GetForeground() const = 0;
       
   398 
       
   399     /**
       
   400      * Sets the color of the control's background.
       
   401      * @param aColor The colour to set the background to, if NULL
       
   402      *               the default colour will be used.
       
   403      */
       
   404     virtual void SetBackgroundL(const MSwtColor* aColor) =0;
       
   405 
       
   406     /**
       
   407      * Sets the color of the control's text.
       
   408      * @param aColor The colour to set the foreground to, if NULL
       
   409      *               the default colour will be used.
       
   410      */
       
   411     virtual void SetForegroundL(const MSwtColor* aColor) =0;
       
   412 
       
   413     /**
       
   414      * Returns the control font used for writing text
       
   415      * @return The control's font, cannot be NULL
       
   416      */
       
   417     virtual const MSwtFont* GetFont() const =0;
       
   418 
       
   419     /**
       
   420      * Gets the control's border width
       
   421      * @return The control's border width
       
   422      */
       
   423     virtual TInt GetBorderWidth() const =0;
       
   424 
       
   425     /**
       
   426      * Returns the client rectangle (i.e. the part without scroll-bars, borders
       
   427      *        and other decorations) of this Control
       
   428      * The client area returned is in window coordinates.
       
   429      */
       
   430     virtual TRect ClientRect() const =0;
       
   431 
       
   432     /**
       
   433      * Gets the control's bounding rectangle
       
   434      * @return The control's coordinates relative to its parent, or in screen
       
   435      *         coordinates if it has no parent. Shells always return screen
       
   436      *         coordinates.
       
   437      */
       
   438     virtual TRect GetBounds() const =0;
       
   439 
       
   440     /**
       
   441      * Gets the control's position.
       
   442      * @return The control's position relative to its parent, or in screen
       
   443      *         coordinates if it has no parent. Shells always return screen
       
   444      *         coordinates.
       
   445      */
       
   446     virtual TPoint GetLocation() const =0;
       
   447 
       
   448     /**
       
   449      * Returns the control's popup menu
       
   450      */
       
   451     virtual const MSwtMenu* GetPopupMenu() const =0;
       
   452 
       
   453     /**
       
   454      * Returns the control's native menu
       
   455      */
       
   456     virtual const MSwtMenu* GetControlMenu() const =0;
       
   457 
       
   458     /**
       
   459      * Returns the control parent
       
   460      */
       
   461     virtual MSwtComposite* GetParent() const =0;
       
   462 
       
   463     /**
       
   464      * Check if aParent is in the parent hierarchy.
       
   465      */
       
   466     virtual TBool IsDescentOf(const MSwtControl& aParent) const =0;
       
   467 
       
   468     /**
       
   469      * Get the closest parent Shell of the Control
       
   470      */
       
   471     virtual MSwtShell& GetShell() const =0;
       
   472 
       
   473     /**
       
   474      * Get the top Shell of the Control
       
   475      */
       
   476     virtual MSwtShell& GetTopShell() const =0;
       
   477 
       
   478     /**
       
   479      * Get the top CaptionedControl of the Control, if any
       
   480      */
       
   481     virtual MSwtCaptionedControl* GetNearestCaptionedControl(TBool aIncludeSelf = ETrue) const =0;
       
   482 
       
   483     /**
       
   484      * Gets the control's width and height;
       
   485      */
       
   486     virtual TSize GetWidgetSize() const =0;
       
   487 
       
   488     /**
       
   489      * Returns true if we have UI focus, false otherwise
       
   490      */
       
   491     virtual TBool IsFocusControl() =0;
       
   492 
       
   493     /**
       
   494      * Moves this control above aControl in the drawing order
       
   495      */
       
   496     virtual void MoveAbove(const MSwtControl* aControl) =0;
       
   497 
       
   498     /**
       
   499      * Moves this control below aControl in the drawing order
       
   500      */
       
   501     virtual void MoveBelow(const MSwtControl* aControl) =0;
       
   502 
       
   503     /**
       
   504      * Redraws the entire control
       
   505      */
       
   506     virtual void Redraw() =0;
       
   507 
       
   508     /**
       
   509      * Updates DoNotDraw flag after a call to setRedraw
       
   510      */
       
   511     virtual void UpdateDoNotDrawFlag() =0;
       
   512 
       
   513     /**
       
   514      * Redraws the specified area of the control
       
   515      * @param aRect The rectangle to redraw, in client area coordinates.
       
   516      */
       
   517     virtual void RedrawRegion(const TRect& aRect) =0;
       
   518 
       
   519     /**
       
   520      * Enables or disables future redraw requests
       
   521      */
       
   522     virtual void SetRedraw(TBool aRedraw) =0;
       
   523 
       
   524     /**
       
   525      * Sets the font of the control.
       
   526      * @param aFont The font to use, if NULL a default font is to be used.
       
   527      */
       
   528     virtual void SetFontL(const MSwtFont* aFont) =0;
       
   529 
       
   530     /**
       
   531      * Sets the visibility status of the control
       
   532      */
       
   533     virtual void SetVisible(TBool aVisible) =0;
       
   534 
       
   535     /**
       
   536      * Sets the Control's location
       
   537      * @param aPoint The new location; in the parent's coordinates, in screen
       
   538      *        coordinates for Shells.
       
   539      */
       
   540     virtual void SetLocation(const TPoint& aPoint) =0;
       
   541 
       
   542     /**
       
   543      * Sets the Control's size
       
   544      *
       
   545      * @param aSize The new size.
       
   546      */
       
   547     virtual void SetWidgetSize(const TSize& aSize) =0;
       
   548 
       
   549     /**
       
   550      * Compute the preferred size.
       
   551      */
       
   552     virtual TSize ComputeSizeL(TInt aWHint, TInt aHHint) = 0;
       
   553 
       
   554     /**
       
   555      * Sets the control as selectable by the user
       
   556      */
       
   557     virtual void SetEnabled(TBool aEnabled) =0;
       
   558 
       
   559     /**
       
   560      * Sets the Control's location and size
       
   561      * @param aRect The new rectangle; in the parent's coordinates, in screen
       
   562      *        coordinates for Shells.
       
   563      */
       
   564     virtual void SetBounds(const TRect& aRect) =0;
       
   565 
       
   566     /**
       
   567      * Sets the Control's popup menu
       
   568      * @param aMenu The popup menu.
       
   569      */
       
   570     virtual void SetPopupMenuL(const MSwtMenu* aMenu) =0;
       
   571 
       
   572     /**
       
   573      * Enable or disable pointer capture for this control
       
   574      */
       
   575     virtual void SetCapture(TBool aCapture) =0;
       
   576 
       
   577     /**
       
   578      * Returns the style of the control.
       
   579      */
       
   580     virtual TInt Style() const =0;
       
   581 
       
   582     /**
       
   583      * Updates the control by forcing an immediate draw
       
   584      * on itself and flushes all paint events on this Control.
       
   585      */
       
   586     virtual void Update() const =0;
       
   587 
       
   588     /**
       
   589      * Returns a pointer to the MSwtButton interface of this
       
   590      * Control if it is a Button.
       
   591      * Only actual Button will return a non-null pointer
       
   592      * @return The Control's MSwtButton interface, or NULL
       
   593      */
       
   594     virtual MSwtButton* ButtonInterface()
       
   595     {
       
   596         return NULL;
       
   597     }
       
   598 
       
   599     /**
       
   600      * Returns a pointer to the MSwtCaptionedControl interface of this
       
   601      * Control if it is a CaptionedControl.
       
   602      * Only actual CaptionedControl will return a non-null pointer
       
   603      * @return The Control's MSwtCaptionedControl interface, or NULL
       
   604      */
       
   605     virtual MSwtCaptionedControl* CaptionedControlInterface() const
       
   606     {
       
   607         return NULL;
       
   608     }
       
   609 
       
   610     /**
       
   611      * Returns a pointer to the MSwtShell interface of this Control.
       
   612      * Only actual Shells will return a non-null pointer
       
   613      * @return The Control's MSwtShell interface, or NULL
       
   614      */
       
   615     virtual MSwtShell* ShellInterface()
       
   616     {
       
   617         return NULL;
       
   618     }
       
   619 
       
   620     virtual const MSwtShell* ShellInterface() const
       
   621     {
       
   622         return NULL;
       
   623     }
       
   624 
       
   625     /**
       
   626      * Tests if this control is a shell
       
   627      */
       
   628     inline TBool IsShell() const
       
   629     {
       
   630         return (const_cast<MSwtControl*>(this)->ShellInterface()!=NULL);
       
   631     }
       
   632 
       
   633     /**
       
   634      * Returns a pointer to the MSwtDecorations interface of this Control.
       
   635      * Only actual Decorations (or Shells) will return a non-null pointer
       
   636      * @return The Control's MSwtDecorations interface, or NULL
       
   637      */
       
   638     virtual MSwtDecorations* DecorationsInterface()
       
   639     {
       
   640         return NULL;
       
   641     }
       
   642 
       
   643     /**
       
   644      * Tests if this control is a decorations
       
   645      */
       
   646     inline TBool IsDecorations() const
       
   647     {
       
   648         return (const_cast<MSwtControl*>(this)->DecorationsInterface()!=NULL);
       
   649     }
       
   650 
       
   651     /**
       
   652      * Returns a pointer to the MSwtComposite interface of this Control.
       
   653      * Only controls actually implementing MSwtComposite will return a non-null pointer
       
   654      * @return The Control's MSwtComposite interface, or NULL
       
   655      */
       
   656     virtual MSwtComposite* CompositeInterface() const
       
   657     {
       
   658         return NULL;
       
   659     }
       
   660 
       
   661     /**
       
   662      * Returns a pointer to the MSwtBrowser interface of this Control.
       
   663      * Only actual Browser will return a non-null pointer
       
   664      * @return The Control's MSwtBrowser interface, or NULL
       
   665      */
       
   666     virtual MSwtBrowser* BrowserInterface()
       
   667     {
       
   668         return NULL;
       
   669     }
       
   670 
       
   671     /**
       
   672      * Recursively adds to the provided list all the controls that can
       
   673      * be traversed using the "Tab" key.
       
   674      * Controls must be appended to the list in the same order as specified in
       
   675      * the control's own tab list. All controls are to be put in the list, even
       
   676      * non-focusable ones.
       
   677      * @param aList The list to add the controls to
       
   678      */
       
   679     virtual void ComputeTabListL(RSwtControlArray& aList) =0;
       
   680 
       
   681     /**
       
   682      * Converts screen coordinates to control coordinates (client area coordinates).
       
   683      * @return Control relative point
       
   684      */
       
   685     virtual TPoint ToControl(const TPoint& aPoint) const =0;
       
   686 
       
   687     /**
       
   688      * Converts control coordinates (client area coordinates) to screen coordinates.
       
   689      * @return Screen relative point
       
   690      */
       
   691     virtual TPoint ToDisplay(const TPoint& aPoint) const =0;
       
   692 
       
   693     /**
       
   694      * Indicates if control uses CBA button or if CBA button is available to user commands.
       
   695      * @param aCbaButtonIndex Index of the CBA button
       
   696      * @return ETrue if control uses CBA button, EFalse otherwise
       
   697      */
       
   698     virtual TBool CbaButtonIsUsed(TInt aCbaButtonIndex) const =0;
       
   699 
       
   700     /**
       
   701      * Indicates if control uses the key passed in argument.
       
   702      * @param aKeyCode Key code
       
   703      * @return ETrue if control uses the key, EFalse otherwise
       
   704      */
       
   705     virtual TBool IsKeyUsed(TUint aKeyCode) const =0;
       
   706 
       
   707     /**
       
   708      * Returns the MSK label to be displayed. This is used in correlation
       
   709      * with the IsKeyUsed to determine the label for the MSK.
       
   710      * @return descriptor to be displayed.
       
   711      */
       
   712     virtual HBufC* MSKLabelL() const=0;
       
   713 
       
   714     /**
       
   715      * Indicates if external selection command can replace
       
   716      * internal selection operation when pressing MSK.
       
   717      * @return ETrue if external selection command is allowed, EFalse otherwise
       
   718      */
       
   719     virtual TBool MSKSelCmdEnabled() const = 0;
       
   720 
       
   721     /**
       
   722      * Posts an asynchronous traverse event without taking into account any key event.
       
   723      * @param aDetail   The traversal detail
       
   724      * @param aDoIt     Initial value for the doit field
       
   725      * @return ETrue if the post is succesfull.
       
   726      */
       
   727     virtual TBool ForceTraverseEvent(TSwtTraversal aDetail, TBool aDoIt) =0;
       
   728 
       
   729     /**
       
   730      * Add this control to the Control Stack of the Eikon AppUi
       
   731      * @param aPriority The control’s stack priority.
       
   732      */
       
   733     virtual void AddToControlStackL(TInt aPriority) =0;
       
   734 
       
   735     /**
       
   736      * Remove this control from the Control Stack of the Eikon AppUi
       
   737      * @param aPriority The control’s stack priority.
       
   738      */
       
   739     virtual void RemoveFromControlStack()  =0;
       
   740 
       
   741     /**
       
   742      * Says if this control is on Control Stack of the Eikon AppUi
       
   743      * @return ETrue if control is on Control Stack of the Eikon AppUi.
       
   744      */
       
   745     virtual TBool IsOnControlStack() const =0;
       
   746 
       
   747     /**
       
   748      * Says if the control is allowed to draw outside its own extent.
       
   749      * @return ETrue if control is allowed to draw outside its own extent.
       
   750      */
       
   751     virtual TBool CanDrawOutsideRect() const
       
   752     {
       
   753         return EFalse;
       
   754     }
       
   755 
       
   756 #ifdef RD_SCALABLE_UI_V2
       
   757     /**
       
   758      * Returns the control's native menu for stylus popup menu. It may contain
       
   759      * different commands than the control menu opened with MSK.
       
   760      */
       
   761     virtual const MSwtMenu* GetStylusPopupControlMenu() const
       
   762     {
       
   763         return NULL;
       
   764     }
       
   765 #endif //RD_SCALABLE_UI_V2
       
   766 
       
   767     /**
       
   768      * Destructor wrapper. Use cautiously.
       
   769      */
       
   770     virtual void Destroy()
       
   771     {
       
   772         delete this;
       
   773     };
       
   774 
       
   775     /**
       
   776      * Hide / send to background the CoeControl directly without notifications.
       
   777      * For instance a Shell can be hidden without changing its focusability.
       
   778      * Does not redraw.
       
   779      */
       
   780     virtual void HideSilently() = 0;
       
   781     virtual void ShowSilently() = 0;
       
   782     virtual TBool HiddenSilently() const = 0;
       
   783 
       
   784     /**
       
   785      * Allows the Control to decide which pointer events are good for long tap animation.
       
   786      */
       
   787     virtual TBool IsLongTapAnimationCandidate(const TPointerEvent& aPointerEvent) const =0;
       
   788 
       
   789     virtual void DoControlSpecificFeedback(const TBool& aFirstTap,
       
   790                                            const TBool& aTappedToChildRect,
       
   791                                            const TPointerEvent& aPointerEvent) const = 0;
       
   792 
       
   793     virtual void PostMouseEventL(const TPointerEvent& aPointerEvent) = 0;
       
   794 
       
   795     /**
       
   796      * Enables or disables focus highlight for controls
       
   797      * Used only for list controls (Lists, ListView, ListBox and Table)
       
   798      * Only for 9.2
       
   799      */
       
   800     virtual void EnableFocusHighlight(TBool aEnable) = 0;
       
   801 
       
   802     /**
       
   803      * Get the visible rectangle of this control.
       
   804      * Window coordinates.
       
   805      * The clipping take in account the parent, but not the brother.
       
   806      * To take in account the sibblings use VisibleRegion() method.
       
   807      * @param aVisibleBounds If true return the visible rectangle of the control,
       
   808      *        else return visible client rectangle of the control.
       
   809      */
       
   810     virtual TRect VisibleRect(TBool aVisibleBounds = EFalse) const = 0;
       
   811 
       
   812     /**
       
   813      * Get the scrollable interface of control.
       
   814      * If control is not scrollable method returns null
       
   815      */
       
   816     virtual MSwtScrollable* ScrollableInterface() const
       
   817     {
       
   818         return NULL;
       
   819     }
       
   820 
       
   821     /**
       
   822      * True if the control owns a focus / pressed highlighted background.
       
   823      * @param aIncludingParents - if true, the parent tree is checked also.
       
   824      */
       
   825     virtual TBool HasHighlight(TBool aIncludingParents = ETrue) const = 0;
       
   826 
       
   827     /**
       
   828      * Instructs the control to create and display a highlighted background.
       
   829      * This is *not* supposed to repaint!
       
   830      */
       
   831     virtual void SetHighlight(TBool aEnabled) = 0;
       
   832 
       
   833     /**
       
   834      * React to highlight changes in itself or in the parent tree.
       
   835      * This is *not* supposed to repaint!
       
   836      */
       
   837     virtual void HandleHighlightChange() = 0;
       
   838 
       
   839     /**
       
   840      * True if pressed by pointer.
       
   841      */
       
   842     virtual TInt Pressed() const = 0;
       
   843 
       
   844     /**
       
   845      * Get ready for traverse event
       
   846      */
       
   847     virtual void PrepareForTraverse() = 0;
       
   848 };
       
   849 
       
   850 
       
   851 /**
       
   852  * Interface class for the org.eclipse.swt.widgets.Scrollable class
       
   853  * A class that implements MSwtScrollable must also implement MSwtControl.
       
   854  */
       
   855 class MSwtScrollable
       
   856 {
       
   857 protected:
       
   858     virtual ~MSwtScrollable() {} // Made protected to prevent destruction through the interface
       
   859 
       
   860 public:
       
   861     /**
       
   862      * Returns the MSwtControl interface.
       
   863      */
       
   864     virtual MSwtControl* Control() =0;
       
   865 
       
   866     /**
       
   867      * Computes the size needed to obtain the specified client area
       
   868      * @param aRect Must contain the client area to be obtained, this will be
       
   869      *        modified to be the needed area.
       
   870      */
       
   871     virtual void ComputeTrim(TRect& aRect) const =0;
       
   872 
       
   873     /**
       
   874      * Creates a ScrollBar object that represents this Scrollable's scroll-bar.
       
   875      * @param aPeer  The Java peer of the scroll-bar to be created
       
   876      * @param aStyle Can be KSwtHScroll or KSwtVScroll.
       
   877      */
       
   878     virtual MSwtScrollBar* CreateScrollBarL(TSwtPeer aPeer, TInt aStyle) =0;
       
   879 
       
   880     /**
       
   881      * Hides the specified scroll-bar
       
   882      * @param aStyle   The scroll-bar whose visibility to alter, must be one of
       
   883      *                 KSwtStyleHScroll and KSwtStyleVScroll.
       
   884      * @param aVisible Whether to make the specified scroll-bar visible or invisible
       
   885      */
       
   886     virtual void SetVisibleScrollBar(TInt aStyle, TBool aVisible) =0;
       
   887 
       
   888     /**
       
   889      * Notifies this Scrollable that one of its scroll-bars has been destroyed.
       
   890      */
       
   891     virtual void ScrollBarDestroyed(const MSwtScrollBar* aScrollBar) =0;
       
   892 
       
   893     /**
       
   894      * Tells if control has scrollbars
       
   895      */
       
   896     virtual TBool HasScrollBars() const
       
   897     {
       
   898         return EFalse;
       
   899     };
       
   900 };
       
   901 
       
   902 
       
   903 /**
       
   904  * Interface class for the org.eclipse.swt.widgets.Composite class
       
   905  * A class that implements MSwtComposite must also implement MSwtScrollable.
       
   906  */
       
   907 class MSwtComposite
       
   908 {
       
   909 protected:
       
   910     virtual ~MSwtComposite() {} // Made protected to prevent destruction through the interface
       
   911 
       
   912 public:
       
   913     /**
       
   914      * Returns the MSwtScrollable interface
       
   915      */
       
   916     virtual MSwtScrollable* Scrollable() =0;
       
   917 
       
   918     /**
       
   919      * Returns the MSwtControl interface
       
   920      */
       
   921     inline MSwtControl* Control()
       
   922     {
       
   923         return Scrollable()->Control();
       
   924     }
       
   925 
       
   926     /**
       
   927      * Registers a new child with this Composite
       
   928      * A Control may register itself only once it has been
       
   929      * <b>fully</b> constructed. Additionally, a Control shall
       
   930      * register only once with its parent.
       
   931      * @param aChild The child control to register, cannot be a Shell.
       
   932      * @sa MSwtShell::RegisterChildShellL()
       
   933      */
       
   934     virtual void RegisterChildL(MSwtControl& aChild) =0;
       
   935 
       
   936     /**
       
   937      * Unregisters a child from this Composite
       
   938      * A Control shall not attempt to unregister itself from a
       
   939      * parent it was not registered with.
       
   940      * @param aChild The child control to unregister, cannot be a Shell
       
   941      * @sa MSwtShell::UnregisterChildShell()
       
   942      */
       
   943     virtual void UnregisterChild(MSwtControl& aChild) =0;
       
   944 
       
   945     /**
       
   946      * Retrieves the Java peer of each child.
       
   947      * @return A newly allocated array containing the peers; the caller is
       
   948      *         responsible for freeing the array. NULL can be returned if
       
   949      *         the Composite has no child.
       
   950      */
       
   951     virtual CSwtPeerArray* GetChildrenPeersL() =0;
       
   952 
       
   953     /**
       
   954      * Returns the array containing the Composite's children.
       
   955      * @return The array containing the Composite's children.
       
   956      *         NULL can be returned if the Composite has no child.
       
   957      */
       
   958     virtual const RSwtControlArray* Children() const =0;
       
   959 
       
   960     /**
       
   961      * Notifies this Composite that one of its children has gained or lost focus.
       
   962      * @param aControl The child whose focus state has changed. The child may
       
   963      *        not be a direct child, it can be the child of a child, and so on.
       
   964      */
       
   965     virtual void ChildFocusChanged(MSwtControl& aControl) =0;
       
   966 
       
   967     /**
       
   968      * Count focusable kids.
       
   969      * @param aTryBreakAfter try to stop counting when reached, count all when < 0
       
   970      * @param aExclude count all except the composite and all its descents
       
   971      * @param aVisualFocusCount ignores controls which have ENoFocusBackground policy
       
   972      */
       
   973     virtual TInt CountFocusableChildren(TInt aTryBreakAfter = -1,
       
   974                                         const MSwtControl* aExclude = NULL,
       
   975                                         TBool aVisualFocusCount = ETrue) const =0;
       
   976 
       
   977     /**
       
   978      * Sets the tabbing order for the specified controls to match the
       
   979      * order that they occur in the argument list.
       
   980      * @param aControls An array of pointers to controls, they must all be
       
   981      *                  direct children of this Composite. May be NULL
       
   982      *                  but if so, aCount must be 0.
       
   983      * @param aCount    The number of controls in aControls, if 0
       
   984      *                  the tab order is reset to its default.
       
   985      */
       
   986     virtual void SetTabListL(MSwtControl** aControls, TInt aCount) =0;
       
   987 
       
   988     virtual CSwtPeerArray* GetTabListL() const =0;
       
   989 
       
   990     /**
       
   991      * Moves aChild1 such that it will lie above aChild2
       
   992      * @param aChild1 The child to move.
       
   993      * @param aChild2 The child to be placed above of. If NULL,
       
   994      *                aChild1 is moved to the top.
       
   995      */
       
   996     virtual void MoveChildAbove(MSwtControl& aChild1, const MSwtControl* aChild2) =0;
       
   997 
       
   998     /**
       
   999      * Moves aChild1 such that it will lie below aChild2
       
  1000      * @param aChild1 The child to move.
       
  1001      * @param aChild2 The child to be placed below of. If NULL,
       
  1002      *                aChild1 is moved to the bottom.
       
  1003      */
       
  1004     virtual void MoveChildBelow(MSwtControl& aChild1, const MSwtControl* aChild2) =0;
       
  1005 
       
  1006     /**
       
  1007      * When a Radio Button with a Parent which don't have a NO_RADIO_GROUP is selected
       
  1008      * the other Radio Button with the same parent must be unselected.
       
  1009      * So the new selected Radio Button call this method.
       
  1010      * @param aSelectedButton The new selected Buttton.
       
  1011      */
       
  1012     virtual void NotifyRadioGroup(MSwtButton* aSelectedButton) = 0;
       
  1013 
       
  1014     /**
       
  1015      * Returns the pointer grabbing control of the composite.
       
  1016      * Pay attention that this returns NULL after pointer up!
       
  1017      * @return Pointer to the pointer grabbing control or NULL.
       
  1018      */
       
  1019     virtual MSwtControl* GetPointerGrabbingControl() const
       
  1020     {
       
  1021         return NULL;
       
  1022     }
       
  1023 
       
  1024     /**
       
  1025      * ScrolledComposite content setter.
       
  1026      */
       
  1027     virtual void SetScrolledCompositeContentL(MSwtControl* aContent) = 0;
       
  1028 
       
  1029     /**
       
  1030      * In case this is a ScrolledComposite, returns the scrolled content.
       
  1031      */
       
  1032     virtual MSwtControl* ScrolledCompositeContent() const = 0;
       
  1033 
       
  1034     /**
       
  1035      * In case this is a ScrolledComposite, returns one of the possible physics actions defined in eswt.h
       
  1036      */
       
  1037     virtual TInt ScrolledCompositePysicsAction() const = 0;
       
  1038 
       
  1039     /**
       
  1040      * Draw scrollbar background.
       
  1041      */
       
  1042     virtual void DrawScrollBarBackground(const TRect& aRect) const = 0;
       
  1043 };
       
  1044 
       
  1045 /**
       
  1046  * Interface class for the org.eclipse.swt.widgets.Canvas class
       
  1047  * A class that implements MSwtCanvas must also implement MSwtComposite.
       
  1048  */
       
  1049 class MSwtCanvas
       
  1050 {
       
  1051 protected:
       
  1052     virtual ~MSwtCanvas() {} // Made protected to prevent destruction through the interface
       
  1053 
       
  1054 public:
       
  1055     /**
       
  1056      * Returns the MSwtComposite interface
       
  1057      */
       
  1058     virtual MSwtComposite* Composite() =0;
       
  1059 
       
  1060     /**
       
  1061      * Returns the MSwtScrollable interface
       
  1062      */
       
  1063     inline MSwtScrollable* Scrollable()
       
  1064     {
       
  1065         return Composite()->Scrollable();
       
  1066     }
       
  1067 
       
  1068     /**
       
  1069      * Returns the MSwtControl interface
       
  1070      */
       
  1071     inline MSwtControl* Control()
       
  1072     {
       
  1073         return Composite()->Control();
       
  1074     }
       
  1075 
       
  1076     /**
       
  1077      * Scrolls a rectangular area of this Canvas
       
  1078      * @param aDest The coordinates of the destination, in client coordinates.
       
  1079      * @param aRect The rectangle being scrolled, in client coordinates.
       
  1080      * @param aAll  Whether to scroll the children as well. Only the children
       
  1081      *              intersecting aRect are to be scrolled.
       
  1082      */
       
  1083     virtual void Scroll(const TPoint& aDest, const TRect& aRect, TBool aAll) =0;
       
  1084 };
       
  1085 
       
  1086 
       
  1087 /**
       
  1088  * Interface class for the org.eclipse.swt.widgets.Decorations class
       
  1089  * A class that implements MSwtDecorations must also implement MSwtCanvas.
       
  1090  */
       
  1091 class MSwtDecorations
       
  1092 {
       
  1093 protected:
       
  1094     virtual ~MSwtDecorations() {} // Made protected to prevent destruction through the interface
       
  1095 
       
  1096 public:
       
  1097     /**
       
  1098      * Returns the MSwtCanvas interface
       
  1099      */
       
  1100     virtual MSwtCanvas* Canvas() =0;
       
  1101 
       
  1102     /**
       
  1103      * Returns the MSwtComposite interface
       
  1104      */
       
  1105     inline MSwtComposite* Composite()
       
  1106     {
       
  1107         return Canvas()->Composite();
       
  1108     }
       
  1109 
       
  1110     /**
       
  1111      * Returns the MSwtScrollable interface
       
  1112      */
       
  1113     inline MSwtScrollable* Scrollable()
       
  1114     {
       
  1115         return Canvas()->Scrollable();
       
  1116     }
       
  1117 
       
  1118     /**
       
  1119      * Returns the MSwtControl interface
       
  1120      */
       
  1121     inline MSwtControl* Control()
       
  1122     {
       
  1123         return Canvas()->Control();
       
  1124     }
       
  1125 
       
  1126     /**
       
  1127      * Returns the decorations menu bar
       
  1128      */
       
  1129     virtual const MSwtMenu* MenuBar() =0;
       
  1130 
       
  1131     /**
       
  1132      * Sets the images for this Decorations
       
  1133      */
       
  1134     virtual void SetImageL(const MSwtImage* aImage) =0;
       
  1135 
       
  1136     /**
       
  1137      * Gets the images of this Decorations
       
  1138      */
       
  1139     virtual const MSwtImage* GetImage() const = 0;
       
  1140 
       
  1141     /**
       
  1142      * Maximises the control
       
  1143      */
       
  1144     virtual void SetMaximized(TBool aMaximized) =0;
       
  1145 
       
  1146     /**
       
  1147      * Returns if the control is currently maximised.
       
  1148      */
       
  1149     virtual TBool GetMaximized() const =0;
       
  1150 
       
  1151     /**
       
  1152      * Minimises (iconifies) the control.
       
  1153      */
       
  1154     virtual void SetMinimized(TBool aMinimized) =0;
       
  1155 
       
  1156     /**
       
  1157      * Returns if the control is currently maximised.
       
  1158      */
       
  1159     virtual TBool GetMinimized() const =0;
       
  1160 
       
  1161     /**
       
  1162      * Sets the menu bar
       
  1163      */
       
  1164     virtual void SetMenuBar(const MSwtMenu* aMenuBar) =0;
       
  1165 
       
  1166     /**
       
  1167      * Sets the <a>Decorations</a>'s title.
       
  1168      * @param aText A reference to the title descriptor.
       
  1169      * The method does nothing if the <a>Decorations</a> has no title.
       
  1170      */
       
  1171     virtual void SetTextL(const TDesC& aText) =0;
       
  1172 
       
  1173     /**
       
  1174      * Returns the Decorations' title.
       
  1175      * @return The title text, can be NULL.
       
  1176      */
       
  1177     virtual const TDesC* GetText() const =0;
       
  1178 
       
  1179     /**
       
  1180      * Sets the original default button of this Decorations.
       
  1181      */
       
  1182     virtual void SetDefaultButton(MSwtButton* aButton) =0;
       
  1183 
       
  1184     /**
       
  1185      * Sets the Button wich have the Focus.
       
  1186      */
       
  1187     virtual void SetFocusedDefaultButton(MSwtButton* aButton) =0;
       
  1188 
       
  1189     /**
       
  1190      * Returns the default button.
       
  1191      */
       
  1192     virtual const MSwtButton* OriginalDefaultButton() const =0;
       
  1193 
       
  1194     /**
       
  1195      * Returns the button wich have the Focus or the OriginalDefaultButton.
       
  1196      */
       
  1197     virtual const MSwtButton* DefaultButton() const =0;
       
  1198 
       
  1199     /**
       
  1200      * Returns the button wich have the Focus or the OriginalDefaultButton.
       
  1201      */
       
  1202     virtual TSwtPeer GetDefaultButton() const =0;
       
  1203 };
       
  1204 
       
  1205 
       
  1206 /**
       
  1207  * Interface class for the org.eclipse.swt.widgets.Shell class
       
  1208  * A class that implements MSwtShell must also implement MSwtDecorations.
       
  1209  */
       
  1210 class MSwtShell
       
  1211         : public MEikStatusPaneObserver
       
  1212 {
       
  1213 public:
       
  1214     /**
       
  1215      * Possible different styles for the status pane.
       
  1216      * The values have to match with what is defined in Java API for
       
  1217      * MobileShell.NO_STATUS_PANE, MobileShell.SMALL_STATUS_PANE and
       
  1218      * MobileShell.LARGE_STATUS_PANE.
       
  1219      */
       
  1220     enum TSwtStatusPaneStyle
       
  1221     {
       
  1222         EStyleNoStatusPane    = 1,  // No status pane at all
       
  1223         EStyleSmallStatusPane = 2,  // Small status pane variant
       
  1224         EStyleLargeStatusPane = 3   // Large status pane variant
       
  1225     };
       
  1226 
       
  1227 public:
       
  1228     virtual ~MSwtShell() {}
       
  1229 
       
  1230     /**
       
  1231      * Returns the MSwtDecorations interface
       
  1232      */
       
  1233     virtual MSwtDecorations* Decorations() =0;
       
  1234 
       
  1235     /**
       
  1236      * Returns the MSwtCanvas interface
       
  1237      */
       
  1238     inline MSwtCanvas* Canvas()
       
  1239     {
       
  1240         return Decorations()->Canvas();
       
  1241     }
       
  1242 
       
  1243     /**
       
  1244      * Returns the MSwtComposite interface
       
  1245      */
       
  1246     inline MSwtComposite* Composite()
       
  1247     {
       
  1248         return Decorations()->Composite();
       
  1249     }
       
  1250 
       
  1251     /**
       
  1252      * Returns the MSwtScrollable interface
       
  1253      */
       
  1254     inline MSwtScrollable* Scrollable()
       
  1255     {
       
  1256         return Decorations()->Scrollable();
       
  1257     }
       
  1258 
       
  1259     /**
       
  1260      * Returns the MSwtControl interface
       
  1261      */
       
  1262     inline MSwtControl* Control()
       
  1263     {
       
  1264         return Decorations()->Control();
       
  1265     }
       
  1266 
       
  1267     /**
       
  1268      * Returns a pointer to the MSwtMobileShell interface of this Shell.
       
  1269      * Only actual MobileShells will return a non-null pointer
       
  1270      * @return The Control's MSwtMobileShell interface, or NULL
       
  1271      */
       
  1272     virtual MSwtMobileShell* MobileShellInterface()
       
  1273     {
       
  1274         return NULL;
       
  1275     }
       
  1276     virtual const MSwtMobileShell* MobileShellInterface() const
       
  1277     {
       
  1278         return NULL;
       
  1279     }
       
  1280 
       
  1281     /**
       
  1282      * Tests if this Shell is a MobileShell
       
  1283      */
       
  1284     virtual TBool IsMobileShell() const
       
  1285     {
       
  1286         return EFalse;
       
  1287     }
       
  1288 
       
  1289     /**
       
  1290      * Returns the parent Shell of this Shell.
       
  1291      * Note: this method is only a more effective shortcut. The parent Shell
       
  1292      * can also be retrieved using Control(), MSwtControl::GetParent()
       
  1293      * and MSwtControl::ShellInterface()
       
  1294      */
       
  1295     virtual MSwtShell* GetParentShell() =0;
       
  1296 
       
  1297     /**
       
  1298      * Causes the Shell to become the active Shell
       
  1299      */
       
  1300     virtual void ForceActive() =0;
       
  1301 
       
  1302     /**
       
  1303      * Retrieves the Java peer of each child shell.
       
  1304      * @return A newly allocated array containing the peers; the caller is
       
  1305      *         responsible for freeing the array. NULL can be returned if
       
  1306      *         the Composite has no child.
       
  1307      */
       
  1308     virtual CSwtPeerArray* GetChildShellsPeersL() =0;
       
  1309 
       
  1310     /**
       
  1311      * Returns the display of the composite.
       
  1312      * @return A reference to the display.
       
  1313      */
       
  1314     virtual MSwtDisplay& Display() const =0;
       
  1315 
       
  1316     /**
       
  1317      * Returns the fullscreen mode of the MSwtShell
       
  1318      */
       
  1319     virtual TBool FullScreenMode() const =0;
       
  1320 
       
  1321     /**
       
  1322      * @return the initial editor input mode
       
  1323      */
       
  1324     virtual TInt GetImeInputMode() const =0;
       
  1325 
       
  1326     /**
       
  1327      * @return the minimum possible size for the shell
       
  1328      */
       
  1329     virtual TSize GetMinimumSize() const =0;
       
  1330 
       
  1331     /**
       
  1332      * Set the initial editor input mode
       
  1333      */
       
  1334     virtual void SetImeInputMode(TInt aMode) =0;
       
  1335 
       
  1336     /**
       
  1337      * Sets the minimum possible size for the shell
       
  1338      */
       
  1339     virtual void SetMinimumSize(const TSize& aMinimumSize) =0;
       
  1340 
       
  1341     /**
       
  1342      * Sets the control's style
       
  1343      * This method is provided in order to implement MobileShell
       
  1344      * whose ChangeTrimL method impacts on the style.
       
  1345      */
       
  1346     virtual void SetStyle(TInt aStyle) =0;
       
  1347 
       
  1348     /**
       
  1349      * Returns this Shell's full tab list
       
  1350      * The full tab list contains all of the Shell's children in the order they
       
  1351      * are to be traversed. It includes focusable as well as non-focusable
       
  1352      * controls but excludes child Shells.
       
  1353      */
       
  1354     virtual const RSwtControlArray& GetFullTabListL() =0;
       
  1355 
       
  1356     /**
       
  1357      * Tells the Shell to reset its tab list as it may have changed
       
  1358      * Reasons for resetting the tab list are addition or removal of a child.
       
  1359      */
       
  1360     virtual void ResetTabList() =0;
       
  1361 
       
  1362     /**
       
  1363      * Finds the new control to receive focus if the specified traversal is to be performed.
       
  1364      * @param aDetail           The traversal detail; only values defined in
       
  1365      *                          TSwtTraversal are valid, others are to be ignored.
       
  1366      * @param aFocusControl     The control that currently has the focus.
       
  1367      * @param aExcludedControls Optional list of controls that can not get the focus.
       
  1368      */
       
  1369     virtual MSwtControl* FindTraversalTargetL(TInt aDetail, MSwtControl& aFocusControl,
       
  1370             RSwtControlArray* aExcludedControls = NULL) =0;
       
  1371 
       
  1372     /**
       
  1373      * Sets this Shell's focus control
       
  1374      */
       
  1375     virtual void SetFocusControl(MSwtControl* aControl) =0;
       
  1376 
       
  1377     /**
       
  1378      * Test whether this Shell has a modal child Shell
       
  1379      * Only modal children that would prevent this Shell from being active are
       
  1380      * to be considered. For example, if a child Shell is modal but invisible
       
  1381      * it will not cause this method to return ETrue.
       
  1382      */
       
  1383     virtual TBool HasModalChild() const =0;
       
  1384 
       
  1385     /**
       
  1386      * Informs this Shell that its active status has changed.
       
  1387      * @param aIsActive The new active status
       
  1388      * @param aSetFocus Instructs a newly activated Shell to try and set the
       
  1389      *        focus on one of its children. To be ignored if aIsActive is EFalse.
       
  1390      */
       
  1391     virtual void ActivityChanged(TBool aIsActive, TBool aSetFocus) =0;
       
  1392 
       
  1393     /**
       
  1394      * Sets the Shell's Z-order position
       
  1395      * The Shell must recursively set its child Shells' Z-order positions so as
       
  1396      * not to obscure them.
       
  1397      * @param aZPosition The new Z-order position, 0 being the foreground and
       
  1398      *        the background being >0.
       
  1399      */
       
  1400     virtual void SetZPosition(TInt aZPosition) =0;
       
  1401 
       
  1402     /**
       
  1403      * Return the focussed control or NULL
       
  1404      */
       
  1405     virtual MSwtControl* FocusControl() const =0;
       
  1406 
       
  1407     /**
       
  1408      * Sets the default command
       
  1409      */
       
  1410     virtual void SetDefaultCommand(const MSwtCommand* aCommand) =0;
       
  1411 
       
  1412     /**
       
  1413      * Returns the default command
       
  1414      */
       
  1415     virtual const MSwtCommand* DefaultCommand() const =0;
       
  1416 
       
  1417     /**
       
  1418      * Makes the Shell full-screen or not
       
  1419      */
       
  1420     virtual void SetFullScreen(TBool aFullScreen) =0;
       
  1421 
       
  1422     /**
       
  1423      * Set the pointer to the child which should be added to Control Stack.
       
  1424      */
       
  1425     virtual void SetControlGoingToStack(MSwtControl* aControl) =0;
       
  1426 
       
  1427     /**
       
  1428      * Set the pointer to the child which gains the focus.
       
  1429      */
       
  1430     virtual void SetControlGainingFocus(MSwtControl* aControl) =0;
       
  1431 
       
  1432     /**
       
  1433      * Get the current status pane style.
       
  1434      */
       
  1435     virtual TSwtStatusPaneStyle StatusPaneStyle() const = 0;
       
  1436 
       
  1437     /**
       
  1438      * Returns the default bounds of the shell taking into consideration
       
  1439      * fullscreen mode, title and shell style.
       
  1440      */
       
  1441     virtual TRect DefaultBounds() const =0;
       
  1442 
       
  1443     /**
       
  1444      * Remember the control on which the foucus was set before activating the shell
       
  1445      */
       
  1446     virtual void SetToBeFocusedControl(MSwtControl* aControl) = 0;
       
  1447 
       
  1448     /**
       
  1449      * Checks if shell is not keeping reference (in iFocusMemory) to Control,
       
  1450      * that is going to be unregistered.
       
  1451      */
       
  1452     virtual void CheckFocusMemory(MSwtControl& aUnregisteredControl) =0;
       
  1453 
       
  1454     /**
       
  1455      * Unfortunately we are not able to keep drawing through Java side while
       
  1456      * kinetic scrolling is ongoing (panning or flicking). Shells need to
       
  1457      * respond immediately to native draw requests during scrolling.
       
  1458      * There can be only one Control at a time drawing urgently.
       
  1459      * See CSwtShell:Draw().
       
  1460      */
       
  1461     virtual void SetUrgentPaintControl(MSwtControl* aControl) = 0;
       
  1462     virtual MSwtControl* UrgentPaintControl() const = 0;
       
  1463 
       
  1464     /**
       
  1465      * True if Java paint listeners are registered to self or children.
       
  1466      */
       
  1467     virtual TBool AsyncPainting() const = 0;
       
  1468     virtual void SetAsyncPainting(TBool aStatus) = 0;
       
  1469 
       
  1470     /**
       
  1471      * Attached CBA to the Shell. Cannot be undone.
       
  1472      */
       
  1473     virtual void InstallCba() = 0;
       
  1474     virtual TBool HasCba() const = 0;
       
  1475 
       
  1476     /**
       
  1477      * Set task tip style.
       
  1478      */
       
  1479     virtual void SetTaskTip() = 0;
       
  1480     virtual TBool IsTaskTip() const = 0;
       
  1481 
       
  1482     /**
       
  1483      * Sets the location even if top shell.
       
  1484      */
       
  1485     virtual void DoSetLocation(const TPoint& aPoint) = 0;
       
  1486 
       
  1487     /**
       
  1488      * To be called whenever focus changes or controls get pressed.
       
  1489      * @param aDrawNow - immediate or deferred repaint.
       
  1490      *      For focus changes deferred repaint is preferred.
       
  1491      *      For pressed state changes immediate repaint is preferred.
       
  1492      */
       
  1493     virtual void UpdateHighlight(TBool aDrawNow = EFalse) = 0;
       
  1494 
       
  1495     /**
       
  1496      * Remove any references to the disposing control.
       
  1497      */
       
  1498     virtual void ControlDisposing(const MSwtControl& aControl) = 0;
       
  1499 };
       
  1500 
       
  1501 /**
       
  1502  * Structure containing the data needed for the
       
  1503  * org.eclipse.swt.core.Item class.
       
  1504  */
       
  1505 NONSHARABLE_CLASS(CSwtItem)
       
  1506         : public CBase
       
  1507 {
       
  1508 public:
       
  1509     inline CSwtItem(HBufC* aString, const MSwtImage* aImage)
       
  1510             : iString(aString)
       
  1511             , iImage(aImage)
       
  1512             , iImageSize(TSize::EUninitialized)
       
  1513     {
       
  1514         if (iImage != NULL)
       
  1515             iImage->AddRef();
       
  1516     }
       
  1517 
       
  1518     inline CSwtItem(HBufC* aString, const MSwtImage* aImage, const TSize& aImageSize)
       
  1519             : iString(aString)
       
  1520             , iImage(aImage)
       
  1521             , iImageSize(aImageSize)
       
  1522     {
       
  1523         if (iImage != NULL)
       
  1524             iImage->AddRef();
       
  1525     }
       
  1526 
       
  1527     ~CSwtItem()
       
  1528     {
       
  1529         delete iString;
       
  1530         if (iImage != NULL)
       
  1531             iImage->RemoveRef();
       
  1532     }
       
  1533 
       
  1534     inline const TDesC& String() const
       
  1535     {
       
  1536         return (iString!=NULL) ? static_cast<const TDesC&>(*iString) : KNullDesC;
       
  1537     }
       
  1538 
       
  1539     inline void SetString(HBufC* aString)
       
  1540     {
       
  1541         delete iString;
       
  1542         iString = aString;
       
  1543     }
       
  1544 
       
  1545     inline const MSwtImage* Image() const
       
  1546     {
       
  1547         return iImage;
       
  1548     }
       
  1549 
       
  1550     inline void SetImageSize(const TSize& aNewSize)
       
  1551     {
       
  1552         iImageSize = aNewSize;
       
  1553     }
       
  1554 
       
  1555     inline TSize ImageSize() const
       
  1556     {
       
  1557         return iImageSize;
       
  1558     }
       
  1559 
       
  1560     inline void SetImage(const MSwtImage* aImage)
       
  1561     {
       
  1562         if (iImage != NULL)
       
  1563             iImage->RemoveRef();
       
  1564         iImage = aImage;
       
  1565         if (iImage != NULL)
       
  1566             iImage->AddRef();
       
  1567     }
       
  1568 
       
  1569 private:
       
  1570     HBufC*           iString; // Owned
       
  1571     const MSwtImage* iImage;  // Ref counted
       
  1572     TSize            iImageSize;
       
  1573 };
       
  1574 
       
  1575 
       
  1576 /**
       
  1577  * Type for an array of titles in menu bar
       
  1578  */
       
  1579 typedef CEikMenuBar::CTitleArray CMenuBarTitleArray;
       
  1580 
       
  1581 
       
  1582 /**
       
  1583  * Interface class for the org.eclipse.swt.widgets.Menu class
       
  1584  *
       
  1585  */
       
  1586 class MSwtMenu
       
  1587 {
       
  1588 protected:
       
  1589     virtual ~MSwtMenu() {} // Made protected to prevent destruction through the interface
       
  1590 
       
  1591 public:
       
  1592     /**
       
  1593      * Disposes of (i.e. destroys) the menu.
       
  1594      * @return The Java peer associated with this object
       
  1595      */
       
  1596     virtual TSwtPeer Dispose() =0;
       
  1597 
       
  1598     /**
       
  1599      * Returns the Java peer associated with this object.
       
  1600      */
       
  1601     virtual TSwtPeer JavaPeer() const =0;
       
  1602 
       
  1603     /**
       
  1604      * Registers a new menu item with this Menu
       
  1605      * A MenuItem may register itself only once it has been
       
  1606      * <b>fully</b> constructed. Additionally, a MenuItem shall
       
  1607      * register only once with its parent.
       
  1608      * @param aChild The menu item to register.
       
  1609      * @param aIndex The position of the menu item.
       
  1610      */
       
  1611     virtual void RegisterChildL(MSwtMenuItem& aChild, TInt aIndex) =0;
       
  1612 
       
  1613     /**
       
  1614      * Unregisters a menu item from this Menu
       
  1615      * A MenuItem shall not attempt to unregister itself from a
       
  1616      * parent it was not registered with.
       
  1617      * @param aChild The menu item to unregister.
       
  1618      */
       
  1619     virtual void UnregisterChild(MSwtMenuItem& aChild) =0;
       
  1620 
       
  1621     /**
       
  1622      * Enables or disables the menubar
       
  1623      */
       
  1624     virtual void SetEnabled(TBool aEnabled) =0;
       
  1625 
       
  1626     /**
       
  1627      * Make menu visible or invisible
       
  1628      */
       
  1629     virtual void SetVisible(TBool aEnabled) =0;
       
  1630 
       
  1631     /**
       
  1632      * Returns ETrue if the menu is enabled, EFalse otherwise.
       
  1633      */
       
  1634     virtual TBool IsEnabled() const =0;
       
  1635 
       
  1636     /**
       
  1637      * Returns ETrue if the menu is set to be visible, EFalse otherwise.
       
  1638      * This is just a flag setting, does not reffer to Menu's actual visibility on the screen.
       
  1639      */
       
  1640     virtual TBool IsVisible() const =0;
       
  1641 
       
  1642     /**
       
  1643      * Set default menu item
       
  1644      */
       
  1645     virtual void SetDefaultItem(MSwtMenuItem* aMenuItem) =0;
       
  1646 
       
  1647     virtual MSwtMenuItem* DefaultItem() const =0;
       
  1648 
       
  1649     /**
       
  1650      * Fills the menu pane control with the menu items.
       
  1651      */
       
  1652     virtual void FillPaneL(CEikMenuPane& aPane) const =0;
       
  1653 
       
  1654     /**
       
  1655      * Asks the menu to reload resources and redisplay them on the shown menu pane.
       
  1656      */
       
  1657     virtual void RefreshPaneL(CEikMenuPane& aPane) const =0;
       
  1658 
       
  1659 #ifdef RD_SCALABLE_UI_V2
       
  1660     /**
       
  1661      * Adds the menu items to the stylus popup menu. Also the submenu items are
       
  1662      * added directly to the stylus popup menu as it does not support cascaded menus.
       
  1663      * @param aPoupMenu     The stylus popup menu to which the menu items are added.
       
  1664      */
       
  1665     virtual void FillPopupL(CAknStylusPopUpMenu& aPopupMenu) const =0;
       
  1666 #endif //RD_SCALABLE_UI_V2
       
  1667 
       
  1668     /**
       
  1669      * Processes the command associated with the command Id and the item index.
       
  1670      */
       
  1671     virtual void ProcessCommandL(TInt aCommandId, TInt aItemIndex, TBool aOfferToSubMenus = EFalse) const =0;
       
  1672 
       
  1673     /**
       
  1674      * Returns the number of enabled items.
       
  1675      * @param aStylusPopupMenu  Indicates if the displayable items are counted for
       
  1676      *                          stylus popup menu. Stylus popup menu is handled differently
       
  1677      *                          than the other menus.
       
  1678      * @return The number of displayable items.
       
  1679      */
       
  1680     virtual TInt CountDisplayableItems(TBool aStylusPopupMenu = EFalse) const =0;
       
  1681 
       
  1682     virtual const MSwtMenu* GetCascadeMenu(const CEikMenuPaneItem::SData& aItemData) const =0;
       
  1683 
       
  1684     virtual TBool HasRadioGroup() const =0;
       
  1685 
       
  1686     /**
       
  1687      * Return the host menu pane of this menu.
       
  1688      */
       
  1689     virtual CEikMenuPane* Host() const =0;
       
  1690 
       
  1691     /**
       
  1692      * Set the host menu pane of this menu.
       
  1693      */
       
  1694     virtual void SetHost(CEikMenuPane* aPane) =0;
       
  1695 
       
  1696     /**
       
  1697      * Set menu location
       
  1698      */
       
  1699     virtual void SetLocation(TInt aX, TInt aY) =0;
       
  1700 
       
  1701     /**
       
  1702      * Get menu location
       
  1703      */
       
  1704     virtual TPoint GetLocation() const =0;
       
  1705 
       
  1706     /**
       
  1707      * Show menu on its location
       
  1708      */
       
  1709     virtual TBool LocationEnabled() const =0;
       
  1710 
       
  1711     /**
       
  1712      * Get reference to item list.
       
  1713      */
       
  1714     virtual const RPointerArray<MSwtMenuItem>* Items() const = 0;
       
  1715 };
       
  1716 
       
  1717 
       
  1718 /**
       
  1719  * Interface class for the org.eclipse.swt.widgets.MenuItem class
       
  1720  */
       
  1721 class MSwtMenuItem
       
  1722 {
       
  1723 // Types
       
  1724 public:
       
  1725     enum TSwtMenuItemData
       
  1726     {
       
  1727         ESwtMenuItemDataAll = 0,
       
  1728         ESwtMenuItemDataText,
       
  1729         ESwtMenuItemDataCascade,
       
  1730         ESwtMenuItemDataSelection,
       
  1731         ESwtMenuItemDataImage,
       
  1732         ESwtMenuItemDataFlags
       
  1733     };
       
  1734 protected:
       
  1735     virtual ~MSwtMenuItem() {} // Made protected to prevent destruction through the interface
       
  1736 
       
  1737 public:
       
  1738     /**
       
  1739      * Disposes of (i.e. destroys) the menu item.
       
  1740      * @return The Java peer associated with this object
       
  1741      */
       
  1742     virtual TSwtPeer Dispose() =0;
       
  1743 
       
  1744     /**
       
  1745      * Returns the Java peer associated with this object.
       
  1746      */
       
  1747     virtual TSwtPeer JavaPeer() const =0;
       
  1748 
       
  1749     /**
       
  1750      * Returns the parent menu.
       
  1751      */
       
  1752     virtual const MSwtMenu& Parent() const =0;
       
  1753 
       
  1754     /**
       
  1755      * Returns ETrue if the menu item is selected.
       
  1756      */
       
  1757     virtual TBool GetSelection() const =0;
       
  1758 
       
  1759     /**
       
  1760      * Sets an accelerator to the menu item.
       
  1761      */
       
  1762     virtual void SetAcceleratorL(TInt aAccelerator) =0;
       
  1763 
       
  1764     /**
       
  1765      * Enables or disables the menu item.
       
  1766      */
       
  1767     virtual void SetEnabled(TBool aEnabled) =0;
       
  1768 
       
  1769     /**
       
  1770      * Sets the image of the menu item.
       
  1771      */
       
  1772     virtual void SetImageL(const MSwtImage* aImage) =0;
       
  1773 
       
  1774     /**
       
  1775      * Sets the Menu of the menu item.
       
  1776      */
       
  1777     virtual void SetMenuL(const MSwtMenu* aMenu) =0;
       
  1778 
       
  1779     /**
       
  1780      * Selects of unselects the menu item.
       
  1781      */
       
  1782     virtual void SetSelection(TBool aSelected) =0;
       
  1783 
       
  1784     /**
       
  1785      * Sets the text of the menu item.
       
  1786      */
       
  1787     virtual void SetTextL(const TDesC& aText) =0;
       
  1788 
       
  1789     /**
       
  1790      * Gets the accelerator of the menu item.
       
  1791      */
       
  1792     virtual TInt Accelerator() const =0;
       
  1793 
       
  1794     /**
       
  1795      * Returns ETrue if the menu item is enabled, EFalse otherwise.
       
  1796      */
       
  1797     virtual TBool IsEnabled() const =0;
       
  1798 
       
  1799     /**
       
  1800      * Gets the image of the menu item.
       
  1801      */
       
  1802     virtual const MSwtImage* Image() const =0;
       
  1803 
       
  1804     /**
       
  1805      * Gets the bitmap and mask of the menu item image.
       
  1806      * MenuItem keeps the ownership and its image is subreferenced according to aSize.
       
  1807      */
       
  1808     virtual void GetImageBitmapsL(CFbsBitmap*& aBitmap, CFbsBitmap*& aMask,
       
  1809                                   const TSize& aSize) = 0;
       
  1810 
       
  1811     /**
       
  1812      * Gets the menu associated with the menu item.
       
  1813      */
       
  1814     virtual const MSwtMenu* Menu() const =0;
       
  1815 
       
  1816     /**
       
  1817      * @ brief Gets the text of the menu item.
       
  1818      */
       
  1819     virtual const TDesC& Text() const =0;
       
  1820 
       
  1821     /**
       
  1822      * Gets the command id.
       
  1823      */
       
  1824     virtual TInt CommandId() const =0;
       
  1825 
       
  1826     /**
       
  1827      * Returns the style of the menu item.
       
  1828      */
       
  1829     virtual TInt Style() const =0;
       
  1830 
       
  1831     /**
       
  1832      * Similar to Menu's FillPaneL, adds data to the native pane item.
       
  1833      * @param one of TSwtMenuItemData
       
  1834      */
       
  1835     virtual void UpdatePaneL(CEikMenuPane& aPane, TSwtMenuItemData aDetail) =0;
       
  1836 };
       
  1837 
       
  1838 
       
  1839 /**
       
  1840  * Interface class for the menu arranger
       
  1841  */
       
  1842 class MSwtMenuArranger
       
  1843 {
       
  1844 public:
       
  1845     typedef enum TSwtMenuEvent
       
  1846     {
       
  1847         ESwtMenuAdded,
       
  1848         ESwtMenuRemoved,
       
  1849         ESwtMenuEnableStateChanged,
       
  1850         ESwtMenuItemAdded,
       
  1851         ESwtMenuItemRemoved,
       
  1852         ESwtMenuItemEnableStateChanged
       
  1853     };
       
  1854 
       
  1855 public:
       
  1856     virtual ~MSwtMenuArranger() {}
       
  1857     virtual void ControlFocusLost() =0;
       
  1858     virtual void ControlFocusGained(const MSwtControl& aControl) =0;
       
  1859     virtual void ActiveShellLost() =0;
       
  1860     virtual void ActiveShellGained(const MSwtShell& aShell) =0;
       
  1861     virtual void MenuBarSetOnDecorations() =0;
       
  1862     virtual void SetCommandMenu(const MSwtMenu* aCommandMenu) =0;
       
  1863     virtual void SetContextMenu(const MSwtMenu* aContextMenu) =0;
       
  1864     virtual void HandleMenuChangedL(const MSwtMenu& aMenu, TSwtMenuEvent aType) =0;
       
  1865     virtual CEikMenuBar* EikMenuBar() const =0;
       
  1866     virtual void AddOptionsCommandL() =0;
       
  1867     virtual void RemoveOptionsCommand() =0;
       
  1868     virtual TBool IsOptionsCommandAdded() =0;
       
  1869     virtual void TryDisplayMenuBarL(TInt aDisplayContextMenu) =0;
       
  1870     virtual void StopDisplayingMenuBar() =0;
       
  1871     virtual TBool HasMenuItems() const =0;
       
  1872     virtual void HandleResolutionChangeL() =0;
       
  1873     virtual void HandleWindowVisibilityChangeL(CCoeControl* aDestination) =0;
       
  1874     virtual TSize ImageSize() const =0;
       
  1875     virtual CEikMenuPane* ParentPane(CEikMenuPane& aPane) const =0;
       
  1876 
       
  1877 #ifdef RD_SCALABLE_UI_V2
       
  1878     virtual void OpenStylusPopupMenuL(const MSwtControl& aControl, const TPoint& aPoint,
       
  1879                                       MSwtPopupMenuCallBack* aCallBack = NULL) =0;
       
  1880     virtual void OpenStylusPopupMenuL(const MSwtMenu& aMenu, const TPoint& aPoint) =0;
       
  1881     virtual void CloseStylusPopupMenuL() =0;
       
  1882 #endif //RD_SCALABLE_UI_V2
       
  1883 };
       
  1884 
       
  1885 
       
  1886 /**
       
  1887  * Interface class for the org.eclipse.swt.widgets.Label class
       
  1888  */
       
  1889 class MSwtLabel
       
  1890 {
       
  1891 protected:
       
  1892     virtual ~MSwtLabel() {} // Made protected to prevent destruction through the interface
       
  1893 
       
  1894 public:
       
  1895     /**
       
  1896      * Returns the MSwtControl interface.
       
  1897      */
       
  1898     virtual MSwtControl* Control() = 0;
       
  1899 
       
  1900     /**
       
  1901      * Returns a value which describes the position of the text or image in the receiver.
       
  1902      * This method will only get called if the KSwtStyleSeparator flag is <b>not</b> set.
       
  1903      */
       
  1904     virtual TInt GetAlignment() const = 0;
       
  1905 
       
  1906     /**
       
  1907      * Controls how text and images will be displayed in the receiver.
       
  1908      * This method will only get called if the KSwtStyleSeparator
       
  1909      * flag is <b>not</b> set.
       
  1910      * @param aAlignment The new alignment, one of KSwtStyleLead,
       
  1911      *        KSwtStyleCenter or KSwtStyleTrail.
       
  1912      */
       
  1913     virtual void SetAlignment(TInt aAlignment) = 0;
       
  1914 
       
  1915     /**
       
  1916      * Sets the receiver's image to the argument, which may be null
       
  1917      * indicating that no image should be displayed.
       
  1918      * This method will only get called if the KSwtStyleSeparator
       
  1919      * flag is <b>not</b> set.
       
  1920      */
       
  1921     virtual void SetImageL(const MSwtImage* aImage) = 0;
       
  1922 
       
  1923     /**
       
  1924      * Sets the receiver's text.
       
  1925      * This method will only get called if the KSwtStyleSeparator
       
  1926      * flag is <b>not</b> set.
       
  1927      */
       
  1928     virtual void SetTextL(const TDesC& aText) = 0;
       
  1929 };
       
  1930 
       
  1931 
       
  1932 /**
       
  1933  * Interface class for the org.eclipse.swt.widgets.Button class
       
  1934  */
       
  1935 class MSwtButton
       
  1936 {
       
  1937 protected:
       
  1938     virtual ~MSwtButton() {} // Made protected to prevent destruction through the interface
       
  1939 
       
  1940 public:
       
  1941     /**
       
  1942      * Returns the MSwtControl interface.
       
  1943      */
       
  1944     virtual MSwtControl* Control() = 0;
       
  1945 
       
  1946     /**
       
  1947      * Returns a value which describes state of the button.
       
  1948      */
       
  1949     virtual TBool GetSelection() const = 0;
       
  1950 
       
  1951     /**
       
  1952      * Gets the state of the button.
       
  1953      */
       
  1954     virtual void SetSelection(TBool aState) = 0;
       
  1955 
       
  1956     /**
       
  1957      * Returns a value which describes the position of the text or image in the receiver.
       
  1958      */
       
  1959     virtual TInt GetAlignment() const = 0;
       
  1960 
       
  1961     /**
       
  1962      * Controls how text and images will be displayed in the receiver.
       
  1963      * @param aAlignment The new alignment, one of KSwtStyleLeft,
       
  1964      *        KSwtStyleCenter or KSWtStyleRight.
       
  1965      */
       
  1966     virtual void SetAlignment(TInt aAlignment) = 0;
       
  1967 
       
  1968     /**
       
  1969      * Sets the receiver's image to the argument, which may be null
       
  1970      * indicating that no image should be displayed.
       
  1971      */
       
  1972     virtual void SetImageL(const MSwtImage* aImage) = 0;
       
  1973 
       
  1974     /**
       
  1975      * Sets the receiver's text.
       
  1976      */
       
  1977     virtual void SetTextL(const TDesC& aText) = 0;
       
  1978 
       
  1979     /**
       
  1980      * Sets this button as the default Button.
       
  1981      */
       
  1982     virtual void SetDefault(TBool aDefault) = 0;
       
  1983 
       
  1984     /**
       
  1985      * Indicate if the Button is default button.
       
  1986      */
       
  1987     virtual TBool IsDefault() const = 0;
       
  1988 
       
  1989     /**
       
  1990      * Simulate button selection.
       
  1991      */
       
  1992     virtual void ClickL() = 0;
       
  1993 };
       
  1994 
       
  1995 
       
  1996 /**
       
  1997  * Interface class for Verify event observer.
       
  1998  */
       
  1999 class MSwtVerifyEventObserver
       
  2000 {
       
  2001 public:
       
  2002     /**
       
  2003      * Processes the text from the verify event
       
  2004      */
       
  2005     virtual void ProcessVerifiedTextL(TInt aStart, TInt aEnd, TDes& aText) =0;
       
  2006 };
       
  2007 
       
  2008 
       
  2009 /**
       
  2010  * Interface class for the org.eclipse.swt.widgets.Combo class
       
  2011  * A class that implements MSwtCombo must also implement MSwtComposite.
       
  2012  */
       
  2013 class MSwtCombo
       
  2014 {
       
  2015 protected:
       
  2016     virtual ~MSwtCombo() {} // Made protected to prevent destruction through the interface
       
  2017 
       
  2018 public:
       
  2019     /**
       
  2020      * Returns the MSwtComposite interface
       
  2021      */
       
  2022     virtual MSwtComposite* Composite() =0;
       
  2023 
       
  2024     /**
       
  2025      * Returns the MSwtScrollable interface
       
  2026      */
       
  2027     inline MSwtScrollable* Scrollable()
       
  2028     {
       
  2029         return Composite()->Scrollable();
       
  2030     }
       
  2031 
       
  2032     /**
       
  2033      * Returns the MSwtControl interface
       
  2034      */
       
  2035     inline MSwtControl* Control()
       
  2036     {
       
  2037         return Composite()->Control();
       
  2038     }
       
  2039 
       
  2040     /**
       
  2041      * Appends a string element to the <a>Combo</a>.
       
  2042      * @param aPtr A reference to the descriptor to be appended.
       
  2043      */
       
  2044     virtual void AppendL(const TDesC& aPtr) =0;
       
  2045 
       
  2046     /**
       
  2047      * Inserts a string element into the <a>Combo</a> at the specified position.
       
  2048      * @param aPos The position (relative to zero) where the string element is to be inserted.
       
  2049      * @param aPtr A reference to the descriptor to be inserted.
       
  2050      */
       
  2051     virtual void InsertL(TInt aPos, const TDesC& aPtr) =0;
       
  2052 
       
  2053     /**
       
  2054      * Clears the selection.
       
  2055      */
       
  2056     virtual void ClearSelectionL() =0;
       
  2057 
       
  2058     /**
       
  2059      * Copies the selected text to the clipboard.
       
  2060      */
       
  2061     virtual void CopyL() =0;
       
  2062 
       
  2063     /**
       
  2064      * Deselects the item indexed as aIndex from the <a>Combo</a>.
       
  2065      *
       
  2066      * @param aIndex    The index of the item to deselect.
       
  2067      */
       
  2068     virtual void DeselectItem(TInt aIndex) =0;
       
  2069 
       
  2070     /**
       
  2071      * Deselects all the items from the <a>Combo</a>.
       
  2072      */
       
  2073     virtual void DeselectAll() =0;
       
  2074 
       
  2075     /**
       
  2076      * Gets the text of the specified item.
       
  2077      * @param aItemIndex The specified item.
       
  2078      * @param aString    The descriptor that will hold the item's text upon return.
       
  2079      *                   Must be empty upon call.
       
  2080      */
       
  2081     virtual void GetItemL(TInt aItemIndex, TPtrC& aString) const =0;
       
  2082 
       
  2083     /**
       
  2084      * Returns the number of elements of the <a>Combo</a>.
       
  2085      */
       
  2086     virtual TInt GetItemCount() const =0;
       
  2087 
       
  2088     /**
       
  2089      * Returns the item height.
       
  2090      */
       
  2091     virtual TInt GetItemHeight() const =0;
       
  2092 
       
  2093     /**
       
  2094      * Returns the array of items from the <a>Combo</a>
       
  2095      */
       
  2096     virtual CPtrCArray* GetItemsL() const =0;
       
  2097 
       
  2098     /**
       
  2099      * Returns the orientation of the receiver.
       
  2100      */
       
  2101     virtual TInt GetOrientation() const =0;
       
  2102 
       
  2103     /**
       
  2104      * Returns the selection range
       
  2105      * @return The selection in a TPoint where iX is
       
  2106      *         the start and  iY is the end.
       
  2107      */
       
  2108     virtual TPoint GetSelection() const =0;
       
  2109 
       
  2110     /**
       
  2111      * Returns the index of the currently selected item.
       
  2112      */
       
  2113     virtual TInt GetSelectionIndex() const =0;
       
  2114 
       
  2115     /**
       
  2116      * Gets the widget's text.
       
  2117      * @return The widget's text in a newly allocated buffer. The caller is
       
  2118      *         responsible for deleting the returned buffer. NULL
       
  2119      *         may be returned if the widget is empty.
       
  2120      */
       
  2121     virtual HBufC* GetTextL() const =0;
       
  2122 
       
  2123     /**
       
  2124      * Returns the height of the text field.
       
  2125      */
       
  2126     virtual TInt GetTextHeightL() const =0;
       
  2127 
       
  2128     /**
       
  2129      * Returns the maximum number of characters that the text field is capable of holding.
       
  2130      */
       
  2131     virtual TInt GetTextLimit() const =0;
       
  2132 
       
  2133     /**
       
  2134      * Gets the number of items that are visible in the drop down portion of the list.
       
  2135      */
       
  2136     virtual TInt GetVisibleItemCount() const =0;
       
  2137 
       
  2138     /**
       
  2139      * Searches for a text item from a given position.
       
  2140      * @param aString   The string to search for.
       
  2141      * @param aStart    The position from which we start.
       
  2142      */
       
  2143     virtual TInt IndexOf(const TDesC& aString, TInt& aStart) const =0;
       
  2144 
       
  2145     /**
       
  2146      * Insert a text at the current caret position.
       
  2147      * No event is posted.
       
  2148      */
       
  2149     virtual TBool InsertInTextControlL(const TDesC& aText) =0;
       
  2150 
       
  2151     /**
       
  2152      * Pastes text from the clipboard.
       
  2153      * The selected text is deleted from the widget and new text inserted from
       
  2154      * the clipboard.
       
  2155      * @return ETrue if a modify notification must be sent
       
  2156      */
       
  2157     virtual TBool PasteL() =0;
       
  2158 
       
  2159     /**
       
  2160      * Removes the specified item from the <a>Combo</a>.
       
  2161      * @param aIndex    The specified item.
       
  2162      */
       
  2163     virtual void RemoveItemL(TInt aIndex) =0;
       
  2164 
       
  2165     /**
       
  2166      * Removes a range of items from the <a>Combo</a>.
       
  2167      * @param aStart    The first element to remove.
       
  2168      * @param aEnd      The last element to remove.
       
  2169      */
       
  2170     virtual void RemoveRangeL(TInt aStart, TInt aEnd) =0;
       
  2171 
       
  2172     /**
       
  2173      * Removes all items from the <a>Combo</a>.
       
  2174      */
       
  2175     virtual void RemoveAllL() =0;
       
  2176 
       
  2177     /**
       
  2178      * Selects a single item.
       
  2179      * @param aIndex    The item to select.
       
  2180      */
       
  2181     virtual void SelectItemL(TInt aIndex) =0;
       
  2182 
       
  2183     /**
       
  2184      * Sets the receiver's items to be the given array of items.
       
  2185      * @param aStringArray The array to set.
       
  2186      */
       
  2187     virtual void SetItemsL(MDesCArray* aStringArray) =0;
       
  2188 
       
  2189     /**
       
  2190      * Sets the orientation of the widget.
       
  2191      */
       
  2192     virtual void SetOrientationL(TInt aOrientation) =0;
       
  2193 
       
  2194     /**
       
  2195      * Sets the selection.
       
  2196      * Indexing is zero based. The range of a selection is from 0..N where N is
       
  2197      * the number of characters in the widget. If the specified range is invalid,
       
  2198      * as much of it as is possible must be set as the selection.
       
  2199      * @param aStart The selection's starting point.
       
  2200      * @param aEnd   The selection's ending point.
       
  2201      */
       
  2202     virtual void SetSelectionL(TInt aStart, TInt aEnd) =0;
       
  2203 
       
  2204     /**
       
  2205      * Sets the text
       
  2206      * @param aText The new text. As a convenience, the descriptor can be freely
       
  2207      *        modified by the implementation if need be.
       
  2208      * @return ETrue if a modify notification must be sent
       
  2209      */
       
  2210     virtual TBool SetTextL(TDes& aText) =0;
       
  2211 
       
  2212     /**
       
  2213      * Sets the maximum number of characters that the text field is capable of holding to be the argument.
       
  2214      * @param aTextLimit The limit to set.
       
  2215      * @return ETrue if a modify notification must be sent
       
  2216     */
       
  2217     virtual TBool SetTextLimit(TInt aTextLimit) =0;
       
  2218 
       
  2219     /**
       
  2220      * Sets the number of items that are visible in the drop down portion of the list.
       
  2221      * @param aCount The number of items to set.
       
  2222      */
       
  2223     virtual void SetVisibleItemCount(TInt aCount) =0;
       
  2224 };
       
  2225 
       
  2226 
       
  2227 /**
       
  2228  * Interface class for the org.eclipse.ercp.swt.mobile.HyperLink class.
       
  2229  */
       
  2230 class MSwtLink
       
  2231 {
       
  2232 protected:
       
  2233     virtual ~MSwtLink() {}; // Made protected to prevent destruction through the interface
       
  2234 
       
  2235 public:
       
  2236     /**
       
  2237      * Returns the MSwtControl interface
       
  2238      */
       
  2239     virtual MSwtControl* Control() = 0;
       
  2240 
       
  2241     /**
       
  2242      * Sets the receiver's data.
       
  2243      * @param aTextFragments Array of text fragments strings.
       
  2244      * @param aLinkTargets Link targets asociated to the text fragments.
       
  2245      */
       
  2246     virtual void SetLinkDataL(const CDesCArray* aTextFragments,
       
  2247                               const CDesCArray* aLinkTargets) = 0;
       
  2248 };
       
  2249 
       
  2250 /**
       
  2251  * Interface class for the org.eclipse.swt.widgets.List class
       
  2252  * A class that implements MSwtList must also implement MSwtScrollable.
       
  2253  */
       
  2254 class MSwtList
       
  2255 {
       
  2256 protected:
       
  2257     virtual ~MSwtList() {} // Made protected to prevent destruction through the interface
       
  2258 
       
  2259 public:
       
  2260     /**
       
  2261      * Returns the MSwtScrollable interface
       
  2262      */
       
  2263     virtual MSwtScrollable* Scrollable() =0;
       
  2264 
       
  2265     /**
       
  2266      * Returns the MSwtControl interface
       
  2267      */
       
  2268     inline MSwtControl* Control()
       
  2269     {
       
  2270         return Scrollable()->Control();
       
  2271     }
       
  2272 
       
  2273     /**
       
  2274      * Appends a string element to the <a>List</a>.
       
  2275      * @param aPtr A reference to the descriptor to be appended.
       
  2276      */
       
  2277     virtual void AppendL(const TDesC& aPtr) =0;
       
  2278 
       
  2279     /**
       
  2280      * Inserts a string element into the <a>List</a> at the specified position.
       
  2281      * @param aPos The position (relative to zero) where the string element is to be inserted.
       
  2282      * @param aPtr A reference to the descriptor to be inserted.
       
  2283      */
       
  2284     virtual void InsertL(TInt aPos, const TDesC& aPtr) =0;
       
  2285 
       
  2286     /**
       
  2287      * Deselects the items defined in the aIndices array from the <a>List</a>.
       
  2288      * @param aIndices  The array of the items to deselect.
       
  2289      * @param aCount    The number of items of this array.
       
  2290      */
       
  2291     virtual void DeselectItems(const TInt* aIndices, TInt aCount) =0;
       
  2292 
       
  2293     /**
       
  2294      * Deselects the item indexed as aIndex from the <a>List</a>.
       
  2295      * @param aIndex    The index of the item to deselect.
       
  2296      */
       
  2297     virtual void DeselectItem(TInt aIndex) =0;
       
  2298 
       
  2299     /**
       
  2300      * Deselects the items indexed from aStart to aEnd from the <a>List</a>.
       
  2301      * @param aStart    The first element to deselect.
       
  2302      * @param aEnd      The last element to deselect.
       
  2303      */
       
  2304     virtual void DeselectRange(TInt aStart, TInt aEnd) =0;
       
  2305 
       
  2306     /**
       
  2307      * Deselects all the items from the <a>List</a>.
       
  2308      */
       
  2309     virtual void DeselectAll() =0;
       
  2310 
       
  2311     /**
       
  2312      * Gets the current item.
       
  2313      */
       
  2314     virtual TInt GetFocusIndex() const =0;
       
  2315 
       
  2316     /**
       
  2317      * Gets the text of the specified item.
       
  2318      * @param aItemIndex The specified item.
       
  2319      * @param aString The descriptor that will hold the item's text upon return.
       
  2320      *        Must be empty upon call.
       
  2321      */
       
  2322     virtual void GetItemL(TInt aItemIndex, TPtrC& aString) const =0;
       
  2323 
       
  2324     /**
       
  2325      * Returns the number of elements of the <a>List</a>.
       
  2326      */
       
  2327     virtual TInt GetItemCount() const =0;
       
  2328 
       
  2329     /**
       
  2330      * Returns the item height.
       
  2331      */
       
  2332     virtual TInt GetItemHeight() const =0;
       
  2333 
       
  2334     /**
       
  2335      * Returns the number of selected elements.
       
  2336      */
       
  2337     virtual TInt GetSelectionCount() const =0;
       
  2338 
       
  2339     /**
       
  2340      * Returns the index of the currently selected item.
       
  2341      */
       
  2342     virtual TInt GetSelectionIndex() const =0;
       
  2343 
       
  2344     /**
       
  2345      * Get the selected items indices.
       
  2346      */
       
  2347     virtual const CArrayFix<TInt>* GetSelectionIndices() const =0;
       
  2348 
       
  2349     /**
       
  2350      * Returns the index of the top element.
       
  2351      */
       
  2352     virtual TInt GetTopIndex() const =0;
       
  2353 
       
  2354     /**
       
  2355      * Searches for a text item from a given position.
       
  2356      * @param aString   The string to search for.
       
  2357      * @param aStart    The position from which we start.
       
  2358      */
       
  2359     virtual TInt IndexOf(const TDesC& aString, TInt& aStart) const =0;
       
  2360 
       
  2361     /**
       
  2362      * Returns if the specified item is selected.
       
  2363      * @param aIndex The specified item.
       
  2364      */
       
  2365     virtual TBool IsSelected(TInt aIndex) const =0;
       
  2366 
       
  2367     /**
       
  2368      * Removes the items defined in the aIndices array from the <a>List</a>.
       
  2369      * @param aIndices  The array of the items to remove.
       
  2370      * @param aCount    The number of items of this array.
       
  2371      */
       
  2372     virtual void RemoveItemsL(const TInt* aIndices, TInt aCount) =0;
       
  2373 
       
  2374     /**
       
  2375      * Removes the specified item from the <a>List</a>.
       
  2376      * @param aIndex    The specified item.
       
  2377      */
       
  2378     virtual void RemoveItemL(TInt aIndex) =0;
       
  2379 
       
  2380     /**
       
  2381      * Removes a range of items from the <a>List</a>.
       
  2382      * @param aStart    The first element to remove.
       
  2383      * @param aEnd      The last element to remove.
       
  2384      */
       
  2385     virtual void RemoveRangeL(TInt aStart, TInt aEnd) =0;
       
  2386 
       
  2387     /**
       
  2388      * Removes all items from the <a>List</a>.
       
  2389      */
       
  2390     virtual void RemoveAllL() =0;
       
  2391 
       
  2392     /**
       
  2393      * Selects a single item.
       
  2394      * @param aIndex    The item to select.
       
  2395      * @param aScroll   Scrolls the list if true.
       
  2396      */
       
  2397     virtual void SelectItemL(TInt aIndex, TBool aScroll) =0;
       
  2398 
       
  2399     /**
       
  2400      * Selects a range of items.
       
  2401      * @param aStart    The first item to select.
       
  2402      * @param aEnd      The last item to select.
       
  2403      */
       
  2404     virtual void SelectRangeL(TInt aStart, TInt aEnd) =0;
       
  2405 
       
  2406     /**
       
  2407      * Selects all items.
       
  2408      */
       
  2409     virtual void SelectAllL() =0;
       
  2410 
       
  2411     /**
       
  2412      * Sets the current focused item.
       
  2413      *
       
  2414      * @param aIndex    The item to focus on.
       
  2415      */
       
  2416     virtual void SetFocusIndex(TInt aIndex) =0;
       
  2417 
       
  2418     /**
       
  2419      * Sets the receiver's items to be the given array of items.
       
  2420      * @param aStringArray The array to set.
       
  2421      */
       
  2422     virtual void SetItemsL(MDesCArray* aStringArray) =0;
       
  2423 
       
  2424     /**
       
  2425      * Sets the top item index.
       
  2426      * @param aIndex The index to set as the top item.
       
  2427      */
       
  2428     virtual void SetTopIndex(TInt aIndex) =0;
       
  2429 
       
  2430     /**
       
  2431      * Shows the selection.
       
  2432      */
       
  2433     virtual void ShowSelection() =0;
       
  2434 };
       
  2435 
       
  2436 
       
  2437 
       
  2438 /**
       
  2439  * Interface for class for the org.eclipse.swt.Text class.
       
  2440  * A class that implements MSwtText must also implement MSwtScrollable.
       
  2441  */
       
  2442 class MSwtText
       
  2443 {
       
  2444 protected:
       
  2445     virtual ~MSwtText() {};
       
  2446 
       
  2447 public:
       
  2448     enum {ETextLimit=KMaxTInt};
       
  2449 
       
  2450 public:
       
  2451     virtual MSwtScrollable* Scrollable() =0;
       
  2452 
       
  2453     /**
       
  2454      * Gets the widget's text.
       
  2455      * @return The widget's text in a newly allocated buffer. The caller is
       
  2456      *         responsible for deleting the returned buffer. NULL
       
  2457      *         may be returned if the widget is empty.
       
  2458      */
       
  2459     virtual HBufC* GetTextL() const =0;
       
  2460 
       
  2461     /**
       
  2462      * Returns a range of the widget's text.
       
  2463      * If the specified values are out of range, as much text as possible is
       
  2464      * returned. However, aStart can never exceed aEnd.
       
  2465      * @param aStart The position of the first character in the range
       
  2466      * @param aEnd   The position of the last character in the range
       
  2467      * @return The widget's text in a newly allocated buffer. The caller is
       
  2468      *         responsible for deleting the returned buffer. NULL
       
  2469      *         may be returned if the widget is empty.
       
  2470      */
       
  2471     virtual HBufC* GetTextRangeL(TInt aStart, TInt aEnd) const =0;
       
  2472 
       
  2473     /**
       
  2474      * Sets the text
       
  2475      * @param aText The new text. As a convenience, the descriptor can be freely
       
  2476      *        modified by the implementation if need be.
       
  2477      * @return ETrue if a modify notification must be sent
       
  2478      */
       
  2479     virtual TBool SetTextL(TDes& aText) =0;
       
  2480 
       
  2481     /**
       
  2482      * Appends a string.
       
  2483      * @param aText The text to be appended. As a convenience, the descriptor
       
  2484      *        can be freely modified by the implementation if need be.
       
  2485      * @return ETrue if a modify notification must be sent
       
  2486      */
       
  2487     virtual TBool AppendL(TDes& aText) =0;
       
  2488 
       
  2489     /**
       
  2490      * Inserts a string.
       
  2491      * The old selection is replaced with the new text.
       
  2492      * @param aText The text to be inserted. As a convenience, the descriptor
       
  2493      *        can be freely modified by the implementation if need be.
       
  2494      * @return ETrue if a modify notification must be sent
       
  2495      */
       
  2496     virtual TBool InsertL(TDes& aText) =0;
       
  2497 
       
  2498     /**
       
  2499      * Gets the number of characters.
       
  2500      */
       
  2501     virtual TInt GetCharCount() const =0;
       
  2502 
       
  2503     /**
       
  2504      * Sets the maximum number of characters that the receiver is capable of holding.
       
  2505      * @return ETrue if a modify notification must be sent
       
  2506      */
       
  2507     virtual TBool SetTextLimitL(TInt aLimit) =0;
       
  2508 
       
  2509     /**
       
  2510      * Gets the line number of the caret.
       
  2511      */
       
  2512     virtual TInt GetCaretLineNumber() const =0;
       
  2513 
       
  2514     /**
       
  2515      * Gets the location of the caret.
       
  2516      * @return The caret's position in pixels, in client area coordinates.
       
  2517      */
       
  2518     virtual TPoint GetCaretLocationL() const =0;
       
  2519 
       
  2520     /**
       
  2521      * Gets the position of the caret.
       
  2522      * @return The caret's position in characters.
       
  2523      */
       
  2524     virtual TInt GetCaretPosition() const =0;
       
  2525 
       
  2526     /**
       
  2527      * Returns the selection range
       
  2528      * @return The selection in a TPoint where iX is
       
  2529      *         the start and  iY is the end.
       
  2530      */
       
  2531     virtual TPoint GetSelection() const =0;
       
  2532 
       
  2533     /**
       
  2534      * Returns the selected text.
       
  2535      * @return The selected text in a newly allocated buffer, may return
       
  2536      *         NULL if no text is selected.
       
  2537      */
       
  2538     virtual HBufC* GetSelectionTextL() const =0;
       
  2539 
       
  2540     /**
       
  2541      * Sets the selection.
       
  2542      * Indexing is zero based. The range of a selection is from 0..N where N is
       
  2543      * the number of characters in the widget. If the specified range is invalid,
       
  2544      * as much of it as is possible must be set as the selection.
       
  2545      * The control is scrolled so as to make the new selection visible.
       
  2546      * @param aStart The selection's starting point.
       
  2547      * @param aEnd   The selection's ending point.
       
  2548      */
       
  2549     virtual void SetSelectionL(TInt aStart, TInt aEnd) =0;
       
  2550 
       
  2551     /**
       
  2552      * Clears the selection.
       
  2553      */
       
  2554     virtual void ClearSelectionL() =0;
       
  2555 
       
  2556     /**
       
  2557      * Selects all the text in the widget.
       
  2558      */
       
  2559     virtual void SelectAllL() =0;
       
  2560 
       
  2561     /**
       
  2562      * Makes the selction visible
       
  2563      * The control is scrolled is need be such that the selection is visible.
       
  2564      */
       
  2565     virtual void ShowSelectionL() =0;
       
  2566 
       
  2567     /**
       
  2568      * Copies the selected text to the clipboard.
       
  2569      */
       
  2570     virtual void CopyL() =0;
       
  2571 
       
  2572     /**
       
  2573      * Pastes text from the clipboard.
       
  2574      * The selected text is deleted from the widget and new text inserted from
       
  2575      * the clipboard.
       
  2576      * @return ETrue if a modify notification must be sent
       
  2577      */
       
  2578     virtual TBool PasteL() =0;
       
  2579 
       
  2580     /**
       
  2581      * Gets the editable state.
       
  2582      */
       
  2583     virtual TBool GetEditable() const =0;
       
  2584 
       
  2585     /**
       
  2586      * Sets the editable state.
       
  2587      */
       
  2588     virtual void SetEditable(TBool aEditable) =0;
       
  2589 
       
  2590     /**
       
  2591      * Gets the number of lines.
       
  2592      */
       
  2593     virtual TInt GetLineCount() const =0;
       
  2594 
       
  2595     /**
       
  2596      * Gets the height of a line.
       
  2597      * @return The height of a line, in pixels.
       
  2598      */
       
  2599     virtual TInt GetLineHeightL() const =0;
       
  2600 
       
  2601     /**
       
  2602      * Returns the zero-relative index of the line which is currently
       
  2603      * at the top of the widget.
       
  2604      */
       
  2605     virtual TInt GetTopIndexL() const =0;
       
  2606 
       
  2607     /**
       
  2608      * Sets the zero-relative index of the line which is currently at the top.
       
  2609      */
       
  2610     virtual void SetTopIndexL(TInt aIndex) =0;
       
  2611 
       
  2612     /**
       
  2613      * Gets the top pixel.
       
  2614      * The top pixel is the pixel position of the line that is currently at the
       
  2615      * top of the widget.  On some platforms, a text widget can be scrolled by
       
  2616      * pixels instead of lines so that a partial line is displayed at the top of the widget.
       
  2617      * The top pixel changes when the widget is scrolled.
       
  2618      * The top pixel does not include the widget trimming.
       
  2619      */
       
  2620     virtual TInt GetTopPixelL() const =0;
       
  2621 
       
  2622     /**
       
  2623      * Gets the echo character.
       
  2624      * The echo character is the character that is displayed when the user
       
  2625      * enters text or the text is changed by the programmer.
       
  2626      */
       
  2627     virtual TText GetEchoChar() const =0;
       
  2628 
       
  2629     /**
       
  2630      * Sets the echo character.
       
  2631      * The echo character is the character that is displayed when the user
       
  2632      * enters text or the text is changed by the programmer. Setting the echo
       
  2633      * character to 0 clears the echo character and redraws the original
       
  2634      * text. If for any reason the echo character is invalid, the default echo
       
  2635      * character for the platform is used.
       
  2636      */
       
  2637     virtual void SetEchoCharL(TText aEcho) =0;
       
  2638 
       
  2639     /**
       
  2640      * Sets the double click enabled flag.
       
  2641      * The double click flag enables or disables the default action of the text
       
  2642      * widget when the user double clicks.
       
  2643      */
       
  2644     virtual void SetDoubleClickEnabled(TBool aEnabled) =0;
       
  2645 
       
  2646     /**
       
  2647      * Returns the orientation of the receiver.
       
  2648      */
       
  2649     virtual TInt GetOrientation() const =0;
       
  2650 
       
  2651     /**
       
  2652      * Sets the orientation of the widget.
       
  2653      */
       
  2654     virtual void SetOrientationL(TInt aOrientation) =0;
       
  2655 };
       
  2656 
       
  2657 /**
       
  2658  * Interface for class for the org.eclipse.swt.ProgressBar class.
       
  2659  */
       
  2660 class MSwtProgressBar
       
  2661 {
       
  2662 protected:
       
  2663     virtual ~MSwtProgressBar() {};
       
  2664 
       
  2665 public:
       
  2666     virtual MSwtControl* Control() = 0;
       
  2667     virtual TInt GetMaximum() const =0;
       
  2668     virtual TInt GetMinimum() const =0;
       
  2669     virtual TInt GetSelection() const =0;
       
  2670     virtual void SetMaximum(TInt aValue) =0;
       
  2671     virtual void SetMinimum(TInt aValue) =0;
       
  2672     virtual void SetSelection(TInt aValue) =0;
       
  2673 };
       
  2674 
       
  2675 /**
       
  2676  * Interface for class for the org.eclipse.swt.Slider class.
       
  2677  */
       
  2678 class MSwtSlider
       
  2679 {
       
  2680 protected:
       
  2681     virtual ~MSwtSlider() {};
       
  2682 
       
  2683 public:
       
  2684     virtual MSwtControl* Control() = 0;
       
  2685     virtual TInt GetMaximum() const =0;
       
  2686     virtual TInt GetMinimum() const =0;
       
  2687     virtual TInt GetIncrement() const =0;
       
  2688     virtual TInt GetPageIncrement() const =0;
       
  2689     virtual TInt GetSelection() const =0;
       
  2690     virtual void SetMaximum(TInt aValue) =0;
       
  2691     virtual void SetMinimum(TInt aValue) =0;
       
  2692     virtual void SetIncrement(TInt aValue) =0;
       
  2693     virtual void SetPageIncrement(TInt aValue) =0;
       
  2694     virtual void SetSelection(TInt aValue) =0;
       
  2695     virtual void SetValues(TInt aSelection, TInt aMinimum,
       
  2696                            TInt aMaximum, TInt aIncrement, TInt aPageIncrement) =0;
       
  2697 };
       
  2698 
       
  2699 
       
  2700 /**
       
  2701  * Interface for class for the org.eclipse.swt.FileDialog class.
       
  2702  */
       
  2703 class MSwtFileDialog
       
  2704 {
       
  2705 protected:
       
  2706     virtual ~MSwtFileDialog() {};
       
  2707 
       
  2708 public:
       
  2709     /**
       
  2710      * Opens a File dialog, according to the style of the dialog.
       
  2711      * @return A buffer containing the path and filename of the selected file,
       
  2712      *         or NULL if Cancel button is used to close the dialog. The user
       
  2713      *         has to release this buffer.
       
  2714      */
       
  2715     virtual HBufC* OpenLD() =0;
       
  2716 };
       
  2717 
       
  2718 
       
  2719 /**
       
  2720  * Interface for a utility class
       
  2721  * An instance (and only one) of the concrete class implementing this interface
       
  2722  * will be created by the Display when the UI thread is started.
       
  2723  * The instance will be destroyed when the UI thread is terminated.
       
  2724  */
       
  2725 class MSwtUiUtils : public MSwtAppFocusObserver
       
  2726 {
       
  2727 public:
       
  2728     /**
       
  2729      * Destructor
       
  2730      */
       
  2731     virtual ~MSwtUiUtils() {};
       
  2732 
       
  2733     /**
       
  2734      * Returns the matching standard color for the given constant.
       
  2735      * @param aId SWT color constant
       
  2736      * @return The Symbian OS' matching standard color. Any value other
       
  2737      *         than one of the SWT color constants which is passed
       
  2738      *         in will result in the color black.
       
  2739      */
       
  2740     virtual TRgb GetSystemColor(TSwtColorId aId) const =0;
       
  2741 
       
  2742     /**
       
  2743      * Returns the font spec of a reasonable font for applications to use.
       
  2744      */
       
  2745     virtual TFontSpec SystemFontSpec() const =0;
       
  2746 
       
  2747     /**
       
  2748      * Open a modal note
       
  2749      * @param aDisplay The Display the MessageBox belongs to
       
  2750      * @param aTitle Dialog's title.
       
  2751      * @param aMessage The message that will be displayed.
       
  2752      * @param aStyle MessageBox's style
       
  2753      * @return A button id.
       
  2754      */
       
  2755     virtual TInt RunMessageBoxDlgLD(MSwtDisplay& aDisplay, const TDesC& aTitle,
       
  2756                                     const TDesC& aMessage, TInt aStyle) const =0;
       
  2757 
       
  2758     /**
       
  2759      * Returns the active shell.
       
  2760      */
       
  2761     virtual MSwtShell* GetActiveShell() const =0;
       
  2762 
       
  2763     /**
       
  2764      * Returns the parent top level Shell of the active shell.
       
  2765      */
       
  2766     virtual MSwtShell* GetParentTopShellOfActiveShell() const =0;
       
  2767 
       
  2768     /**
       
  2769      * Get the top most top Shell, that is the only top Shell displayed.
       
  2770      */
       
  2771     virtual MSwtShell* TopMostTopShell() const = 0;
       
  2772 
       
  2773     /**
       
  2774      * Returns the peer of the active shell.
       
  2775      */
       
  2776     virtual TSwtPeer GetActiveShellPeer() const =0;
       
  2777 
       
  2778     /**
       
  2779      * Returns the existing shells.
       
  2780      */
       
  2781     virtual const RPointerArray<MSwtShell>& Shells() const =0;
       
  2782 
       
  2783     /**
       
  2784      * Returns peers of the existing shells
       
  2785      */
       
  2786     virtual CSwtPeerArray* GetShellPeersL() const =0;
       
  2787 
       
  2788     /**
       
  2789      * Returns the focussed control, or NULL.
       
  2790      */
       
  2791     virtual TSwtPeer GetFocusControl() const =0;
       
  2792 
       
  2793     /**
       
  2794      * Returns the Control's closest parent top level Shell
       
  2795      */
       
  2796     virtual MSwtShell& GetControlTopShell(const MSwtControl& aControl) const =0;
       
  2797 
       
  2798     /**
       
  2799      * Draw a rectangle which has the appearance of the platform's
       
  2800      * focus rectangle.
       
  2801      * If there is no such thing as a focus rectangle, this method must draw
       
  2802      * a rectangle with the GC's foreground colour.
       
  2803      * @param aGc   The GC to draw the rectangle on
       
  2804      * @param aRect The rectangle to draw
       
  2805      */
       
  2806     virtual void DrawFocusRect(MSwtGc& aGc, const TRect& aRect) const =0;
       
  2807 
       
  2808     /**
       
  2809      * Returns the cba created by MSwtUiUtils
       
  2810      */
       
  2811     virtual CEikButtonGroupContainer& Cba() const =0;
       
  2812 
       
  2813     /**
       
  2814      * Recreate the status pane based on the current active shell if that shell
       
  2815      * is a top shell, or on the last active top shell.
       
  2816      */
       
  2817     virtual void UpdateStatusPaneL() =0;
       
  2818 
       
  2819     /**
       
  2820      * Get the state of the application focus.
       
  2821      */
       
  2822     virtual TBool IsAppFocused() const =0;
       
  2823 
       
  2824     /**
       
  2825      * Get localized string for the ok command title
       
  2826      */
       
  2827     virtual const HBufC* GetCommandOkTitleL() const =0;
       
  2828 
       
  2829     /**
       
  2830      * Get localized string for the cancel command title
       
  2831      */
       
  2832     virtual const HBufC* GetCommandCancelTitleL() const =0;
       
  2833 
       
  2834     /**
       
  2835      * Handles free ram memory event.
       
  2836      * @param aEventType The type of event.
       
  2837      */
       
  2838     virtual void HandleFreeRamEventL(TInt aEventType) = 0;
       
  2839 
       
  2840     /**
       
  2841      * Returns the mouse event state mask that can be passed to the eSWT application in MouseEvent.
       
  2842      * @param aPointerEventModifiers    The modifiers of the corresponding symbian TPointerEvent.
       
  2843      * @return State mask that can be sent to the eSWT application in MouseEvent
       
  2844      */
       
  2845     virtual TInt GetPointerEventStateMask(TUint aPointerEventModifiers) const =0;
       
  2846 
       
  2847     /**
       
  2848      * Returns the eventual faded Shell.
       
  2849      */
       
  2850     virtual MSwtShell* FadingShell() const =0;
       
  2851 
       
  2852     /**
       
  2853      * Change the name of the Title in the Status Pane.
       
  2854      * @param The name for the eSwt display title in the Status Pane.
       
  2855      */
       
  2856     virtual void SetAppNameL(const TDesC* aAppName) = 0;
       
  2857 
       
  2858     /**
       
  2859      * Gets the image maximum size from the layouts.
       
  2860      * @param The type of the image passed to the layouts to get the size.
       
  2861      * Returns maximum size from the layouts
       
  2862      */
       
  2863     virtual TSize GetBestImageSize(TInt aImageType) = 0;
       
  2864 
       
  2865     /**
       
  2866      * Default padding reference for helping inline controls (Button, Label,
       
  2867      * Text, DateEditor) achieving similar ideal size, height especially.
       
  2868      *
       
  2869      */
       
  2870     virtual TMargins8 InlineReferencePadding() const = 0;
       
  2871 
       
  2872     /**
       
  2873      * Default font height reference for helping inline controls (Button, Label,
       
  2874      * Text, DateEditor) achieving similar ideal size, height especially.
       
  2875      * Does not mean that all these controls should have same font!
       
  2876      */
       
  2877     virtual TInt InlineReferenceFontHeight() const = 0;
       
  2878 
       
  2879     /**
       
  2880      * Update cached values, inform Shells.
       
  2881      */
       
  2882     virtual void HandleResourceChangedL(TInt aType) = 0;
       
  2883 
       
  2884     /**
       
  2885      * Get breadth of the scrollbar. The value is cached.
       
  2886      * If the scrollbar is null returns 0.
       
  2887      */
       
  2888     virtual TInt ScrollBarBreadth(const CEikScrollBar* aBar) = 0;
       
  2889 
       
  2890     /**
       
  2891       * Returns number of active browsers in applicaition.
       
  2892       */
       
  2893     virtual TInt ActiveBrowserCount() const = 0;
       
  2894 
       
  2895     /**
       
  2896      * Setter and getter for key input flag.
       
  2897      */
       
  2898     virtual TBool NaviKeyInput() const = 0;
       
  2899     virtual void SetNaviKeyInput(TBool aKeyInput) = 0;
       
  2900 
       
  2901     /**
       
  2902      * This should be always used to hide, show the CBA.
       
  2903      */
       
  2904     virtual void SetCbaVisible(TBool aVisible) = 0;
       
  2905 
       
  2906     /**
       
  2907      * Returns the pointer to the control that is currently receiving the pointer events
       
  2908      * because it has received EButton1Down event. This returns a valid control only between
       
  2909      * EButton1Down and EButton1Up events.
       
  2910      * @return Pointer to the control that is receiving the pointer events currently or NULL.
       
  2911      */
       
  2912     virtual MSwtControl* GetPointerGrabbingControl() = 0;
       
  2913 
       
  2914     /**
       
  2915      * Default bounds for TaskTips
       
  2916      */
       
  2917     virtual TRect TaskTipRect() const = 0;
       
  2918 
       
  2919     /**
       
  2920      * Sets the pointerGrabbingControl
       
  2921      * Calling with NULL of course unsets.
       
  2922      */
       
  2923     virtual void SetPointerCaptureControl(MSwtControl* aControl) = 0;
       
  2924 
       
  2925     /**
       
  2926      * Returns the current control that is grabbing the pointer events.
       
  2927      */
       
  2928     virtual MSwtControl* PointerCaptureControl() = 0;
       
  2929 
       
  2930     /**
       
  2931      * Rearranges the application layout (status pane, Shell position, split
       
  2932      * input view size) for best editing experience. There can be only one
       
  2933      * editor in split view mode at a time. Setting 0 clears the split view
       
  2934      * and restores the layout.
       
  2935      *
       
  2936      * Following actions must be delegated to UiUtils while split editing is on:
       
  2937      * - Relocating the split input Shell (@see SetSplitInputShellPos)
       
  2938      * - Resizing the split input view. (@see SetSplitInputViewSize)
       
  2939      *
       
  2940      * Following actions must be notified to UiUtils while split editing is on:
       
  2941      * - Resizing the split input shell. (@see AdjustSplitInputShellPos)
       
  2942      * - Relocating the split input view. (@see AdjustSplitInputShellPos)
       
  2943      */
       
  2944     virtual void SetSplitInputEditor(MSwtControl* aEditor) = 0;
       
  2945 
       
  2946     /**
       
  2947      * The currently active(focused) split input editor.
       
  2948      * Can be any Text, TextExtension, ConstrainedText or DateEditor.
       
  2949      */
       
  2950     virtual MSwtControl* SplitInputEditor() const = 0;
       
  2951 
       
  2952     /**
       
  2953      * The currently active split input editor or a parent ScrolledComposite.
       
  2954      * The view is getting resized automatically to fit in the available space
       
  2955      * above the VKB.
       
  2956      */
       
  2957     virtual MSwtControl* SplitInputView() const = 0;
       
  2958 
       
  2959     /**
       
  2960      * The parent shell of the active split input editor is temporarily
       
  2961      * moved vertically during split input editing therefore setting a new
       
  2962      * location must be diverted trough UiUtils.
       
  2963      * @param aOriginalPos - The real position of the Shell, which will be
       
  2964      *                       applied when VKB closes.
       
  2965      */
       
  2966     virtual void SetSplitInputShellPos(const TPoint& aOriginalPos) = 0;
       
  2967 
       
  2968     /**
       
  2969      * The active split input editor or its ScrolledComposite ancestor
       
  2970      * is temporarily resized vertically during split input editing
       
  2971      * therefore setting a new size must be diverted trough UiUtils.
       
  2972      * @param aOriginalSize - The real size of the control, which will be
       
  2973      *                        applied when VKB closes.
       
  2974      */
       
  2975     virtual void SetSplitInputViewSize(const TSize& aOriginalSize) = 0;
       
  2976 
       
  2977     /**
       
  2978      * The split input shell resized during split editing or
       
  2979      * the split input view relocated during split editing.
       
  2980      * The vertical position of the shell will be readjusted.
       
  2981      */
       
  2982     virtual void AdjustSplitInputShellPos() = 0;
       
  2983 
       
  2984     /**
       
  2985      * Fixes the UI orientation on screen.
       
  2986      * The orientation remains fixed until UnRegisterFixScreenOrientation()
       
  2987      * is called for so many times as this method was called.
       
  2988      */
       
  2989     virtual void RegisterFixScreenOrientation() = 0;
       
  2990 
       
  2991     /**
       
  2992      * Unregisters request to fix the UI orientation.
       
  2993      * Component which called RegisterFixScreenOrientation()
       
  2994      * must call this funtion when UI orientation fix is no more needed.
       
  2995      * The UI orientation remains fixed until this method is called
       
  2996      * so many times as registering methods was called.
       
  2997      */
       
  2998     virtual void UnRegisterFixScreenOrientation() = 0;
       
  2999 
       
  3000     /**
       
  3001      * Indicates that the UI orientation is fixed.
       
  3002      * This means that some components requested it calling
       
  3003      * RegisterFixScreenOrientation().
       
  3004      *
       
  3005      * @return ETrue when the UI orientation is fixed.
       
  3006      */
       
  3007     virtual TBool IsScreenOrientationFixed() const = 0;
       
  3008 };
       
  3009 
       
  3010 
       
  3011 /**
       
  3012  * Interface class for constructing native peers.
       
  3013  */
       
  3014 class MSwtFactory
       
  3015 {
       
  3016 public:
       
  3017     /**
       
  3018      * Destructor.
       
  3019      */
       
  3020     virtual ~MSwtFactory() {};
       
  3021 
       
  3022     /**
       
  3023      * Constructs a utility object
       
  3024      */
       
  3025     virtual MSwtUiUtils* NewUiUtilsL(MSwtDisplay& aDisplay) const =0;
       
  3026 
       
  3027     /**
       
  3028      * Constructs a Canvas
       
  3029      * @param aDisplay The Display this Canvas belongs to
       
  3030      * @param aPeer    The Java object associated with this C++ object
       
  3031      * @param aParent  The parent Composite
       
  3032      * @param aStyle   The SWT style flags
       
  3033      */
       
  3034     virtual MSwtCanvas* NewCanvasL(
       
  3035         MSwtDisplay& aDisplay,
       
  3036         TSwtPeer aPeer,
       
  3037         MSwtComposite& aParent,
       
  3038         TInt aStyle) const =0;
       
  3039 
       
  3040     /**
       
  3041      * Constructs a Composite
       
  3042      *
       
  3043      * @param aDisplay The Display this Composite belongs to
       
  3044      * @param aPeer    The Java object associated with this C++ object
       
  3045      * @param aParent  The parent Composite
       
  3046      * @param aStyle   The SWT style flags
       
  3047      */
       
  3048     virtual MSwtComposite* NewCompositeL(
       
  3049         MSwtDisplay& aDisplay,
       
  3050         TSwtPeer aPeer,
       
  3051         MSwtComposite& aParent,
       
  3052         TInt aStyle) const =0;
       
  3053 
       
  3054     /**
       
  3055      * Constructs a Decorations
       
  3056      * @param aDisplay The Display this Decorations belongs to
       
  3057      * @param aPeer    The Java object associated with this C++ object
       
  3058      * @param aParent  The parent Composite
       
  3059      * @param aStyle   The SWT style flags
       
  3060      */
       
  3061     virtual MSwtDecorations* NewDecorationsL(
       
  3062         MSwtDisplay& aDisplay,
       
  3063         TSwtPeer aPeer,
       
  3064         MSwtComposite& aParent,
       
  3065         TInt aStyle) const =0;
       
  3066 
       
  3067     /**
       
  3068      * Constructs a Shell
       
  3069      * @param aDisplay     The Display this Shell belongs to
       
  3070      * @param aPeer        The Java object associated with this C++ object
       
  3071      * @param aParent      The parent Composite, if NULL a top level
       
  3072      *                     Shell is to be created.
       
  3073      * @param aStyle       The SWT style flags
       
  3074      */
       
  3075     virtual MSwtShell* NewShellL(
       
  3076         MSwtDisplay& aDisplay,
       
  3077         TSwtPeer aPeer,
       
  3078         MSwtShell* aParent,
       
  3079         TInt aStyle) const =0;
       
  3080 
       
  3081     virtual MSwtMenu* NewMenuL(
       
  3082         MSwtDisplay& aDisplay,
       
  3083         TSwtPeer aPeer,
       
  3084         TInt aStyle) const =0;
       
  3085 
       
  3086     virtual MSwtMenuItem* NewMenuItemL(
       
  3087         MSwtDisplay& aDisplay,
       
  3088         TSwtPeer aPeer,
       
  3089         MSwtMenu& aParent,
       
  3090         TInt aIndex,
       
  3091         TInt aStyle) const =0;
       
  3092 
       
  3093     virtual MSwtMenuArranger* NewMenuArrangerL(
       
  3094         MSwtDisplay& aDisplay) const =0;
       
  3095 
       
  3096     /**
       
  3097      * Constructs a Link
       
  3098      * @param aDisplay The Display this List belongs to
       
  3099      * @param aPeer    The Java object associated with this C++ object
       
  3100      * @param aParent  The parent Composite
       
  3101      * @param aStyle   The SWT style flags
       
  3102      */
       
  3103     virtual MSwtLink* NewLinkL(
       
  3104         MSwtDisplay& aDisplay,
       
  3105         TSwtPeer aPeer,
       
  3106         MSwtComposite& aParent,
       
  3107         TInt aStyle) const =0;
       
  3108 
       
  3109     /**
       
  3110      * Constructs a List
       
  3111      * @param aDisplay The Display this List belongs to
       
  3112      * @param aPeer    The Java object associated with this C++ object
       
  3113      * @param aParent  The parent Composite
       
  3114      * @param aStyle   The SWT style flags
       
  3115      */
       
  3116     virtual MSwtList* NewListL(
       
  3117         MSwtDisplay& aDisplay,
       
  3118         TSwtPeer aPeer,
       
  3119         MSwtComposite& aParent,
       
  3120         TInt aStyle) const =0;
       
  3121 
       
  3122     /**
       
  3123      * Constructs a Label
       
  3124      * @param aDisplay The Display this Label belongs to
       
  3125      * @param aPeer    The Java object associated with this C++ object
       
  3126      * @param aParent  The parent Composite
       
  3127      * @param aStyle   The SWT style flags
       
  3128      */
       
  3129     virtual MSwtLabel* NewLabelL(
       
  3130         MSwtDisplay& aDisplay,
       
  3131         TSwtPeer aPeer,
       
  3132         MSwtComposite& aParent,
       
  3133         TInt aStyle) const =0;
       
  3134 
       
  3135     /**
       
  3136      * Constructs a Button
       
  3137      * @param aDisplay The Display this Button belongs to
       
  3138      * @param aPeer    The Java object associated with this C++ object
       
  3139      * @param aParent  The parent Composite
       
  3140      * @param aStyle   The SWT style flags
       
  3141      */
       
  3142     virtual MSwtButton* NewButtonL(
       
  3143         MSwtDisplay& aDisplay,
       
  3144         TSwtPeer aPeer,
       
  3145         MSwtComposite& aParent,
       
  3146         TInt aStyle) const =0;
       
  3147 
       
  3148     /**
       
  3149      * Constructs a Text
       
  3150      * @param aDisplay The Display this Text belongs to
       
  3151      * @param aPeer    The Java object associated with this C++ object
       
  3152      * @param aParent  The parent Composite
       
  3153      * @param aStyle   The SWT style flags
       
  3154      */
       
  3155     virtual MSwtText* NewTextL(
       
  3156         MSwtDisplay& aDisplay,
       
  3157         TSwtPeer aPeer,
       
  3158         MSwtComposite& aParent,
       
  3159         TInt aStyle) const =0;
       
  3160 
       
  3161     /**
       
  3162      * Constructs a ProgressBar
       
  3163      * @param aDisplay The Display this ProgressBar belongs to
       
  3164      * @param aPeer    The Java object associated with this C++ object
       
  3165      * @param aParent  The parent Composite
       
  3166      * @param aStyle   The SWT style flags
       
  3167      */
       
  3168     virtual MSwtProgressBar* NewProgressBarL(
       
  3169         MSwtDisplay& aDisplay,
       
  3170         TSwtPeer aPeer,
       
  3171         MSwtComposite& aParent,
       
  3172         TInt aStyle) const =0;
       
  3173 
       
  3174     /**
       
  3175      * Constructs a Slider
       
  3176      * @param aDisplay The Display this Slider belongs to
       
  3177      * @param aPeer    The Java object associated with this C++ object
       
  3178      * @param aParent  The parent Composite
       
  3179      * @param aStyle   The SWT style flags
       
  3180      */
       
  3181     virtual MSwtSlider* NewSliderL(
       
  3182         MSwtDisplay& aDisplay,
       
  3183         TSwtPeer aPeer,
       
  3184         MSwtComposite& aParent,
       
  3185         TInt aStyle) const =0;
       
  3186 
       
  3187     /**
       
  3188      * Constructs a Combo
       
  3189      * @param aDisplay The Display this Combo belongs to
       
  3190      * @param aPeer    The Java object associated with this C++ object
       
  3191      * @param aParent  The parent Composite
       
  3192      * @param aStyle   The SWT style flags
       
  3193      */
       
  3194     virtual MSwtCombo* NewComboL(
       
  3195         MSwtDisplay& aDisplay,
       
  3196         TSwtPeer aPeer,
       
  3197         MSwtComposite& aParent,
       
  3198         TInt aStyle) const =0;
       
  3199 
       
  3200     /**
       
  3201      * Construct a File dialog. Custom title.
       
  3202      * @param aFileName Initial path and filename. A new buffer will be allocated.
       
  3203      * @param aTitle    Title of the dialog.
       
  3204      * @param aStyle    Style of the dialog: KSwtStyleOpen or KSwtStyleSave.
       
  3205      */
       
  3206     virtual MSwtFileDialog* NewFileDialogL(const TDesC& aFileName,
       
  3207                                            const TDesC& aTitle, TInt aStyle) const =0;
       
  3208 
       
  3209     virtual MSwtCommand* NewCommandL(MSwtDisplay& aDisplay, TSwtPeer aPeerRef,
       
  3210                                      MSwtControl& aParentControl, MSwtCommand* aParentCommand, TInt aType,
       
  3211                                      TInt aPriority) const =0;
       
  3212     virtual MSwtCommandArranger* NewCommandArrangerL(MSwtDisplay& aDisplay) const =0;
       
  3213 
       
  3214     /**
       
  3215      * Constructs a MobileShell
       
  3216      * @param aDisplay            The Display this Shell belongs to
       
  3217      * @param aPeer               The Java object associated with this C++ object
       
  3218      * @param aParent             The parent Composite, if NULL
       
  3219      *                            a top level Shell is to be created.
       
  3220      * @param aStyle              The SWT style flags
       
  3221      */
       
  3222     virtual MSwtMobileShell* NewMobileShellL(MSwtDisplay& aDisplay,
       
  3223             TSwtPeer aPeer, MSwtShell* aParent, TInt aStyle) const =0;
       
  3224 
       
  3225     /**
       
  3226      * Constructs a MobileDevice
       
  3227      * @param aDisplay The Display this Device belongs to
       
  3228      * @param aPeer               The Java object associated with this C++ object
       
  3229      */
       
  3230     virtual MSwtMobileDevice* NewMobileDeviceL(MSwtDisplay& aDisplay, TSwtPeer aPeer) const =0;
       
  3231 
       
  3232     /**
       
  3233      * Constructs a Screen
       
  3234      * @param aPeer               The Java object associated with this C++ object
       
  3235      * @param aInputId            The identifier of the output.
       
  3236      */
       
  3237     virtual MSwtInput* NewInputL(TSwtPeer aPeer, TInt aInputId) const =0;
       
  3238 
       
  3239     /**
       
  3240      * Constructs a Screen
       
  3241      *
       
  3242      * @param aDisplay The Display this HyperLink belongs to.
       
  3243      * @param aPeer The Java object associated with this C++ object
       
  3244      * @param aScreenId Screen identifier.
       
  3245      */
       
  3246     virtual MSwtScreen* NewScreenL(MSwtDisplay& aDisplay, TSwtPeer aPeer,
       
  3247                                    TInt aScreenId) const =0;
       
  3248 
       
  3249     /**
       
  3250      * Constructs a multi page pages.
       
  3251      * @param aDisplay            The Display this MultiPageDialog belongs to.
       
  3252      * @param aPeer               The Java object associated with this C++ object
       
  3253      * @param aParent             The parent of this control ( it must be a shell )
       
  3254      */
       
  3255     virtual MSwtMultiPagePager* NewMultiPagePagerL(MSwtDisplay& aDisplay,
       
  3256             TSwtPeer aPeer, MSwtShell& aParent) const =0;
       
  3257 
       
  3258     /**
       
  3259      * Constructs a multi page tab group. This is a control for implementing page tabs
       
  3260      * @param aDisplay            The Display this MultiPageDialog belongs to.
       
  3261      * @param aPeer               The Java object associated with this C++ object
       
  3262      * @param aParent             The parent of this control ( it must be a shell )
       
  3263      */
       
  3264     virtual MSwtMultiPageTabGroup*  NewMultiPageTabGroupL(MSwtDisplay& aDisplay,
       
  3265             TSwtPeer aPeer, MSwtShell& aParent) const = 0;
       
  3266 
       
  3267     /**
       
  3268      * Constructs a multi page dialog. This is a control for implementing page tabs
       
  3269      *
       
  3270      * @param aDisplay            The Display this MultiPageDialog belongs to.
       
  3271      * @param aPeer               The Java object associated with this C++ object
       
  3272      * @param aParent             The parent of this control ( it must be a shell )
       
  3273      */
       
  3274     virtual MSwtMultiPageDialog*  NewMultiPageDialogL(MSwtDisplay& aDisplay,
       
  3275             TSwtPeer aPeer, MSwtShell& aParent) const = 0;
       
  3276 
       
  3277     /**
       
  3278      * Constructs a CaptionedControl
       
  3279      * @param aDisplay The Display this CaptionedControl belongs to.
       
  3280      * @param aPeer    The Java object associated with this C++ object
       
  3281      * @param aParent  The parent Composite
       
  3282      * @param aStyle   The SWT style flags
       
  3283      */
       
  3284     virtual MSwtCaptionedControl* NewCaptionedControlL(MSwtDisplay& aDisplay,
       
  3285             TSwtPeer aPeer, MSwtComposite& aParent, TInt aStyle) const =0;
       
  3286 
       
  3287     /**
       
  3288      * Constructs a ConstrainedText
       
  3289      * @param aDisplay The Display this CaptionedControl belongs to.
       
  3290      * @param aPeer    The Java object associated with this C++ object
       
  3291      * @param aParent  The parent Composite
       
  3292      * @param aStyle   The SWT style flags
       
  3293      */
       
  3294     virtual MSwtConstrainedText* NewConstrainedTextL(MSwtDisplay& aDisplay,
       
  3295             TSwtPeer aPeer, MSwtComposite& aParent, TInt aStyle) const =0;
       
  3296 
       
  3297     /**
       
  3298      * Constructs a DateEditor
       
  3299      * @param aDisplay The Display this DateEditor belongs to.
       
  3300      * @param aPeer    The Java object associated with this C++ object
       
  3301      * @param aParent  The parent Composite
       
  3302      * @param aStyle   The SWT style flags
       
  3303      */
       
  3304     virtual MSwtDateEditor*  NewDateEditorL(MSwtDisplay& aDisplay,
       
  3305                                             TSwtPeer aPeer, MSwtComposite& aParent, TInt aStyle) const =0;
       
  3306 
       
  3307     /**
       
  3308      * Constructs a HyperLink
       
  3309      * @param aDisplay The Display this HyperLink belongs to.
       
  3310      * @param aPeer    The Java object associated with this C++ object
       
  3311      * @param aParent  The parent Composite
       
  3312      * @param aStyle   The SWT style flags
       
  3313      */
       
  3314     virtual MSwtHyperLink* NewHyperLinkL(MSwtDisplay& aDisplay,
       
  3315                                          TSwtPeer aPeer, MSwtComposite& aParent, TInt aStyle) const =0;
       
  3316 
       
  3317     /**
       
  3318      * Constructs a ListBox
       
  3319      * @param aDisplay     The Display this ListBox belongs to.
       
  3320      * @param aPeer        The Java object associated with this C++ object
       
  3321      * @param aParent      The parent Composite
       
  3322      * @param aStyle       The SWT style flags
       
  3323      */
       
  3324     virtual MSwtListBox* NewListBoxL(MSwtDisplay& aDisplay,
       
  3325                                      TSwtPeer aPeer, MSwtComposite& aParent, TInt aStyle) const =0;
       
  3326 
       
  3327     /**
       
  3328      * Constructs a ListView
       
  3329      * @param aDisplay     The Display this ListView belongs to.
       
  3330      * @param aPeer        The Java object associated with this C++ object
       
  3331      * @param aParent      The parent Composite
       
  3332      * @param aStyle       The SWT style flags
       
  3333      */
       
  3334     virtual MSwtListView* NewListViewL(MSwtDisplay& aDisplay,
       
  3335                                        TSwtPeer aPeer, MSwtComposite& aParent, TInt aStyle) const =0;
       
  3336 
       
  3337     /**
       
  3338      * Constructs a SortedList
       
  3339      * @param aDisplay     The Display this ListBox belongs to.
       
  3340      * @param aPeer        The Java object associated with this C++ object
       
  3341      * @param aParent      The parent Composite
       
  3342      * @param aStyle       The SWT style flags
       
  3343      */
       
  3344     virtual MSwtSortedList* NewSortedListL(MSwtDisplay& aDisplay,
       
  3345                                            TSwtPeer aPeer, MSwtComposite& aParent, TInt aStyle) const =0;
       
  3346 
       
  3347     /**
       
  3348      * Constructs a TextExtension
       
  3349      * @param aDisplay The Display this TextExtension belongs to.
       
  3350      * @param aPeer    The Java object associated with this C++ object
       
  3351      * @param aParent  The parent Composite
       
  3352      * @param aStyle   The SWT style flags
       
  3353      */
       
  3354     virtual MSwtTextExtension* NewTextExtensionL(MSwtDisplay& aDisplay,
       
  3355             TSwtPeer aPeer, MSwtComposite& aParent, TInt aStyle) const =0;
       
  3356 
       
  3357     /**
       
  3358      * Constructs a TimedMessageBox
       
  3359      * @param aTitle        The string to display as the receiver's title
       
  3360      * @param aMessage      The description of the purpose for which the dialog was opened
       
  3361      * @param aStyle        The SWT style flags
       
  3362      * @param aImage   The image to display in the message box
       
  3363      */
       
  3364     virtual void RunTimedMessageBoxDlgLD(const TDesC& aTitle,
       
  3365                                          const TDesC& aMessage, TInt aStyle, const MSwtImage* aImage) const=0;
       
  3366 
       
  3367     /**
       
  3368      * Constructs a QueryDialog
       
  3369      * @param aTitle        The dialog title
       
  3370      * @param aStyle        The SWT style flags
       
  3371      * @param aQueryType    The query style flags
       
  3372      * @param aPromptText   The prompt text
       
  3373      * @param aDefaultValue The default value string
       
  3374      * @param aMinimum      The minimum of allowed characters
       
  3375      * @param aMaximum      The maximum of allowed characters
       
  3376      * @return The string input result
       
  3377      */
       
  3378     virtual HBufC* RunQueryDialogL(const TDesC& aTitle, TInt aStyle,
       
  3379                                    TInt aQueryType, const TDesC& aPromptText, const TDesC& aDefaultValue,
       
  3380                                    TInt aMinimum, TInt aMaximum) const=0;
       
  3381 
       
  3382     /**
       
  3383      * Calls ConvertDefaultValueL of QueryDialog
       
  3384      * @param aString       The string to check the format
       
  3385      * @param aQueryType    The query style flags
       
  3386      * @return True if the string is valid
       
  3387      */
       
  3388     virtual HBufC* RunQueryDialogConvertDefaultValueL(const TDesC& aString,
       
  3389             TInt aQueryType) const=0;
       
  3390 
       
  3391     /**
       
  3392      * Construct a Clipboard
       
  3393      * @param aPeer The Java object associated with this C++ object
       
  3394      */
       
  3395     virtual MSwtClipboard* NewClipboardL(TSwtPeer aPeer) const =0;
       
  3396 
       
  3397     /**
       
  3398      * Construct a TableColumn
       
  3399      * @param aPeer         The Java object associated with this C++ object
       
  3400      * @param aParent       The parent Table
       
  3401      * @param aStyle        The SWT style flags
       
  3402      * @param aColumnIndex  The index where to insert the column
       
  3403      */
       
  3404     virtual MSwtTableColumn* NewTableColumnL(
       
  3405         TSwtPeer aPeer,
       
  3406         MSwtTable& aParent,
       
  3407         TInt aStyle,
       
  3408         TInt aColumnIndex) const =0;
       
  3409 
       
  3410     /**
       
  3411      * Construct a TableItem
       
  3412      * @param aDisplay   The Display this TableItem belongs to
       
  3413      * @param aPeer      The Java object associated with this C++ object
       
  3414      * @param aParent    The parent Table
       
  3415      * @param aRowIndex  The index where to insert the row inside the Table
       
  3416     */
       
  3417     virtual MSwtTableItem* NewTableItemL(
       
  3418         MSwtDisplay& aDisplay,
       
  3419         TSwtPeer aPeer,
       
  3420         MSwtTable& aParent,
       
  3421         TInt aRowIndex) const =0;
       
  3422 
       
  3423     /**
       
  3424      * Constructs a Table
       
  3425      * @param aDisplay  The Display this Table belongs to.
       
  3426      * @param aPeer     The Java object associated with this C++ object
       
  3427      * @param aParent   The parent Composite
       
  3428      * @param aStyle    The SWT style flags
       
  3429      */
       
  3430     virtual MSwtTable* NewTableL(
       
  3431         MSwtDisplay& aDisplay,
       
  3432         TSwtPeer aPeer,
       
  3433         MSwtComposite& aParent,
       
  3434         TInt aStyle) const =0;
       
  3435 
       
  3436     /**
       
  3437      * Constructs a Tree
       
  3438      * @param aDisplay     The Display this Tree belongs to.
       
  3439      * @param aPeer        The Java object associated with this C++ object
       
  3440      * @param aParent      The parent Composite
       
  3441      * @param aStyle       The SWT style flags
       
  3442      */
       
  3443     virtual MSwtTree* NewTreeL(
       
  3444         MSwtDisplay& aDisplay,
       
  3445         TSwtPeer aPeer,
       
  3446         MSwtComposite& aParent,
       
  3447         TInt aStyle) const =0;
       
  3448 
       
  3449     /**
       
  3450      * Constructs a QueryDialog
       
  3451      * @param aDefaultColor The default selected color.
       
  3452      * @return  The color input result, null if the user doesn't select a color
       
  3453      *          (Exit from the dialog with the CANCEL button).
       
  3454      *          This object must be deleted by the caller.
       
  3455      */
       
  3456     virtual TRgb* RunColorDialogL(TRgb* aDefaultColor) const=0;
       
  3457 
       
  3458     /**
       
  3459      * Constructs a DirectoryDialog
       
  3460      */
       
  3461     virtual MSwtDirectoryDialog* NewDirectoryDialogL(const TDesC& aFilterPath,
       
  3462             const TDesC& aTitle) const =0;
       
  3463 
       
  3464     /**
       
  3465      * Consturct a browser object
       
  3466      * @param aDisplay The Display the browser  belongs to.
       
  3467      * @param aPeer The Java object associated with this C++ object
       
  3468      * @param aParent he parent composite
       
  3469      * @param aStyle The SWT style flags
       
  3470      */
       
  3471     virtual MSwtBrowser* NewBrowserL(MSwtDisplay& aDisplay, TSwtPeer aPeer
       
  3472                                      , MSwtComposite& aParent, TInt aStyle) const = 0;
       
  3473 
       
  3474     /**
       
  3475      * Constructs a Color
       
  3476      * @param aDevice The device this colour is represented on.
       
  3477      * @param aRgb    A RGB triplet of the colour to represent.
       
  3478      */
       
  3479     virtual MSwtColor* NewColorL(const MSwtDevice& aDevice, const TRgb& aRgb) const =0;
       
  3480 
       
  3481     /**
       
  3482      * Constructs a GC suitable for the font & bitmap server's devices.
       
  3483      * @param aDrawable   The drawable that created aGc.
       
  3484      * @param aGc         The native GC to use, ownership is transferred.
       
  3485      * @param aDestructor The function that will take care of destroying iGc.
       
  3486      * @param aPenCol     The pen's colour.
       
  3487      * @param aBrushCol   The brush's colour.
       
  3488      * @param aFont       The font to use
       
  3489      */
       
  3490     virtual MSwtGc* NewBitmapGcL(MSwtBitmapDrawable& aDrawable, CFbsBitGc* aGc,
       
  3491                                  MSwtGc::TDestructor aDestructor, const TRgb& aPenCol, const TRgb& aBrushCol,
       
  3492                                  const MSwtFont& aFont) const =0;
       
  3493 
       
  3494     /**
       
  3495      * Constructs a GC suitable for the window server's devices.
       
  3496      * @param aDrawable     The drawable that created aGc.
       
  3497      * @param aGc           The native GC to use, ownership is transferred.
       
  3498      * @param aDestructor   The function that will take care of destroying iGc.
       
  3499      * @param aPenCol       The pen's colour.
       
  3500      * @param aBrushCol     The brush's colour.
       
  3501      * @param aFont         The font to use
       
  3502      * @param aBoundaryRect The rectangle drawing is restricted to, in GC coordinates.
       
  3503      * @param aGcScreenRect The GC's rectangle in screen coordinates
       
  3504      */
       
  3505     virtual MSwtGc* NewWindowGcL(MSwtWindowDrawable& aDrawable, CWindowGc* aGc,
       
  3506                                  MSwtGc::TDestructor aDestructor, const TRgb& aPenCol, const TRgb& aBrushCol,
       
  3507                                  const MSwtFont& aFont,const TRect& aBoundaryRect, const TRect& aGcScreenRect) const =0;
       
  3508 
       
  3509     /**
       
  3510      * Constructs a Font
       
  3511      * @param aDevice       The device this font is represented on.
       
  3512      * @param aTypefaceName The name of the typeface (i.e. Courrier for example).
       
  3513      * @param aHeight       The height of the font.
       
  3514      * @param aStyle        The style of the font.
       
  3515      */
       
  3516     virtual MSwtFont* NewFontL(const MSwtDevice& aDevice,
       
  3517                                const TDesC& aTypefaceName, TInt aHeight, TInt aStyle) const =0;
       
  3518 };
       
  3519 
       
  3520 
       
  3521 #endif // ESWTWIDGETSCORE_H