calendarui/application/inc/CalenDoc.h
branchRCL_3
changeset 30 bd7edf625bdd
parent 0 f979ecb2b13e
equal deleted inserted replaced
29:12af337248b1 30:bd7edf625bdd
       
     1 /*
       
     2 * Copyright (c) 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:   Calendar Application Document
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CALENDOC_H
       
    21 #define CALENDOC_H
       
    22 
       
    23 // Include files
       
    24 #include <AknDoc.h>                 // CAknDocument
       
    25 
       
    26 // Forward Declarations
       
    27 class CCalenController;             // Calendar Controller
       
    28 
       
    29 /**
       
    30 * CCalenDocument Class Definition
       
    31 * Document class for Calendar application.  The document takes ownership
       
    32 * of the Calendar controller and is responsible for its destruction
       
    33 */
       
    34 NONSHARABLE_CLASS( CCalenDocument ) : public CAknDocument
       
    35     {
       
    36     public:
       
    37         /**
       
    38         * First phase construction
       
    39         * Creates a new CCalenDocument instance
       
    40         * @param aApp Reference to a CCalenApplication
       
    41         */
       
    42         static CCalenDocument* NewL( CEikApplication& aApp );
       
    43 
       
    44         /**
       
    45         * Destructor
       
    46         * Frees all resources used by this class
       
    47         */  
       
    48         virtual ~CCalenDocument();
       
    49     
       
    50     public:
       
    51         /**
       
    52         * Takes ownership of the controller.        
       
    53         * CCalenDocument owns the controller so that any customisation 
       
    54         * plugins that provide custom views can be successfully unloaded.
       
    55         * The CAknAppUi deletes the view array after ~CCalenAppUi has 
       
    56         * been called, therefore the plugins have to be deleted after the
       
    57         * CAknAppUI destructor has been called.        
       
    58         *  
       
    59         * The design of the Eikon framework is that the framework uses 
       
    60         * CreateAppUiL to create the appUi, and later on the AppUi's second
       
    61         * stage constructor is called. As the controller is dependent on the
       
    62         * appUi, it has to created in the AppUi's ConstructL() and ownership
       
    63         * passed to CCalenDocument.
       
    64         */ 
       
    65         void SetController( CCalenController* aController );
       
    66     
       
    67 
       
    68     private:
       
    69         /**
       
    70         * Private constructor
       
    71         * Creates a new CCalenDocument instance
       
    72         * @param aApp Reference to a CCalenApplication
       
    73         */  
       
    74         CCalenDocument( CEikApplication& aApp );
       
    75 
       
    76         /**
       
    77         * From CEikDocument 
       
    78         * Creates a new CCalenAppUi instance
       
    79         * @return CCalenAppUi pointer
       
    80         */
       
    81         CEikAppUi* CreateAppUiL(void);
       
    82         
       
    83     private:
       
    84         /**
       
    85         * The controller is created by the appUi and then passes
       
    86         * ownership to the document class
       
    87         */
       
    88         CCalenController* iController;
       
    89     };
       
    90 
       
    91 
       
    92 #endif  //  CALENDOC_H
       
    93 
       
    94 // End of File