Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: EIKAPPUI.H
Link against: eikcore.lib

Class CEikAppUi

class CEikAppUi : public CCoeAppUi, public MEikMenuObserver, public MCoeMessageObserver, public MObjectProvider;

Description

Handles application-wide aspects of the application's user interface such as the menu bar, toolbar pop-up menus, opening and closing files and exiting the application cleanly.

Every GUI application should use its own class derived from CEikAppUi.

An app UI's main role is to handle commands, in its HandleCommandL() function. These may be invoked using the menu bar, toolbar, or hotkeys; the commands that an app UI handles are specified in the application's resource file.

In addition, the app UI normally needs to respond to other kinds of events, by providing suitable implementations of the following virtual functions, all inherited from CCoeAppUi:

Derivation

Members

Defined in CEikAppUi:
Application(), ApplicationLanguageL(), ApplicationRect(), BaseConstructL(), CEikAppUi(), ClientRect(), ClosePopup(), ConstructL(), ContainerAppUi(), CreateFileL(), CreateHotKeyControlL(), Document(), ELastReservedEikAppUiFlag, ENoAppResourceFile, ENoScreenFurniture, ENonStandardResourceFile, EStandardApp, Exit(), FadeWhenInBackground(), HandleApplicationSpecificEventL(), HandleCommandL(), HandleError(), HandleForegroundEventL(), HandleMessageL(), HandleModelChangeL(), HandleResourceChangeL(), HandleScreenDeviceChangedL(), HandleSideBarMenuL(), HandleSystemEventL(), HandleWsEventL(), LaunchPopupMenuL(), MopNext(), MopSupplyObject(), OpenFileL(), PrepareToExit(), ProcessCommandL(), ProcessCommandParametersL(), ProcessCommandParametersL(), ProcessCommandParametersL(), ProcessMessageL(), ReadAppInfoResourceL(), ReportResourceChangedToAppL(), ReportResourceChangedToAppStackL(), Reserved_3(), Reserved_4(), SaveAnyChangesL(), SaveL(), SetDocChanged(), SetDocument(), SetEmbeddedDocInfo(), SetEmphasis(), SetFaded(), SetFadedL(), StopDisplayingMenuBar(), ValidFileType(), anonymous, iContainerAppUi, iDocument, iDoorObserver, iEmbeddedAndReadOnly, iFlags, ~CEikAppUi()

Inherited from CBase:
Delete(), Extension_(), operator new()

Inherited from CCoeAppUi:
ActivateViewL(), AddToStackL(), AddToViewStackL(), AddViewDeactivationObserverL(), AppHelpContextL(), CheckSourceOfViewSwitchL(), DeactivateActiveViewIfOwnerMatchL(), DeactivateActiveViewL(), DeregisterApplicationView(), DeregisterView(), GetActiveViewId(), GetDefaultViewId(), HandleKeyEventL(), HandleStackChanged(), HandleStackedControlsResourceChange(), HandleSwitchOnEventL(), HelpContextL(), InputCapabilities(), IsDisplayingControlBetweenPriorities(), IsDisplayingDialog(), IsDisplayingMenuOrDialog(), IsViewConstructed(), NotifyNextDeactivation(), RegisterApplicationViewL(), RegisterViewL(), RemoveFromStack(), RemoveFromViewStack(), RemoveViewDeactivationObserver(), SetAndDrawFocus(), SetDefaultViewL(), UpdateStackedControlFlags(), WriteInternalStateOfStackedControlsL(), iCoeEnv

Inherited from MCoeMessageObserver:
EMessageHandled, EMessageNotHandled, MCoeMessageObserver_Reserved_1(), MCoeMessageObserver_Reserved_2(), TMessageResponse

Inherited from MEikMenuObserver:
CheckHotKeyNotDimmedL(), CreateCustomCommandControlL(), DynInitMenuBarL(), DynInitMenuPaneL(), EMenuBar, EMenuPane, HandleAttemptDimmedSelectionL(), MEikCommandObserver_Reserved1(), MEikCommandObserver_Reserved2(), OfferKeyToAppL(), Reserved_1_MenuObserver(), Reserved_2_MenuObserver(), RestoreMenuL(), TMenuType

