1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
27 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
29 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
36 Creates a FEP interface object.
41 typedef CCoeFep* (*TCoeFepFactoryFunctionL)(CCoeEnv& aConeEnvironment, const TDesC& aFullFileNameOfDll, const CCoeFepParameters& aFepParameters);
44 Calls the second ordinal function of the FEP for which the settings dialog is to be executed.
49 typedef void (*TCoeSynchronouslyExecuteFepSettingsDialogFunctionL)(CCoeEnv& aConeEnvironment, const TDesC& aFullFileNameOfDll);
51 /** Stack priority flags.
53 Controls with higher priorities get offered key events before controls
54 with lower priorities.
61 ECoeStackPriorityDefault=0,
63 ECoeStackPriorityMenu=10,
65 ECoeStackPriorityDialog=50,
67 ECoeStackPriorityCba=60,
69 ECoeStackPriorityAlert=200,
71 ECoeStackPrioritySoftkey=240,
73 ECoeStackPriorityFep=250,
75 ECoeStackPriorityEnvironmentFilter=300
79 /** Control stack flags.
81 Each control on the stack has a set of these flags which can be used
82 to refuse to accept key events and to refuse requests for focus.
88 /** The default value */
89 ECoeStackFlagStandard = 0,
90 /** The control does not accept key events. */
91 ECoeStackFlagRefusesAllKeys = 0x01,
92 /** The control does not accept keyboard focus. */
93 ECoeStackFlagRefusesFocus = 0x02,
94 /** The control is owned and deleted by the stack. */
95 ECoeStackFlagOwnershipTransfered= 0x04,
96 /** The control is also added to the stack of any embedded app UI. For
97 example, an alert dialog added through CEikonEnv will be
98 shared on the stack of all embedded app UIs that may appear in the
100 ECoeStackFlagSharable = 0x08
103 class CCoeControlStack;
104 class CCoeViewManager;
106 /** Application user interface (app UI) base class.
108 The app UI's responsibilities include owning the application's control stack and views,
109 handling user commands, (see the derived class CEikAppUi), and handling events sent by
110 the OS to the application, for instance being brought to the foreground.
112 The UI framework class CEikAppUi is derived from this class. UIs may derive
113 further to add their own UI-specific features to the app UI; each application must
114 derive its own concrete app UI class from this.
118 class CCoeAppUi : public CBase
121 // Construction and destruction
122 IMPORT_C CCoeAppUi();
123 IMPORT_C ~CCoeAppUi();
124 IMPORT_C void ConstructL(CCoeAppUi* aPrevious=NULL);
126 IMPORT_C void AddToStackL(const MCoeView& aView,CCoeControl* aControl,TInt aPriority=ECoeStackPriorityDefault,TInt aStackingFlags=ECoeStackFlagStandard);
127 IMPORT_C void AddToStackL(CCoeControl* aControl,TInt aPriority=ECoeStackPriorityDefault,TInt aStackingFlags=ECoeStackFlagStandard);
128 IMPORT_C void RemoveFromStack(CCoeControl* aControl);
129 IMPORT_C void HandleStackChanged();
130 IMPORT_C void HandleStackedControlsResourceChange(TInt aType);
131 IMPORT_C void UpdateStackedControlFlags(CCoeControl* aControl,TInt aFlags,TInt aMask);
133 IMPORT_C CArrayFix<TCoeHelpContext>* AppHelpContextL() const;
135 IMPORT_C virtual TCoeInputCapabilities InputCapabilities() const;
137 IMPORT_C CCoeControl* TopFocusedControl() const;
139 IMPORT_C TBool IsDisplayingMenuOrDialog() const;
140 IMPORT_C TBool IsDisplayingDialog() const;
141 IMPORT_C TBool IsDisplayingControlBetweenPriorities(TInt aLowerPriority, TInt aHigherPriority) const;
143 IMPORT_C void RegisterViewL(MCoeView& aView);
144 IMPORT_C void DeregisterView(const MCoeView& aView);
145 IMPORT_C void SetDefaultViewL(const MCoeView& aView);
146 IMPORT_C TInt GetDefaultViewId(TVwsViewId& aViewId) const;
147 // Pseudo-view registration
148 IMPORT_C void CheckInitializeViewsL(TUid aAppUid);
149 IMPORT_C void RegisterApplicationViewL(TUid aAppUid);
150 IMPORT_C void DeregisterApplicationView();
152 IMPORT_C TBool IsViewConstructed(const TVwsViewId& aViewId) const;
154 IMPORT_C void ActivateViewL(const TVwsViewId& aViewId);
155 IMPORT_C void ActivateViewL(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage);
156 IMPORT_C void ActivateTopViewL();
157 IMPORT_C void CreateActivateViewEventL(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage);
158 IMPORT_C void DeactivateActiveViewIfOwnerMatchL();
159 IMPORT_C void DeactivateActiveViewL();
160 IMPORT_C TInt GetActiveViewId(TVwsViewId& aViewId) const;
162 IMPORT_C void AddViewObserverL(MCoeViewObserver* aViewObserver);
163 IMPORT_C void RemoveViewObserver(MCoeViewObserver* aViewObserver);
164 // View activation observer
165 IMPORT_C void AddViewActivationObserverL(MCoeViewActivationObserver* aViewActivationObserver);
166 IMPORT_C void RemoveViewActivationObserver(MCoeViewActivationObserver* aViewActivationObserver);
167 IMPORT_C void NotifyNextActivation(const TVwsViewId& aViewId, MCoeViewActivationObserver& aViewActivationObserver);
168 IMPORT_C void NotifyNextActivation(MCoeViewActivationObserver& aViewActivationObserver);
169 IMPORT_C TBool CheckSourceOfViewSwitchL(const TSecurityPolicy& aSecurityPolicy,const char* aDiagnostic=NULL) const;
170 // View decativation observer
171 IMPORT_C void AddViewDeactivationObserverL(MCoeViewDeactivationObserver* aViewDeactivationObserver);
172 IMPORT_C void RemoveViewDeactivationObserver(MCoeViewDeactivationObserver* aViewDeactivationObserver);
173 IMPORT_C void NotifyNextDeactivation(const TVwsViewId& aViewId, MCoeViewDeactivationObserver& aViewDeactivationObserver);
174 IMPORT_C void NotifyNextDeactivation(MCoeViewDeactivationObserver& aViewDeactivationObserver);
175 // View session configuration
176 IMPORT_C TInt EnableExternalViewSwitches(TBool aEnable);
177 IMPORT_C void UpdateViewServerBackgroundColor(const TRgb& aBgColor);
180 IMPORT_C void SetCustomControl(TInt aCustomControl);
181 IMPORT_C TInt GetTopViewId(TVwsViewId& aViewId) const;
182 IMPORT_C void SetWindowGroupOrdinal(TInt aWindowGroupOrdinal);
185 IMPORT_C void SetApplicationViewAsDefaultL(); // internalTechnology
186 IMPORT_C void SetSystemDefaultViewL(const TVwsViewId& aViewId,TInt aMode); // internalTechnology
187 IMPORT_C void SetSystemDefaultViewL(const TVwsViewId& aViewId); // internalTechnology
188 IMPORT_C void GetSystemDefaultViewL(TVwsViewId& aViewId); // internalTechnology
189 IMPORT_C virtual void HandleWsEventL(const TWsEvent& aEvent,CCoeControl* aDestination);
190 IMPORT_C virtual void PrepareToExit();
191 protected: // Internal
192 IMPORT_C virtual void HandleScreenDeviceChangedL();
194 IMPORT_C virtual TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
195 IMPORT_C virtual void HandleForegroundEventL(TBool aForeground);
196 IMPORT_C virtual void HandleSwitchOnEventL(CCoeControl* aDestination);
197 IMPORT_C virtual void HandleSystemEventL(const TWsEvent& aEvent);
198 IMPORT_C virtual void HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent);
199 IMPORT_C virtual void SetAndDrawFocus(TBool aFocus);
200 IMPORT_C virtual CArrayFix<TCoeHelpContext>* HelpContextL() const;
202 IMPORT_C virtual TBool FrameworkCallsRendezvous() const;
204 IMPORT_C void WriteInternalStateOfStackedControlsL(RWriteStream& aWriteStream) const; // internalTechnology
205 public: // Deprecated. Do not use!
206 IMPORT_C void RegisterViewAndAddStackL(MCoeView& aView); // deprecated
207 IMPORT_C void DeregisterViewAndRemoveStack(const MCoeView& aView); // deprecated
208 IMPORT_C void RemoveFromViewStack(const MCoeView& aView,CCoeControl* aControl); // deprecated
209 IMPORT_C void UpdateViewStackedControlFlags(const MCoeView& aView,CCoeControl* aControl,TInt aFlags,TInt aMask); // deprecated
210 IMPORT_C void AddToViewStackL(const MCoeView& aView,CCoeControl* aControl,TInt aPriority=ECoeStackPriorityDefault,TInt aStackingFlags=ECoeStackFlagStandard); // deprecated
211 public: // not exported
212 TBool IsControlOnStack(CCoeControl* aControl) const;
213 void SetCurrentControlStackGroupId(TInt aGroupId);
214 void NotifyFontChange(const CCoeFontProvider& aFontProvider);
215 void RefetchPixelMappingL();
217 enum TRemoveCondition
219 ERemoveUnconditionally,
220 ERemoveOnlyIfSharable
223 IMPORT_C virtual void CCoeAppUi_Reserved_2();
225 CCoeControl* TopFocusableControl() const;
226 TInt FindPos(CCoeControlStack* aStack,CCoeControl* aControl) const;
227 void SetFocusToControl(CCoeControl* aControl,TBool aFocus);
228 void DoAddToStackL(CCoeControlStack* aStack,CCoeControl* aControl,TInt aPriority,TInt aStackingFlags);
229 void DoAddToStackL(CCoeControlStack* aStack,CCoeControl* aControl,TInt aPriority,TInt aStackingFlags, TInt aGroupId);
230 void DoRemoveFromStack(CCoeControlStack* aStack,CCoeControl* aControl,TRemoveCondition aRemoveCondition=ERemoveUnconditionally);
231 void DoUpdateStackedControlFlags(CCoeControlStack* aStack,CCoeControl* aControl,TInt aFlags,TInt aMask);
233 /**Monitor function for passing all windows events to registered monitor observers for optional inspection*/
234 void MonitorWsEvent(const TWsEvent& aEvent);
238 friend class CTestDriver;
242 CCoeViewManager* iViewManager;
243 CCoeControlStack* iStack;
245 TInt iCCoeAppUi_Reserved1;
249 #endif // __COEAUI_H__