williamr@2: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef __COEVIEW_H__ williamr@2: #define __COEVIEW_H__ williamr@2: williamr@2: #include williamr@2: #include // for CCoeStatic williamr@2: williamr@2: class CCoeAppUi; williamr@4: class TVwsViewEvent; williamr@2: williamr@2: /** Specifies an interface for views. williamr@2: williamr@2: This class should be implemented by all application views. williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: class MCoeView williamr@2: { williamr@2: public: williamr@2: /** Returns a TVwsViewId uniquely identifying the view. williamr@2: williamr@2: @return Represents a view in the server. */ williamr@2: virtual TVwsViewId ViewId() const=0; williamr@2: private: williamr@2: /** Takes any action required when a view is activated. Reimplemented versions williamr@2: should read the contents of aCustomMessage for any message type identified williamr@2: by aCustomMessageId that the view understands. williamr@2: williamr@2: The ID of the previously active view aPrevViewId is supplied so that the activated williamr@2: view can subsequently switch back to the caller if required. williamr@2: williamr@2: @param aPrevViewId The UID of the previously active view. williamr@2: @param aCustomMessageId Message type. williamr@2: @param aCustomMessage Message contents. williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: virtual void ViewActivatedL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage)=0; williamr@2: /** Takes any action that is required following deactivation of the view. williamr@2: williamr@2: This reduces the work required of the window server. williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: virtual void ViewDeactivated()=0; williamr@2: williamr@2: protected: williamr@2: IMPORT_C MCoeView(); williamr@2: IMPORT_C virtual TVwsViewIdAndMessage ViewScreenDeviceChangedL(); williamr@2: private: williamr@2: IMPORT_C virtual void ViewConstructL(); williamr@2: protected: williamr@2: IMPORT_C virtual TBool ViewScreenModeCompatible(TInt aScreenMode); // was MCoeView_Reserved_1() williamr@2: private: williamr@2: friend class CCoeViewManager; williamr@2: IMPORT_C virtual void PrepareForViewActivation(); williamr@2: IMPORT_C virtual void MCoeView_Reserved_2(); williamr@2: IMPORT_C virtual void MCoeView_Reserved_3(); williamr@2: private: williamr@2: TInt iMCoeView_Reserved1; williamr@2: }; williamr@2: williamr@4: /** An interface through which view events can be notified to an observer. williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@4: class MCoeViewObserver williamr@2: { williamr@2: public: williamr@4: virtual void HandleViewEventL(const TVwsViewEvent& aEvent)=0; williamr@2: protected: williamr@4: IMPORT_C MCoeViewObserver(); williamr@2: private: williamr@4: IMPORT_C virtual void MCoeViewObserver_Reserved1(); williamr@4: IMPORT_C virtual void MCoeViewObserver_Reserved2(); williamr@2: private: williamr@4: TInt iMCoeViewObserver_Reserved1; williamr@2: }; williamr@2: williamr@2: /** An interface through which view activations can be notified to an observer. williamr@2: williamr@4: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class MCoeViewActivationObserver williamr@2: { williamr@2: public: williamr@2: // williamr@2: // Handles the activation of the view aNewlyActivatedViewId before the old view aViewIdToBeDeactivated is williamr@2: // to be deactivated. williamr@2: // williamr@2: virtual void HandleViewActivation(const TVwsViewId& aNewlyActivatedViewId,const TVwsViewId& aViewIdToBeDeactivated)=0; williamr@2: protected: williamr@2: IMPORT_C MCoeViewActivationObserver(); williamr@2: private: williamr@2: IMPORT_C virtual void MCoeViewActivationObserver_Reserved_1(); williamr@2: IMPORT_C virtual void MCoeViewActivationObserver_Reserved_2(); williamr@2: private: williamr@2: TInt iMCoeViewActivationObserver_Reserved1; williamr@2: }; williamr@2: williamr@4: /** An interface through which view deactivations can be williamr@4: notified to an observer. williamr@2: williamr@4: Dialogs and other floating windows such as virtual keyboards which should be dismissed williamr@4: when a view is deactivated can implement this interface and take any action required. williamr@2: williamr@4: @publishedAll williamr@2: @released */ williamr@4: williamr@4: class MCoeViewDeactivationObserver williamr@2: { williamr@2: public: williamr@4: // williamr@4: // Handles the deactivation of the view identified by aViewIdToBeDeactivated before the newly activated williamr@4: // view with id aNewlyActivatedViewId is marked as current. williamr@4: // williamr@4: virtual void HandleViewDeactivation(const TVwsViewId& aViewIdToBeDeactivated,const TVwsViewId& aNewlyActivatedViewId)=0; williamr@2: protected: williamr@4: IMPORT_C MCoeViewDeactivationObserver(); williamr@2: private: williamr@4: IMPORT_C virtual void MCoeViewDeactivationObserver_Reserved_1(); williamr@4: IMPORT_C virtual void MCoeViewDeactivationObserver_Reserved_2(); williamr@2: private: williamr@4: TInt iMCoeViewDeactivationObserver_Reserved1; williamr@2: }; williamr@2: williamr@2: // williamr@2: // Handles any screen device changes that occur while a view is active williamr@2: // williamr@2: /** A default screen device change handler. williamr@2: williamr@2: This class is used to activate a default view when a screen "flip" occurs, williamr@2: if the currently active view does not implement MCoeView::ViewScreenDeviceChangedL(). williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: @see MCoeView::ViewScreenDeviceChangedL() */ williamr@2: class CCoeScreenDeviceChangeDefaultHandler : public CCoeStatic williamr@2: { williamr@2: public: williamr@2: IMPORT_C ~CCoeScreenDeviceChangeDefaultHandler(); williamr@2: IMPORT_C static CCoeScreenDeviceChangeDefaultHandler* Self(); williamr@2: protected: williamr@2: IMPORT_C CCoeScreenDeviceChangeDefaultHandler(); williamr@2: IMPORT_C CCoeScreenDeviceChangeDefaultHandler(TInt aDestructionPriority); williamr@2: private: williamr@2: IMPORT_C virtual void CCoeStatic_Reserved1(); williamr@2: IMPORT_C virtual void CCoeStatic_Reserved2(); williamr@2: IMPORT_C virtual void CCoeScreenDeviceChangeDefaultHandler_Reserved1(); williamr@2: IMPORT_C virtual void CCoeScreenDeviceChangeDefaultHandler_Reserved2(); williamr@2: public: williamr@2: virtual void HandleScreenDeviceChangedL()=0; williamr@2: virtual TVwsViewIdAndMessage DefaultViewOnScreenDeviceChanged()=0; williamr@2: private: williamr@2: TInt iCCoeScreenDeviceChangeDefaultHandler; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif // __COEVIEW_H__