Inherited from MObjectProvider:
MObjectProvider_Reserved1(), MObjectProvider_Reserved2(), MopGetObject(), MopGetObjectNoChaining()

See also


Construction and destruction


~CEikAppUi()

IMPORT_C ~CEikAppUi();

Description

Destructor.

Deletes any resources allocated by this CEikAppUi during its construction.


CEikAppUi()

IMPORT_C CEikAppUi();

Description

Empty default constructor.


ConstructL()

virtual IMPORT_C void ConstructL();

Description

Completes construction.

This simply calls BaseConstructL().

[Top]


Member functions


HandleModelChangeL()

virtual IMPORT_C void HandleModelChangeL();

Description

Handles changes to the model associated with this CEikAppUi's application.

The implementation is empty in CEikAppUi.


LaunchPopupMenuL()

IMPORT_C void LaunchPopupMenuL(TInt aResourceId, const TPoint &aTargetPos, TPopupTargetPosType aTargetType, const CEikHotKeyTable *aHotKeyTable=0);

Description

Launches a popup menu.

This function is called by CEikAppUI::HandleSideBarMenuL().

Parameters

TInt aResourceId

ID of the menu resource.

const TPoint &aTargetPos

Position of the corner of the menu identified by aTargetType.

TPopupTargetPosType aTargetType

The corner of the menu by which the menu will be positioned.

const CEikHotKeyTable *aHotKeyTable

Optional menu hotkey table.


ContainerAppUi()

inline CEikAppUi *ContainerAppUi() const;

Description

Returns the app UI inside which this app UI is embedded.

Embedded app UIs are used for editing embedded documents.

Return value

CEikAppUi *

A pointer to this object's container app UI. NULL if this app UI is not embedded


SetDocument()

IMPORT_C void SetDocument(CEikDocument *aDocument);

Description

Sets this app UI's document.

The document associated with the app UI is initially owned by CEikProcess, and there is usually no reason to change it with this function.

Parameters

CEikDocument *aDocument

The app UI's document.


SetEmbeddedDocInfo()

IMPORT_C void SetEmbeddedDocInfo(MApaEmbeddedDocObserver *aObserver, TBool aReadOnly);

Description

Sets the embedded document's observer and read only state.

Parameters

MApaEmbeddedDocObserver *aObserver

Observer for the embedded document.

TBool aReadOnly

ETrue to set the embedded document as read-only. EFalse if not.


ProcessCommandParametersL()

virtual IMPORT_C TBool ProcessCommandParametersL(TApaCommand aCommand, TFileName &aDocumentName, const TDesC8 &aTail);

Description

Processes shell commands.

The Uikon application framework calls this overload when an application is launched by the user opening a file from the shell or when a Create new file command is issued.

This overload simply returns whether or not the file aDocumentName exists.

Most file-based applications will override this function to invoke the 2-parameter overload.

Parameters

TApaCommand aCommand

The shell command sent to the application. Not used in this implementation.

TFileName &aDocumentName

At call time, the name of the document as specified on the command line. On return, the name for the file which will be created by the calling framework.

const TDesC8 &aTail

Command line tail. Not used in this implementation.

Return value

TBool

Whether the final value of aDocumentName represents an existing file.


ProcessCommandParametersL()

virtual IMPORT_C TBool ProcessCommandParametersL(CApaCommandLine &aCommandLine);

Description

Processes shell commands.

The Uikon application framework calls this overload when an application is launched by the user opening a file from the shell or when a Create new file command is issued.

This overload simply returns whether or not the file aDocumentName exists.

Parameters

CApaCommandLine &aCommandLine

The command line used to initialise the new application.

Return value

TBool

Whether the final value of aDocumentName represents an existing file.


Document()

IMPORT_C CEikDocument *Document() const;

Description

Gets a pointer to the app UI's associated document.

Return value

CEikDocument *

Pointer to the app UI's associated document.


Application()

IMPORT_C CEikApplication *Application() const;

Description

Gets a pointer to the application associated with this app UI.

Return value

CEikApplication *

A pointer to the application associated with this app UI.


ClientRect()

IMPORT_C TRect ClientRect() const;

