williamr@2
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __EIKAPPUI_H__
|
williamr@2
|
17 |
#define __EIKAPPUI_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <coeaui.h>
|
williamr@2
|
20 |
#include <coemain.h>
|
williamr@2
|
21 |
#include <eikmobs.h>
|
williamr@2
|
22 |
#include <apadef.h>
|
williamr@2
|
23 |
#include <vwsdef.h>
|
williamr@2
|
24 |
#include <eikdef.h>
|
williamr@2
|
25 |
#include <baerrhan.h>
|
williamr@2
|
26 |
#include <eikaufty.h>
|
williamr@2
|
27 |
#include <coemop.h>
|
williamr@2
|
28 |
|
williamr@2
|
29 |
class CEikDocument;
|
williamr@2
|
30 |
class CEikApplication;
|
williamr@2
|
31 |
class CEikAppUiExtra;
|
williamr@2
|
32 |
class MApaEmbeddedDocObserver;
|
williamr@2
|
33 |
struct SExtendedError;
|
williamr@2
|
34 |
class CApaCommandLine;
|
williamr@2
|
35 |
|
williamr@2
|
36 |
/** Handles application-wide aspects of the application's user interface such
|
williamr@2
|
37 |
as the menu bar, toolbar pop-up menus, opening and closing files and exiting the
|
williamr@2
|
38 |
application cleanly.
|
williamr@2
|
39 |
|
williamr@2
|
40 |
Every GUI application should use its own class derived from CEikAppUi.
|
williamr@2
|
41 |
|
williamr@2
|
42 |
An app UI's main role is to handle commands, in its HandleCommandL() function.
|
williamr@2
|
43 |
These may be invoked using the menu bar, toolbar, or hotkeys; the commands
|
williamr@2
|
44 |
that an app UI handles are specified in the application's resource file.
|
williamr@2
|
45 |
|
williamr@2
|
46 |
In addition, the app UI normally needs to respond to other kinds of events, by
|
williamr@2
|
47 |
providing suitable implementations of the following virtual functions, all
|
williamr@2
|
48 |
inherited from CCoeAppUi:
|
williamr@2
|
49 |
|
williamr@2
|
50 |
- HandleKeyEventL(): Key events.
|
williamr@2
|
51 |
|
williamr@2
|
52 |
- HandleForegroundEventL(): Application switched to foreground.
|
williamr@2
|
53 |
|
williamr@2
|
54 |
- HandleSwitchOnEventL(): Machine switched on.
|
williamr@2
|
55 |
|
williamr@2
|
56 |
- HandleSystemEventL(): System events.
|
williamr@2
|
57 |
|
williamr@2
|
58 |
- HandleApplicationSpecificEventL(): Application-specific events.
|
williamr@2
|
59 |
|
williamr@2
|
60 |
@publishedAll
|
williamr@2
|
61 |
@released */
|
williamr@2
|
62 |
class CEikAppUi : public CCoeAppUi, public MEikMenuObserver, public MCoeMessageObserver, public MObjectProvider
|
williamr@2
|
63 |
{
|
williamr@2
|
64 |
public:
|
williamr@2
|
65 |
IMPORT_C ~CEikAppUi();
|
williamr@2
|
66 |
IMPORT_C CEikAppUi();
|
williamr@2
|
67 |
public: // new functions
|
williamr@2
|
68 |
IMPORT_C virtual void ConstructL();
|
williamr@2
|
69 |
IMPORT_C virtual void HandleModelChangeL();
|
williamr@2
|
70 |
IMPORT_C TLanguage ApplicationLanguageL() const;
|
williamr@2
|
71 |
IMPORT_C CEikApplication* Application() const;
|
williamr@2
|
72 |
IMPORT_C CEikDocument* Document() const;
|
williamr@2
|
73 |
IMPORT_C void SetDocument(CEikDocument* aDocument);
|
williamr@2
|
74 |
inline CEikAppUi* ContainerAppUi() const;
|
williamr@2
|
75 |
IMPORT_C void SetEmbeddedDocInfo(MApaEmbeddedDocObserver* aObserver, TBool aReadOnly);
|
williamr@2
|
76 |
IMPORT_C virtual TBool ProcessCommandParametersL(TApaCommand aCommand, TFileName& aDocumentName, const TDesC8& aTail);
|
williamr@2
|
77 |
IMPORT_C virtual TBool ProcessCommandParametersL(CApaCommandLine& aCommandLine);
|
williamr@2
|
78 |
// Application screen extent
|
williamr@2
|
79 |
IMPORT_C TRect ClientRect() const;
|
williamr@2
|
80 |
IMPORT_C virtual TRect ApplicationRect() const;
|
williamr@2
|
81 |
// Menu utilities
|
williamr@2
|
82 |
IMPORT_C void LaunchPopupMenuL(TInt aResourceId, const TPoint& aTargetPos, TPopupTargetPosType aTargetType, const CEikHotKeyTable* aHotKeyTable = NULL);
|
williamr@2
|
83 |
IMPORT_C virtual void StopDisplayingMenuBar();
|
williamr@2
|
84 |
// Fading effect
|
williamr@2
|
85 |
IMPORT_C TBool FadeWhenInBackground();
|
williamr@2
|
86 |
IMPORT_C virtual void SetFadedL(TBool aFaded);
|
williamr@2
|
87 |
inline void SetFaded(TBool aFaded); //mm: has no implementation
|
williamr@2
|
88 |
public: // new function
|
williamr@2
|
89 |
IMPORT_C virtual void ReportResourceChangedToAppL(TInt aType);
|
williamr@2
|
90 |
IMPORT_C virtual void HandleCommandL(TInt aCommand);
|
williamr@2
|
91 |
IMPORT_C virtual void ProcessMessageL(TUid aUid, const TDesC8& aParams);
|
williamr@2
|
92 |
IMPORT_C virtual void OpenFileL(const TDesC& aFileName);
|
williamr@2
|
93 |
IMPORT_C virtual void CreateFileL(const TDesC& aFileName);
|
williamr@2
|
94 |
IMPORT_C virtual TErrorHandlerResponse HandleError(TInt aError, const SExtendedError& aExtErr, TDes& aErrorText, TDes& aContextText);
|
williamr@2
|
95 |
IMPORT_C virtual void HandleResourceChangeL(TInt aType);
|
williamr@2
|
96 |
public: // from CCoeAppUi
|
williamr@2
|
97 |
IMPORT_C void PrepareToExit();
|
williamr@2
|
98 |
protected: // new functions
|
williamr@2
|
99 |
// Construction
|
williamr@2
|
100 |
IMPORT_C void BaseConstructL(TInt aAppUiFlags = 0);
|
williamr@2
|
101 |
IMPORT_C void ReadAppInfoResourceL(TInt aResourceFileOffset = 0);
|
williamr@2
|
102 |
IMPORT_C void CreateHotKeyControlL(TInt aResourceId);
|
williamr@2
|
103 |
IMPORT_C TBool ProcessCommandParametersL(TApaCommand aCommand, TFileName& aDocumentName);
|
williamr@2
|
104 |
// User data change management
|
williamr@2
|
105 |
IMPORT_C void SetDocChanged();
|
williamr@2
|
106 |
IMPORT_C void SaveAnyChangesL();
|
williamr@2
|
107 |
IMPORT_C void SaveL();
|
williamr@2
|
108 |
IMPORT_C virtual void Exit();
|
williamr@2
|
109 |
// Utility
|
williamr@2
|
110 |
IMPORT_C void ClosePopup(); //mm: deprecate?
|
williamr@2
|
111 |
protected: // from MEikMenuObserver
|
williamr@2
|
112 |
IMPORT_C void HandleSideBarMenuL(TInt aResourceId,const TPoint& aPos,TInt aModifiers,const CEikHotKeyTable* aTable);
|
williamr@2
|
113 |
protected: // from CCoeAppUi
|
williamr@2
|
114 |
IMPORT_C void HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent);
|
williamr@2
|
115 |
IMPORT_C void HandleForegroundEventL(TBool aForeground);
|
williamr@2
|
116 |
IMPORT_C void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);
|
williamr@2
|
117 |
IMPORT_C void HandleSystemEventL(const TWsEvent& aEvent);
|
williamr@2
|
118 |
IMPORT_C void HandleScreenDeviceChangedL();
|
williamr@2
|
119 |
protected: // from MEikCommandObserver
|
williamr@2
|
120 |
IMPORT_C void ProcessCommandL(TInt aCommand);
|
williamr@2
|
121 |
private: // from MEikMenuObserver
|
williamr@2
|
122 |
IMPORT_C void SetEmphasis(CCoeControl* aMenuWindow,TBool aEmphasis);
|
williamr@2
|
123 |
protected: // from MCoeMessageObserver
|
williamr@2
|
124 |
IMPORT_C MCoeMessageObserver::TMessageResponse HandleMessageL(TUint32 aClientHandleOfTargetWindowGroup, TUid aMessageUid, const TDesC8& aMessageParameters);
|
williamr@2
|
125 |
protected: // from MObjectProvider
|
williamr@2
|
126 |
IMPORT_C virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
|
williamr@2
|
127 |
IMPORT_C virtual MObjectProvider* MopNext();
|
williamr@2
|
128 |
private:
|
williamr@2
|
129 |
// Validate document file type
|
williamr@2
|
130 |
IMPORT_C virtual TBool ValidFileType(TUid aFileUid) const;
|
williamr@2
|
131 |
private: // spare virtuals
|
williamr@2
|
132 |
IMPORT_C virtual void Reserved_3();
|
williamr@2
|
133 |
IMPORT_C virtual void Reserved_4();
|
williamr@2
|
134 |
public:
|
williamr@2
|
135 |
/** Application resource file and screen furniture flags, passed to BaseConstructL(). */
|
williamr@2
|
136 |
enum
|
williamr@2
|
137 |
{
|
williamr@2
|
138 |
/** Application uses a standard resource file. */
|
williamr@2
|
139 |
EStandardApp = 0x00,
|
williamr@2
|
140 |
/** Application has no resource file. */
|
williamr@2
|
141 |
ENoAppResourceFile = 0x01,
|
williamr@2
|
142 |
/** Application uses a different resource file from the standard. */
|
williamr@2
|
143 |
ENonStandardResourceFile= 0x02,
|
williamr@2
|
144 |
/** Application uses no screen furniture. */
|
williamr@2
|
145 |
ENoScreenFurniture = 0x04,
|
williamr@2
|
146 |
/** Indicates the last value in the enum. */
|
williamr@2
|
147 |
ELastReservedEikAppUiFlag = 0x8000
|
williamr@2
|
148 |
};
|
williamr@2
|
149 |
public:
|
williamr@2
|
150 |
IMPORT_C void ReportResourceChangedToAppStackL(CEikAppUi* aTopApp, TInt aEventId);
|
williamr@2
|
151 |
CEikAppUiExtra* AppUiExtra();
|
williamr@2
|
152 |
private:
|
williamr@2
|
153 |
void CreateResourceIndependentFurnitureL();
|
williamr@2
|
154 |
TBool ValidFileExistsL(const TDesC& aFileName);
|
williamr@2
|
155 |
protected:
|
williamr@2
|
156 |
/** A pointer to the application's document. */
|
williamr@2
|
157 |
CEikDocument* iDocument;
|
williamr@2
|
158 |
/** A pointer to the containing app UI. This is NULL for non-embedded
|
williamr@2
|
159 |
apps. */
|
williamr@2
|
160 |
CEikAppUi* iContainerAppUi;
|
williamr@2
|
161 |
/** Embedded document observer. */
|
williamr@2
|
162 |
MApaEmbeddedDocObserver* iDoorObserver;
|
williamr@2
|
163 |
/** Indicates whether or not this is the app UI for an embedded,
|
williamr@2
|
164 |
read-only document. */
|
williamr@2
|
165 |
TBool iEmbeddedAndReadOnly;
|
williamr@2
|
166 |
TInt iFlags;
|
williamr@2
|
167 |
private:
|
williamr@2
|
168 |
enum
|
williamr@2
|
169 |
{
|
williamr@2
|
170 |
EEmbedded = 0x01
|
williamr@2
|
171 |
};
|
williamr@2
|
172 |
private:
|
williamr@2
|
173 |
CEikAppUiExtra* iAppUiExtra;
|
williamr@2
|
174 |
};
|
williamr@2
|
175 |
|
williamr@2
|
176 |
|
williamr@2
|
177 |
|
williamr@2
|
178 |
/** Returns the app UI inside which this app UI is embedded.
|
williamr@2
|
179 |
Embedded app UIs are used for editing embedded documents.
|
williamr@2
|
180 |
|
williamr@2
|
181 |
@return A pointer to this object's container app UI. NULL if this app
|
williamr@2
|
182 |
UI is not embedded */
|
williamr@2
|
183 |
inline CEikAppUi* CEikAppUi::ContainerAppUi() const
|
williamr@2
|
184 |
{ return iContainerAppUi; }
|
williamr@2
|
185 |
|
williamr@2
|
186 |
#endif // __EIKAPPUI_H__
|