uiaccelerator_plat/alf_visual_api/inc/alf/alfdisplay.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Display class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_ALFDISPLAY_H
       
    21 #define C_ALFDISPLAY_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <alf/alfdisplaybackgrounditem.h>
       
    25 #include <alf/alfevent.h>
       
    26 
       
    27 class CAlfEnv;
       
    28 class CAlfRoster;
       
    29 class MAlfInputCapabilitiesSupplier;
       
    30 class MObjectProvider;
       
    31 class TPointerEvent;
       
    32 
       
    33 
       
    34 /* Screen buffer uids */
       
    35 const TUid KAlfUidBackBufferAll = 			{0x2000e59d}; // Not used
       
    36 const TUid KAlfUidBackBufferScreen0 = 		{0x2000e59e};
       
    37 const TUid KAlfUidBackBufferScreen1 = 		{0x2000e59f};
       
    38 const TUid KAlfUidBackBufferTvOutNormal = 	{0x2000e5a0};
       
    39 const TUid KAlfUidBackBufferTvOutWide = 	{0x2000e5a1};
       
    40 
       
    41 /**
       
    42  * Rendering quality enumerator. 
       
    43  *
       
    44  * @see CAlfDisplay::SetQuality()
       
    45  * @see CAlfDisplay::Quality()
       
    46  */
       
    47 enum TAlfQuality
       
    48     {
       
    49     /** Accurate quality ensures the best visual quality. */
       
    50     EAlfQualityAccurate,
       
    51 
       
    52     /** Fastest rendering speed in exchange for lower quality. */
       
    53     EAlfQualityFast
       
    54     };
       
    55 
       
    56 /**
       
    57 *  The intended usage of the display. The display may use this info to 
       
    58 *  prioritize the HW usage and route content.
       
    59 *  Vendor specific meanings may be used at the end of the enum space.
       
    60 *
       
    61 *  @see CAlfDisplay::SetUsageL()
       
    62 */
       
    63 enum TAlfDisplayUsageHint
       
    64     {
       
    65     EAlfDisplayUsageGeneric        = 0x00000001,
       
    66     EAlfDisplayUsage3D             = 0x00000002,
       
    67     EAlfDisplayUsageVideoPlayback  = 0x00000004,
       
    68     EAlfDisplayUsageVideoCapture   = 0x00000008,
       
    69     EAlfDisplayUsageViewfinder     = 0x00000010,
       
    70     EAlfDisplayUsageStillImage     = 0x00000011,
       
    71     EAlfDisplayUsageVendorSpecific = 0x80000000
       
    72     };
       
    73 
       
    74 /**
       
    75  *  Display class represents a drawing area on which UI Accelerator Toolkit
       
    76  *  draws it's contents. 
       
    77  *  
       
    78  *  The display always occupies a rectangular area of a rendering surface. 
       
    79  *  Usually the display occupies the whole rendering surface but it can also 
       
    80  *  occupy only parts of the rendering surface. Multiple displays can then 
       
    81  *  occupy multiple parts of the same rendering surface. This can be achieved 
       
    82  *  by setting the visible area of a display through 
       
    83  *  CAlfDisplay::SetVisibleArea() - method.
       
    84  *
       
    85  *  There should always be at least one display on which the contents of an
       
    86  *  application UI can be drawn to. The display can be one of the several 
       
    87  *  display types listed in CAlfDisplay::TDisplayType.
       
    88  *
       
    89  *  Before any visual content is drawn on the display, the display area is
       
    90  *  cleared. Different parts of the display can be cleared with different 
       
    91  *  methods and can be configured using the 
       
    92  *  CAlfDisplay::SetBackgroundItemsL() - method. Alternatively the clearing 
       
    93  *  mode to clear the whole display area can be assigned using 
       
    94  *  CAlfDisplay::SetClearBackgroundL() - method.
       
    95  *
       
    96  *  A display contains always a CAlfRoster - object which defines the drawing
       
    97  *  order of the CAlfControlGroup objects in the UI, controls the order in 
       
    98  *  which events are passed from control group to another and defines which
       
    99  *  control groups are shown and hidden at any given time.
       
   100  *
       
   101  *  To construct a display, use the CAlfEnv::NewDisplayL() - method.
       
   102  *  Usage:
       
   103  *  @code
       
   104  *  CAlfDisplay* display = iEnv->NewDisplayLiEnv->NewDisplayL( ClientRect(), 
       
   105  * 				CAlfEnv::ENewDisplayAsCoeControl );
       
   106  * 
       
   107  *  @endcode
       
   108  *  @lib alfclient.lib
       
   109  *  @since S60 v3.2
       
   110  */
       
   111 NONSHARABLE_CLASS( CAlfDisplay ): public CBase
       
   112     {
       
   113 public:
       
   114 
       
   115     /* Types. */
       
   116 
       
   117     /**
       
   118      * Background clear modes. Different clear modes can be taken into use 
       
   119      * with CAlfDisplay::SetClearBackgroundL() - method.
       
   120      */
       
   121     enum TClearMode
       
   122         {
       
   123         /**
       
   124          * Do not clear. This is more like an optimization flag.
       
   125          * Using this with OpenGL ES renderer results
       
   126          * to undefined (Trashed) background - so be sure to display content
       
   127          * that fills the entire screen. With the BITGDI renderer the
       
   128          * behavior is similar but the display are will show the previously
       
   129          * rendered avkon content (if any).
       
   130          */
       
   131         EClearNone = EFalse,
       
   132 
       
   133         /**
       
   134          * Clear with a solid color.
       
   135          */
       
   136         EClearWithColor = ETrue,
       
   137 
       
   138         /**
       
   139          * Clear with the skin background texture.
       
   140          */
       
   141         EClearWithSkinBackground
       
   142         };
       
   143 
       
   144     /** Display types. */
       
   145     enum TDisplayType
       
   146         {
       
   147         /** @deprecated: Primary LCD display. */
       
   148         EDisplayLcd0 = 0x0,              
       
   149  
       
   150         /** @deprecated: TV out */
       
   151         EDisplayTvOut = 0x2,
       
   152 
       
   153         /** @deprecated: TV out widescreen */
       
   154         EDisplayTvOutWide = 0x3,
       
   155 
       
   156         /** Physical screen */
       
   157         EDisplayNormal = 0x10,     
       
   158  
       
   159         /** Not used. Virtual display */
       
   160         EDisplayVirtual = 0x20,
       
   161 
       
   162         /** @deprecated: Off screen buffer */
       
   163         EDisplayOffScreenBuffer = 0x40
       
   164         };
       
   165                 
       
   166     /**
       
   167      * Constructor
       
   168      *
       
   169      * To construct a new display, use CAlfEnv::NewDisplayL() - method.
       
   170      */
       
   171     CAlfDisplay();
       
   172     
       
   173     /**
       
   174      * ConstructL
       
   175      *
       
   176      * To construct a new display, use CAlfEnv::NewDisplayL() - method.
       
   177      */
       
   178     void ConstructL(
       
   179         CAlfEnv& aEnv, 
       
   180         TBool aAsCoeControl,
       
   181         const TRect& aRect, 
       
   182         CAlfRoster* aSharedRoster,
       
   183         TInt aDisplayType, 
       
   184         TUid aBufferUid);
       
   185 
       
   186     /**
       
   187      * Destructor.
       
   188      */
       
   189     virtual ~CAlfDisplay();
       
   190 
       
   191     /**
       
   192      * Sets the flag that tells the display to clear the background before
       
   193      * doing a refresh. Creates new objects required to be able to clear
       
   194      * the background with the defined mode.
       
   195      *
       
   196      * @param aClearBackground  Background clearing mode. For example EFalse,
       
   197      *                          ETrue, EClearWithColor,
       
   198      *                          EClearWithSkinBackground are the valid 
       
   199      *                          alternatives. EClearWithColor is equivalent to 
       
   200      *                          ETrue. EFalse is equivalent to EClearNone.
       
   201      *
       
   202      * @see CAlfDisplay::TClearMode
       
   203      */
       
   204     IMPORT_C void SetClearBackgroundL(TInt aClearBackground);
       
   205 
       
   206     /**
       
   207      * Sets the items that specify how to clear display before display
       
   208      * refresh. Items may have overlapping rectangles, drawing order is same 
       
   209      * as item order in the parameter array. But having lots of overlapping 
       
   210      * drawing causes negative performance impact.
       
   211      *
       
   212      * This method is alternative to SetClearBackgroundL().
       
   213      *
       
   214      * @see SetClearBackgroundL()
       
   215      * @param aItems Array of items that specify how to clear the background.
       
   216      *
       
   217      */
       
   218     IMPORT_C void SetBackgroundItemsL(
       
   219                     const RArray<TAlfDisplayBackgroundItem>& aItems);
       
   220     
       
   221     /**
       
   222      * Returns the roster of the display.
       
   223      * @return The roster.
       
   224      */
       
   225     IMPORT_C CAlfRoster& Roster();
       
   226 
       
   227     /**
       
   228      * Returns the roster of the display.
       
   229      * @return The roster.
       
   230      */
       
   231     IMPORT_C const CAlfRoster& Roster() const;
       
   232     
       
   233     /**
       
   234      * Sets the visible area of the display. The visible area is the area on
       
   235      * the display's rendering surface where the display is drawn. Normally
       
   236      * a display covers the entire rendering surface, but in the situation
       
   237      * where multiple displays are drawn on the same surface, this would be
       
   238      * used to define the visible area of each display.
       
   239      * Note: This does not set the visible area if alf server session is not focused
       
   240      * 
       
   241      * @param aArea  Visible area for the display.
       
   242      */
       
   243     IMPORT_C void SetVisibleArea(const TRect& aArea);
       
   244 
       
   245     /**
       
   246      * Sets the visible area of the display. Similar to SetVisibleArea.
       
   247      * But this sets the visible area even though alf server session is not focused.
       
   248      * Shall be used by client app when Dynamic layout switch happens. 
       
   249      *
       
   250      * @param aArea  Visible area for the display.
       
   251      */
       
   252     IMPORT_C void ForceSetVisibleArea(const TRect& aArea);
       
   253     
       
   254     /**
       
   255      * Returns the visible area of the display.
       
   256      *
       
   257      * @return  Visible area of the display. Affected by display orientation
       
   258      *          so that the returned rectangle uses the oriented coordinate
       
   259      *          space.
       
   260      */
       
   261     IMPORT_C TRect VisibleArea() const;
       
   262     
       
   263     /**
       
   264      * Returns the environment of the display.
       
   265      */
       
   266     IMPORT_C CAlfEnv& Env();
       
   267     
       
   268     /**
       
   269      * Return the server side handle
       
   270      *
       
   271      * @return Handle to the server side CAlfSrvDisplaySubSession object. 0 if
       
   272      *         not set.
       
   273      */
       
   274     TInt ServerHandle() const;
       
   275     
       
   276     /**
       
   277      * Set the current focused editor. 
       
   278      */
       
   279     IMPORT_C void SetFocusedEditor(
       
   280                     MAlfInputCapabilitiesSupplier* aCurrentEditor);
       
   281 
       
   282     /**
       
   283      * Flag the entire display as dirty.
       
   284      */
       
   285     IMPORT_C void SetDirty();
       
   286     
       
   287     /**
       
   288      * Sets the rendering quality of the display.
       
   289      *
       
   290      * @param aRenderingQuality One of the quality enumerators in TAlfQuality.
       
   291      */
       
   292     IMPORT_C void SetQuality(TAlfQuality aRenderingQuality);
       
   293 
       
   294     /**
       
   295      * Determines the rendering quality of the display.
       
   296      *
       
   297      * @return TAlfQuality enumerator that represents the rendering quality
       
   298      *         setting.
       
   299      */
       
   300     IMPORT_C TAlfQuality Quality() const;
       
   301     
       
   302     /**
       
   303      * Sets the flag that enables the use of depth testing.
       
   304      *
       
   305      * @param aUseDepth  <code>ETrue</code> to enable depth.
       
   306      */
       
   307     IMPORT_C void SetUseDepth(TBool aUseDepth);
       
   308         
       
   309     /**
       
   310     * Method to return an object provider interface for this display.
       
   311     *
       
   312     * @return a pointer or NULL to an MObjectProvider interface
       
   313     */
       
   314     IMPORT_C MObjectProvider* ObjectProvider() const;
       
   315 
       
   316     /**
       
   317      * Tells display the intended usage of the display. Display may use this
       
   318      * information to optimize the drawing.
       
   319      *
       
   320      * @param aUsageHint
       
   321      *
       
   322      *   Possible values for parameter are:
       
   323      *   - EAlfDisplayUsageGeneric 
       
   324      *   - EAlfDisplayUsage3D      
       
   325      *   - EAlfDisplayUsageVideoPlayback
       
   326      *   - EAlfDisplayUsageVideoCapture 
       
   327      *   - EAlfDisplayUsageViewfinder   
       
   328      *   - EAlfDisplayUsageStillImage   
       
   329      *   - EAlfDisplayUsageVendorSpecific + n
       
   330      *  
       
   331      *  Supported values depend on display type
       
   332      *  and underlying HW.
       
   333      * 
       
   334      *  @see TAlfDisplayUsageHint
       
   335      */    
       
   336     IMPORT_C void SetUsageL(TUint aUsageHint);
       
   337 
       
   338     /**
       
   339      * Suppresses automatic fading by display. This applies only to displays that are tied
       
   340      * to windows. By default, automatic fading is enabled.
       
   341      * @param aSuppress ETrue to suppress, EFalse to enable automatic fading.
       
   342      * @return error code, KErrNone upon success.
       
   343      */
       
   344     IMPORT_C TInt SuppressAutomaticFading( TBool aSuppress = ETrue );
       
   345 
       
   346     /**
       
   347      * Visual content will be drawn to the given window. The visual can be a visual tree i.e.
       
   348      * layout visual. The visual will not be any more drawn to the original place. The window
       
   349      * need not to be a full screen window. Giving NULL as aVisual will remove the binding,
       
   350      * and visual content will be drawn to the original place again.
       
   351      *
       
   352      * @param aWindow  Application window.
       
   353      * @param aVisual  Visual or layout visual.
       
   354      */
       
   355 	IMPORT_C void SetClientWindowForDrawingL(RWindow* aWindow, CAlfVisual* aVisual);
       
   356 
       
   357     /** @endAPI */
       
   358     
       
   359     /**
       
   360      * Handles layout change.
       
   361      */
       
   362     void NotifyLayoutChangedL();
       
   363 
       
   364     /**
       
   365     * Accesses whether this CAlfDisplay is focused. 
       
   366     * A display should normally be focused. It will not be focused at least in
       
   367     * the following cases:
       
   368     *  - a non-ALF window in the current application is present in front of
       
   369     *    this AlfDisplay
       
   370     *  - a non-ALF window in another application is present in front of this
       
   371     *    AlfDisplay
       
   372     *
       
   373     * @return the focus state
       
   374     */
       
   375     TBool IsFocused() const;
       
   376 
       
   377     /**
       
   378      * Forwards a pointer event received from CONE. This can be called directly by application
       
   379      * to pass in external pointer events. You will have to call this from an application to pass
       
   380      * pointer events to CAlfControl - derived objects if you have created the CAlfDisplay 
       
   381      * class as offscreen buffer that has no native window to grab pointerevents automatically.
       
   382      *
       
   383      * @param aPointerEvent  Received pointer event to handle. Note that iParentPosition of the 
       
   384      * pointerevent should always be in the same coordinate space as where the displays rect 
       
   385      * was defined when it was created.
       
   386      */
       
   387     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   388 
       
   389 private:
       
   390 
       
   391     /**
       
   392      * Chacks screen size.
       
   393      */
       
   394     void CheckScreenRect(TRect aRect);
       
   395 
       
   396 
       
   397 private:
       
   398     
       
   399     // Private data. Owned.
       
   400     struct TPrivateData;
       
   401     TPrivateData* iData;
       
   402      
       
   403     };
       
   404 
       
   405 #endif // C_ALFDISPLAY_H