Description

Gets the area of the screen available to the application for drawing.

This does not include the space available for UI components like the menu bar.

The co-ordinates of the rectangle are relative to the whole screen area so, for example, the co-ordinate for the top, left point of the area available for drawing may be (0, 45).

Return value

TRect

The area of the screen available to the application for drawing.


ApplicationRect()

virtual IMPORT_C TRect ApplicationRect() const;

Description

Gets the total area of the screen available to the application.

This includes the space available for UI components like the menu bar.

Return value

TRect

The total area of the screen available to the application.


StopDisplayingMenuBar()

virtual IMPORT_C void StopDisplayingMenuBar();

Description

Stops displaying the application's menu bar.

If the application has no menu bar, or if the menu bar is not visible, this function has no effect.


FadeWhenInBackground()

IMPORT_C TBool FadeWhenInBackground();

Description

Tests whether the application is set to fade when in the background.

Return value

TBool

ETrue if the application is set to fade when in the background, EFalse if not.


SetFadedL()

virtual IMPORT_C void SetFadedL(TBool aFaded);

Description

This is a virtual function. The base class implemenatiation causes the root window and all of its children to change to the desired faded state.

Parameters

TBool aFaded

The desired faded state


SetFaded()

inline void SetFaded(TBool aFaded);

Description

Parameters

TBool aFaded


ReportResourceChangedToAppL()

virtual IMPORT_C void ReportResourceChangedToAppL(TInt aType);

Description

Reports a resource change to the application.

Parameters

TInt aType

The type of resource that has changed.


HandleCommandL()

virtual IMPORT_C void HandleCommandL(TInt aCommand);

Description

Handles user commands.

This is overridden by subclasses to handle commands passed on by the application framework. This function is called by CEikAppUi::ProcessCommandL(), and has an empty implementation. Commands can be invoked using a menu item, a hotkey, or a button (for instance in a toolbar or dialog).

Parameters

TInt aCommand

The ID of the command.


ProcessMessageL()

virtual IMPORT_C void ProcessMessageL(TUid aUid, const TDesC8 &aParams);

Description

Processes Application Architecture messages.

This is overridden by subclasses to handle messages sent from the Application Architecture framework. This implementation only recognises the message UIDs KUidApaMessageSwitchOpenFileValue and KUidApaMessageSwitchCreateFileValue. It performs no action if the message contains other values.

Parameters

TUid aUid

The message's unique identifier.

const TDesC8 &aParams

Message parameters.


OpenFileL()

virtual IMPORT_C void OpenFileL(const TDesC &aFileName);

Description

Opens the specified file.

The default implementation is empty.

Parameters

const TDesC &aFileName

The name of the file to open.

See also:


CreateFileL()

virtual IMPORT_C void CreateFileL(const TDesC &aFileName);

Description

Creates and opens a file with the given name.

The default implementation is empty.

Parameters

const TDesC &aFileName

The name of the file to create.

See also:


HandleError()

virtual IMPORT_C TErrorHandlerResponse HandleError(TInt aError, const SExtendedError &aExtErr, TDes &aErrorText, TDes &aContextText);

Description

Handles errors.

The default implementation of this function returns EErrorNotHandled.

Parameters

TInt aError

The error code.

const SExtendedError &aExtErr

For extended error messages.

TDes &aErrorText

Error text.

TDes &aContextText

Text describing the context of the error.

Return value

TErrorHandlerResponse

How the error was handled.


HandleResourceChangeL()

virtual IMPORT_C void HandleResourceChangeL(TInt aType);

Description

Handles a change to the application's resources which are shared across the environment, for instance colours or fonts.

Parameters

TInt aType

The type of resources that have changed.


PrepareToExit()

virtual IMPORT_C void PrepareToExit();

Description

Performs pre-exit processing to ensure the application will exit cleanly.


BaseConstructL()

protected: IMPORT_C void BaseConstructL(TInt aAppUiFlags=0);

Description

Initialises this app UI with standard values.

The application's standard resource file will be read unless either the ENoAppResourceFile or ENonStandardResourceFile flag is specified.

Parameters

TInt aAppUiFlags

Application user interface flags, EStandardApp for example.


