Nokia N97 SDK
Example Applications Guide

CDynamicSettingListAppView Class Reference

#include <DynamicSettingListAppview.h>

Inheritance diagram for CDynamicSettingListAppView:

List of all members.

Detailed Description

A view class for a dynamic setting list.

Definition at line 28 of file DynamicSettingListAppview.h.


Public Member Functions

void  ConstructL (const TRect &aRect)
  CDynamicSettingListAppView ()
  ~CDynamicSettingListAppView ()

Private Member Functions

void  Draw (const TRect &aRect) const
TInt  CountComponentControls () const
CCoeControl *  ComponentControl (TInt aIndex) const
TKeyResponse  OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType)
void  LoadListL ()
void  StoreSettingsL ()

Private Attributes

CAknSettingItemList *  iItemList
TBuf< KMaxTextLength >  iText
TBuf< KMaxPasswordLength >  iPassword
TInt  iNumber
TInt  iVolume
TInt  iSlider
TTime  iDate
TTimeIntervalSeconds  iTime
TInetAddr  iIp
TInt  iEnumText
TBool  iBinary


Constructor & Destructor Documentation

CDynamicSettingListAppView::CDynamicSettingListAppView (   ) 
 

Constructor

Definition at line 43 of file DynamicSettingListAppview.cpp.

References iDate.

00044     : iVolume(KDefaultVolume), iIp(KDefaultIp, KDefaultIpPort)
00045     {
00046     iDate.HomeTime();
00047     }

CDynamicSettingListAppView::~CDynamicSettingListAppView (   ) 
 

Destructor

Definition at line 50 of file DynamicSettingListAppview.cpp.

References iItemList.

00051     {
00052     delete iItemList;
00053     }


Member Function Documentation

void CDynamicSettingListAppView::ConstructL (  const TRect &  aRect  ) 
 

Symbian OS default constructor.

Definition at line 60 of file DynamicSettingListAppview.cpp.

References iItemList, and LoadListL().

Referenced by CDynamicSettingListAppUi::ConstructL().

00061     {
00062     // Create a window for this application view
00063     CreateWindowL();
00064 
00065     iItemList = new (ELeave) CAknSettingItemList;
00066     iItemList->SetMopParent(this);
00067     iItemList->ConstructFromResourceL(R_ENTRY_SETTINGS_LIST);
00068 
00069     LoadListL();
00070 
00071     iItemList->MakeVisible(ETrue);
00072     iItemList->SetRect(aRect);
00073     iItemList->ActivateL();
00074     iItemList->ListBox()->UpdateScrollBarsL();
00075     iItemList->DrawNow();
00076 
00077     // Set the windows size
00078     SetRect(aRect);
00079 
00080     // Activate the window, which makes it ready to be drawn
00081     ActivateL();
00082     }

void CDynamicSettingListAppView::Draw (  const TRect &  aRect  )  const [private]
 

From CCoeControl,Draw.

Definition at line 91 of file DynamicSettingListAppview.cpp.

00092     {
00093     // Get the standard graphics context
00094     CWindowGc& gc = SystemGc();
00095 
00096     // Gets the control's extent
00097     TRect rect = Rect();
00098 
00099     // Clears the screen
00100     gc.Clear(rect);
00101     }

TInt CDynamicSettingListAppView::CountComponentControls (   )  const [private]
 

From CoeControl,CountComponentControls.

Definition at line 109 of file DynamicSettingListAppview.cpp.

References iItemList.

00110     {
00111     TInt count = 0;
00112     if (iItemList)
00113         count++;
00114     return count;
00115     }

CCoeControl * CDynamicSettingListAppView::ComponentControl (  TInt  aIndex  )  const [private]
 

From CCoeControl,ComponentControl.

Definition at line 122 of file DynamicSettingListAppview.cpp.

References iItemList.

00123     {
00124     return iItemList;
00125     }

TKeyResponse CDynamicSettingListAppView::OfferKeyEventL (  const TKeyEvent &  aKeyEvent,
TEventCode  aType
)  [private]
 

From CCoeControl,OfferKeyEventL.

Definition at line 135 of file DynamicSettingListAppview.cpp.

References iItemList.

00137     {
00138     if(aType != EEventKey)
00139         {
00140         return EKeyWasNotConsumed;
00141         }
00142     else if(iItemList)
00143         {
00144         return iItemList->OfferKeyEventL( aKeyEvent, aType );
00145         }
00146     else
00147         {
00148         return EKeyWasNotConsumed;
00149         }
00150 
00151     }

