uifw/AvKon/inc/AknPreviewPopUp.h
changeset 0 2f259fa3e83a
child 10 9f56a4e1b8ab
child 14 3320e4e6e8bb
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2005-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:  View part of the preview popup component.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef AKNPREVIEWPOPUP_H
       
    20 #define AKNPREVIEWPOPUP_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <AknControl.h>
       
    24 #include <coecobs.h>
       
    25 #include <AknsItemID.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CFbsBitmap;
       
    29 class CAknPreviewPopUpController;
       
    30 class CAknsFrameBackgroundControlContext;
       
    31 class TAknWindowComponentLayout;
       
    32 class CAknButton;
       
    33 
       
    34 /**
       
    35 *  Preview popup.
       
    36 *
       
    37 *  @lib avkon.lib
       
    38 *  @since S60 3.2
       
    39 */
       
    40 NONSHARABLE_CLASS( CAknPreviewPopUp ) : public CAknControl,
       
    41                                         public MCoeControlObserver,
       
    42                                         public MCoeControlBackground
       
    43     {    
       
    44     public: // Constructors and destructor
       
    45 
       
    46         /**
       
    47         * Two-phased constructor.
       
    48         * @param aContent Reference to the content of preview popup.
       
    49         * @param aController Reference to the controller of this popup.
       
    50         * @param aStyle Used layout style.
       
    51         */
       
    52   	    static CAknPreviewPopUp* NewL( CCoeControl& aContent,
       
    53   	                                   CAknPreviewPopUpController& aController,
       
    54                                        const TInt aStyle );
       
    55 
       
    56   	    /**
       
    57         * Destructor.
       
    58         */
       
    59       	~CAknPreviewPopUp();
       
    60       	
       
    61     public: // New functions
       
    62 
       
    63         /**
       
    64         * Shows the preview popup.
       
    65         */
       
    66         void Show();
       
    67         
       
    68         /**
       
    69         * Hides the preview popup.
       
    70         */
       
    71         void Hide();
       
    72         
       
    73         /**
       
    74         * Return flags specified during construction.
       
    75         * @return Used flags.
       
    76         */
       
    77         TInt Flags() const;
       
    78         
       
    79         /**
       
    80         * Sets optional heading text. If heading text is already set the
       
    81         * current text is replaced. When set also a closing icon is shown if 
       
    82         * the currently active layout supports stylus.
       
    83         * @param aText Heading text.
       
    84         */
       
    85         void SetHeadingTextL( const TDesC& aText );
       
    86         
       
    87     public: // Functions from base classes
       
    88     
       
    89         /**
       
    90         * From CCoeControl. Gets the control's minimum required size.
       
    91         * @return The minimum size required by the control.
       
    92         */
       
    93         TSize MinimumSize();
       
    94     	
       
    95       	/**
       
    96       	* From CCoeControl. Handles a change to the control's resources.
       
    97       	* @param aType A message UID value.
       
    98       	*/
       
    99       	void HandleResourceChange( TInt aType );
       
   100       	
       
   101       	/**
       
   102       	* From MCoeControlObserver. Handles an event from an observed control.
       
   103       	* @param aControl The control that sent the event.
       
   104 	    * @param aEventType The event type.
       
   105       	*/
       
   106       	void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
       
   107       	
       
   108       	/**
       
   109         * From MCoeControlBackground. Draws the background for a given control.
       
   110         * @param aGc Graphics context used for drawing.
       
   111         * @param aControl The control being drawn.
       
   112         * @param aRect The area to be redrawn.
       
   113       	*/
       
   114       	void Draw( CWindowGc& aGc, const CCoeControl& aControl,
       
   115       	           const TRect& aRect ) const;
       
   116 
       
   117         /**
       
   118         * From CCoeControl. Gets the number of component controls contained by 
       
   119         * this control.
       
   120         * @return The number of component controls contained by this control.
       
   121         */
       
   122         TInt CountComponentControls() const;
       
   123         
       
   124         /**
       
   125         * From CCoeControl. Gets the specified control contained by this
       
   126         * control.
       
   127         * @param aIndex The index of the control to get.
       
   128         * @return The component control with an index on aIndex
       
   129         */
       
   130         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   131         
       
   132     protected: // Functions from base classes
       
   133 
       
   134         /**
       
   135         * From CCoeControl. Responds to changes to the size and position of the
       
   136         * contents of this control.
       
   137         */
       
   138         void SizeChanged();
       
   139         
       
   140         /**
       
   141         * From CCoeControl. Handles pointer events. 
       
   142         * @param aPointerEvent The pointer event.
       
   143         */
       
   144         void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   145         
       
   146         /**
       
   147         * From CCoeControl. Handles key events.
       
   148         * @param aKeyEvent The key event.
       
   149         * @param aType The type of the event.
       
   150         */
       
   151         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
       
   152                                      TEventCode aType );
       
   153         
       
   154         /**
       
   155         * From CCoeControl. Retrieves an object of the same type as that 
       
   156         * encapsulated in aId.
       
   157         * @param aId An encapsulated object id.
       
   158         * @return Pointer to the object provider.
       
   159         */
       
   160         TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
       
   161         
       
   162     private: // Constructors
       
   163     
       
   164         /**
       
   165         * C++ default constructor.
       
   166         */   
       
   167       	CAknPreviewPopUp( CCoeControl& aContent,
       
   168       	                  CAknPreviewPopUpController& aController,
       
   169                           const TInt aStyle );
       
   170 
       
   171       	/**
       
   172       	* Symbian 2nd phase constructor.
       
   173       	*/
       
   174     	void ConstructL();
       
   175 
       
   176     private: // Functions from base classes
       
   177 
       
   178         /**
       
   179         *  From CCoeControl. Draws the backgound graphics of this control.
       
   180         */
       
   181         void Draw( const TRect& aRect ) const;
       
   182   	
       
   183     private: // New functions
       
   184     
       
   185         /**
       
   186         * Gets the correct layout data depending on the used layout.
       
   187         * @return Layout data for the center of the popup.
       
   188         */
       
   189         TAknWindowComponentLayout CenterLayout();
       
   190         
       
   191         /**
       
   192         * Creates the closing icon if heading pane is visible and pen
       
   193         * support enabled in the current layout.
       
   194         */
       
   195         void CreateClosingIconL();
       
   196         
       
   197         /**
       
   198         * Checks if the heading should be drawn.
       
   199         *
       
   200         * @return ETrue if the heading should be drawn.
       
   201         */
       
   202         TBool HasHeading() const;
       
   203         
       
   204         /**
       
   205         * Draws background.
       
   206         * @param aGc Graphics context.
       
   207         * @param aRect Rect to draw.
       
   208         */
       
   209         void DrawBackground( CWindowGc& aGc, const TRect& aRect ) const;
       
   210         
       
   211     private: // Data
       
   212     
       
   213         // skin context
       
   214         CAknsFrameBackgroundControlContext* iBgContext;
       
   215 
       
   216         // application specific content
       
   217         CCoeControl& iContent;
       
   218         
       
   219         // controller of the preview popup
       
   220         CAknPreviewPopUpController& iController;
       
   221         
       
   222         // frame graphics id
       
   223         TAknsItemID iFrameId;
       
   224         
       
   225         // center graphics id
       
   226         TAknsItemID iCenterId;
       
   227         
       
   228         // layout id
       
   229         TInt iFlags;
       
   230         
       
   231         // heading text
       
   232         HBufC* iHeadingText;
       
   233         
       
   234         // closing icon
       
   235         CAknButton* iClosingIcon;
       
   236         
       
   237         
       
   238         // If the content of this control has pointer grabbed, the popup is not 
       
   239         // hidden. This boolean tells other pointer event than event drag event 
       
   240         // has occured so then pointer grab does not matter and popup can be closed. 
       
   241         TBool iCloseMenu;
       
   242         
       
   243         // It is true when user clicks the popup, transfer pointer up event to its child control
       
   244         TBool iAllowUpEvent;
       
   245 
       
   246     };
       
   247 
       
   248 #endif // AKNPREVIEWPOPUP_H
       
   249 
       
   250 //  End of File