ReadAppInfoResourceL()

protected: IMPORT_C void ReadAppInfoResourceL(TInt aResourceFileOffset=0);

Description

Reads the application UI information at the specified offset in the app's standard resource file.

This function is called by BaseConstructL(), unless either of the ENoAppResourceFile or ENonStandardResourceFile flags was specified.

Parameters

TInt aResourceFileOffset

Offset of the application information in the resource file.


CreateHotKeyControlL()

protected: IMPORT_C void CreateHotKeyControlL(TInt aResourceId);

Description

Creates a hotkey control.

Constructs a CEikHotKeyControl whose CEikHotKeyTable is specified by a resource ID, and adds it to the control stack.

Parameters

TInt aResourceId

ID of a hotkey table resource.


SetDocChanged()

protected: IMPORT_C void SetDocChanged();

Description

Marks the app UI's associated document as having changed.


SaveAnyChangesL()

protected: IMPORT_C void SaveAnyChangesL();

Description

Saves any changes made to the app UI's associated document, if the document is marked as having changed.


Exit()

protected: virtual IMPORT_C void Exit();

Description

Closes the app UI.


SaveL()

protected: IMPORT_C void SaveL();

Description

Saves the app UI's associated document, or sets the document as changed, if the app UI is embedded.


ClosePopup()

protected: IMPORT_C void ClosePopup();

Description

Closes any currently visible popup menu.


ProcessCommandParametersL()

protected: IMPORT_C TBool ProcessCommandParametersL(TApaCommand aCommand, TFileName &aDocumentName);

Description

Tests whether a file exists that is valid for the application associated with the specified document.

If aCommand is EApaCommandCreate, the function simply returns EFalse.

If aCommand is EApaCommandOpen, the function tests whether the specified document is valid and exists. If not, the function attempts to generate a valid filename and returns that in aDocumentName provided the file name portion of the specified full path name has valid format.

If aCommand is any other value, the function tests whether the most recently open document that is valid for the application exists, and returns that in aDocumentName.

The file must be a valid document file, as indicated by the UID value(s),otherwise the function generates a new filename. An application may handle the request by overriding CEikAppUi::ValidFileType() if required.

Parameters

TApaCommand aCommand

The shell command sent to the application.

TFileName &aDocumentName

The name of the document as specified on the command line. On return, this contains the name of the file which will be created by the calling framework.

Return value

TBool

Whether the returned value of aDocumentName represents an existing, valid file.

See also:


HandleSideBarMenuL()

protected: virtual IMPORT_C void HandleSideBarMenuL(TInt aResourceId, const TPoint &aPos, TInt aModifiers, const CEikHotKeyTable *aTable);

Description

Handles sidebar menu commands.

This is called by the Uikon framework to handle invocation of a sidebar menu. See also MEikMenuObserver::HandleSideBarMenuL().

Note that not all UIs support a sidebar.

Parameters

TInt aResourceId

ID of the menu resource.

const TPoint &aPos

Position of the menu's reference point. For sidebar menus, this is the top-right corner.

TInt aModifiers

Bitwise OR of the modifiers held when the menu was invoked by the user.

const CEikHotKeyTable *aTable

Hotkey table for the menu.


HandleApplicationSpecificEventL()

protected: virtual IMPORT_C void HandleApplicationSpecificEventL(TInt aType, const TWsEvent &aEvent);

Description

Handles an application-specific event.

This implementation handles a change to the environment's colour scheme and informs everything on the control stack of the change.

Parameters

TInt aType

The type of the event that occurred. This should be a unique identifier constant.

const TWsEvent &aEvent

The window server event that occurred.


HandleForegroundEventL()

protected: virtual IMPORT_C void HandleForegroundEventL(TBool aForeground);

Description

Handles changes to the application when it switches to or from the foreground.

For instance it handles changes to the cursor visibility and to the fade state.

This function is called from HandleWsEventL() when an event occurs of type EEventFocusLost or EEventFocusGained.

Any application overriding this should first call this base implementation.

Parameters

TBool aForeground

ETrue to switch to the foreground. EFalse to switch from the foreground..


HandleWsEventL()