void CDynamicSettingListAppView::LoadListL (   )  [private]
 

Loads the setting list dynamically.

Definition at line 158 of file DynamicSettingListAppview.cpp.

References iBinary, iDate, iEnumText, iIp, iItemList, iNumber, iPassword, iSlider, iText, iTime, and iVolume.

Referenced by ConstructL().

00159     {
00160     TBool isNumberedStyle = iItemList->IsNumberedStyle();
00161     CArrayPtr<CGulIcon>* icons = iItemList->ListBox()->ItemDrawer()->FormattedCellData()->IconArray();
00162 
00163 
00164     /* Text setting item */
00165     CAknTextSettingItem* item = new (ELeave) CAknTextSettingItem(1, iText);
00166     CleanupStack::PushL(item);
00167     item->SetEmptyItemTextL( KEmptyText );
00168     // The same resource id can be used for multiple text setting pages.
00169     item->ConstructL(isNumberedStyle, 1, KName, icons, R_TEXT_SETTING_PAGE, -1);
00170     iItemList->SettingItemArray()->AppendL(item);
00171     CleanupStack::Pop(item);
00172 
00173 
00174     /* Integer setting item */
00175     CAknIntegerEdwinSettingItem* item2 = new (ELeave) CAknIntegerEdwinSettingItem(2, iNumber);
00176     CleanupStack::PushL(item2);
00177     // The same resource id can be used for multiple integer setting pages.
00178     item2->ConstructL(isNumberedStyle, 2, KName2, icons, R_INTEGER_SETTING_PAGE, -1);
00179     iItemList->SettingItemArray()->AppendL(item2);
00180     CleanupStack::Pop(item2);
00181 
00182 
00183     /* Password setting item */
00184     CAknPasswordSettingItem* item3 = new (ELeave) CAknPasswordSettingItem(  3,
00185                                                                             CAknPasswordSettingItem::EAlpha,
00186                                                                             iPassword);
00187     CleanupStack::PushL(item3);
00188     item3->SetEmptyItemTextL( KEmptyText );
00189     // The same resource id can be used for multiple password setting pages.
00190     item3->ConstructL(isNumberedStyle, 3, KName3, icons, R_PASSWORD_SETTING_PAGE, -1);
00191     iItemList->SettingItemArray()->AppendL(item3);
00192     CleanupStack::Pop(item3);
00193 
00194 
00195     /* Volume setting item */
00196     CAknVolumeSettingItem* item4 = new (ELeave) CAknVolumeSettingItem(4, iVolume);
00197     CleanupStack::PushL(item4);
00198     // The same resource id can be used for multiple volume setting pages.
00199     item4->ConstructL(isNumberedStyle, 4, KName4, icons, R_VOLUME_SETTING_PAGE, -1);
00200     iItemList->SettingItemArray()->AppendL(item4);
00201     CleanupStack::Pop(item4);
00202 
00203 
00204    /* Slider setting item. Read comments in CDynamicSettingListSlider, why
00205     * a derived class is used instead of CAknSliderSettingItem
00206     */
00207     CDynamicSettingListSlider* item5 = new (ELeave) CDynamicSettingListSlider(5, iSlider);
00208     CleanupStack::PushL(item5);
00209     // The same resource id can be used for multiple slider setting pages.
00210     item5->ConstructL(isNumberedStyle, 5, KName5, icons, R_SLIDER_SETTING_PAGE, -1);
00211     iItemList->SettingItemArray()->AppendL(item5);
00212     CleanupStack::Pop(item5);
00213 
00214 
00215     /* Date setting item */
00216     CAknTimeOrDateSettingItem* item6 = new (ELeave) CAknTimeOrDateSettingItem(  6,
00217                                                                                 CAknTimeOrDateSettingItem::EDate,
00218                                                                                 iDate);
00219     CleanupStack::PushL(item6);
00220     // The same resource id can be used for multiple date setting pages.
00221     item6->ConstructL(isNumberedStyle, 6, KName6, icons, R_DATE_SETTING_PAGE, -1);
00222     iItemList->SettingItemArray()->AppendL(item6);
00223     CleanupStack::Pop(item6);
00224 
00225 
00226     /* Time offset setting item */
00227     CAknTimeOffsetSettingItem* item7 = new (ELeave) CAknTimeOffsetSettingItem(7, iTime);
00228     CleanupStack::PushL(item7);
00229     // The same resource id can be used for multiple time offset setting pages.
00230     item7->ConstructL(isNumberedStyle, 7, KName7, icons, R_TIMEOFFSET_SETTING_PAGE, -1);
00231     iItemList->SettingItemArray()->AppendL(item7);
00232     CleanupStack::Pop(item7);
00233 
00234 
00235     /* Ip field setting item */
00236     CAknIpFieldSettingItem* item8 = new (ELeave) CAknIpFieldSettingItem(8, iIp);
00237     CleanupStack::PushL(item8);
00238     // The same resource id can be used for multiple ip field setting pages.
00239     item8->ConstructL(isNumberedStyle, 8, KName8, icons, R_IPFIELD_SETTING_PAGE, -1);
00240     iItemList->SettingItemArray()->AppendL(item8);
00241     CleanupStack::Pop(item8);
00242 
00243 
00244     /* Enumerated text setting item */
00245     CAknEnumeratedTextPopupSettingItem* item9 = new (ELeave) CAknEnumeratedTextPopupSettingItem(9, iEnumText);
00246     CleanupStack::PushL(item9);
00247     // The same resource id can be used for multiple enumerated text setting pages.
00248     item9->ConstructL(isNumberedStyle, 9, KName9, icons, R_ENUMERATEDTEXT_SETTING_PAGE, -1, 0, R_POPUP_SETTING_TEXTS);
00249 
00250     // Load texts dynamically.
00251     CArrayPtr<CAknEnumeratedText>* texts = item9->EnumeratedTextArray();
00252     texts->ResetAndDestroy();
00253     CAknEnumeratedText* enumText;
00254     // Text 1
00255     HBufC* text = KEnumText1().AllocLC();
00256     enumText = new (ELeave) CAknEnumeratedText(0, text);
00257     CleanupStack::Pop(text);
00258     CleanupStack::PushL(enumText);
00259     texts->AppendL(enumText);
00260     CleanupStack::Pop(enumText);
00261     // Text 2
00262     text = KEnumText2().AllocLC();
00263     enumText = new (ELeave) CAknEnumeratedText(1, text);
00264     CleanupStack::Pop(text);
00265     CleanupStack::PushL(enumText);
00266     texts->AppendL(enumText);
00267     CleanupStack::Pop(enumText);
00268 
00269     iItemList->SettingItemArray()->AppendL(item9);
00270     CleanupStack::Pop(item9);
00271 
00272 
00273     /* Binary popup setting item */
00274     CAknBinaryPopupSettingItem* item10 = new (ELeave) CAknBinaryPopupSettingItem(10, iBinary);
00275     CleanupStack::PushL(item10);
00276     // The same resource id can be used for multiple binary setting pages.
00277     item10->ConstructL(isNumberedStyle, 10, KName10, icons, R_BINARY_SETTING_PAGE, -1, 0, R_BINARY_TEXTS);
00278 
00279     // Load texts dynamically.
00280     texts = item10->EnumeratedTextArray();
00281     texts->ResetAndDestroy();
00282     // Text 1
00283     text = KEnumText1().AllocLC();
00284     enumText = new (ELeave) CAknEnumeratedText(0, text);
00285     CleanupStack::Pop(text);
00286     CleanupStack::PushL(enumText);
00287     texts->AppendL(enumText);
00288     CleanupStack::Pop(enumText);
00289     // Text 2
00290     text = KEnumText2().AllocLC();
00291     enumText = new (ELeave) CAknEnumeratedText(1, text);
00292     CleanupStack::Pop(text);
00293     CleanupStack::PushL(enumText);
00294     texts->AppendL(enumText);
00295     CleanupStack::Pop(enumText);
00296 
00297     // Sets the correct text visible
00298     item10->LoadL();
00299 
00300     iItemList->SettingItemArray()->AppendL(item10);
00301     CleanupStack::Pop(item10);
00302 
00303     // Required when there is only one setting item.
00304     iItemList->SettingItemArray()->RecalculateVisibleIndicesL();
00305 
00306     iItemList->HandleChangeInItemArrayOrVisibilityL();
00307     }

void CDynamicSettingListAppView::StoreSettingsL (   )  [private]
 

Stores the settings of the setting list.

Definition at line 314 of file DynamicSettingListAppview.cpp.

References iItemList.

00315     {
00316     iItemList->StoreSettingsL();
00317     }


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top