calendarui/multicaluidialog/inc/multicaluidialogimpl.h
changeset 0 f979ecb2b13e
child 60 96907930389d
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     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 : implementation class for multiple calendars list dialog.
       
    15  */
       
    16 
       
    17 #ifndef CMultiCalUiDialogImpl_H_
       
    18 #define CMultiCalUiDialogImpl_H_
       
    19 
       
    20 //System include
       
    21 #include <calentry.h>
       
    22 #include <AknDialog.h>
       
    23 #include <coemain.h>
       
    24 #include <eiklbo.h>
       
    25 #include <aknlists.h>
       
    26 #include <AknDialog.h>
       
    27 #include <coecobs.h>
       
    28 #include <eiklbo.h>
       
    29 #include <eikcapc.h>
       
    30 #include "caldblistbox.h"
       
    31 #include"caldblistboxitemdrawer.h"
       
    32 
       
    33 //Forward declarations.
       
    34 class CEikColumnListBox;
       
    35 class TAknsItemID;
       
    36 class CAknIconArray;
       
    37 class CAknDoubleGraphicStyleListBox;
       
    38 class CAknsBasicBackgroundControlContext;
       
    39 class CAknNavigationControlContainer;
       
    40 class CCalenDbListbox;
       
    41 class CGulIcon;
       
    42 class CCalEntry;
       
    43 class CMultiCalUiDialogModel;
       
    44 class MPointerEventObserver;
       
    45 /*
       
    46 enum TCalenListDbIcons
       
    47     {
       
    48     ECalenListDbIconUnMarked,           //  done To-do icon
       
    49     ECalenListDbIconMarked,             //  Undone To-do icon
       
    50     };
       
    51 */
       
    52 
       
    53 NONSHARABLE_CLASS(CMultiCalUiDialogImpl) : public CAknDialog,  public MEikListBoxObserver
       
    54     {
       
    55     public:
       
    56         /**
       
    57          * 1st phase constructor pushes pointer on the cleanup stack
       
    58          * @return CCalenMultiDbUtilityImpl* A pointer to CCalenMultiDbUtilityImpl
       
    59          */
       
    60         static CMultiCalUiDialogImpl* NewL(const RPointerArray<CCalEntry>& aCalEntries);
       
    61         
       
    62         /**
       
    63          * 1st phase constructor pushes pointer on the cleanup stack
       
    64          * @return CCalenMultiDbUtilityImpl* A pointer to CCalenMultiDbUtilityImpl
       
    65          */
       
    66         static CMultiCalUiDialogImpl* NewLC(const RPointerArray<CCalEntry>& aCalEntries);
       
    67 
       
    68          /**
       
    69          * Destructor.
       
    70          */
       
    71         ~CMultiCalUiDialogImpl();
       
    72         
       
    73         /**
       
    74          * Launches the multiple calendars list dialog
       
    75          */
       
    76         TInt LaunchCalenDbListDialogL();
       
    77         
       
    78         /**
       
    79          * @brief From CAknDialog.
       
    80          * @param aDrawNow draw status from CAknDialog.
       
    81          */ 
       
    82         void FocusChanged( TDrawNow aDrawNow );
       
    83         
       
    84     protected:
       
    85         /**
       
    86          * From CEikDialog
       
    87          * @param aResourceId Not used.
       
    88          * @param aMenuPane Not used.
       
    89          */ 
       
    90         void DynInitMenuPaneL( TInt aResourceId,CEikMenuPane* aMenuPane ) ;
       
    91 
       
    92         /**
       
    93          * From MEikMenuObserver.
       
    94          * Hides the menu.
       
    95          * @param aCommandId Not used.
       
    96          */ 
       
    97         void ProcessCommandL( TInt aCommandId ) ;
       
    98 
       
    99         /** 
       
   100          * From CCoeControl.
       
   101          * Handles key events.
       
   102          **/
       
   103         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) ;
       
   104 
       
   105         /** 
       
   106          * From CCoeControl.
       
   107          * Handles pointer events.
       
   108          **/
       
   109         void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   110 
       
   111         /**
       
   112          * From CEikDialog.
       
   113          * Handles a dialog button press for the specified button. 
       
   114          **/
       
   115         TBool OkToExitL(TInt aButtonId) ;
       
   116         
       
   117         /** 
       
   118          * From MObjectProvider. 
       
   119          * Gets Mop supply object of the given type.  
       
   120          * @param aId Identifier for the supply object.
       
   121          * @return Pointer to the supply object type ID.
       
   122          */
       
   123         TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
       
   124 
       
   125         /**
       
   126          * From @c CEikDialog.
       
   127          * Prepare of controls
       
   128          **/
       
   129         void PreLayoutDynInitL();
       
   130 
       
   131         /**
       
   132          * From @c CEikDialog.
       
   133          **/
       
   134         void PostLayoutDynInitL();
       
   135 
       
   136         /**
       
   137          * From @c CCoeControl.
       
   138          * Called when controls extent is set.
       
   139          **/
       
   140         void SizeChanged();
       
   141 
       
   142         /**
       
   143          * From @c CCoeControl.
       
   144          **/ 
       
   145         void HandleResourceChange(TInt aType);
       
   146 
       
   147         /**
       
   148          * From @c CCoeControl.
       
   149          * @param aIndex index of the control
       
   150          * @return Pointer to the Control.
       
   151          **/
       
   152         CCoeControl* ComponentControl( TInt aIndex) const;
       
   153 
       
   154         /**
       
   155          * From @c CCoeControl.
       
   156          * @return Pointer to the Control.
       
   157          **/
       
   158         TInt CountComponentControls() const;
       
   159 
       
   160         /**
       
   161          * From @c CCoeControl.
       
   162          * 
       
   163          * @param aRect
       
   164          **/
       
   165         void Draw(const TRect &aRect) const;
       
   166         
       
   167     private:
       
   168         /**
       
   169          * Class constructor
       
   170          */
       
   171         CMultiCalUiDialogImpl();
       
   172 
       
   173         /**
       
   174          * Second phase constructor
       
   175          */
       
   176         void ConstructL(const RPointerArray<CCalEntry>& aCalEntries);
       
   177         
       
   178     private: //Internal
       
   179         /**
       
   180          * Construction of listbox ui
       
   181          * @return void
       
   182          */
       
   183         void ConstructListL();
       
   184 
       
   185         /** 
       
   186          * Update listbox contents 
       
   187          * @return void
       
   188          */
       
   189         void UpdateListboxL();
       
   190 
       
   191         /**
       
   192          * setup title pane for the status pane
       
   193          * @param aCurrentState 
       
   194          * @return void 
       
   195          */
       
   196         void SetTitlePaneL( TBool aCurrentState );  
       
   197 
       
   198         /**
       
   199          * Load icons into memory
       
   200          * @return void
       
   201          */
       
   202         void PrepareIconsL();
       
   203 
       
   204         /**
       
   205          * Get calendar icon of specific type
       
   206          * @return CGulIcon*
       
   207          */
       
   208         CGulIcon* GetIconL( TCalenListDbIcons aIndex );
       
   209 
       
   210         /**
       
   211          * Creates icon array according to icon index passed in
       
   212          * @return CAknIconArray
       
   213          */
       
   214         CAknIconArray* CreateIconsL();
       
   215 
       
   216         /*
       
   217          * Creates bitmap skinned icon
       
   218          * @param aFilename file 
       
   219          * @param aNormalIconId icon id
       
   220          * @param aNormalMaskId mask id
       
   221          *  @return CGulIcon*     
       
   222          */
       
   223          
       
   224         CGulIcon* CreateBitmapSkinnedIconL(const TAknsItemID& aSkinIconId,
       
   225                 const TDesC& aFilename, 
       
   226                 TInt aNormalIconId,
       
   227                 TInt aNormalMaskId) const;
       
   228 
       
   229         /**
       
   230          * Marks or unmarks the calendar based on user input.
       
   231          * @return void
       
   232          */
       
   233         void MarkUnmarkCalendarL();
       
   234 
       
   235         /**
       
   236          * updates the cba depending upon mark and unmark.
       
   237          * @return void
       
   238          */
       
   239         void UpdateCbaL();
       
   240         
       
   241         // from MEikListBoxObserver
       
   242         /**
       
   243          * Handles list box events.
       
   244          *
       
   245          * This is invoked by CEikListBox to
       
   246          * notify the observer of list box events.
       
   247          *
       
   248          * @param aListBox   The originating list box.
       
   249          * @param aEventType A code for the event. 
       
   250          */          
       
   251         void HandleListBoxEventL( CEikListBox* /*aListBox */,
       
   252             TListBoxEvent aEventType );
       
   253         
       
   254         /*
       
   255         * Async exit for the dialog
       
   256         */
       
   257         static TInt DoAsyncExit(TAny* aPtr);        
       
   258   
       
   259         
       
   260     private: // data
       
   261         CCalenDbListbox*                    iListBox;        
       
   262         CAknsBasicBackgroundControlContext* iBgContext; //Owns
       
   263         CAknNavigationControlContainer*     iNaviContainer;
       
   264         CDesCArrayFlat*                     iDesArray; //Owns
       
   265         TRect                               iRect;
       
   266         RArray<TInt32>                      iColorUidArray;
       
   267         TInt                                iResourceFileOffset;
       
   268         TFileName                           iIconFile;
       
   269         CAknIconArray*                      iIconsList;
       
   270         TBool                               iFirstTap;
       
   271         TBufC<20>                           iTitlepaneText;
       
   272         CMultiCalUiDialogModel*             iMultiCalUiDialogModel;
       
   273         CAsyncCallBack* iAsyncExit;
       
   274         TInt iAsyncExitCmd;
       
   275         
       
   276 
       
   277     private: // Data
       
   278         /// Own: Focus index
       
   279         TInt iFocusIndex;
       
   280         TInt iPrevSelectedItem;
       
   281         
       
   282     };
       
   283 
       
   284 #endif  //CMultiCalUiDialogImpl_H_