|
Nokia N97 SDK Example Applications Guide |
#include <HierarchicalColumnListAppView.h>
Inheritance diagram for CHierarchicalColumnListAppView:

This class acts as a contaner for CAknSingleColumnStyleTreeList instance, and provides a bacground control context for the list through mop-chain. Class realizes the MAknTreeListObserver interface, so that it can register itself as an observer of the list in orded to receive list events.
Definition at line 36 of file HierarchicalColumnListAppView.h.
Public Member Functions |
|
| ~CHierarchicalColumnListAppView () | |
| void | ExpandFocusedNode () |
| void | CollapseFocusedNode () |
| void | OpenFocusedItem () |
| TBool | IsListLooping () const |
| void | ChangeLooping () |
| TBool | IsMarqueeOn () const |
| void | ChangeMarquee () |
| TBool | IsMarkable () const |
| void | ChangeMarkable () |
| void | ChangeFunctionIndicatorsL () |
| void | Mark () |
| void | Unmark () |
| void | MarkAll () |
| void | UnmarkAll () |
| void | DynInitOptionsMenuPaneL (CEikMenuPane *aMenuPane) |
| void | DynInitSettingsMenuPaneL (CEikMenuPane *aMenuPane) |
| void | DynInitMarkingMenuPaneL (CEikMenuPane *aMenuPane) |
| TKeyResponse | OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType) |
| TBool | HandleTreeListEvent (CAknTreeList &aList, TAknTreeItemID aItem, TEvent aEvent) |
Static Public Member Functions |
|
| static CHierarchicalColumnListAppView * | NewL (const TRect &aRect) |
| static CHierarchicalColumnListAppView * | NewLC (const TRect &aRect) |
Protected Member Functions |
|
| void | FocusChanged (TDrawNow aDrawNow) |
| void | SizeChanged () |
| TTypeUid::Ptr | MopSupplyObject (TTypeUid aId) |
Private Member Functions |
|
| void | ConstructL (const TRect &aRect) |
| CHierarchicalColumnListAppView () | |
| void | UpdateMskCommand (CAknTreeList &aList, TAknTreeItemID aFocusedItem) |
| void | ChangeMskCommand (TInt aCommandId, TInt aLabelResourceId) |
| void | Draw (const TRect &aRect) const |
Private Attributes |
|
| CAknSingleColumnStyleTreeList * | iList |
| CAknsBasicBackgroundControlContext * | iBgContext |
| TBool | iMarkingModeEnabled |
|
|
Destructor. Destroys the object and releases all memory objects. Definition at line 191 of file HierarchicalColumnListAppView.cpp. References iBgContext, and iList. 00192 { 00193 delete iBgContext; 00194 delete iList; 00195 }
|
|
|
C++ constructor. Performs the first phase of two phase construction. Definition at line 185 of file HierarchicalColumnListAppView.cpp. 00186 : iMarkingModeEnabled( EFalse ) 00187 { 00188 }
|
|
|
Two phased constructor. Creates a CHierarchicalColumnListAppView object, which will draw itself to aRect.
Definition at line 164 of file HierarchicalColumnListAppView.cpp. References NewLC(). Referenced by CHierarchicalColumnListAppUi::ConstructL(). 00166 { 00167 CHierarchicalColumnListAppView* self = 00168 CHierarchicalColumnListAppView::NewLC( aRect ); 00169 CleanupStack::Pop( self ); 00170 return self; 00171 }
|
|
|
Two phased constructor. Creates a CHierarchicalColumnListAppView object, which will draw itself to aRect.
Definition at line 174 of file HierarchicalColumnListAppView.cpp. References ConstructL(). Referenced by NewL(). 00176 { 00177 CHierarchicalColumnListAppView* self = 00178 new ( ELeave ) CHierarchicalColumnListAppView; 00179 CleanupStack::PushL( self ); 00180 self->ConstructL( aRect ); 00181 return self; 00182 }
|
|
|
Expands currently focused node in the displayed list. Definition at line 242 of file HierarchicalColumnListAppView.cpp. References iList. Referenced by CHierarchicalColumnListAppUi::HandleCommandL(). 00243 { 00244 if ( iList ) 00245 { 00246 // Get focused item ID. 00247 TAknTreeItemID focused = iList->FocusedItem(); 00248 00249 // Check that focused item is a node and then expand it. 00250 if ( focused != KAknTreeIIDNone && iList->IsNode( focused ) ) 00251 { 00252 iList->ExpandNode( focused, ETrue ); 00253 } 00254 } 00255 }
|
|
|
Collapses currently focused node in the displayed list. Definition at line 262 of file HierarchicalColumnListAppView.cpp. References iList. Referenced by CHierarchicalColumnListAppUi::HandleCommandL(). 00263 { 00264 if ( iList ) 00265 { 00266 // Get focused item ID. 00267 TAknTreeItemID focused = iList->FocusedItem(); 00268 00269 // Check that focused item is a node and then collapse it. 00270 if ( focused != KAknTreeIIDNone && iList->IsNode( focused ) ) 00271 { 00272 iList->CollapseNode( focused, ETrue ); 00273 } 00274 } 00275 }
|
|
|
Opens currently focused item in the displayed list. Definition at line 282 of file HierarchicalColumnListAppView.cpp. References iList. Referenced by CHierarchicalColumnListAppUi::HandleCommandL(). 00283 { 00284 if ( iList ) 00285 { 00286 // Get focused item ID. 00287 TAknTreeItemID focused = iList->FocusedItem(); 00288 00289 // Get item type of focused item. 00290 CAknSingleColumnStyleTreeList::TItemType type = 00291 iList->ItemType( focused ); 00292 00293 // If focused item is core data row, remove emphasis from the item. 00294 if ( type == CAknSingleColumnStyleTreeList::ECoreDataRow ) 00295 { 00296 iList->SetEmphasis( focused, EFalse, ETrue ); 00297 } 00298 } 00299 }
|
|
|
Checks whether the list is looping. Definition at line 306 of file HierarchicalColumnListAppView.cpp. References iList. Referenced by DynInitSettingsMenuPaneL().
|
|
|
Toggles the looping setting. Definition at line 316 of file HierarchicalColumnListAppView.cpp. References iList. Referenced by CHierarchicalColumnListAppUi::HandleCommandL(). 00317 { 00318 if ( iList ) 00319 { 00320 iList->SetFlags( iList->Flags() ^ KAknTreeListLooping ); 00321 } 00322 }
|
|
|
Checks whether marquee scrolling is enabled in the list. Definition at line 333 of file HierarchicalColumnListAppView.cpp. Referenced by DynInitSettingsMenuPaneL().
|
|
|
Toggles the marquee setting. Definition at line 343 of file HierarchicalColumnListAppView.cpp. Referenced by CHierarchicalColumnListAppUi::HandleCommandL(). 00344 { 00345 if ( iList ) 00346 { 00347 iList->SetFlags( iList->Flags() ^ KAknTreeListMarqueeScrolling ); 00348 } 00349 }
|
|
|
Checks whether list is set markable. Definition at line 360 of file HierarchicalColumnListAppView.cpp. Referenced by DynInitSettingsMenuPaneL().
|
|
|
Toggles the markable setting. Definition at line 370 of file HierarchicalColumnListAppView.cpp. Referenced by CHierarchicalColumnListAppUi::HandleCommandL(). 00371 { 00372 if ( iList ) 00373 { 00374 iList->SetFlags( iList->Flags() ^ KAknTreeListMarkable ); 00375 } 00376 }
|
|
|
Changes the used collapse/expand function indicators. Definition at line 383 of file HierarchicalColumnListAppView.cpp. Referenced by CHierarchicalColumnListAppUi::HandleCommandL(). 00384 { 00385 if ( iList ) 00386 { 00387 iList->EnableTabModeFunctionIndicatorsL( 00388 !iList->TabModeFunctionIndicators() ); 00389 } 00390 }
|
|
|
Marks the focused list item. Definition at line 397 of file HierarchicalColumnListAppView.cpp. Referenced by CHierarchicalColumnListAppUi::HandleCommandL(). 00398 { 00399 if ( iList && iList->FocusedItem() != KAknTreeIIDNone ) 00400 { 00401 iList->SetMarked( iList->FocusedItem(), ETrue, ETrue ); 00402 } 00403 }
|
|
|
Unmarks the focused list item. Definition at line 410 of file HierarchicalColumnListAppView.cpp. Referenced by CHierarchicalColumnListAppUi::HandleCommandL(). 00411 { 00412 if ( iList && iList->FocusedItem() != KAknTreeIIDNone ) 00413 { 00414 iList->SetMarked( iList->FocusedItem(), EFalse, ETrue ); 00415 } 00416 }
|
|
|
Marks every list item. Definition at line 423 of file HierarchicalColumnListAppView.cpp. Referenced by CHierarchicalColumnListAppUi::HandleCommandL(). 00424 { 00425 if ( iList ) 00426 { 00427 // Every list item can be set marked by setting the tree root as 00428 // the marked item. 00429 iList->SetMarked( KAknTreeIIDRoot, ETrue, ETrue ); 00430 } 00431 }
|
|
|
Unmarks every list item. Definition at line 438 of file HierarchicalColumnListAppView.cpp. Referenced by CHierarchicalColumnListAppUi::HandleCommandL(). 00439 { 00440 if ( iList ) 00441 { 00442 // The marking can be removed from every list item by specifying 00443 // the tree root as the unmarked item. 00444 iList->SetMarked( KAknTreeIIDRoot, EFalse, ETrue ); 00445 } 00446 }
|
|
|
Dynamically initialises a menu pane.
Definition at line 455 of file HierarchicalColumnListAppView.cpp. Referenced by CHierarchicalColumnListAppUi::DynInitMenuPaneL(). 00457 { 00458 if ( iList && iList->FocusedItem() != KAknTreeIIDNone ) 00459 { 00460 if ( iList->IsNode( iList->FocusedItem() ) ) 00461 { 00462 // Focused item is node, remove open command and the invalid one 00463 // of expand and collapse commands. 00464 aMenuPane->DeleteMenuItem( EHclExampleCmdOpen ); 00465 if ( iList->IsExpanded( iList->FocusedItem() ) ) 00466 { 00467 aMenuPane->DeleteMenuItem( EHclExampleCmdExpand ); 00468 } 00469 else 00470 { 00471 aMenuPane->DeleteMenuItem( EHclExampleCmdCollapse ); 00472 } 00473 } 00474 else 00475 { 00476 // Focused item is a leaf, remove expand and collapse commands. 00477 aMenuPane->DeleteMenuItem( EHclExampleCmdExpand ); 00478 aMenuPane->DeleteMenuItem( EHclExampleCmdCollapse ); 00479 } 00480 } 00481 else 00482 { 00483 // No item is focused, remove all related commands. 00484 aMenuPane->DeleteMenuItem( EHclExampleCmdOpen ); 00485 aMenuPane->DeleteMenuItem( EHclExampleCmdExpand ); 00486 aMenuPane->DeleteMenuItem( EHclExampleCmdCollapse ); 00487 } 00488 }
|
|
|
Dynamically initialises a settings menu pane.
Definition at line 495 of file HierarchicalColumnListAppView.cpp. References IsListLooping(), IsMarkable(), and IsMarqueeOn(). Referenced by CHierarchicalColumnListAppUi::DynInitMenuPaneL(). 00497 { 00498 // List looping setting. The menu symbol is set for the item 00499 // depending whether looping is enabled for the list. 00500 if ( IsListLooping() ) 00501 { 00502 aMenuPane->ItemData( EHclExampleCmdChangeLooping ).iFlags 00503 |= EEikMenuItemSymbolOn; 00504 } 00505 else 00506 { 00507 aMenuPane->ItemData( EHclExampleCmdChangeLooping ).iFlags 00508 &= ~EEikMenuItemSymbolOn; 00509 } 00510 00511 // Marquee scrolling setting. The menu symbol is set for the item 00512 // depending whether marquee scrolling is enabled for the list. 00513 if ( IsMarqueeOn() ) 00514 { 00515 aMenuPane->ItemData( EHclExampleCmdChangeMarquee ).iFlags 00516 |= EEikMenuItemSymbolOn; 00517 } 00518 else 00519 { 00520 aMenuPane->ItemData( EHclExampleCmdChangeMarquee ).iFlags 00521 &= ~EEikMenuItemSymbolOn; 00522 } 00523 00524 // Markable list setting. The menu symbol is set for the item 00525 // depending whether list is set markable. 00526 if ( IsMarkable() ) 00527 { 00528 aMenuPane->ItemData( EHclExampleCmdChangeMarkable ).iFlags 00529 |= EEikMenuItemSymbolOn; 00530 } 00531 else 00532 { 00533 aMenuPane->ItemData( EHclExampleCmdChangeMarkable).iFlags 00534 &= ~EEikMenuItemSymbolOn; 00535 } 00536 00537 // Tabulator mode expand/collapse function indicator setting. 00538 // The menu symbol is set for the item depending whether tabulator 00539 // mode function indicators are enabled for the list. 00540 if ( iList && iList->TabModeFunctionIndicators() ) 00541 { 00542 aMenuPane->ItemData( EHclExampleCmdChangeIndicators ).iFlags 00543 |= EEikMenuItemSymbolOn; 00544 } 00545 else 00546 { 00547 aMenuPane->ItemData( EHclExampleCmdChangeIndicators ).iFlags 00548 &= ~EEikMenuItemSymbolOn; 00549 } 00550 }
|
|
|
Dynamically initialises a marking menu pane.
Definition at line 557 of file HierarchicalColumnListAppView.cpp. Referenced by CHierarchicalColumnListAppUi::DynInitMenuPaneL(). 00559 { 00560 if ( iList && iList->FocusedItem() != KAknTreeIIDNone ) 00561 { 00562 if ( iList->IsMarked( iList->FocusedItem() ) ) 00563 { 00564 aMenuPane->DeleteMenuItem( EAknCmdMark ); 00565 } 00566 else 00567 { 00568 aMenuPane->DeleteMenuItem( EAknCmdUnmark ); 00569 } 00570 } 00571 else 00572 { 00573 aMenuPane->DeleteMenuItem( EAknCmdMark ); 00574 aMenuPane->DeleteMenuItem( EAknCmdUnmark ); 00575 } 00576 }
|
|
||||||||||||
|
From CCoeControl. Handles key events. Definition at line 584 of file HierarchicalColumnListAppView.cpp. 00586 { 00587 if ( iList ) 00588 { 00589 return iList->OfferKeyEventL( aKeyEvent, aType ); 00590 } 00591 else 00592 { 00593 return EKeyWasNotConsumed; 00594 } 00595 }
|
|
||||||||||||||||
|
From MAknTreeListObserver. Handles tree list events. Definition at line 604 of file HierarchicalColumnListAppView.cpp. References ChangeMskCommand(), and iMarkingModeEnabled. 00606 { 00607 // This event is received from hierarchical list, when one of the nodes 00608 // in the list is being expanded. In this example, the list contains only 00609 // a static structure, but when the list content is being updated 00610 // dynamically, the content of the node should be updated on this event. 00611 if ( aEvent == ENodeExpanded ) 00612 { 00613 // If the expanded node is currently focused and the list is not in 00614 // the marking mode, the MSK command is updated. 00615 if ( aItem == aList.FocusedItem() && !iMarkingModeEnabled ) 00616 { 00617 ChangeMskCommand( EHclExampleCmdCollapse, 00618 R_QTN_MSK_COLLAPSE ); 00619 } 00620 } 00621 00622 // This event is received from hierarchical list, when one of the nodes 00623 // in the list is collapsed. The item ID of collapsed node is received 00624 // in aItem parameter. 00625 else if ( aEvent == ENodeCollapsed ) 00626 { 00627 // If the collapsed node is currently focused and the list is not in 00628 // the marking mode, the MSK command is updated. 00629 if ( aItem == aList.FocusedItem() && !iMarkingModeEnabled ) 00630 { 00631 ChangeMskCommand( EHclExampleCmdExpand, 00632 R_QTN_MSK_EXPAND ); 00633 } 00634 } 00635 00636 // EItemFocused event is received from the list, when the focused item 00637 // changes. The list also sents this event, when it gains or loses focus. 00638 else if ( aEvent == EItemFocused ) 00639 { 00640 // MSK command is updated on focus change events, if the list is not 00641 // in the marking mode. 00642 if ( !iMarkingModeEnabled ) 00643 { 00644 UpdateMskCommand( aList, aItem ); 00645 } 00646 } 00647 00648 // EItemSelected event is received when a leaf item (simple data row or 00649 // core data row in hierarchical column list) is selected. 00650 else if ( aEvent == EItemSelected ) 00651 { 00652 OpenFocusedItem(); 00653 } 00654 00655 // EItemRemoved event is received when an item is being removed from 00656 // the list. 00657 else if ( aEvent == EItemRemoved ) 00658 { 00659 } 00660 00661 // EMarkinModeEnabled event is received when hierarchical list has 00662 // entered in marking mode. In marking mode, the list controls the 00663 // mark/unmark commands in MSK, and the list client is not allowed 00664 // to change MSK commands. 00665 else if ( aEvent == EMarkingModeEnabled ) 00666 { 00667 iMarkingModeEnabled = ETrue; 00668 } 00669 00670 // The EMarkingModeDisabled event is received when hierarchical list 00671 // exits the marking mode and it no longer controls the MSK commands. 00672 // At this point, the client should resume to update them itself. 00673 else if ( aEvent == EMarkingModeDisabled ) 00674 { 00675 iMarkingModeEnabled = EFalse; 00676 UpdateMskCommand( aList, aList.FocusedItem() ); 00677 } 00678 00679 return KErrNone; 00680 }
|
|
|
Retrieves an object of the same type as that encapsulated in aId.
Definition at line 728 of file HierarchicalColumnListAppView.cpp. References iBgContext. 00729 { 00730 if ( aId.iUid == MAknsControlContext::ETypeId && iBgContext ) 00731 { 00732 return MAknsControlContext::SupplyMopObject( aId, iBgContext ); 00733 } 00734 return CCoeControl::MopSupplyObject( aId ); 00735 }
|
|
|
Second phase constructor. Performs the second phase construction of a CHierarchicalColumnListAppView object.
Definition at line 198 of file HierarchicalColumnListAppView.cpp. References iBgContext, and iList. Referenced by NewLC(). 00199 { 00200 // Create a window for this application view. 00201 CreateWindowL(); 00202 00203 // Init component array. 00204 InitComponentArrayL(); 00205 Components().SetControlsOwnedExternally( ETrue ); 00206 00207 // Construct list. 00208 CAknSingleColumnStyleTreeList* list = 00209 CAknSingleColumnStyleTreeList::NewL( *this ); 00210 00211 // Use list as a component control of the view. 00212 Components().AppendLC( list, KCoeNoControlId ); 00213 CleanupStack::Pop( list ); 00214 iList = list; 00215 00216 // Set the view to observer events from tree list. These events will 00217 // be received through MAknTreeObserver inerface. 00218 iList->AddObserverL( this ); 00219 00220 // Populate the list with some list items. 00221 PopulateListL( iList ); 00222 00223 // Construct background control context. 00224 iBgContext = CAknsBasicBackgroundControlContext::NewL( 00225 KAknsIIDQsnBgAreaMain, iAvkonAppUi->ApplicationRect(), EFalse ); 00226 00227 SetComponentsToInheritVisibility( ETrue ); 00228 00229 // Set the windows size. 00230 SetRect( aRect ); 00231 00232 // Activate the window, which makes it ready to be drawn. This makes also 00233 // the list ready to be drawn, as it is now component of this control. 00234 ActivateL(); 00235 }
|
|
||||||||||||
|
Updates the command and label in MSK depending on the curryntly focused hierarchical list item.
Definition at line 742 of file HierarchicalColumnListAppView.cpp. References ChangeMskCommand(). 00744 { 00745 TInt resourceId = NULL; 00746 TInt command = NULL; 00747 00748 // Determine the MSK command depending on the focused item type and state. 00749 if ( aFocusedItem == KAknTreeIIDNone ) 00750 { 00751 // No item focused. 00752 } 00753 else if ( aList.IsNode( aFocusedItem ) ) 00754 { 00755 if ( aList.IsExpanded( aFocusedItem ) ) 00756 { 00757 resourceId = R_QTN_MSK_COLLAPSE; 00758 command = EHclExampleCmdCollapse; 00759 } 00760 else 00761 { 00762 resourceId = R_QTN_MSK_EXPAND; 00763 command = EHclExampleCmdExpand; 00764 } 00765 } 00766 else if ( aList.IsLeaf( aFocusedItem ) ) 00767 { 00768 resourceId = R_QTN_MSK_OPEN; 00769 command = EHclExampleCmdOpen; 00770 } 00771 00772 if ( resourceId ) 00773 { 00774 ChangeMskCommand( command, resourceId ); 00775 } 00776 }
|
|
||||||||||||
|
Change the specified command and label to MSK.
Definition at line 783 of file HierarchicalColumnListAppView.cpp. References iMarkingModeEnabled. Referenced by HandleTreeListEvent(), and UpdateMskCommand(). 00785 { 00786 // The MSK commands should not be changed when controlled by the list. 00787 __ASSERT_DEBUG( !iMarkingModeEnabled, User::Invariant() ); 00788 00789 // Get cba and update the given label and command to MSK. 00790 CEikButtonGroupContainer* cba = iAvkonAppUi->Cba(); 00791 if ( cba ) 00792 { 00793 TBuf<20> label; 00794 StringLoader::Load( label, aLabelResourceId, iCoeEnv ); 00795 cba->SetCommandL( 3, aCommandId, label ); 00796 cba->DrawDeferred(); 00797 } 00798 }
|
|
|
From CCoeControl. Draws this CHierarchicalColumnListAppView to the screen.
Definition at line 806 of file HierarchicalColumnListAppView.cpp. 00807 { 00808 // Get the standard graphics context. 00809 CWindowGc& gc = SystemGc(); 00810 00811 // Gets the control's extent. 00812 TRect rect = Rect(); 00813 00814 // Clears the screen. 00815 gc.Clear( rect ); 00816 }
|
|
|
Hierarchical column list. Own. Definition at line 240 of file HierarchicalColumnListAppView.h. Referenced by ChangeLooping(), CollapseFocusedNode(), ConstructL(), ExpandFocusedNode(), IsListLooping(), OpenFocusedItem(), and ~CHierarchicalColumnListAppView(). |
|
|
Background control context. Own. Definition at line 246 of file HierarchicalColumnListAppView.h. Referenced by ConstructL(), MopSupplyObject(), SizeChanged(), and ~CHierarchicalColumnListAppView(). |
|
|
Marking mode enabled. This member variable is used to store the information whether the used hierarhcical column list is being in marking mode, where it controls the MSK labels and application cannot change them. Definition at line 254 of file HierarchicalColumnListAppView.h. Referenced by ChangeMskCommand(), and HandleTreeListEvent(). |
|
© Nokia 2009 |