|
Nokia N97 SDK Example Applications Guide |
1. About this Example
2. Architecture
3. Design and Implementation
The following UML diagram shows key classes of the Listbox example application. Classes indicated by yellow color are classes of listbox example and classes indicated by blue are concrete listbox control classes.
Following screen is displayed after selecting "Options" -> "Change listbox" -> "Graphic style listbox". Each listbox item of listbox has an icon. It is possible to add and remove listbox items, change listbox type, and exit the application. Note that the class name of this listbox control is displayed on the navigation pane. In this view the MSK can open context specific options menu with "Add item" and "Remove item" items.
Following screen is displayed after selecting "Options" -> "Change listbox" -> "Setting style listbox". This view contains a setting listbox. By selecting "Options" -> "Change" or pressing the "Change" middle softkey, it is possible to modify setting item value on setting page. Also from this view it is possible to change listbox type, exit the application, and see the listbox control class name on the navigation pane. It is possible to change the setting item value py pressing the MSK.
For detailed information about constructing listbox from resource and at run-time, refer to SDK documentation Lists API: Using Lists API
void CListboxGraphicContainer::SetIconsL() { CArrayPtr<CGulIcon>* iconList = new (ELeave) CAknIconArray(1); // push iconarray to stack CleanupStack::PushL(iconList); User::LeaveIfError( iFsSession.Connect() ); // Let other sessions to use this. ShareProtected() must be called for // enabling other other threads in this process to use this handle. iFsSession.ShareProtected(); TBuf<256> path; iFsSession.PrivatePath( path ); path.Append( KMifFileName() ); // insert the drive to the private path TParsePtrC parse( (CEikonEnv::Static()->EikAppUi()->Application())->AppFullName() ); path.Insert( 0, parse.Drive() ); CFbsBitmap* bitmap = NULL; CFbsBitmap* mask = NULL; iFileProvider = CIconFileProvider::NewL( iFsSession, path ); // Create icons. This function uses CIconFileProvider to pass handle to // icon file (which lies in application private directory) to AknIcon // server. This server does not have access to private directories. AknIconUtils::CreateIconL(bitmap, mask, *iFileProvider, EMbmListbox_bitmapsListbox_icon, EMbmListbox_bitmapsListbox_icon_mask); CGulIcon* newIcon = CGulIcon::NewL( bitmap, mask ); iconList->AppendL( newIcon ); iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconList ); CleanupStack::Pop(iconList); }
After calling the CreateIconL() function, icon framework retrieves the specified icon via given MAknIconFileProvider, using MAknIconFileProvider::RetrieveIconFileHandleL().
void CIconFileProvider::RetrieveIconFileHandleL( RFile& aFile, const TIconFileType aType ) { ... User::LeaveIfError(aFile.Open(iSession, filename, EFileShareAny)); }
When one item is selected using selection key, the base class calls the EditItemL method. It is implemented in CListboxSettingList class. On this method, a corresponding setting page is launched by calling base class version of EditItemL.
For more information about using setting lists and setting pages, refer to SDK documentation SettingPages API: Using Setting Pages API.
For more information about using MSK, refer to SDK documentation Middle Softkey (MSK) Guide for Applications.
|
© Nokia 2009 |