CEikAppUi Class Reference

#include <mw/eikappui.h>

Link against: eikcore.lib

class CEikAppUi : public CCoeAppUi

Inherits from

  • CEikAppUi
    Protected Attributes
    CEikAppUi *iContainerAppUi
    CEikDocument *iDocument
    MApaEmbeddedDocObserver *iDoorObserver
    TBool iEmbeddedAndReadOnly
    TInt iFlags
    Public Member Enumerations
    enumanonymous { EStandardApp, ENoAppResourceFile, ENonStandardResourceFile, ENoScreenFurniture, ELastReservedEikAppUiFlag }
    Public Member Functions
    CEikAppUiExtra *AppUiExtra()
    IMPORT_C CEikApplication *Application()
    IMPORT_C TLanguageApplicationLanguageL()
    virtual IMPORT_C TRectApplicationRect()
    IMPORT_C TRectClientRect()
    virtual IMPORT_C voidConstructL()
    CEikAppUi *ContainerAppUi()
    virtual IMPORT_C voidCreateFileL(const TDesC &)
    IMPORT_C CEikDocument *Document()
    IMPORT_C TBoolFadeWhenInBackground()
    virtual IMPORT_C voidHandleCommandL(TInt)
    virtual IMPORT_C TErrorHandlerResponseHandleError(TInt, const SExtendedError &, TDes &, TDes &)
    virtual IMPORT_C voidHandleModelChangeL()
    virtual IMPORT_C voidHandleResourceChangeL(TInt)
    IMPORT_C voidLaunchPopupMenuL(TInt, const TPoint &, TPopupTargetPosType, const CEikHotKeyTable *)
    virtual IMPORT_C voidOpenFileL(const TDesC &)
    virtual IMPORT_C voidPrepareToExit()
    virtual IMPORT_C TBoolProcessCommandParametersL(TApaCommand, TFileName &, const TDesC8 &)
    virtual IMPORT_C TBoolProcessCommandParametersL(CApaCommandLine &)
    virtual IMPORT_C voidProcessMessageL(TUid, const TDesC8 &)
    virtual IMPORT_C voidReportResourceChangedToAppL(TInt)
    IMPORT_C voidReportResourceChangedToAppStackL(CEikAppUi *, TInt)
    IMPORT_C voidSetDocument(CEikDocument *)
    IMPORT_C voidSetEmbeddedDocInfo(MApaEmbeddedDocObserver *, TBool)
    virtual IMPORT_C voidSetFadedL(TBool)
    virtual IMPORT_C voidStopDisplayingMenuBar()
    Protected Member Functions
    IMPORT_C voidBaseConstructL(TInt)
    IMPORT_C voidClosePopup()
    IMPORT_C voidCreateHotKeyControlL(TInt)
    virtual IMPORT_C voidExit()
    virtual IMPORT_C voidHandleApplicationSpecificEventL(TInt, const TWsEvent &)
    virtual IMPORT_C voidHandleForegroundEventL(TBool)
    IMPORT_C MCoeMessageObserver::TMessageResponseHandleMessageL(TUint32, TUid, const TDesC8 &)
    virtual IMPORT_C voidHandleScreenDeviceChangedL()
    IMPORT_C voidHandleSideBarMenuL(TInt, const TPoint &, TInt, const CEikHotKeyTable *)
    virtual IMPORT_C voidHandleSystemEventL(const TWsEvent &)
    virtual IMPORT_C voidHandleWsEventL(const TWsEvent &, CCoeControl *)
    virtual IMPORT_C MObjectProvider *MopNext()
    virtual IMPORT_C TTypeUid::PtrMopSupplyObject(TTypeUid)
    IMPORT_C voidProcessCommandL(TInt)
    IMPORT_C TBoolProcessCommandParametersL(TApaCommand, TFileName &)
    IMPORT_C voidReadAppInfoResourceL(TInt)
    IMPORT_C voidSaveAnyChangesL()
    IMPORT_C voidSaveL()
    IMPORT_C voidSetDocChanged()
    Inherited Attributes
    Inherited Functions
    CBase::Delete(CBase *)
    CBase::Extension_(TUint,TAny *&,TAny *)
    CBase::operator new(TUint)
    CBase::operator new(TUint,TAny *)
    CBase::operator new(TUint,TLeave)
    CBase::operator new(TUint,TLeave,TUint)
    CBase::operator new(TUint,TUint)
    CCoeAppUi::ActivateViewL(const TVwsViewId &)
    CCoeAppUi::ActivateViewL(const TVwsViewId &,TUid,const TDesC8 &)
    CCoeAppUi::AddToStackL(CCoeControl *,TInt,TInt)
    CCoeAppUi::AddToStackL(const MCoeView &,CCoeControl *,TInt,TInt)
    CCoeAppUi::AddToViewStackL(const MCoeView &,CCoeControl *,TInt,TInt)
    CCoeAppUi::AddViewActivationObserverL(MCoeViewActivationObserver *)
    CCoeAppUi::AddViewDeactivationObserverL(MCoeViewDeactivationObserver *)
    CCoeAppUi::AddViewObserverL(MCoeViewObserver *)
    CCoeAppUi::CheckSourceOfViewSwitchL(const TSecurityPolicy &,const char *)const
    CCoeAppUi::ConstructL(CCoeAppUi *)
    CCoeAppUi::CreateActivateViewEventL(const TVwsViewId &,TUid,const TDesC8 &)
    CCoeAppUi::DeregisterView(const MCoeView &)
    CCoeAppUi::DeregisterViewAndRemoveStack(const MCoeView &)
    CCoeAppUi::GetActiveViewId(TVwsViewId &)const
    CCoeAppUi::GetDefaultViewId(TVwsViewId &)const
    CCoeAppUi::GetSystemDefaultViewL(TVwsViewId &)
    CCoeAppUi::GetTopViewId(TVwsViewId &)const
    CCoeAppUi::IsControlOnStack(CCoeControl *)const
    CCoeAppUi::IsViewConstructed(const TVwsViewId &)const
    CCoeAppUi::MonitorWsEvent(const TWsEvent &)
    CCoeAppUi::NotifyFontChange(const CCoeFontProvider &)
    CCoeAppUi::NotifyNextActivation(MCoeViewActivationObserver &)
    CCoeAppUi::NotifyNextActivation(const TVwsViewId &,MCoeViewActivationObserver &)
    CCoeAppUi::NotifyNextDeactivation(MCoeViewDeactivationObserver &)
    CCoeAppUi::NotifyNextDeactivation(const TVwsViewId &,MCoeViewDeactivationObserver &)
    CCoeAppUi::RegisterViewAndAddStackL(MCoeView &)
    CCoeAppUi::RegisterViewL(MCoeView &)
    CCoeAppUi::RemoveFromStack(CCoeControl *)
    CCoeAppUi::RemoveFromViewStack(const MCoeView &,CCoeControl *)
    CCoeAppUi::RemoveViewActivationObserver(MCoeViewActivationObserver *)
    CCoeAppUi::RemoveViewDeactivationObserver(MCoeViewDeactivationObserver *)
    CCoeAppUi::RemoveViewObserver(MCoeViewObserver *)
    CCoeAppUi::SetDefaultViewL(const MCoeView &)
    CCoeAppUi::SetSystemDefaultViewL(const TVwsViewId &)
    CCoeAppUi::SetSystemDefaultViewL(const TVwsViewId &,TInt)
    CCoeAppUi::UpdateStackedControlFlags(CCoeControl *,TInt,TInt)
    CCoeAppUi::UpdateViewServerBackgroundColor(const TRgb &)
    CCoeAppUi::UpdateViewStackedControlFlags(const MCoeView &,CCoeControl *,TInt,TInt)
    CCoeAppUi::WriteInternalStateOfStackedControlsL(RWriteStream &)const

    Detailed 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:

    • HandleKeyEventL(): Key events.

    • HandleSwitchOnEventL(): Machine switched on.

    Member Attribute Documentation


    CEikAppUi *iContainerAppUi[protected]

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


    CEikDocument *iDocument[protected]

    A pointer to the application's document.


    MApaEmbeddedDocObserver *iDoorObserver[protected]

    Embedded document observer.


    TBool iEmbeddedAndReadOnly[protected]

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


    TInt iFlags[protected]

    Member Enumeration Documentation

    Enum anonymous

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


    Application uses a standard resource file.


    Application has no resource file.


    Application uses a different resource file from the standard.


    Application uses no screen furniture.


    Indicates the last value in the enum.

    Constructor & Destructor Documentation

    CEikAppUi ( )


    Empty default constructor.

    ~CEikAppUi ( )



    Deletes any resources allocated by this CEikAppUi during its construction.

    Member Function Documentation

    AppUiExtra ( )

    CEikAppUiExtra *AppUiExtra()

    Application ( )

    IMPORT_C CEikApplication *Application()const

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

    Returns: A pointer to the application associated with this app UI.

    ApplicationLanguageL ( )

    IMPORT_C TLanguageApplicationLanguageL()const

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

    Returns: The application language.

    ApplicationRect ( )

    IMPORT_C TRectApplicationRect()const [virtual]

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

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

    Returns: The total area of the screen available to the application.

    BaseConstructL ( TInt )

    IMPORT_C voidBaseConstructL(TIntaAppUiFlags = 0)[protected]

    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.

    aAppUiFlagsApplication user interface flags, EStandardApp for example.

    ClientRect ( )

    IMPORT_C TRectClientRect()const

    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).

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

    ClosePopup ( )

    IMPORT_C voidClosePopup()[protected]

    Closes any currently visible popup menu.

    ConstructL ( )

    IMPORT_C voidConstructL()[virtual]

    Completes construction.

    This simply calls BaseConstructL().

    ContainerAppUi ( )

    CEikAppUi *ContainerAppUi()const [inline]

    Returns the app UI inside which this app UI is embedded. Embedded app UIs are used for editing embedded documents.

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

    CreateFileL ( const TDesC & )

    IMPORT_C voidCreateFileL(const TDesC &aFileName)[virtual]

    Creates and opens a file with the given name.

    The default implementation is empty.

    See also: CEikAppUi::ProcessMessageL()

    aFileNameThe name of the file to create.

    CreateHotKeyControlL ( TInt )

    IMPORT_C voidCreateHotKeyControlL(TIntaResourceId)[protected]

    Creates a hotkey control.

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

    aResourceIdID of a hotkey table resource.

    Document ( )

    IMPORT_C CEikDocument *Document()const

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

    Returns: Pointer to the app UI's associated document.

    Exit ( )

    IMPORT_C voidExit()[protected, virtual]

    Closes the app UI.

    FadeWhenInBackground ( )

    IMPORT_C TBoolFadeWhenInBackground()

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

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

    HandleApplicationSpecificEventL ( TInt, const TWsEvent & )

    IMPORT_C voidHandleApplicationSpecificEventL(TIntaType,
    const TWsEvent &aEvent
    )[protected, virtual]

    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.

    See also: CCoeAppUi::HandleApplicationSpecificEventL KUidValueEikColorSchemeChangeEvent

    aTypeThe type of the event that occurred. This should be a unique identifier constant.
    aEventThe window server event that occurred.

    HandleCommandL ( TInt )

    IMPORT_C voidHandleCommandL(TIntaCommand)[virtual]

    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).

    aCommandThe ID of the command.

    HandleError ( TInt, const SExtendedError &, TDes &, TDes & )

    IMPORT_C TErrorHandlerResponseHandleError(TIntaError,
    const SExtendedError &aExtErr,
    TDes &aErrorText,
    TDes &aContextText

    Handles errors.

    The default implementation of this function returns EErrorNotHandled.

    aErrorThe error code.
    aExtErrFor extended error messages.
    aErrorTextError text.
    aContextTextText describing the context of the error.

    Returns: How the error was handled.

    HandleForegroundEventL ( TBool )

    IMPORT_C voidHandleForegroundEventL(TBoolaForeground)[protected, virtual]

    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.

    aForegroundETrue to switch to the foreground. EFalse to switch from the foreground..

    HandleMessageL ( TUint32, TUid, const TDesC8 & )

    HandleModelChangeL ( )

    IMPORT_C voidHandleModelChangeL()[virtual]

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

    The implementation is empty in CEikAppUi.

    HandleResourceChangeL ( TInt )

    IMPORT_C voidHandleResourceChangeL(TIntaType)[virtual]

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

    aTypeThe type of resources that have changed.

    HandleScreenDeviceChangedL ( )

    IMPORT_C voidHandleScreenDeviceChangedL()[protected, virtual]

    HandleSideBarMenuL ( TInt, const TPoint &, TInt, const CEikHotKeyTable * )

    IMPORT_C voidHandleSideBarMenuL(TIntaResourceId,
    const TPoint &aPos,
    const CEikHotKeyTable *aTable

    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.

    aResourceIdID of the menu resource.
    aPosPosition of the menu's reference point. For sidebar menus, this is the top-right corner.
    aModifiersBitwise OR of the modifiers held when the menu was invoked by the user.
    aTableHotkey table for the menu.

    HandleSystemEventL ( const TWsEvent & )

    IMPORT_C voidHandleSystemEventL(const TWsEvent &aEvent)[protected, virtual]

    See also: CCoeAppUi::HandleSystemEventL( const TWsEvent& aEvent ) CCoeAppUi::HandleSystemEventL

    HandleWsEventL ( const TWsEvent &, CCoeControl * )

    IMPORT_C voidHandleWsEventL(const TWsEvent &aEvent,
    CCoeControl *aDestination
    )[protected, virtual]

    Handles window server events.

    See also: CCoeAppUi::HandleWsEventL

    aEventThe window server event that occurred.
    aDestinationThe control associated with the event.

    LaunchPopupMenuL ( TInt, const TPoint &, TPopupTargetPosType, const CEikHotKeyTable * )

    IMPORT_C voidLaunchPopupMenuL(TIntaResourceId,
    const TPoint &aTargetPos,
    const CEikHotKeyTable *aHotKeyTable = NULL

    Launches a popup menu.

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

    aResourceIdID of the menu resource.
    aTargetPosPosition of the corner of the menu identified by aTargetType.
    aTargetTypeThe corner of the menu by which the menu will be positioned.
    aHotKeyTableOptional menu hotkey table.

    MopNext ( )

    IMPORT_C MObjectProvider *MopNext()[protected, virtual]

    Retrieves the parent.

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

    MopSupplyObject ( TTypeUid )

    IMPORT_C TTypeUid::PtrMopSupplyObject(TTypeUidaId)[protected, virtual]

    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.

    aIdAn encapsulated object type ID.

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

    OpenFileL ( const TDesC & )

    IMPORT_C voidOpenFileL(const TDesC &aFileName)[virtual]

    Opens the specified file.

    The default implementation is empty.

    See also: CEikAppUi::ProcessMessageL()

    aFileNameThe name of the file to open.

    PrepareToExit ( )

    IMPORT_C voidPrepareToExit()[virtual]

    Reimplemented from CCoeAppUi::PrepareToExit()

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

    ProcessCommandL ( TInt )

    IMPORT_C voidProcessCommandL(TIntaCommand)[protected]

    ProcessCommandParametersL ( TApaCommand, TFileName &, const TDesC8 & )

    IMPORT_C TBoolProcessCommandParametersL(TApaCommandaCommand,
    TFileName &aDocumentName,
    const TDesC8 &aTail

    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.

    Many document based applications will override this function to invoke the 2-parameter utility version of this methid.

    See also: CEikAppUi::ProcessCommandParametersL(TApaCommand aCommand, TFileName& aDocumentName)

    aCommandThe shell command sent to the application. Not used in this implementation.
    aDocumentNameAt 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.
    aTailCommand line tail. Not used in this implementation.

    Returns: Whether the final value of aDocumentName represents an existing file.

    ProcessCommandParametersL ( CApaCommandLine & )

    IMPORT_C TBoolProcessCommandParametersL(CApaCommandLine &aCommandLine)[virtual]

    Processes shell commands.

    This is the ProcessCommandParametersL() method that the Uikon application framework will call at application startup. The implementation will extract the command, document file name, and tail parameteres from the command line and call the 3-parameter version of this method.

    The default implementation will simply returns whether or not the file aDocumentName exists.

    See also: CEikAppUi::ProcessCommandParametersL(TApaCommand aCommand ,TFileName& aDocumentName, const TDesC8& aTail)

    aCommandLineThe command line used to initialise the new application.

    Returns: Whether the final value of aDocumentName represents an existing file.

    ProcessCommandParametersL ( TApaCommand, TFileName & )

    IMPORT_C TBoolProcessCommandParametersL(TApaCommandaCommand,
    TFileName &aDocumentName

    This is a convinience utility method that an application can call from an overriden version of the virtual ProcessCommandParametersL() taking three arguments. This method will not be called unless explicitly used by the application in this way.

    This method is useful for applications that are used to view or edit document files, such as text documents or spreadsheets.

    This method will make an application automatically open the document file that was last open in the application, unless a document file is explicitly defined as part of the command line, and the Open or Create commands are specified.

    This method will call CEikAppUi::ValidFileType() to find out if the specified document file can be opened by this application.

    In detail: If aCommand is EApaCommandCreate, the function simply returns EFalse as the file does not yet exist.

    If aCommand is EApaCommandOpen, the function tests whether the specified document is valid and exists. If not, the function attempts to generate a valid default 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.

    See also: CEikAppUi::ValidFileType()

    aCommandThe shell command sent to the application.
    aDocumentNameThe 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.

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

    ProcessMessageL ( TUid, const TDesC8 & )

    IMPORT_C voidProcessMessageL(TUidaUid,
    const TDesC8 &aParams

    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.

    See also: CCoeAppUi::HandleMessageReadyL() CApaTask::SendMessage()

    aUidThe message's unique identifier.
    aParamsMessage parameters.

    ReadAppInfoResourceL ( TInt )

    IMPORT_C voidReadAppInfoResourceL(TIntaResourceFileOffset = 0)[protected]

    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.

    aResourceFileOffsetOffset of the application information in the resource file.

    ReportResourceChangedToAppL ( TInt )

    IMPORT_C voidReportResourceChangedToAppL(TIntaType)[virtual]

    Reports a resource change to the application.

    aTypeThe type of resource that has changed.

    ReportResourceChangedToAppStackL ( CEikAppUi *, TInt )

    IMPORT_C voidReportResourceChangedToAppStackL(CEikAppUi *aTopApp,

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

    See also: CEikAppUi::ReportResourceChangedToAppL(TInt aType)

    aTopAppAppUi of an embedded application.
    aEventIdThe type of resource that has changed.

    SaveAnyChangesL ( )

    IMPORT_C voidSaveAnyChangesL()[protected]

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

    SaveL ( )

    IMPORT_C voidSaveL()[protected]

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

    SetDocChanged ( )

    IMPORT_C voidSetDocChanged()[protected]

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

    SetDocument ( CEikDocument * )

    IMPORT_C voidSetDocument(CEikDocument *aDocument)

    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.

    aDocumentThe app UI's document.

    SetEmbeddedDocInfo ( MApaEmbeddedDocObserver *, TBool )

    IMPORT_C voidSetEmbeddedDocInfo(MApaEmbeddedDocObserver *aObserver,

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

    aObserverObserver for the embedded document.
    aReadOnlyETrue to set the embedded document as read-only. EFalse if not.

    SetFaded ( TBool )


    SetFadedL ( TBool )

    IMPORT_C voidSetFadedL(TBoolaFaded)[virtual]

    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.

    aFadedThe desired faded state

    StopDisplayingMenuBar ( )

    IMPORT_C voidStopDisplayingMenuBar()[virtual]

    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.