protected: virtual IMPORT_C void HandleWsEventL(const TWsEvent &aEvent, CCoeControl *aDestination);

Description

Handles window server events.

Parameters

const TWsEvent &aEvent

The window server event that occurred.

CCoeControl *aDestination

The control associated with the event.


HandleSystemEventL()

protected: virtual IMPORT_C void HandleSystemEventL(const TWsEvent &aEvent);

Description

Parameters

const TWsEvent &aEvent


HandleScreenDeviceChangedL()

protected: virtual IMPORT_C void HandleScreenDeviceChangedL();

Description


ProcessCommandL()

protected: virtual IMPORT_C void ProcessCommandL(TInt aCommand);

Description

Checks for, and closes, popups and menubars before calling HandleCommandL()

Parameters

TInt aCommand


SetEmphasis()

private: virtual IMPORT_C void SetEmphasis(CCoeControl *aMenuWindow, TBool aEmphasis);

Description

Parameters

CCoeControl *aMenuWindow

TBool aEmphasis


HandleMessageL()

protected: virtual IMPORT_C MCoeMessageObserver::TMessageResponse HandleMessageL(TUint32 aClientHandleOfTargetWindowGroup, TUid aMessageUid, const TDesC8 &aMessageParameters);

Description

Parameters

TUint32 aClientHandleOfTargetWindowGroup

TUid aMessageUid

const TDesC8 &aMessageParameters

Return value

MCoeMessageObserver::TMessageResponse

See also:


MopSupplyObject()

protected: virtual IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);

Description

Retrieves an object of the same type as that encapsulated in aId.

This function is used to allow to ask owners for access to other objects that they own.

Other than in the case where NULL is returned, the object returned must be of the same object type - that is, the ETypeId member of the object pointed to by the pointer returned by this function must be equal to the iUid member of aId.

Parameters

TTypeUid aId

An encapsulated object type ID.

Return value

TTypeUid::Ptr

Encapsulates the pointer to the object provided. Note that the encapsulated pointer may be NULL.


MopNext()

protected: virtual IMPORT_C MObjectProvider *MopNext();

Description

Retrieves the parent.

Return value

MObjectProvider *

A pointer to an object provider, or NULL if none is defined.


ValidFileType()

private: virtual IMPORT_C TBool ValidFileType(TUid aFileUid) const;

Description

Parameters

TUid aFileUid

Return value

TBool


Reserved_3()

private: virtual IMPORT_C void Reserved_3();

Description


Reserved_4()

private: virtual IMPORT_C void Reserved_4();

Description


ApplicationLanguageL()

IMPORT_C TLanguage ApplicationLanguageL() const;

Description

Determines the current language the application is using to display its user interface.

Return value

TLanguage

The application language.


ReportResourceChangedToAppStackL()

IMPORT_C void ReportResourceChangedToAppStackL(CEikAppUi *aTopApp, TInt aEventId);

Description

Calls ReportResourceChangedToAppL( aEventId ) on recursively on each ContainerAppUi. For use with embedded applications (where iContanerAppUI != NULL)

Parameters

CEikAppUi *aTopApp

AppUi of an embedded application.

TInt aEventId

The type of resource that has changed.

[Top]


Member enumerations


Enum anonymous

n/a

Description

Application resource file and screen furniture flags, passed to BaseConstructL().

EStandardApp

Application uses a standard resource file.

ENoAppResourceFile

Application has no resource file.

ENonStandardResourceFile

Application uses a different resource file from the standard.

ENoScreenFurniture

Application uses no screen furniture.

ELastReservedEikAppUiFlag

Indicates the last value in the enum.

[Top]


Member data


iDocument

protected: CEikDocument * iDocument;

Description

A pointer to the application's document.


iContainerAppUi

protected: CEikAppUi * iContainerAppUi;

Description

A pointer to the containing app UI. This is NULL for non-embedded apps.


iDoorObserver

protected: MApaEmbeddedDocObserver * iDoorObserver;

Description

Embedded document observer.


iEmbeddedAndReadOnly

protected: TBool iEmbeddedAndReadOnly;

Description

Indicates whether or not this is the app UI for an embedded, read-only document.


iFlags

protected: TInt iFlags;

Description