Location:
eikappui.h
Link against: eikcore.lib
CEikAppUi
Supported from 6.0
Handles application-wide aspects of the application’s user interface such as toolbar pop-up menus, opening and closing files and exiting the application cleanly. App UIs handle commands, which are invoked using the menu bar, toolbar, toolband and hotkeys; the commands that an app UI handles are specified in its application’s resource file.
An application’s UI is responsible for opening and closing the application document’s files in response to user commands. It also owns and manages the core controls of the user interface, for example the tool bar and menu bar, and handles commands from these.
Every Uikon application should use its own class derived from
CEikAppUi
to handle application-wide user interface details.
Responses to various kinds of events can be handled at the level of the app UI
by providing suitable implementations of the following virtual
functions:
CCoeAppUi::HandleKeyEventL()
: Key events
CCoeAppUi::HandleForegroundEventL()
: Application
switched to foreground
CCoeAppUi::HandleSwitchOnEventL()
: Machine
switched on.
CCoeAppUi::HandleSystemEventL()
: System
events.
CCoeAppUi::HandleMessageReadyL()
: Message
ready.
CCoeAppUi::HandleApplicationSpecificEventL()
:
Application-specific events.
CEikAppUi::HandleCommandL()
: Handles commands
defined in resource files.
|
Defined in CEikAppUi
:
Anonymous
, Application()
, ApplicationRect()
, BaseConstructL()
, CEikAppUi()
, ClientRect()
, ClosePopup()
, ConstructL()
, ContainerAppUi()
, CreateFileL()
, CreateHotKeyControlL()
, Document()
, ENoAppResourceFile
, ENoScreenFurniture
, ENonStandardResourceFile
, EStandardApp
, Exit()
, FadeWhenInBackground()
, HandleApplicationSpecificEventL()
, HandleCommandL()
, HandleError()
, HandleForegroundEventL()
, HandleModelChangeL()
, HandleResourceChangeL()
, HandleSideBarMenuL()
, HandleWsEventL()
, LaunchPopupMenuL()
, OpenFileL()
, PrepareToExit()
, ProcessCommandParametersL()
, ProcessMessageL()
, ReadAppInfoResourceL()
, ReportResourceChangedToAppL()
, SaveAnyChangesL()
, SaveL()
, SetDocChanged()
, SetDocument()
, SetEmbeddedDocInfo()
, StopDisplayingMenuBar()
, iContainerAppUi
, iDocument
, iDoorObserver
, iEmbeddedAndReadOnly
, ~CEikAppUi()
Inherited from CBase
:
operator new()
Inherited from CCoeAppUi
:
ActivateViewL()
,
AddToStackL()
,
AppHelpContextL()
,
DeregisterView()
,
HandleStackChanged()
,
HandleStackedControlsResourceChange()
,
InputCapabilities()
,
IsDisplayingControlBetweenPriorities()
,
IsDisplayingMenuOrDialog()
,
RegisterViewL()
,
RemoveFromStack()
,
UpdateStackedControlFlags()
Inherited from MCoeMessageObserver
:
EMessageHandled
,
EMessageNotHandled
,
HandleMessageL()
,
TMessageResponse
Inherited from MEikCommandObserver
:
CreateCustomCommandControlL()
,
ProcessCommandL()
Inherited from MEikMenuObserver
:
CheckHotKeyNotDimmedL()
,
DynInitMenuBarL()
,
DynInitMenuPaneL()
,
EMenuBar
,
EMenuPane
,
HandleAttemptDimmedSelectionL()
,
OfferKeyToAppL()
,
RestoreMenuL()
,
SetEmphasis()
,
TMenuType
The construction of a CEikAppUi
is usually handled
automatically by the Application Architecture framework; application writers
usually don’t need to call the constructors
themselves.
~CEikAppUi();
Destructor.
Deletes any resources acquired by this CEikAppUi
during its construction phases.
virtual void ConstructL();
Completes construction. The implementation of
ConstructL()
in CEikAppUi
simply calls
BaseConstructL()
.
protected: void BaseConstructL(TInt aAppUiFlags=0);
Initialises this app UI with standard values. The
application’s standard resource file will be read unless the
ENoAppResourceFile
or ENonStandardResourceFile
flags
are passed.
|
protected: void ReadAppInfoResourceL(TInt aResourceFileOffset=0);
Reads the application information for this application from the
specified resource offset. This function is called automatically in
BaseConstructL()
.
|
virtual void HandleCommandL(TInt aCommand);
Handles user commands. This is overridden by subclasses to
handle user commands passed on by the application framework. This function is
called by CEikAppUi::ProcessCommandL()
, and has a blank
implementation. It may be overridden in order to provide custom responses to
user commands. A command:
instructs the application to perform some function
can be invoked using either a menu item, a hotkey, or a button (in a toolbar, toolband or dialog)
|
virtual void HandleModelChangeL();
Handles changes to the model associated with this
CEikAppUi
’s application. This virtual function is empty in
CEikAppUi
.
void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);
Handles window server events.
|
protected: TBool ProcessCommandParametersL(TApaCommand aCommand,TFileName& aDocumentName);
Processes shell commands. The default implementation of this
function returns whether or not the file aDocumentName
exists, and
does nothing else. The Uikon application framework calls the three-argument
form when an application is started by selecting a file from the shell or by
issuing a Create new file
command.
Most file-based applications will override the virtual
three-argument form of this function to invoke the two-argument form. If the
passed value of aDocumentName
is not the name of a file of the
right type for this application, a new filename is returned through
aDocumentName
. Implementations of this function should not attempt
to open the document. That is handled separately by the application framework
after the command line has been processed.
When called automatically, aCommand
is either
EApaCommandCreate
or EApaCommandRun
.
|
|
public: virtual TBool ProcessCommandParametersL(TApaCommand aCommand,TFileName& aDocumentName,const TDesC8& aTail);
Processes shell commands. The default implementation of this
function returns whether or not the file aDocumentName
exists, and
does nothing else. The Uikon application framework calls the three-argument
form when an application is started by selecting a file from the shell or by
issuing a Create new file
command.
Most file-based applications will override the virtual
three-argument form to invoke the two-argument form. If the passed value of
aDocumentName
is not the name of a file of the right type for this
application, a new filename is returned through aDocumentName
.
Implementations of this function should not attempt to open the document. That
is handled separately by the application framework after the command line has
been processed.
When called automatically, aCommand
is either
EApaCommandCreate
or EApaCommandRun
.
|
|
virtual void ProcessMessageL(TUid aUid,const TDesC8& aParams);
Processes Application Architecture messages. This is overridden
by subclasses to handle messages sent from the Application Architecture
framework. As defined in CEikAppUi
, this function recognises the
message UIDs KUidApaMessageSwitchOpenFileValue
and
KUidApaMessageSwitchCreateFileValue
, and performs no action if the
message contains neither of these values.
See also: CCoeAppUi::HandleMessageReadyL()
and
CApaTask::SendMessage()
.
|
virtual TErrorHandlerResponse HandleError
(TInt aError,
const SExtendedError& aExtErr,
TDes& aErrorText,
TDes& aContextText);
Handles errors. The default implementation of this function
simply returns EErrorNotHandled
.
|
|
virtual void OpenFileL(const TDesC& aFileName);
Opens the specified file in response to a corresponding message. The default implementation is empty; and can be overridden by application developers to provide a file opening capability.
|
virtual void CreateFileL(const TDesC& aFileName);
Creates and opens a file with the given name in response to the corresponding message. The default implementation is empty; and can be overridden by application developers.
|
CEikAppUi* ContainerAppUi() const;
Returns the app UI inside which this app UI is embedded. Embedded app UIs are used for example, for editing embedded documents and to stack a help application onto the context of a current application.
|
void SetEmbeddedDocInfo(MApaEmbeddedDocObserver* aObserver,TBool aReadOnly);
Sets the embedded document’s observer and read only state.
|
CEikDocument* Document() const;
Gets this application UI’s document pointer.
|
void SetDocument(CEikDocument* aDocument);
Sets this Application UI’s document pointer. The
document being presented in an app UI is initially owned by
CEikProcess
, and there is usually no reason to change it with this
function.
|
protected: void SetDocChanged();
Marks this CEikAppUi
’s associated document
as having changed.
protected: void SaveAnyChangesL();
Saves changes made to the app UI’s associated document if the document is marked as having changed.
CEikApplication* Application() const;
Gets a pointer to the application associated with this app UI.
|
TRect ApplicationRect() const;
Gets the total area of the screen available to the application. This includes the space that is available for a toolbar, toolband or title band, if the application requires them.
|
TRect ClientRect() const;
Gets the area of the screen available to the application for drawing. This does not include the space that is available for a toolbar, toolband or title band, if the application requires them.
|
protected: void CreateHotKeyControlL(TInt aResourceId);
Creates a hotkey control.
Constructs a CEikHotKeyControl
whose
CEikHotKeytable
is specified by a resource ID, and adds it to the
control stack.
|
TBool FadeWhenInBackground();
Tests whether the application is set to fade when in the background.
|
void LaunchPopupMenuL(TInt aResourceId,const TPoint& aTargetPos,TPopupTargetPosType aTargetType,const CEikHotKeyTable* aHotKeyTable = NULL);
Launches a popup menu. This function is called by
CEikAppUI::HandleSideBarMenuL()
.
|
void StopDisplayingMenuBar();
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.
protected: void ClosePopup();
Closes any currently visible sidebar popup menu. Calls to
Popup()
immediately after a ClosePopup()
return
NULL
.
protected: void HandleSideBarMenuL(TInt aResourceId,const TPoint& aPos,TInt aModifiers,const CEikHotKeyTable* aTable);
Handles sidebar menu commands. This is called by the Uikon
framework to handle user invocation of a sidebar menu. See also
MEikMenuObserver::HandleSideBarMenuL()
.
|
void HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent);
Handles an application specific event. This function takes action on notification of a change to the environment colour scheme and informs everything on the control stack of the change.
See also: CCoeAppUi
.
|
void HandleForegroundEventL(TBool aForeground);
Handles changes in keyboard focus when an application switches
to, or from, the foreground. This function is called from
HandleWsEventL()
when an event occurs of type
EEventFocusLost
or EEventFocusGained
.
Any application overriding this should first call the base function.
|
void ReportResourceChangedToAppL(TInt aType);
Reports a resource change to the application.
|
virtual void HandleResourceChangeL(TInt aType);
Handles a change to the application's resources which are shared across the environment. Colours or fonts for example.
|
void PrepareToExit();
Performs pre-exit processing to ensure the application will exit cleanly.
void SaveL();
Saves the app UI’s document, or sets the document as changed if the app UI is embedded.
enum {...} //anonymous
The following enums relate to the use of an application resource file and screen furniture.
|
CEikAppUi* iContainerAppUi
A pointer to the containing app UI.
iContainerAppUi
is NULL
for non-embedded app
UIs.
TBool iEmbeddedAndReadOnly
ETrue
only if this CEikAppUi
is the
app UI for an embedded document which is read-only.