williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: Base class for view architecture-based applications.
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
#ifndef __AKNVIEWAPPUI_H__
|
williamr@2
|
19 |
#define __AKNVIEWAPPUI_H__
|
williamr@2
|
20 |
|
williamr@2
|
21 |
// INCLUDES
|
williamr@2
|
22 |
#include <aknappui.h>
|
williamr@2
|
23 |
|
williamr@2
|
24 |
// FORWARD DECLARATIONS
|
williamr@2
|
25 |
class CAknView;
|
williamr@2
|
26 |
class CAknViewShutter;
|
williamr@2
|
27 |
class CAknLocalScreenClearer;
|
williamr@2
|
28 |
class CAknViewAppUiExtension;
|
williamr@2
|
29 |
class CAknViewNavigator;
|
williamr@2
|
30 |
|
williamr@2
|
31 |
// MACROS
|
williamr@2
|
32 |
#define iAvkonViewAppUi ((CAknViewAppUi*)CEikonEnv::Static()->EikAppUi())
|
williamr@2
|
33 |
|
williamr@2
|
34 |
// CLASS DECLARATION
|
williamr@2
|
35 |
|
williamr@2
|
36 |
/**
|
williamr@2
|
37 |
* Base class for view architecture-based applications.
|
williamr@2
|
38 |
*
|
williamr@2
|
39 |
* @since Series 60 0.9
|
williamr@2
|
40 |
*/
|
williamr@2
|
41 |
class CAknViewAppUi : public CAknAppUi
|
williamr@2
|
42 |
{
|
williamr@2
|
43 |
public:
|
williamr@2
|
44 |
NONSHARABLE_CLASS(CViewActivationItem) : public CBase
|
williamr@2
|
45 |
{
|
williamr@2
|
46 |
public:
|
williamr@2
|
47 |
|
williamr@2
|
48 |
/**
|
williamr@2
|
49 |
* Two-phased constructor.
|
williamr@2
|
50 |
* @param aNewView Application view.
|
williamr@2
|
51 |
* @param aCustomMessageId Message ID.
|
williamr@2
|
52 |
* @param aCustomMessage Message contents.
|
williamr@2
|
53 |
* @param aPrevViewId The UID of the previously active view.
|
williamr@2
|
54 |
* @return Pointer to new @c CViewActivationItem object.
|
williamr@2
|
55 |
*/
|
williamr@2
|
56 |
static CViewActivationItem* NewLC(CAknView* aNewView,
|
williamr@2
|
57 |
TUid aCustomMessageId,
|
williamr@2
|
58 |
const TDesC8& aCustomMessage,
|
williamr@2
|
59 |
const TVwsViewId& aPrevViewId);
|
williamr@2
|
60 |
|
williamr@2
|
61 |
/**
|
williamr@2
|
62 |
* Destructor.
|
williamr@2
|
63 |
*/
|
williamr@2
|
64 |
~CViewActivationItem();
|
williamr@2
|
65 |
private:
|
williamr@2
|
66 |
CViewActivationItem(CAknView* aNewView,
|
williamr@2
|
67 |
TUid aCustomMessageId,
|
williamr@2
|
68 |
const TVwsViewId& aPrevViewId);
|
williamr@2
|
69 |
|
williamr@2
|
70 |
void ConstructL(const TDesC8& aCustomMessage);
|
williamr@2
|
71 |
public:
|
williamr@2
|
72 |
|
williamr@2
|
73 |
// Application view.
|
williamr@2
|
74 |
CAknView* iNewView;
|
williamr@2
|
75 |
|
williamr@2
|
76 |
// Message ID.
|
williamr@2
|
77 |
TUid iCustomMessageId;
|
williamr@2
|
78 |
|
williamr@2
|
79 |
// Message contents.
|
williamr@2
|
80 |
HBufC8* iCustomMessage;
|
williamr@2
|
81 |
|
williamr@2
|
82 |
// The UID of the previously active view.
|
williamr@2
|
83 |
TVwsViewId iPrevViewId;
|
williamr@2
|
84 |
};
|
williamr@2
|
85 |
|
williamr@2
|
86 |
/**
|
williamr@2
|
87 |
* Container class used to hold information about one split view.
|
williamr@2
|
88 |
*/
|
williamr@2
|
89 |
NONSHARABLE_CLASS(TAknSplitViewContainer)
|
williamr@2
|
90 |
{
|
williamr@2
|
91 |
public:
|
williamr@2
|
92 |
/**
|
williamr@2
|
93 |
* Checks is a view is part of the split view.
|
williamr@2
|
94 |
* @param aViewId UID of the view to be checked.
|
williamr@2
|
95 |
* @return ETrue if the given view belongs to the split view.
|
williamr@2
|
96 |
*/
|
williamr@2
|
97 |
TBool IsPartOf( const TUid aViewId );
|
williamr@2
|
98 |
|
williamr@2
|
99 |
public:
|
williamr@2
|
100 |
// view uids
|
williamr@2
|
101 |
TUid iViewIds[2];
|
williamr@2
|
102 |
// ETrue if a view's activation failed
|
williamr@2
|
103 |
TBool iFailed[2];
|
williamr@2
|
104 |
// drawing areas
|
williamr@2
|
105 |
TRect iViewRect[2];
|
williamr@2
|
106 |
// the size of the leftmost view
|
williamr@2
|
107 |
TInt iLeftViewSize;
|
williamr@2
|
108 |
};
|
williamr@2
|
109 |
|
williamr@2
|
110 |
typedef CArrayPtrFlat<CViewActivationItem> CAknViewActivationQueue;
|
williamr@2
|
111 |
typedef CArrayPtrFlat<CAknView> CAknViews;
|
williamr@2
|
112 |
|
williamr@2
|
113 |
public:
|
williamr@2
|
114 |
|
williamr@2
|
115 |
/**
|
williamr@2
|
116 |
* Initialises this app UI with standard values.
|
williamr@2
|
117 |
* @param aAppUiFlags Application user interface flags.
|
williamr@2
|
118 |
*/
|
williamr@2
|
119 |
IMPORT_C void BaseConstructL(TInt aAppUiFlags=EStandardApp);
|
williamr@2
|
120 |
|
williamr@2
|
121 |
/**
|
williamr@2
|
122 |
* Destructor.
|
williamr@2
|
123 |
*/
|
williamr@2
|
124 |
IMPORT_C virtual ~CAknViewAppUi();
|
williamr@2
|
125 |
|
williamr@2
|
126 |
/**
|
williamr@2
|
127 |
* Activates a specified application view, without passing any message.
|
williamr@2
|
128 |
* The function leaves if activation of the view fails.
|
williamr@2
|
129 |
* @param aViewId Identifier of the view to activate.
|
williamr@2
|
130 |
*/
|
williamr@2
|
131 |
IMPORT_C void ActivateLocalViewL(TUid aViewId);
|
williamr@2
|
132 |
|
williamr@2
|
133 |
/**
|
williamr@2
|
134 |
* Activates a specified application view, then passes the message text
|
williamr@2
|
135 |
* descriptor aCustomMessage for a message of type aCustomMessageId.
|
williamr@2
|
136 |
* The function leaves if activation of the view fails.
|
williamr@2
|
137 |
* @param aViewId Identifier of the view to activate.
|
williamr@2
|
138 |
* @param aCustomMessageId Specifies the message type.
|
williamr@2
|
139 |
* @param aCustomMessage The message passed to the activated view.
|
williamr@2
|
140 |
*/
|
williamr@2
|
141 |
IMPORT_C void ActivateLocalViewL(TUid aViewId,
|
williamr@2
|
142 |
TUid aCustomMessageId,
|
williamr@2
|
143 |
const TDesC8& aCustomMessage);
|
williamr@2
|
144 |
|
williamr@2
|
145 |
/**
|
williamr@2
|
146 |
* Gets a pointer to specified application view.
|
williamr@2
|
147 |
* @param aView ID of the application view.
|
williamr@2
|
148 |
* @return Pointer to application view object,
|
williamr@2
|
149 |
* NULL if aView doesn't exists.
|
williamr@2
|
150 |
*/
|
williamr@2
|
151 |
IMPORT_C CAknView* View(TUid aView) const;
|
williamr@2
|
152 |
|
williamr@2
|
153 |
/**
|
williamr@2
|
154 |
* Registers and adds the view to the app UI.
|
williamr@2
|
155 |
* This function calls @c CCoeAppUi::RegisterViewL.
|
williamr@2
|
156 |
* @param aView The view to be registered and added.
|
williamr@2
|
157 |
*/
|
williamr@2
|
158 |
IMPORT_C void AddViewL(CAknView* aView); // takes ownership of aView
|
williamr@2
|
159 |
|
williamr@2
|
160 |
/**
|
williamr@2
|
161 |
* Removes and deregisteres the view from the app UI.
|
williamr@2
|
162 |
* This function calls @c CCoeAppUi::DeregisterView.
|
williamr@2
|
163 |
* @param aViewId The view to be deregistered and removed.
|
williamr@2
|
164 |
*/
|
williamr@2
|
165 |
IMPORT_C void RemoveView(TUid aViewId);
|
williamr@2
|
166 |
|
williamr@2
|
167 |
/**
|
williamr@2
|
168 |
* Processes user commands.
|
williamr@2
|
169 |
* @param aCommand A command ID.
|
williamr@2
|
170 |
*/
|
williamr@2
|
171 |
IMPORT_C void ProcessCommandL(TInt aCommand);
|
williamr@2
|
172 |
|
williamr@2
|
173 |
/**
|
williamr@2
|
174 |
* Stops displaying the application’s menu bar.
|
williamr@2
|
175 |
*/
|
williamr@2
|
176 |
IMPORT_C void StopDisplayingMenuBar();
|
williamr@2
|
177 |
|
williamr@2
|
178 |
// Avkon view architecture system. Internal use only.
|
williamr@2
|
179 |
void ViewActivatedL(CAknView* aView,
|
williamr@2
|
180 |
const TVwsViewId& aPrevViewId,
|
williamr@2
|
181 |
TUid aCustomMessageId,
|
williamr@2
|
182 |
const TDesC8& aCustomMessage);
|
williamr@2
|
183 |
|
williamr@2
|
184 |
void ViewDeactivated(CAknView* aView);
|
williamr@2
|
185 |
|
williamr@2
|
186 |
/**
|
williamr@2
|
187 |
* Combines two views. If either of the views belongs to another view combination
|
williamr@2
|
188 |
* then that combination is removed.
|
williamr@2
|
189 |
* @since Series 60 5.0
|
williamr@2
|
190 |
* @param aView1Id UID of the first (leftmost) view.
|
williamr@2
|
191 |
* @param aView2Id UID of the second view.
|
williamr@2
|
192 |
* @param aLeftViewSize Size of the first view (in percentages).
|
williamr@2
|
193 |
*/
|
williamr@2
|
194 |
IMPORT_C void SetSplitViewL( const TUid aView1Id, const TUid aView2Id, const TInt aLeftViewSize );
|
williamr@2
|
195 |
|
williamr@2
|
196 |
/**
|
williamr@2
|
197 |
* Removes a view combination containing the given view UID. If the view
|
williamr@2
|
198 |
* with the given UID is currently visible then the screen is switched to
|
williamr@2
|
199 |
* single view and the the given view stays active.
|
williamr@2
|
200 |
* @since Series 60 5.0
|
williamr@2
|
201 |
* @param aViewId UID of a view combination.
|
williamr@2
|
202 |
*/
|
williamr@2
|
203 |
IMPORT_C void RemoveSplitViewL( const TUid aViewId );
|
williamr@2
|
204 |
|
williamr@2
|
205 |
/**
|
williamr@2
|
206 |
* Checks if split view is in use.
|
williamr@2
|
207 |
* @since Series 60 5.0
|
williamr@2
|
208 |
* @return ETrue if a split view is active.
|
williamr@2
|
209 |
*/
|
williamr@2
|
210 |
IMPORT_C TBool SplitViewActive() const;
|
williamr@2
|
211 |
|
williamr@2
|
212 |
/**
|
williamr@2
|
213 |
* Returns the currently focused view.
|
williamr@2
|
214 |
* @since Series 60 5.0
|
williamr@2
|
215 |
* @return UID of the currently focused view.
|
williamr@2
|
216 |
*/
|
williamr@2
|
217 |
IMPORT_C TUid FocusedView() const;
|
williamr@2
|
218 |
|
williamr@2
|
219 |
/**
|
williamr@2
|
220 |
* Checks if the given view is visible on the screen.
|
williamr@2
|
221 |
* @since Series 60 5.0
|
williamr@2
|
222 |
* @param aViewId View to be checked.
|
williamr@2
|
223 |
* @return ETrue if the given view is visible.
|
williamr@2
|
224 |
*/
|
williamr@2
|
225 |
IMPORT_C TBool ViewShown( const TUid aViewId ) const;
|
williamr@2
|
226 |
|
williamr@2
|
227 |
/**
|
williamr@2
|
228 |
* Enables/disables local screen clearer.
|
williamr@2
|
229 |
* Local screen clearer is used in the view based applications
|
williamr@2
|
230 |
* to clear the application window if/when the view itself fails
|
williamr@2
|
231 |
* to do this. By default, the clearer is used.
|
williamr@2
|
232 |
* This function must be called before the BaseConstructL() to
|
williamr@2
|
233 |
* prevent the screen clearer on application start up.
|
williamr@2
|
234 |
*
|
williamr@2
|
235 |
* @since 3.2
|
williamr@2
|
236 |
* @param aEnable ETrue enables local screen clearer.
|
williamr@2
|
237 |
* EFalse disables local screen clearer.
|
williamr@2
|
238 |
*/
|
williamr@2
|
239 |
IMPORT_C void EnableLocalScreenClearer( TBool aEnable = ETrue );
|
williamr@2
|
240 |
|
williamr@2
|
241 |
/**
|
williamr@2
|
242 |
* Returns view's rectangle.
|
williamr@2
|
243 |
* @since Series 60 5.0
|
williamr@2
|
244 |
* @param aViewId UID of the view whose rectangle should be returned.
|
williamr@2
|
245 |
* @param Given view's drawing area.
|
williamr@2
|
246 |
*/
|
williamr@2
|
247 |
TRect ViewRect( const TUid aViewId ) const;
|
williamr@2
|
248 |
|
williamr@2
|
249 |
/**
|
williamr@2
|
250 |
* Handles keyboard initiated navigation between visible split views.
|
williamr@2
|
251 |
* @since Series 60 5.0
|
williamr@2
|
252 |
* @param aKeyEvent Keyboard event.
|
williamr@2
|
253 |
* @param EKeyWasConsumed if view focus was changed.
|
williamr@2
|
254 |
*/
|
williamr@2
|
255 |
TKeyResponse HandleViewNavigationL( const TKeyEvent& aKeyEvent );
|
williamr@2
|
256 |
|
williamr@2
|
257 |
protected:
|
williamr@2
|
258 |
|
williamr@2
|
259 |
/**
|
williamr@2
|
260 |
* From @c MEikStatusPaneObserver. Handles a change in the position or
|
williamr@2
|
261 |
* size of the screen area occupied by the status pane.
|
williamr@2
|
262 |
*/
|
williamr@2
|
263 |
IMPORT_C void HandleStatusPaneSizeChange();
|
williamr@2
|
264 |
|
williamr@2
|
265 |
/**
|
williamr@2
|
266 |
* From @c CCoeAppUi. Handles changes in keyboard focus when
|
williamr@2
|
267 |
* an application switches to foreground.
|
williamr@2
|
268 |
* @param aForeground @c ETrue if the application is in the foreground,
|
williamr@2
|
269 |
* otherwise @c EFalse.
|
williamr@2
|
270 |
*/
|
williamr@2
|
271 |
IMPORT_C void HandleForegroundEventL(TBool aForeground);
|
williamr@2
|
272 |
|
williamr@2
|
273 |
/**
|
williamr@2
|
274 |
* From AknAppUi. Handles pointer-initiated view switch. Currently this
|
williamr@2
|
275 |
* function does nothing but calls base class function.
|
williamr@2
|
276 |
* @since Series 60 3.0
|
williamr@2
|
277 |
* @param aEvent Window server event.
|
williamr@2
|
278 |
* @param aDestination Pointer to the control which the event is targeted to.
|
williamr@2
|
279 |
*/
|
williamr@2
|
280 |
IMPORT_C void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination );
|
williamr@2
|
281 |
|
williamr@2
|
282 |
private:
|
williamr@2
|
283 |
static TInt ActivationCallBack(TAny* aThis);
|
williamr@2
|
284 |
void ActivationTick();
|
williamr@2
|
285 |
void QueueActivationTick();
|
williamr@2
|
286 |
|
williamr@2
|
287 |
/**
|
williamr@2
|
288 |
* Asserts that extension object has been created.
|
williamr@2
|
289 |
* @return Extension object.
|
williamr@2
|
290 |
*/
|
williamr@2
|
291 |
CAknViewAppUiExtension* Extension() const;
|
williamr@2
|
292 |
|
williamr@2
|
293 |
/**
|
williamr@2
|
294 |
* Activates views in split view.
|
williamr@2
|
295 |
* @since Series 60 5.0
|
williamr@2
|
296 |
* @param View under activation.
|
williamr@2
|
297 |
*/
|
williamr@2
|
298 |
void ActivateSplitViewL( CViewActivationItem* aItem );
|
williamr@2
|
299 |
|
williamr@2
|
300 |
/**
|
williamr@2
|
301 |
* If the given view is part of a split view then returns that split view,
|
williamr@2
|
302 |
* @since Series 60 5.0
|
williamr@2
|
303 |
* @param aViewId UID of a view that belongs to a split view.
|
williamr@2
|
304 |
* @return Pointer to a correct split view or NULL if no corresponding split view was found.
|
williamr@2
|
305 |
*/
|
williamr@2
|
306 |
TAknSplitViewContainer* SplitView( const TUid aViewId ) const;
|
williamr@2
|
307 |
|
williamr@2
|
308 |
protected:
|
williamr@2
|
309 |
|
williamr@2
|
310 |
// Application view.
|
williamr@2
|
311 |
CAknView* iView;
|
williamr@2
|
312 |
|
williamr@2
|
313 |
// Application views.
|
williamr@2
|
314 |
CAknViews* iViews;
|
williamr@2
|
315 |
|
williamr@2
|
316 |
private:
|
williamr@2
|
317 |
CAknViewShutter* iShutter;
|
williamr@2
|
318 |
CAknLocalScreenClearer* iClearer;
|
williamr@2
|
319 |
CAknViewActivationQueue* iActivationQueue;
|
williamr@2
|
320 |
CIdle* iActivationTick;
|
williamr@2
|
321 |
// extension class
|
williamr@2
|
322 |
CAknViewAppUiExtension* iExtension;
|
williamr@2
|
323 |
};
|
williamr@2
|
324 |
|
williamr@2
|
325 |
#endif // __AKNVIEWAPPUI_H__
|