exampleapps/alfexcalendar/inc/alfexcalendarengine.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2006 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __ALFEXCALENDARENGINE_H__
       
    22 #define __ALFEXCALENDARENGINE_H__
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 /* Forward declarations. */
       
    27 
       
    28 
       
    29 //
       
    30 const TInt KAlfExCalendarEngineTextBufferLength = 50;
       
    31 
       
    32 /**
       
    33 * CAlfExCalendarEngine is a class that gives data to be displayed in 
       
    34 * alfexcalendar example application.
       
    35 */
       
    36 class CAlfExCalendarEngine : public CBase
       
    37     {
       
    38 public:
       
    39     /* Constructors and destructor. */
       
    40 
       
    41     /**
       
    42      * Constructor
       
    43      */	
       
    44     static CAlfExCalendarEngine* NewL();
       
    45     
       
    46     /**
       
    47      * Constructor
       
    48      */
       
    49     static CAlfExCalendarEngine* NewLC();
       
    50     
       
    51     /**
       
    52      * Destructor.
       
    53      */
       
    54 	virtual ~CAlfExCalendarEngine();
       
    55 	
       
    56 public:
       
    57 	
       
    58 	
       
    59     /* Methods. */
       
    60 
       
    61     /** @beginAPI */
       
    62 
       
    63     /**
       
    64      * Loads calendar events for current month.
       
    65      *
       
    66      * @param aDate: day information
       
    67      */
       
    68     void LoadCalendarEventsL( const TTime& aDate );
       
    69 
       
    70     /**
       
    71      * Returns true if calendar event is available for requested day. 
       
    72      *
       
    73      * @param aDate: day information
       
    74      * @return true or false
       
    75      */
       
    76     TBool EventsAvailable( const TTime& aDate );
       
    77     
       
    78     /**
       
    79      * Returns number of calendar events in requested day. 
       
    80      *
       
    81      * @param aDate: day information
       
    82      * @return number of events in requested day.
       
    83      *
       
    84      * @todo: or should we just return array of texts ?
       
    85      */
       
    86     TInt NumberOfEvents( const TTime& aDate );
       
    87     
       
    88     /**
       
    89      * Returns number of calendar events in requested day. 
       
    90      *
       
    91      * @param aDate: day information
       
    92      * @param aIndex: index of the event between 0...x-1, where x=NumberOfEvents().
       
    93      * @param aTextBuffer: text buffer where event information text is copied. 
       
    94      *        Must be at least XX characters long.
       
    95      *
       
    96      * @todo: should this return HBufC* instead of aTextBuffer parameter?
       
    97      */
       
    98     void GetEventInformation( const TTime& aDate, TInt aIndex, TDes& aTextBuffer );
       
    99 
       
   100     /** @endAPI */
       
   101 
       
   102 private:
       
   103     /* Constructors. */
       
   104 
       
   105     /**
       
   106      * C++ constructor
       
   107      */
       
   108 	CAlfExCalendarEngine();
       
   109 	
       
   110     /**
       
   111      * Second-phase constructor. 
       
   112      */
       
   113 	void ConstructL();
       
   114 	
       
   115 private:
       
   116     /**
       
   117     * Class to embed event text and event time. 
       
   118     * In this implementation only date is significant
       
   119     */
       
   120     class TAlfExCalendarEngineListItem
       
   121         {
       
   122         public:
       
   123             /**
       
   124             *  Date of the event
       
   125             */
       
   126             TTime   iItemDay;
       
   127             
       
   128             /**
       
   129             * Event text visible for the user
       
   130             */
       
   131             TBuf<KAlfExCalendarEngineTextBufferLength> iItemText;
       
   132         };
       
   133 
       
   134     /**
       
   135     * Array definition for the calendar events
       
   136     */
       
   137     typedef RArray<TAlfExCalendarEngineListItem> RAlfExCalendarEngineListItemArray;
       
   138     
       
   139 private:
       
   140     /** Array of events */
       
   141     RAlfExCalendarEngineListItemArray iCalendarEventArray;
       
   142 };
       
   143 
       
   144 #endif // __ALFEXCALENDARENGINE_H__