uifw/AvKon/inc/akndiscreetpopupcontrol.h
changeset 0 2f259fa3e83a
child 19 aecbbf00d063
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Avkon discreet popup control
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_AKNDISCREETPOPUPCONTROL_H
       
    19 #define C_AKNDISCREETPOPUPCONTROL_H
       
    20 
       
    21 #include <AknControl.h>
       
    22 #include <AknsConstants.h>
       
    23 #include <babitflags.h>
       
    24 #include <touchfeedback.h>
       
    25 
       
    26 
       
    27 class CAknAppUi;
       
    28 class CAknDiscreetPopupDrawer;
       
    29 class CGulIcon;
       
    30 class MEikCommandObserver;
       
    31 
       
    32 /**
       
    33  *  Akn Discreet Popup control.
       
    34  *  Discreet popup actual control.
       
    35  *
       
    36  *  @lib avkon
       
    37  *  @since S60 v5.2
       
    38  */
       
    39 NONSHARABLE_CLASS( CAknDiscreetPopupControl ) : public CAknControl
       
    40     {
       
    41 
       
    42 public:
       
    43     
       
    44     /**  Discreet popup control action definition */
       
    45     enum TAknDiscreetPopupAction
       
    46         {
       
    47         EAknDiscreetPopupShow = 1,
       
    48         EAknDiscreetPopupHide,
       
    49         EAknDiscreetPopupAnotherLaunched
       
    50         };
       
    51 
       
    52     /**
       
    53      * Two-phased constructor.
       
    54      *
       
    55      * @param aGlobal ETrue if global.
       
    56      * @param aTitle First line of text. 
       
    57      * @param aText Second line of text.
       
    58      * @param aIcon Icon.
       
    59      * @param aSkinId Icon skin item id.
       
    60      * @param aBitmapFile Icon bitmap file.
       
    61      * @param aBitmapId Icon bitmap id.
       
    62      * @param aMaskId Icon mask id.
       
    63      * @param aFlags Popup duration.
       
    64      * @param aCommand Popup command id.
       
    65      * @param aPopupId Popup id.
       
    66      * @param aCommandObserver Popup command observer.
       
    67      */
       
    68     IMPORT_C static CAknDiscreetPopupControl* NewL( 
       
    69         const TBool aGlobal,
       
    70         const TDesC& aTitle, 
       
    71         const TDesC& aText,
       
    72         CGulIcon* aIcon,
       
    73         const TAknsItemID& aSkinId,
       
    74         const TDesC& aBitmapFile,
       
    75         const TInt& aBitmapId,
       
    76         const TInt& aMaskId,
       
    77         const TInt& aFlags,
       
    78         const TInt& aCommand,
       
    79         const TInt& aPopupId,
       
    80         MEikCommandObserver* aCommandObserver );
       
    81 
       
    82     /**
       
    83      * Two-phased constructor.
       
    84      * 
       
    85      * @param aGlobal ETrue if global.
       
    86      * @param aResourceId Popup resource id.
       
    87      * @param aResourceFile Popup resource file.
       
    88      * @param aCommand Popup command id.
       
    89      * @param aPopupId Popup id.
       
    90      * @param aCommandObserver Popup command observer.
       
    91      */
       
    92     IMPORT_C static CAknDiscreetPopupControl* NewL( 
       
    93         const TBool aGlobal,
       
    94         const TInt& aResourceId,
       
    95         const TDesC& aResourceFile,
       
    96         const TInt& aCommand,
       
    97         const TInt& aPopupId,
       
    98         MEikCommandObserver* aCommandObserver );
       
    99 
       
   100     /**
       
   101      * Two-phased constructor.
       
   102      * 
       
   103      * @param aGlobal ETrue if global.
       
   104      * @param aTitle First line of text. 
       
   105      * @param aText Second line of text.
       
   106      * @param aIcon Icon.
       
   107      * @param aSkinId Icon skin item id.
       
   108      * @param aBitmapFile Icon bitmap file.
       
   109      * @param aBitmapId Icon bitmap id.
       
   110      * @param aMaskId Icon mask id.
       
   111      * @param aFlags Popup duration.
       
   112      * @param aCommand Popup command id.
       
   113      * @param aPopupId Popup id.
       
   114      * @param aCommandObserver Popup command observer.
       
   115      */
       
   116     static CAknDiscreetPopupControl* NewLC( 
       
   117         const TBool aGlobal,
       
   118         const TDesC& aTitle, 
       
   119         const TDesC& aText, 
       
   120         CGulIcon* aIcon, 
       
   121         const TAknsItemID& aSkinId,
       
   122         const TDesC& aBitmapFile,
       
   123         const TInt& aBitmapId,
       
   124         const TInt& aMaskId,
       
   125         const TInt& aFlags, 
       
   126         const TInt& aCommand,
       
   127         const TInt& aPopupId, 
       
   128         MEikCommandObserver* aCommandObserver );
       
   129 
       
   130     /**
       
   131      * Two-phased constructor.
       
   132      * 
       
   133      * @param aGlobal ETrue if global.
       
   134      * @param aCommand Popup command id.
       
   135      * @param aPopupId Popup id.
       
   136      * @param aCommandObserver Popup command observer.
       
   137      */
       
   138     static CAknDiscreetPopupControl* NewLC( 
       
   139         const TBool aGlobal,
       
   140         const TInt& aCommand,
       
   141         const TInt& aPopupId,
       
   142         MEikCommandObserver* aCommandObserver );
       
   143 
       
   144     /**
       
   145     * Destructor.
       
   146     */
       
   147     virtual ~CAknDiscreetPopupControl();
       
   148 
       
   149     /**
       
   150      * Handles discreet popup action.
       
   151      * 
       
   152      * @param aType Popup action type.
       
   153      *
       
   154      * @since S60 v5.2
       
   155      */
       
   156     IMPORT_C void HandleDiscreetPopupActionL( const TInt& aType );
       
   157 
       
   158     /**
       
   159      * Returns unique id of this popup control.
       
   160      *
       
   161      * @since S60 v5.2
       
   162      * @return Id of this popup control.
       
   163      */
       
   164     IMPORT_C TInt PopupId();
       
   165 
       
   166     /**
       
   167      * Timer callback.
       
   168      *
       
   169      * @since S60 v5.2
       
   170      * @param aObject
       
   171      * @return
       
   172      */
       
   173     static TInt TimeOut( TAny* aObject );
       
   174 
       
   175 // from base class CAknControl
       
   176 
       
   177     /**
       
   178      * From CAknControl.
       
   179      * Sets this control as visible or invisible.
       
   180      *
       
   181      * @since S60 v5.2
       
   182      * @param aVisible ETrue to make the control visible, EFalse to make it invisible.
       
   183      */
       
   184     void MakeVisible( TBool aVisible );
       
   185 
       
   186 private:
       
   187 
       
   188     /**
       
   189      * C++ constructor.
       
   190      */
       
   191     CAknDiscreetPopupControl( const TBool& aGlobal, 
       
   192                               const TInt& aFlags,
       
   193                               const TInt& aCommand,
       
   194                               const TInt& aPopupId, 
       
   195                               MEikCommandObserver* aCommandObserver );
       
   196  
       
   197     /**
       
   198      * Symbian second-phase constructor.
       
   199      */
       
   200     void ConstructL();
       
   201 
       
   202     /**
       
   203      * Constructs the popup drawer.
       
   204      *
       
   205      * @param aTitleText First text row.
       
   206      * @param aBodyText Second text row.
       
   207      * @param aIcon Popup icon.
       
   208      * @param aSkinId Icon skin item id.
       
   209      * @param aBitmapFile Icon bitmap file.
       
   210      * @param aBitmapId Icon bitmap id.
       
   211      * @param aMaskId Icon mask id.
       
   212      */
       
   213     void ConstructDrawerL( const TDesC& aTitleText, 
       
   214                            const TDesC& aBodyText,
       
   215                            CGulIcon* aIcon,
       
   216                            const TAknsItemID& aSkinId = KAknsIIDNone,
       
   217                            const TDesC& aBitmapFile = KNullDesC,
       
   218                            const TInt& aBitmapId = 0,
       
   219                            const TInt& aMaskId = 0 );
       
   220 
       
   221     /**
       
   222      * Constructs the popup from resources.
       
   223      *
       
   224      * @param aResourceId Resource id.
       
   225      * @param aResourceFile Resource file.
       
   226      */
       
   227     void ConstructFromResourceL( 
       
   228             const TInt& aResourceId,
       
   229             const TDesC& aResourceFile );
       
   230             
       
   231     /**
       
   232      * Performs operations needed on timer callback.
       
   233      */
       
   234     void DoTimeOut();
       
   235         
       
   236     /**
       
   237      * Popup exit when popup is completely invisible.
       
   238      */
       
   239     void RequestExitL();
       
   240 
       
   241     /**
       
   242      * Notifies command observer of user command.
       
   243      */
       
   244     void NotifyObserverL();
       
   245     
       
   246     /**
       
   247      * Requests tactile feedback for popup.
       
   248      *
       
   249      * @param aType Feedback type.
       
   250      */
       
   251     void ImmediateFeedback( TTouchLogicalFeedback aType );
       
   252 
       
   253     /**
       
   254      * Updates popup window nonfading status.
       
   255      */
       
   256     void UpdateNonFadingStatus();
       
   257 
       
   258     /**
       
   259      * Sets pressed down state.
       
   260      * 
       
   261      * @param aPressedDown ETrue if popup is pressed-down.
       
   262      */
       
   263     void SetPressedDownState( const TBool& aPressedDown );
       
   264 
       
   265     /**
       
   266      * Shows the popup.
       
   267      */
       
   268     void ShowPopupL();
       
   269 
       
   270     /**
       
   271      * Hides the popup.
       
   272      */
       
   273     void HidePopup();
       
   274 
       
   275     /**
       
   276      * Provides app ui of this control.
       
   277      * 
       
   278      * @return AppUi.
       
   279      */
       
   280     CAknAppUi* AppUi();
       
   281 
       
   282     /**
       
   283      * Plays popup tone if one defined.
       
   284      */
       
   285     void PlayTone();
       
   286 
       
   287 // from base class CAknControl
       
   288 
       
   289     /**
       
   290      * From CAknControl.
       
   291      * Constructs the control from a resource file.
       
   292      *
       
   293      * @since S60 v5.2
       
   294      * @param aReader The resource reader, with which to access the 
       
   295      * control's resource values.
       
   296      */
       
   297     void ConstructFromResourceL( TResourceReader &aReader );
       
   298 
       
   299     /**
       
   300      * From CAknControl.
       
   301      * Draws the control.
       
   302      *
       
   303      * @since S60 v5.2
       
   304      * @param aRect The region of the control to be redrawn.
       
   305      */
       
   306     void Draw( const TRect& aRect ) const;
       
   307 
       
   308     /**
       
   309      * From CAknControl.
       
   310      * Handles a change to the control's resources.
       
   311      *
       
   312      * @since S60 v5.2
       
   313      * @param aType A message UID value.
       
   314      */
       
   315     void HandleResourceChange( TInt aType );
       
   316 
       
   317     /**
       
   318      * From CAknControl.
       
   319      * Handles pointer events.
       
   320      *
       
   321      * @since S60 v5.2
       
   322      * @param aPointerEvent The pointer event. 
       
   323      */
       
   324     void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   325 
       
   326 private: // data
       
   327 
       
   328     /**
       
   329      * The window group of the popup, if global.
       
   330      */
       
   331     RWindowGroup iWindowGroup;
       
   332 
       
   333     /**
       
   334      * Timer
       
   335      * Own.
       
   336      */
       
   337     CPeriodic* iTimer;
       
   338 
       
   339     /**
       
   340      * Popup flags.
       
   341      */
       
   342     TInt iFlags;
       
   343         
       
   344     /**
       
   345      * Command associated with this popup.
       
   346      */
       
   347     TInt iCommand;
       
   348     
       
   349     /**
       
   350      * Unique id of this popup.
       
   351      */
       
   352     TInt iPopupId;
       
   353         
       
   354     /**
       
   355      * Command observer.
       
   356      * Not own.
       
   357      */
       
   358     MEikCommandObserver* iCommandObserver;
       
   359 
       
   360     /**
       
   361      * Popup drawer.
       
   362      * Own.
       
   363      */
       
   364     CAknDiscreetPopupDrawer* iDrawer;
       
   365     
       
   366     /**
       
   367      * Internal control flags.
       
   368      */
       
   369     TBitFlags iInternalFlags;
       
   370     
       
   371     /**
       
   372      * Touch feedback instance.
       
   373      * Not own.
       
   374      */
       
   375     MTouchFeedback* iFeedBack;
       
   376     
       
   377     };
       
   378 
       
   379 #endif // C_AKNDISCREETPOPUPCONTROL_H