00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 #include <CalendarAPIexample.rsg> 
00032 #include "CalendarAPIexampleEntryContainer.h"
00033 #include "CalendarAPIexample.hrh"
00034 #include "CalendarAPIexampleEntryItemList.h"
00035 #include "CalendarAPIexampleDocument.h"
00036 
00037 
00038 
00039 
00040 
00041 CCalendarAPIexampleEntryContainer::CCalendarAPIexampleEntryContainer()
00042     {
00043     }
00044 
00045 
00046 CCalendarAPIexampleEntryContainer::~CCalendarAPIexampleEntryContainer()
00047     {
00048     delete iItemList;
00049     iItemList=NULL;
00050     }
00051 
00052 
00053 CCalendarAPIexampleEntryContainer* CCalendarAPIexampleEntryContainer::NewL(
00054                             const TRect& aRect, 
00055                             const TDesC& aName,
00056                             const TDateTime& aDate,
00057                             const TBool& aAlarm,
00058                             const TDateTime& aAlarmTime,
00059                             const TInt& aSync)
00060     {
00061     CCalendarAPIexampleEntryContainer* self = 
00062         new (ELeave) CCalendarAPIexampleEntryContainer();
00063     CleanupStack::PushL(self);
00064     self->ConstructL(aRect, aName, aDate,aAlarm, aAlarmTime, aSync);
00065     CleanupStack::Pop(self);
00066     return self;
00067     }
00068 
00069 
00070 void CCalendarAPIexampleEntryContainer::ConstructL(
00071                             const TRect& aRect,
00072                             const TDesC& aName,
00073                             const TDateTime& aDate,
00074                             const TBool& aAlarm,
00075                             const TDateTime& aAlarmTime,
00076                             const TInt& aSync)
00077     {
00078     CreateWindowL();    
00079 
00080     iItemList = new (ELeave) CCalendarAPIexampleEntryItemList();
00081     iItemList->SetContainerWindowL(*this); 
00082 
00083     SetValues(aName, aDate,aAlarm, aAlarmTime, aSync);
00084     
00085     
00086     iItemList->ConstructFromResourceL(R_ENTRY_SETTINGS_LIST); 
00087     
00088     SetRect(aRect);
00089     ActivateL();    
00090     }
00091 
00092 void CCalendarAPIexampleEntryContainer::SizeChanged()
00093     {
00094     iItemList->SetRect(Rect());
00095     iItemList->ListBox()->SetRect(Rect());
00096     }
00097 
00098 void CCalendarAPIexampleEntryContainer::HandleResourceChange(TInt aType)
00099     {
00100     CCoeControl::HandleResourceChange(aType);
00101     if ( aType==KEikDynamicLayoutVariantSwitch )
00102         {
00103         TRect rect;
00104         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
00105         SetRect(rect);
00106         }
00107     }
00108 
00109 
00110 
00111 
00112 
00113 
00114 
00115 
00116 TInt CCalendarAPIexampleEntryContainer::CountComponentControls() const
00117     {
00118     TInt count = 0;
00119     if (iItemList)
00120         count++;
00121     return count;
00122     }
00123     
00124 
00125 
00126 
00127 
00128 
00129 CCoeControl* CCalendarAPIexampleEntryContainer::ComponentControl(
00130                                                                 TInt 
00131                                                                 ) const
00132     {
00133     return iItemList;
00134     }
00135     
00136 
00137 
00138 
00139 
00140 
00141 
00142 
00143 
00144 TKeyResponse CCalendarAPIexampleEntryContainer::OfferKeyEventL( 
00145                                                 const TKeyEvent& aKeyEvent, 
00146                                                 TEventCode aType )
00147     {
00148     if(aType != EEventKey)
00149         {
00150         return EKeyWasNotConsumed;
00151         }    
00152     else if(iItemList)
00153         {
00154         return iItemList->OfferKeyEventL( aKeyEvent, aType );
00155         }
00156     else
00157         {
00158         return EKeyWasNotConsumed;
00159         }
00160     
00161     }
00162     
00163 
00164 
00165 
00166 
00167 
00168 
00169 TBool CCalendarAPIexampleEntryContainer::SaveL()
00170     {   
00171     return iItemList->SaveL();
00172     }
00173     
00174 void CCalendarAPIexampleEntryContainer::GetValues(
00175                                 TDes& aName, TTime& aDate,
00176                                 TBool& aAlarm, TTime& aAlarmTime, 
00177                                 TInt& aSync)
00178     {
00179     iItemList->GetValues(aName,aDate,aAlarm,aAlarmTime,aSync);
00180     }
00181 
00182 void CCalendarAPIexampleEntryContainer::SetValues(
00183                             const TDesC& aName,
00184                             const TDateTime& aDate,
00185                             const TBool& aAlarm,
00186                             const TDateTime& aAlarmTime,
00187                             const TInt& aSync)                               
00188     {
00189     iItemList->SetValues(aName,aDate,aAlarm,aAlarmTime,aSync);
00190     }    
00191 
00192