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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
20 #include <coemain.h> // for CCoeStatic
24 /** Specifies an interface for views.
26 This class should be implemented by all application views.
33 /** Returns a TVwsViewId uniquely identifying the view.
35 @return Represents a view in the server. */
36 virtual TVwsViewId ViewId() const=0;
38 /** Takes any action required when a view is activated. Reimplemented versions
39 should read the contents of aCustomMessage for any message type identified
40 by aCustomMessageId that the view understands.
42 The ID of the previously active view aPrevViewId is supplied so that the activated
43 view can subsequently switch back to the caller if required.
45 @param aPrevViewId The UID of the previously active view.
46 @param aCustomMessageId Message type.
47 @param aCustomMessage Message contents.
51 virtual void ViewActivatedL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage)=0;
52 /** Takes any action that is required following deactivation of the view.
54 This reduces the work required of the window server.
58 virtual void ViewDeactivated()=0;
62 IMPORT_C virtual TVwsViewIdAndMessage ViewScreenDeviceChangedL();
64 IMPORT_C virtual void ViewConstructL();
66 IMPORT_C virtual TBool ViewScreenModeCompatible(TInt aScreenMode); // was MCoeView_Reserved_1()
68 friend class CCoeViewManager;
69 IMPORT_C virtual void PrepareForViewActivation();
70 IMPORT_C virtual void MCoeView_Reserved_2();
71 IMPORT_C virtual void MCoeView_Reserved_3();
73 TInt iMCoeView_Reserved1;
76 /** An interface through which view deactivations can be
77 notified to an observer.
79 Dialogs and other floating windows such as virtual keyboards which should be dismissed
80 when a view is deactivated can implement this interface and take any action required.
84 class MCoeViewDeactivationObserver
88 // Handles the deactivation of the view identified by aViewIdToBeDeactivated before the newly activated
89 // view with id aNewlyActivatedViewId is marked as current.
91 virtual void HandleViewDeactivation(const TVwsViewId& aViewIdToBeDeactivated,const TVwsViewId& aNewlyActivatedViewId)=0;
93 IMPORT_C MCoeViewDeactivationObserver();
95 IMPORT_C virtual void MCoeViewDeactivationObserver_Reserved_1();
96 IMPORT_C virtual void MCoeViewDeactivationObserver_Reserved_2();
98 TInt iMCoeViewDeactivationObserver_Reserved1;
101 /** An interface through which view activations can be notified to an observer.
106 class MCoeViewActivationObserver
110 // Handles the activation of the view aNewlyActivatedViewId before the old view aViewIdToBeDeactivated is
111 // to be deactivated.
113 virtual void HandleViewActivation(const TVwsViewId& aNewlyActivatedViewId,const TVwsViewId& aViewIdToBeDeactivated)=0;
115 IMPORT_C MCoeViewActivationObserver();
117 IMPORT_C virtual void MCoeViewActivationObserver_Reserved_1();
118 IMPORT_C virtual void MCoeViewActivationObserver_Reserved_2();
120 TInt iMCoeViewActivationObserver_Reserved1;
124 /** An interface through which view events can be notified to an observer.
128 class MCoeViewObserver
131 virtual void HandleViewEventL(const TVwsViewEvent& aEvent)=0;
133 IMPORT_C MCoeViewObserver();
135 IMPORT_C virtual void MCoeViewObserver_Reserved1();
136 IMPORT_C virtual void MCoeViewObserver_Reserved2();
138 TInt iMCoeViewObserver_Reserved1;
143 // Handles any screen device changes that occur while a view is active
145 /** A default screen device change handler.
147 This class is used to activate a default view when a screen "flip" occurs,
148 if the currently active view does not implement MCoeView::ViewScreenDeviceChangedL().
152 @see MCoeView::ViewScreenDeviceChangedL() */
153 class CCoeScreenDeviceChangeDefaultHandler : public CCoeStatic
156 IMPORT_C ~CCoeScreenDeviceChangeDefaultHandler();
157 IMPORT_C static CCoeScreenDeviceChangeDefaultHandler* Self();
159 IMPORT_C CCoeScreenDeviceChangeDefaultHandler();
160 IMPORT_C CCoeScreenDeviceChangeDefaultHandler(TInt aDestructionPriority);
162 IMPORT_C virtual void CCoeStatic_Reserved1();
163 IMPORT_C virtual void CCoeStatic_Reserved2();
164 IMPORT_C virtual void CCoeScreenDeviceChangeDefaultHandler_Reserved1();
165 IMPORT_C virtual void CCoeScreenDeviceChangeDefaultHandler_Reserved2();
167 virtual void HandleScreenDeviceChangedL()=0;
168 virtual TVwsViewIdAndMessage DefaultViewOnScreenDeviceChanged()=0;
170 TInt iCCoeScreenDeviceChangeDefaultHandler;
174 #endif // __COEVIEW_H__