epoc32/include/mw/eikappui.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/eikappui.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,186 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __EIKAPPUI_H__
    1.20 +#define __EIKAPPUI_H__
    1.21 +
    1.22 +#include <coeaui.h>
    1.23 +#include <coemain.h>
    1.24 +#include <eikmobs.h>
    1.25 +#include <apadef.h>
    1.26 +#include <vwsdef.h>
    1.27 +#include <eikdef.h>
    1.28 +#include <baerrhan.h>
    1.29 +#include <eikaufty.h>
    1.30 +#include <coemop.h>
    1.31 +
    1.32 +class CEikDocument;
    1.33 +class CEikApplication;
    1.34 +class CEikAppUiExtra;
    1.35 +class MApaEmbeddedDocObserver;
    1.36 +struct SExtendedError;
    1.37 +class CApaCommandLine;
    1.38 +
    1.39 +/** Handles application-wide aspects of the application's user interface such 
    1.40 +as the menu bar, toolbar pop-up menus, opening and closing files and exiting the 
    1.41 +application cleanly. 
    1.42 +
    1.43 +Every GUI application should use its own class derived from CEikAppUi. 
    1.44 +
    1.45 +An app UI's main role is to handle commands, in its HandleCommandL() function. 
    1.46 +These may be invoked using the menu bar, toolbar, or hotkeys; the commands 
    1.47 +that an app UI handles are specified in the application's resource file.
    1.48 +
    1.49 +In addition, the app UI normally needs to respond to other kinds of events, by 
    1.50 +providing suitable implementations of the following virtual functions, all 
    1.51 +inherited from CCoeAppUi: 
    1.52 +
    1.53 +- HandleKeyEventL(): Key events.
    1.54 +
    1.55 +- HandleForegroundEventL(): Application switched to foreground.
    1.56 +
    1.57 +- HandleSwitchOnEventL(): Machine switched on.
    1.58 +
    1.59 +- HandleSystemEventL(): System events.
    1.60 +
    1.61 +- HandleApplicationSpecificEventL(): Application-specific events.
    1.62 +
    1.63 +@publishedAll
    1.64 +@released */
    1.65 +class CEikAppUi : public CCoeAppUi, public MEikMenuObserver, public MCoeMessageObserver, public MObjectProvider
    1.66 +	{
    1.67 +public:
    1.68 +	IMPORT_C ~CEikAppUi();
    1.69 +	IMPORT_C CEikAppUi();
    1.70 +public: // new functions
    1.71 +	IMPORT_C virtual void ConstructL();
    1.72 +	IMPORT_C virtual void HandleModelChangeL();
    1.73 +	IMPORT_C TLanguage ApplicationLanguageL() const;
    1.74 +	IMPORT_C CEikApplication* Application() const;
    1.75 +	IMPORT_C CEikDocument* Document() const;
    1.76 +	IMPORT_C void SetDocument(CEikDocument* aDocument);
    1.77 +	inline CEikAppUi* ContainerAppUi() const;
    1.78 +	IMPORT_C void SetEmbeddedDocInfo(MApaEmbeddedDocObserver* aObserver, TBool aReadOnly);
    1.79 +	IMPORT_C virtual TBool ProcessCommandParametersL(TApaCommand aCommand, TFileName& aDocumentName, const TDesC8& aTail);
    1.80 +	IMPORT_C virtual TBool ProcessCommandParametersL(CApaCommandLine& aCommandLine);
    1.81 +	// Application screen extent
    1.82 +	IMPORT_C TRect ClientRect() const;
    1.83 +	IMPORT_C virtual TRect ApplicationRect() const;
    1.84 +	// Menu utilities
    1.85 +	IMPORT_C void LaunchPopupMenuL(TInt aResourceId, const TPoint& aTargetPos, TPopupTargetPosType aTargetType, const CEikHotKeyTable* aHotKeyTable = NULL);
    1.86 +	IMPORT_C virtual void StopDisplayingMenuBar();
    1.87 +	// Fading effect
    1.88 +	IMPORT_C TBool FadeWhenInBackground();
    1.89 +	IMPORT_C virtual void SetFadedL(TBool aFaded);
    1.90 +	inline void SetFaded(TBool aFaded);			//mm: has no implementation
    1.91 +public: // new function
    1.92 +	IMPORT_C virtual void ReportResourceChangedToAppL(TInt aType);
    1.93 +	IMPORT_C virtual void HandleCommandL(TInt aCommand);
    1.94 +	IMPORT_C virtual void ProcessMessageL(TUid aUid, const TDesC8& aParams);
    1.95 +	IMPORT_C virtual void OpenFileL(const TDesC& aFileName);
    1.96 +	IMPORT_C virtual void CreateFileL(const TDesC& aFileName);
    1.97 +	IMPORT_C virtual TErrorHandlerResponse HandleError(TInt aError, const SExtendedError& aExtErr, TDes& aErrorText, TDes& aContextText);
    1.98 +	IMPORT_C virtual void HandleResourceChangeL(TInt aType);
    1.99 +public: // from CCoeAppUi
   1.100 +	IMPORT_C void PrepareToExit();
   1.101 +protected: // new functions
   1.102 +	// Construction
   1.103 +	IMPORT_C void BaseConstructL(TInt aAppUiFlags = 0);
   1.104 +	IMPORT_C void ReadAppInfoResourceL(TInt aResourceFileOffset = 0);
   1.105 +	IMPORT_C void CreateHotKeyControlL(TInt aResourceId);
   1.106 +	IMPORT_C TBool ProcessCommandParametersL(TApaCommand aCommand, TFileName& aDocumentName);
   1.107 +	// User data change management
   1.108 +	IMPORT_C void SetDocChanged();
   1.109 +	IMPORT_C void SaveAnyChangesL();
   1.110 +	IMPORT_C void SaveL();
   1.111 +	IMPORT_C virtual void Exit();
   1.112 +	// Utility
   1.113 +	IMPORT_C void ClosePopup();		//mm: deprecate?
   1.114 +protected: // from MEikMenuObserver
   1.115 +	IMPORT_C void HandleSideBarMenuL(TInt aResourceId,const TPoint& aPos,TInt aModifiers,const CEikHotKeyTable* aTable);
   1.116 +protected: // from CCoeAppUi
   1.117 +	IMPORT_C void HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent);
   1.118 +	IMPORT_C void HandleForegroundEventL(TBool aForeground);
   1.119 +	IMPORT_C void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);
   1.120 +	IMPORT_C void HandleSystemEventL(const TWsEvent& aEvent);
   1.121 +	IMPORT_C void HandleScreenDeviceChangedL();
   1.122 +protected: // from MEikCommandObserver
   1.123 +	IMPORT_C void ProcessCommandL(TInt aCommand);
   1.124 +private: // from MEikMenuObserver
   1.125 +	IMPORT_C void SetEmphasis(CCoeControl* aMenuWindow,TBool aEmphasis);
   1.126 +protected: // from MCoeMessageObserver
   1.127 +	IMPORT_C MCoeMessageObserver::TMessageResponse HandleMessageL(TUint32 aClientHandleOfTargetWindowGroup, TUid aMessageUid, const TDesC8& aMessageParameters);
   1.128 +protected:	// from MObjectProvider
   1.129 +	IMPORT_C virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
   1.130 +	IMPORT_C virtual MObjectProvider* MopNext();
   1.131 +private: 
   1.132 +	// Validate document file type
   1.133 +	IMPORT_C virtual TBool ValidFileType(TUid aFileUid) const;
   1.134 +private: // spare virtuals	
   1.135 +	IMPORT_C virtual void Reserved_3();
   1.136 +	IMPORT_C virtual void Reserved_4();
   1.137 +public:
   1.138 +	/** Application resource file and screen furniture flags, passed to BaseConstructL(). */
   1.139 +	enum
   1.140 +		{
   1.141 +		/** Application uses a standard resource file. */
   1.142 +		EStandardApp			= 0x00,
   1.143 +		/** Application has no resource file. */
   1.144 +		ENoAppResourceFile		= 0x01,
   1.145 +		/** Application uses a different resource file from the standard. */
   1.146 +		ENonStandardResourceFile= 0x02,
   1.147 +		/** Application uses no screen furniture. */
   1.148 +		ENoScreenFurniture		= 0x04,
   1.149 +		/** Indicates the last value in the enum. */
   1.150 +		ELastReservedEikAppUiFlag = 0x8000
   1.151 +		};
   1.152 +public:
   1.153 +	IMPORT_C void ReportResourceChangedToAppStackL(CEikAppUi* aTopApp, TInt aEventId);
   1.154 +	CEikAppUiExtra* AppUiExtra();
   1.155 +private:
   1.156 +	void CreateResourceIndependentFurnitureL();
   1.157 +	TBool ValidFileExistsL(const TDesC& aFileName);
   1.158 +protected:
   1.159 +	/** A pointer to the application's document. */
   1.160 +	CEikDocument* iDocument;
   1.161 +	/** A pointer to the containing app UI. This is NULL for non-embedded 
   1.162 +	apps. */
   1.163 +	CEikAppUi* iContainerAppUi;
   1.164 +	/** Embedded document observer. */
   1.165 +	MApaEmbeddedDocObserver* iDoorObserver;
   1.166 +	/** Indicates whether or not this is the app UI for an embedded, 
   1.167 +	read-only document. */
   1.168 +	TBool iEmbeddedAndReadOnly;
   1.169 +	TInt iFlags;
   1.170 +private:
   1.171 +	enum
   1.172 +		{
   1.173 +		EEmbedded = 0x01
   1.174 +		};
   1.175 +private:
   1.176 +	CEikAppUiExtra* iAppUiExtra;
   1.177 +	};
   1.178 +
   1.179 +
   1.180 +
   1.181 +/** Returns the app UI inside which this app UI is embedded.
   1.182 +Embedded app UIs are used for editing embedded documents.
   1.183 +
   1.184 +@return A pointer to this object's container app UI. NULL if this app 
   1.185 +UI is not embedded */
   1.186 +inline CEikAppUi* CEikAppUi::ContainerAppUi() const
   1.187 +	{ return iContainerAppUi; }
   1.188 +
   1.189 +#endif	// __EIKAPPUI_H__