Nokia N97 SDK
Example Applications Guide

HierarchicalColumnListAppView.h

00001 /*
00002 * ============================================================================
00003 *  Name        : HierarchicalColumnListAppView.h
00004 *  Part of     : Hierarchical Column List Example Application
00005 *  Description : View class for the example application.
00006 *  Version     : %version: 1 %
00007 *
00008 *  Copyright © 2007 Nokia.  All rights reserved.
00009 *  This material, including documentation and any related computer
00010 *  programs, is protected by copyright controlled by Nokia
00011 *  Corporation.
00012 * ============================================================================
00013 */
00014 
00015 #ifndef C_HIERARCHICALCOLUMNLISTAPPVIEW_H
00016 #define C_HIERARCHICALCOLUMNLISTAPPVIEW_H
00017 
00018 
00019 #include <coecntrl.h>
00020 #include <akntreelistobserver.h>
00021 
00022 class CAknSingleColumnStyleTreeList;
00023 class CAknsBasicBackgroundControlContext;
00024 
00025 
00026 /**
00027  *  An instance of the Application View object for the HierarchicalColumnList 
00028  *  application.
00029  *
00030  *  This class acts as a contaner for @c CAknSingleColumnStyleTreeList
00031  *  instance, and provides a bacground control context for the list through
00032  *  mop-chain. Class realizes the @c MAknTreeListObserver interface, so that
00033  *  it can register itself as an observer of the list in orded to receive
00034  *  list events.
00035  */
00036 class CHierarchicalColumnListAppView : public CCoeControl,
00037                                        public MAknTreeListObserver
00038     {
00039 
00040 public:
00041 
00042     /**
00043      * Two phased constructor. Creates a CHierarchicalColumnListAppView object,
00044      * which will draw itself to aRect.
00045      *
00046      * @param aRect the rectangle this view will be drawn to
00047      * @return a pointer to the created instance of CHierarchicalColumnListAppView
00048      */
00049     static CHierarchicalColumnListAppView* NewL( const TRect& aRect );
00050 
00051     /**
00052      * Two phased constructor. Creates a CHierarchicalColumnListAppView object,
00053      * which will draw itself to aRect.
00054      *
00055      * @param aRect the rectangle this view will be drawn to
00056      * @return a pointer to the created instance of CHierarchicalColumnListAppView
00057      */
00058     static CHierarchicalColumnListAppView* NewLC( const TRect& aRect );
00059 
00060     /**
00061      * Destructor. Destroys the object and releases all memory objects.
00062      */
00063     ~CHierarchicalColumnListAppView();
00064 
00065     /**
00066      * Expands currently focused node in the displayed list.
00067      */
00068     void ExpandFocusedNode();
00069 
00070     /**
00071      * Collapses currently focused node in the displayed list.
00072      */
00073     void CollapseFocusedNode();
00074 
00075     /**
00076      * Opens currently focused item in the displayed list.
00077      */
00078     void OpenFocusedItem();
00079 
00080     /**
00081      * Checks whether the list is looping.
00082      */
00083     TBool IsListLooping() const;
00084 
00085     /**
00086      * Toggles the looping setting.
00087      */
00088     void ChangeLooping();
00089 
00090     /**
00091      * Checks whether marquee scrolling is enabled in the list.
00092      */
00093     TBool IsMarqueeOn() const;
00094 
00095     /**
00096      * Toggles the marquee setting.
00097      */
00098     void ChangeMarquee();
00099 
00100     /**
00101      * Checks whether list is set markable.
00102      */
00103     TBool IsMarkable() const;
00104 
00105     /**
00106      * Toggles the markable setting.
00107      */
00108     void ChangeMarkable();
00109 
00110     /**
00111      * Changes the used collapse/expand function indicators.
00112      */
00113     void ChangeFunctionIndicatorsL();
00114 
00115     /**
00116      * Marks the focused list item.
00117      */
00118     void Mark();
00119 
00120     /**
00121      * Unmarks the focused list item.
00122      */
00123     void Unmark();
00124     
00125     /**
00126      * Marks every list item.
00127      */
00128     void MarkAll();
00129 
00130     /**
00131      * Unmarks every list item.
00132      */
00133     void UnmarkAll();
00134 
00135     /**
00136      * Dynamically initialises a menu pane.
00137      *
00138      * @param aMenuPane Menu pane.
00139      */
00140     void DynInitOptionsMenuPaneL( CEikMenuPane* aMenuPane );
00141 
00142     /**
00143      * Dynamically initialises a settings menu pane.
00144      *
00145      * @param aMenuPane Menu pane.
00146      */
00147     void DynInitSettingsMenuPaneL( CEikMenuPane* aMenuPane );
00148     
00149     /**
00150      * Dynamically initialises a marking menu pane.
00151      *
00152      * @param aMenuPane Menu pane.
00153      */
00154     void DynInitMarkingMenuPaneL( CEikMenuPane* aMenuPane );
00155 
00156 // from base class CCoeControl
00157 
00158     /**
00159      * From CCoeControl.
00160      * Handles key events.
00161      */
00162     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
00163         TEventCode aType );
00164 
00165 // from base class MAknTreeListObserver
00166  
00167     /**
00168      * From MAknTreeListObserver.
00169      * Handles tree list events.
00170      */
00171     TBool HandleTreeListEvent( CAknTreeList& aList, TAknTreeItemID aItem,
00172         TEvent aEvent );
00173 
00174 protected:
00175 
00176 // from base class CCoeControl
00177 
00178     
00179         // Change of focus
00180     void FocusChanged( TDrawNow aDrawNow );
00181 
00182         // Change of size and position
00183         void SizeChanged();
00184 
00185     /**
00186      * Retrieves an object of the same type as that encapsulated in aId.
00187      * 
00188      * @param aId An encapsulated object type ID.
00189      */
00190     TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
00191 
00192 private:
00193 
00194     /**
00195      * Second phase constructor. Performs the second phase construction of a
00196      * CHierarchicalColumnListAppView object.
00197      *
00198      * @param aRect the rectangle this view will be drawn to
00199      */
00200     void ConstructL( const TRect& aRect );
00201 
00202     /**
00203      * C++ constructor. Performs the first phase of two phase construction.
00204      */
00205     CHierarchicalColumnListAppView();
00206 
00207     /**
00208      * Updates the command and label in MSK depending on the curryntly
00209      * focused hierarchical list item.
00210      *
00211      * @param aList Reference to an instance of CAknTreeList.
00212      * @param aFocusedItem Item identifier of focused list item.
00213      */
00214     void UpdateMskCommand( CAknTreeList& aList, TAknTreeItemID aFocusedItem );
00215 
00216     /**
00217      * Change the specified command and label to MSK.
00218      *
00219      * @param aCommandId Command ID.
00220      * @param aLabelResourceId Resource ID for the MSK label.
00221      */
00222     void ChangeMskCommand( TInt aCommandId, TInt aLabelResourceId );
00223 
00224 // from base class CCoeControl
00225 
00226     /**
00227      * From CCoeControl.
00228      * Draws this CHierarchicalColumnListAppView to the screen.
00229      *
00230      * @param aRect the rectangle of this view that needs updating.
00231      */
00232     void Draw( const TRect& aRect ) const;
00233 
00234 private: // data
00235 
00236     /**
00237      * Hierarchical column list.
00238      * Own.
00239      */
00240     CAknSingleColumnStyleTreeList* iList;
00241 
00242     /**
00243      * Background control context.
00244      * Own.
00245      */
00246     CAknsBasicBackgroundControlContext* iBgContext;
00247 
00248     /**
00249      * Marking mode enabled. This member variable is used to store the
00250      * information whether the used hierarhcical column list is being
00251      * in marking mode, where it controls the MSK labels and application
00252      * cannot change them.
00253      */
00254     TBool iMarkingModeEnabled;
00255 
00256     };
00257 
00258 
00259 #endif // C_HIERARCHICALCOLUMNLISTAPPVIEW_H

© Nokia 2009

Back to top