uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplayCoeControl.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:   Definition of the CHuiDisplayCoeControl class. 
       
    15 *                CHuiDisplayCoeControl is a CCoeControl that has its own 
       
    16 *                CHuiDisplay instance attached to the control's RWindow.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef __HUIDISPLAYCOECONTROL_H__
       
    23 #define __HUIDISPLAYCOECONTROL_H__
       
    24 
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <uiacceltk/HuiPlatform.h>
       
    28 
       
    29 
       
    30 /* Forward declarations. */
       
    31 class CHuiEnv;
       
    32 class CHuiDisplay;
       
    33 
       
    34 
       
    35 /**
       
    36  * CHuiCoeControlDisplay is CCoeControl-derived, window-owning control that 
       
    37  * is attached to a CHuiDisplay instance. The entire area of the control is 
       
    38  * used for rendering. 
       
    39  */
       
    40 class CHuiDisplayCoeControl : public CCoeControl, 
       
    41                               public MCoeControlObserver
       
    42     {
       
    43 public:
       
    44 
       
    45     /* Constructors and destructor. */
       
    46 
       
    47     /**
       
    48      * Construct a new CoeControl that has a rendering surface.
       
    49      *
       
    50      * @param aEnv  Environment.
       
    51      */
       
    52     IMPORT_C static CHuiDisplayCoeControl* NewL(CHuiEnv& aEnv, const TRect& aRect, TInt aFlags = 0);
       
    53     
       
    54     /**
       
    55      * Construct a new CoeControl that has a rendering surface, and leaves it 
       
    56      * on the cleanup stack.
       
    57      *
       
    58      * @param aEnv  Environment.
       
    59      */
       
    60     IMPORT_C static CHuiDisplayCoeControl* NewLC(CHuiEnv& aEnv, const TRect& aRect, TInt aFlags = 0);
       
    61 
       
    62     /**
       
    63      * Destructor.
       
    64      */
       
    65     IMPORT_C ~CHuiDisplayCoeControl();
       
    66 
       
    67 
       
    68     /* Methods. */
       
    69 
       
    70     /**
       
    71      * Returns the environment of this CHuiDisplayCoeControl.
       
    72      */
       
    73     IMPORT_C CHuiEnv& Env();
       
    74 
       
    75     /**
       
    76      * Returns the display of this CHuiDisplayCoeControl.
       
    77      */
       
    78     IMPORT_C CHuiDisplay& Display();
       
    79     
       
    80 
       
    81 private: /* from CoeControl */
       
    82 
       
    83     /**
       
    84      * Called when the size of the control changes.
       
    85      */
       
    86     IMPORT_C void SizeChanged();
       
    87 
       
    88     /**
       
    89      * Returns the number of CoeControls inside this control.
       
    90      *
       
    91      * @return  Zero.
       
    92      */
       
    93     IMPORT_C TInt CountComponentControls() const;
       
    94 
       
    95     /**
       
    96      * Returns a pointer to a CoeControl inside this control.
       
    97      *
       
    98      * @return  <code>NULL</code>.
       
    99      */
       
   100     IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
       
   101 
       
   102     /**
       
   103      * From CCoeControl. Invalidate drawing area. No synchronous drawing takes place here
       
   104      */
       
   105     IMPORT_C void Draw(const TRect& aRect) const;
       
   106 
       
   107     /**
       
   108      * Handles resource change.
       
   109      *
       
   110      * @see  S60 documentation.
       
   111      */ 
       
   112     IMPORT_C void HandleResourceChange(TInt aType);
       
   113 
       
   114     /**
       
   115      * Acts upon changes in the hosted control's state.
       
   116      *
       
   117      * @param   aControl    The control changing its state
       
   118      * @param   aEventType  The type of control event
       
   119      */
       
   120     IMPORT_C void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType);
       
   121 
       
   122     /**
       
   123      * Called when a key input event is received by the display. The input
       
   124      * event is passed on to one of the controls in the display.
       
   125      *
       
   126      * @param aKeyEvent  Key event.
       
   127      * @param aType      Type of the event.
       
   128      */
       
   129     IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
       
   130 
       
   131     /** ! future proofing, just basecall */
       
   132 	IMPORT_C void MakeVisible(TBool aVisible);
       
   133 	IMPORT_C void SetDimmed(TBool aDimmed);
       
   134 	IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
       
   135 	IMPORT_C void ActivateL();
       
   136 	IMPORT_C void PrepareForFocusLossL();
       
   137 	IMPORT_C void PrepareForFocusGainL();
       
   138 	IMPORT_C TCoeInputCapabilities InputCapabilities() const;
       
   139 	IMPORT_C void FocusChanged(TDrawNow aDrawNow);
       
   140 	IMPORT_C void PositionChanged();
       
   141 	IMPORT_C void SetContainerWindowL(const CCoeControl& aContainer);
       
   142 
       
   143 protected:
       
   144 
       
   145     /* Constructors. */
       
   146 
       
   147     /**
       
   148      * Constructor.
       
   149      *
       
   150      * @param aEnv  The environment that manages this display.
       
   151      */
       
   152     IMPORT_C CHuiDisplayCoeControl(CHuiEnv& aEnv);
       
   153 
       
   154     /**
       
   155      * Second-phase constructor. Creates a window and an OpenGL context.
       
   156      *
       
   157      * @param aRect  Frame rectangle for container.
       
   158      * @param aFlags  New display flags from CHuiEnv.     
       
   159      */
       
   160     IMPORT_C virtual void ConstructL(const TRect& aRect, TInt aFlags);
       
   161 
       
   162 
       
   163     /* Utility methods. */
       
   164 
       
   165     /**
       
   166      * Handle pointer events.
       
   167      */
       
   168     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   169 
       
   170     IMPORT_C virtual void DisplayCoeCntrlExtension(const TUid& aEstensionUid, TAny** aExtensionParams);
       
   171 
       
   172 private:
       
   173 
       
   174     /** The environment that manages this display. */
       
   175     CHuiEnv& iEnv;
       
   176 
       
   177     /** Display attached to this CoeControl. Not owned. */
       
   178     CHuiDisplay* iDisplay;
       
   179     
       
   180     /** Previous working rectangle of this container control. */
       
   181     TRect iPrevRect;
       
   182 
       
   183     TAny* iSpare;
       
   184     };
       
   185 
       
   186 #endif  // __HUIDISPLAY_H__