javauis/lcdui_akn/lcdui/inc/CMIDAlert.h
branchRCL_3
changeset 66 2455ef1f5bbc
parent 19 04becd199f91
equal deleted inserted replaced
65:ae942d28ec0e 66:2455ef1f5bbc
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Alert implementation for Series 60
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMIDALERT_H
       
    20 #define CMIDALERT_H
       
    21 
       
    22 // INCLUDES
       
    23 // MMIDAlert interface in class declaration
       
    24 // and some other MMID classes used as parameters in several functions
       
    25 #include <lcdui.h>
       
    26 // using for CCoeControl class in inheritance
       
    27 // using for CEikImage class for CEikImage* CreateImageLC() function
       
    28 // using TTone enumeration
       
    29 #include <AknPopupform.h>
       
    30 // CONSTANTS
       
    31 const TInt KAlertModalCommandCount = 2;
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class CMIDAlertDialog;
       
    35 class MMIDBitmapImage;
       
    36 class CMIDGaugeItem;
       
    37 class CMIDDisplayable;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 NONSHARABLE_CLASS(CMIDAlert) : public CCoeControl, public MMIDAlert
       
    41 {
       
    42 
       
    43 public:
       
    44     static CMIDAlert* NewL(
       
    45         MMIDEnv& aEnv,
       
    46         TAlertType aType,
       
    47         MMIDDisplayable& aDisplayable,
       
    48         const TDesC& aString,
       
    49         MMIDImage* aImage,
       
    50         MMIDUtils* aUtils);
       
    51 
       
    52 public: // Called by the displayable, activates and destroies the alert
       
    53     void HandleCurrentL(TBool aCurrent);
       
    54     inline CMIDAlertDialog* Dialog() const;
       
    55 
       
    56 public: // MMIDAlert
       
    57     void SetStringL(const TDesC& aString);
       
    58     void SetImageL(MMIDImage* aImage);
       
    59     void SetIndicatorL(MMIDGauge* aGauge);
       
    60     void SetTypeL(TAlertType aType);
       
    61     TInt DefaultTimeout();
       
    62     void SetTimeoutL(TInt aTime);
       
    63     void SetModalL();
       
    64     TBool IsModal();
       
    65 
       
    66     void SetTitleL(const TDesC* aTitle);
       
    67     TBool IsScrollable();
       
    68 
       
    69     TInt PlaySound();
       
    70 
       
    71 public: // MMIDComponent
       
    72     inline void Dispose();
       
    73 
       
    74 public: // Called by CMIDAlertDialog
       
    75     void TryToDismissDialog();
       
    76 
       
    77 #ifdef RD_SCALABLE_UI_V2
       
    78     /**
       
    79     * Used by CMIDAlertDialog in detecting long taps.
       
    80     * This function call is forwarded to CMIDDisplayable which contains
       
    81     * the actual implementation.
       
    82     * @param    aPointerEvent The pointer event.
       
    83     * @return   ETrue, if the long tap was detected.
       
    84     */
       
    85     TBool TryDetectLongTapL(const TPointerEvent& aPointerEvent);
       
    86 #endif
       
    87 
       
    88 private:
       
    89     CMIDAlert(MMIDEnv& aEnv,TAlertType aType, MMIDUtils* aUtils);
       
    90     ~CMIDAlert();
       
    91     void ConstructL(MMIDDisplayable& aDisplayable,const TDesC& aString,MMIDImage* aImage);
       
    92 
       
    93 private:
       
    94     TInt SetAlertResourceIdsL();
       
    95     void SetImageOrAnimToDialogL();
       
    96 
       
    97     CEikImage* CreateImageLC() const;
       
    98     void ResizeImage(CFbsBitmap* aImage, CFbsBitmap* aMask) const;
       
    99 
       
   100     void CreateDialogL();
       
   101 
       
   102 private:
       
   103     static TInt TimerCallBack(TAny* aThis);
       
   104     void DoTimerCallBack();
       
   105 
       
   106 protected:
       
   107 
       
   108     void HandleResourceChange(TInt aType);
       
   109 
       
   110 private:
       
   111     MMIDEnv* iEnv;
       
   112     CMIDDisplayable* iDisplayable;
       
   113 
       
   114     /** The type of alert */
       
   115     TAlertType iAlertType;
       
   116 
       
   117     /** For timed alerts, the timeout in seconds */
       
   118     TInt iTimeout;
       
   119 
       
   120     /** The dialog itself */
       
   121     CMIDAlertDialog* iDialog;
       
   122 
       
   123     /** A user given dialog text */
       
   124     HBufC* iUserText;
       
   125 
       
   126     /** The dialog default text */
       
   127     HBufC* iDefaultText;
       
   128 
       
   129     /** The dialog image */
       
   130     MMIDBitmapImage* iBitmapImage;
       
   131 
       
   132 
       
   133     /** The dialog tone */
       
   134     TTone iAlertTone;
       
   135 
       
   136     /** Timed alerts are controlled by this timeout, we cannot use
       
   137     the dialog timeout because dialogs should not be automatically
       
   138     dismissed, only java side dismisses dialogs */
       
   139     CPeriodic* iDialogTimer;
       
   140 
       
   141     /** Used for playing a sound */
       
   142     MMIDUtils* iUtils;
       
   143 
       
   144     /** The dialog animation resource id */
       
   145     TInt iAlertAnimation;
       
   146 };
       
   147 
       
   148 
       
   149 inline CMIDAlertDialog* CMIDAlert::Dialog() const
       
   150 {
       
   151     return iDialog;
       
   152 }
       
   153 #endif // CMIDALERT_H
       
   154 
       
   155 // End of File