62
|
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: part of testviewframework.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef TESTMENUVIEW_H
|
|
19 |
#define TESTMENUVIEW_H
|
|
20 |
|
|
21 |
//INCLUDES
|
|
22 |
#include <badesca.h>
|
|
23 |
#include "testbaseview.h"
|
|
24 |
|
|
25 |
|
|
26 |
// FORWARD DECLARATION
|
|
27 |
class CConsoleMain;
|
|
28 |
|
|
29 |
// CLASS DECLARATION
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Abstract View class - contains functions which must be derived
|
|
33 |
*/
|
|
34 |
class MTestMenuView
|
|
35 |
{
|
|
36 |
public:
|
|
37 |
|
|
38 |
/**
|
|
39 |
* Handle number key press
|
|
40 |
* NOTE: Must be derived
|
|
41 |
*/
|
|
42 |
virtual void HandleNumKeyL() = 0;
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Handle left key press
|
|
46 |
* NOTE: Must be derived
|
|
47 |
*/
|
|
48 |
virtual void HandleLeftKeyL() = 0;
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Handle right/enter key press
|
|
52 |
* NOTE: Must be derived
|
|
53 |
*/
|
|
54 |
virtual void HandleRightKeyL() = 0;
|
|
55 |
};
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Menu View class - Console base
|
|
59 |
*/
|
|
60 |
class CTestMenuView :public CTestBaseView, public MTestMenuView
|
|
61 |
{
|
|
62 |
public:
|
|
63 |
/**
|
|
64 |
* Destructor
|
|
65 |
*/
|
|
66 |
IMPORT_C virtual ~CTestMenuView();
|
|
67 |
|
|
68 |
|
|
69 |
public: //Implement abstract function from base classes
|
|
70 |
/**
|
|
71 |
* From: CTestBaseView
|
|
72 |
* Display view
|
|
73 |
*/
|
|
74 |
IMPORT_C void DisplayViewL();
|
|
75 |
|
|
76 |
/**
|
|
77 |
* From: CTestBaseView
|
|
78 |
* Process keypresses on this menu - called by ConsoleMain
|
|
79 |
* @param aSelection, key pressed
|
|
80 |
* @param aContinue, whether to continue or stop scheduler
|
|
81 |
*/
|
|
82 |
IMPORT_C void SelectL( TKeyCode aSelection, TBool& aContinue );
|
|
83 |
|
|
84 |
/**
|
|
85 |
* From: CTestBaseView
|
|
86 |
* Update display from timer - called by ConsoleMain
|
|
87 |
*/
|
|
88 |
IMPORT_C void TimerUpdate();
|
|
89 |
|
|
90 |
|
|
91 |
protected:
|
|
92 |
|
|
93 |
/**
|
|
94 |
* C++ default constructor
|
|
95 |
*/
|
|
96 |
IMPORT_C CTestMenuView(CConsoleMain* aConsoleMain,
|
|
97 |
CTestBaseView* aParent,
|
|
98 |
const TDesC& aName);
|
|
99 |
|
|
100 |
|
|
101 |
/**
|
|
102 |
* NOTE: This function must be call within deriving class ConstructL
|
|
103 |
* the second phase constructor ConstructL to safely construct things
|
|
104 |
* that can leave
|
|
105 |
* @param aConsole, console to display menu
|
|
106 |
* @param aParent, parent menu
|
|
107 |
* @param aName, name of current menu to be set
|
|
108 |
* @param aLastMenu, whether the current has child menu
|
|
109 |
*/
|
|
110 |
IMPORT_C void ConstructL();
|
|
111 |
|
|
112 |
protected:
|
|
113 |
/**
|
|
114 |
* Print line
|
|
115 |
* @param aPrint, descriptor of message to be printed
|
|
116 |
*/
|
|
117 |
IMPORT_C void Print( const TDesC& aPrint);
|
|
118 |
|
|
119 |
/**
|
|
120 |
* Multi line print if message exceeds one line
|
|
121 |
* @param aPrint, descriptor of message to be printed
|
|
122 |
*/
|
|
123 |
IMPORT_C void PrintMulti( const TDesC& aPrint );
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Add item to menu
|
|
127 |
* @param aItem, item of current menu
|
|
128 |
*/
|
|
129 |
IMPORT_C void AddItemL ( const TDesC& aItem );
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Delete an item from menu
|
|
133 |
* @param aIndex, index of item to be deleted
|
|
134 |
*/
|
|
135 |
IMPORT_C void DeleteItem ( TInt aIndex );
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Get last key pressed
|
|
139 |
* @return code of last key pressed
|
|
140 |
*/
|
|
141 |
IMPORT_C TKeyCode LastKeyPressed();
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Determine whether there are items added to iItems
|
|
145 |
* @return whether item is empty
|
|
146 |
*/
|
|
147 |
IMPORT_C TBool ItemsCreated();
|
|
148 |
|
|
149 |
/**
|
|
150 |
* Get the position that the cursor is point to in the items
|
|
151 |
* @return index of current cursor pointing item in iItems
|
|
152 |
*/
|
|
153 |
IMPORT_C TInt CurrentIndex();
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Get the position that the cursor is point to on the screen
|
|
157 |
* @return index of current cursor pointing item on screen
|
|
158 |
*/
|
|
159 |
IMPORT_C TInt CurrentPosition();
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Get the item
|
|
163 |
* @return reference of item
|
|
164 |
*/
|
|
165 |
IMPORT_C TPtrC ItemL(TInt aIndex);
|
|
166 |
|
|
167 |
/**
|
|
168 |
* Count the number of items in the current menu
|
|
169 |
* @return number of items in the current menu
|
|
170 |
*/
|
|
171 |
IMPORT_C TInt ItemCount() const;
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Reads user input into the start of the descriptor aDes
|
|
175 |
* @param aDes, descriptor to store input string
|
|
176 |
*/
|
|
177 |
IMPORT_C void ReadString( TDes& aDes );
|
|
178 |
|
|
179 |
protected: // New functions
|
|
180 |
|
|
181 |
/**
|
|
182 |
* Append text before original text.
|
|
183 |
*/
|
|
184 |
void AppendBefore( TInt aLineNum, TDes& aLine );
|
|
185 |
|
|
186 |
protected: // Data
|
|
187 |
CDesCArrayFlat* iItems; // View items
|
|
188 |
|
|
189 |
TInt iPosOnScreen; // Position on display
|
|
190 |
TInt iFirst; // First displayed item
|
|
191 |
TInt iLast; // Last displayed item
|
|
192 |
TInt iItemCount; // Last Item
|
|
193 |
TSize iSize; // Display size
|
|
194 |
TInt iScreenSize; // "Work area" size
|
|
195 |
TInt iDirection; // Scrolling direction
|
|
196 |
TInt iStart; // Scrolling position
|
|
197 |
TInt iPrevPos; // Previous position in scrolling
|
|
198 |
TKeyCode iKey; // Last key pressed
|
|
199 |
|
|
200 |
};
|
|
201 |
|
|
202 |
|
|
203 |
#endif //TESTMENUVIEW_H
|