satui/satapp/SATUIInc/CSatUiView.h
branchRCL_3
changeset 19 7d48bed6ce0c
parent 18 594d59766373
child 20 987c9837762f
equal deleted inserted replaced
18:594d59766373 19:7d48bed6ce0c
     1 /*
       
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *    Defines CSatUiView class
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef CSATUIVIEW_H
       
    22 #define CSATUIVIEW_H
       
    23 
       
    24 // INCLUDES
       
    25 #include    <msatuiobserver.h>
       
    26 #include    <aknview.h>        // For CAknView class 
       
    27 
       
    28 // CONSTANTS
       
    29 static const TInt KTabLength = 4;     // Items tab length
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class AknStaticNoteDialog;
       
    33 class MSatUiAdapter;
       
    34 class CSatUiViewContainer;
       
    35 class CSatUiViewAppUi;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40 * SatUi view (SetUpMenu and SelectItem).
       
    41 */
       
    42 class CSatUiView : public CAknView, 
       
    43                    public MEikListBoxObserver
       
    44     {
       
    45     public: // Constructors and destructor
       
    46 
       
    47         /**
       
    48         * Two-phased constructor.
       
    49         */
       
    50         static CSatUiView* NewL( TBool aSetUpMenu, 
       
    51                                  CSatUiViewAppUi* aAppUi, 
       
    52                                  TBool aEmpty );
       
    53 
       
    54         /*
       
    55         * Destructor.
       
    56         */
       
    57         virtual ~CSatUiView();
       
    58 
       
    59     public: // New functions
       
    60 
       
    61         /**
       
    62         * Sets the title needed for showing the view.
       
    63         * @param aTitle The Title pane text.
       
    64         */
       
    65         void SetTitle( const HBufC* aTitle );
       
    66 
       
    67         /**
       
    68         * Sets all parameters needed for showing the view.
       
    69         * @param aTitle The Title pane text.
       
    70         * @param aMenuItems The Main pane list items.
       
    71         * @param aMenuItemNextActions The Options items.
       
    72         * @param aHelpIsAvailable The help flag.
       
    73         * @return Operation result.
       
    74         */
       
    75         TSatUiResponse SetItemsL( HBufC* aTitle,
       
    76             const MDesCArray& aMenuItems,
       
    77             const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
       
    78             const TBool aHelpIsAvailable );
       
    79 
       
    80         /**
       
    81         * Activates SetUpMenu view.
       
    82         * @param aTitle The Title pane text.
       
    83         * @param aMenuItems The Main pane list items.
       
    84         * @param aMenuItemNextActions The Options items.
       
    85         * @param aHelpIsAvailable The help flag.
       
    86         * @return Operation result.
       
    87         */
       
    88         TSatUiResponse SetUpMenuL( HBufC* aTitle,
       
    89             const MDesCArray& aMenuItems,
       
    90             const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
       
    91             const TBool aHelpIsAvailable );
       
    92 
       
    93         /**
       
    94         * Activates SelectItem view.
       
    95         * @param aTitle The Title pane text.
       
    96         * @param aMenuItems The Main pane list items.
       
    97         * @param aMenuItemNextActions The Options items.
       
    98         * @param aDefaultItem The item in focus.
       
    99         * @param aSelection The selected item.
       
   100         * @param aHelpIsAvailable The help flag.
       
   101         * @return Operation result.
       
   102         */
       
   103         TSatUiResponse SelectItemL( HBufC* aTitle,
       
   104             const MDesCArray& aMenuItems,
       
   105             const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
       
   106             const TInt aDefaultItem, TUint8& aSelection,
       
   107             const TBool aHelpIsAvailable );
       
   108 
       
   109         /**
       
   110         * Sets the pointer to adapter provided by SatCli.
       
   111         * @param aAdapter A pointer to an abstract adapter interface.
       
   112         */
       
   113         void SetAdapter( MSatUiAdapter* aAdapter );
       
   114 
       
   115         /**
       
   116         * Sets the icon bitmap pointer.
       
   117         * @param aIconBitmap Context Pane icon.
       
   118         */
       
   119         void SetIconL( const CFbsBitmap* aIconBitmap );
       
   120 
       
   121         /**
       
   122         * Sets the items icon array.
       
   123         * @param aItemsIconArray Items iconarray.
       
   124         * @param aSelfExplanatoryItems Indicate if only icons are shown
       
   125         */
       
   126         void SetItemsIconL( const CAknIconArray* aItemsIconArray, 
       
   127             const TBool aSelfExplanatoryItems );
       
   128 
       
   129         /**
       
   130         * Hides and makes list box visible if needed.
       
   131         * @param aVisible Visible or hidden
       
   132         */
       
   133         void MakeListBoxVisible( TBool aVisible );
       
   134         
       
   135         /**
       
   136         * Updates CBA according to current next action
       
   137         * @param aIndex current row on the list
       
   138         * @param aNew is the view just created
       
   139         */
       
   140         void UpdateMskL( TInt aIndex, TBool aNew );
       
   141 
       
   142     public: // Functions from base classes
       
   143 
       
   144         /**
       
   145         * From CAknView Returns the UId of the view.
       
   146         * @return The UId of the view.
       
   147         */
       
   148         TUid Id() const;
       
   149 
       
   150         /**
       
   151         * From CAknView Handles view commands.
       
   152         * @param aCommand The command identifier.
       
   153         */
       
   154         void HandleCommandL(TInt aCommand);
       
   155 
       
   156         /**
       
   157         * From CAknView Handles the options menu.
       
   158         * @param aResourceId Resource id of the menu pane.
       
   159         * @param aMenuPane The menu pane.
       
   160         */
       
   161         void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   162 
       
   163     protected: // New functions
       
   164 
       
   165         /**
       
   166         * Updates the view container.
       
   167         */
       
   168         void RefreshL();
       
   169 
       
   170         /**
       
   171         * Draws the title and list items of the view.
       
   172         */
       
   173         void DrawL();
       
   174 
       
   175     protected: // Functions from base classes
       
   176 
       
   177         /**
       
   178         * From MEikListBoxObserver Handles list box events.
       
   179         * @param aEventType The event identifier.
       
   180         */
       
   181         void HandleListBoxEventL( CEikListBox* /*aListBox*/,
       
   182             TListBoxEvent aEventType );
       
   183 
       
   184         /**
       
   185         * From CAknView Activates the view.
       
   186         */
       
   187         void DoActivateL( const TVwsViewId& /*PrevViewId*/,
       
   188             TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/);
       
   189 
       
   190         /**
       
   191         * From CAknView Deactivates the view.
       
   192         */
       
   193         void DoDeactivate();
       
   194 
       
   195     private:
       
   196 
       
   197         /** 
       
   198         * called when user has been
       
   199         * inactive for a pre-defined period
       
   200         */
       
   201         static TInt DispatchUserInactive( TAny* aPtr );
       
   202 
       
   203         /**
       
   204         * C++ default constructor.
       
   205         */
       
   206         CSatUiView( TBool aSetUpMenu, CSatUiViewAppUi* aAppUi, TBool aEmpty );
       
   207 
       
   208         /**
       
   209         * Symbian OS constructor.
       
   210         */
       
   211         void ConstructL();
       
   212 
       
   213     public: //Data
       
   214         
       
   215         //CUserActivityManager user response wait scheduler
       
   216         CActiveSchedulerWait iWait;
       
   217 
       
   218     private: //Data
       
   219 
       
   220         // Own: indicates that a note was cleared after a delay
       
   221         TBool iNoResponseFromUserAfterDelay;
       
   222 
       
   223         //Ref: adapter provided by SatCli
       
   224         MSatUiAdapter* iAdapter;
       
   225 
       
   226         //To block the keypad abter the user action and unblock when
       
   227         //the new SatServer command comes
       
   228        TBool iKeypadBlocked;
       
   229 
       
   230         //Type of the view (SetUpMenu or SelectItem)
       
   231         TBool iSetUpMenu;
       
   232 
       
   233         //Ref: UI object
       
   234         CSatUiViewAppUi* iSatUiAppUi;
       
   235 
       
   236         //Own: items of the main pain list
       
   237         CDesCArrayFlat* iMenuItems;
       
   238         //Own: codes of options menu items
       
   239         CArrayFixFlat<TSatAction>* iMenuItemNextActions;
       
   240 
       
   241         //Number of items in the maind pane
       
   242         TInt iNItems;
       
   243 
       
   244         //Ref: view title text
       
   245         const HBufC* iTitle;
       
   246 
       
   247         TBool iHelpIsAvailable;
       
   248 
       
   249         //Own: view container
       
   250         CSatUiViewContainer* iContainer;
       
   251 
       
   252         //Ref: list box model
       
   253         CTextListBoxModel* iModel;
       
   254 
       
   255         //The response to SatServer
       
   256         TSatUiResponse iResponse;
       
   257 
       
   258         //default item in the Select Item list
       
   259         TInt iDefaultItem;
       
   260 
       
   261         //selected item in the list
       
   262         TInt iSelection;
       
   263 
       
   264         //client rectangle
       
   265         TRect iRect;
       
   266 
       
   267         //Items icon array
       
   268         CAknIconArray* iItemsIconArray;
       
   269 
       
   270         //Icons exists on view
       
   271         TBool iIconsOn;
       
   272 
       
   273         //Icons state changed
       
   274         TBool iIconStateChange;
       
   275         
       
   276         //If only icons are shown
       
   277         TBool iSelfExplanatoryItems;
       
   278         
       
   279         //Value for displaying list box.
       
   280         TBool iListBoxVisible;
       
   281         
       
   282         //Indication that view is first created empty view
       
   283         TBool iEmpty;
       
   284 
       
   285     };
       
   286 
       
   287 #endif    // CSATUIVIEW_H
       
   288 
       
   289 //  End of File