Location:
coeaui.h
Link against: cone.lib
CCoeAppUi
Supported from 6.0
General purpose application user interface class. This class handles application-wide aspects of the user interface, such as key-press events. The GUI may derive further to provide its own application user interface class to provide a more concrete framework for applications. An application derives once more to provide event handling facilities.
Note:
this class derived additionally from
MCoeInputObserver
for ER5u, but not for ER5 or any of the DFRD
releases
the GUI class CEikAppUi
is derived from this
class
the public header file coeaui.h declares a large number of public functions in addition to the ones described below, however these are for internal use only
|
Defined in CCoeAppUi
:
ActivateViewL()
, AddToStackL()
, AppHelpContextL()
, CCoeAppUi()
, ConstructL()
, DeregisterView()
, HandleApplicationSpecificEventL()
, HandleForegroundEventL()
, HandleKeyEventL()
, HandleMessageReadyL()
, HandleStackChanged()
, HandleStackedControlsResourceChange()
, HandleSwitchOnEventL()
, HandleSystemEventL()
, HandleWsEventL()
, HelpContextL()
, InputCapabilities()
, IsDisplayingControlBetweenPriorities()
, IsDisplayingMenuOrDialog()
, RegisterViewL()
, RemoveFromStack()
, SetAndDrawFocus()
, UpdateStackedControlFlags()
, ~CCoeAppUi()
Inherited from CBase
:
operator new()
Inherited from CCoeAppUiBase
:
PrepareToExit()
void ConstructL(CCoeAppUi* aPrevious=NULL);
Completes construction of a CCoeAppUi
. This
function creates a control stack for the application. In post ER5u releases it
also initiates a view server session.
|
~CCoeAppUi();
This frees all resources owned by the object, including the control stack and the view server session (after ER5u).
Each control on the stack has a priority, and the position of each control on the stack is determined by its priority and the order in which the controls were added to the stack. Position 0 on the stack contains the control with the highest priority. If more than one control has the same priority, the most recently added has the lowest position. Each control on the stack also has a set of flags, which can be used to refuse key events and requests for focus.
void AddToStackL(CCoeControl* aControl,TInt aPriority=ECoeStackPriorityDefault,TInt aStackingFlags=ECoeStackFlagStandard);
Adds a control to the control stack. This function is used by most GUI applications to add their application view — an application-specific control — to the stack.
|
void AddToStackL(const MCoeView& aView,CCoeControl* aControl,TInt aPriority=ECoeStackPriorityDefault,TInt aStackingFlags=ECoeStackFlagStandard);
Supported from 6.1
Adds the control aControl
to the control stack
associated with the view aView
.
|
void RemoveFromStack(CCoeControl* aControl);
Removes a control from the control stack. The function also handles the change to the stack.
|
void UpdateStackedControlFlags(CCoeControl* aControl,TInt aFlags,TInt aMask);
Updates the value of the flags for a control on the control
stack. The mask aMask
defines which flags are modified, while
aFlags
defines the values they are set to.
The function panics if the control is not on the stack.
|
void HandleStackChanged();
Handles changes in control stack flags. This gives keyboard focus to the focusable control with the highest priority on the control stack.
It should be called whenever the flag values are modified,
after calling UpdateStackedControlFlags()
for example
TBool IsDisplayingMenuOrDialog() const;
Tests whether the application is displaying a menu bar or dialog.
|
TBool IsDisplayingControlBetweenPriorities(TInt aLowerPriority, TInt aHigherPriority) const;
Tests whether the application is displaying a control between
given priorities. This function returns ETrue
if the application
is currently displaying a control which has a priority on the control stack of
between (but not including) aLowerPriority
and
aHigherPriority
.
|
|
virtual TCoeInputCapabilities InputCapabilities() const;
Returns the supported input capabilities of the control with focus.
|
MCoeInputObserver
.CCoeAppUi::HandleKeyEventL()
should also override the
InputCapabilities()
virtual function, returning a
TCoeInputCapabilities
object whose attributes correspond to the
behaviour of the HandleKeyEventL()
function.
InputCapabilities()
functions should do a
base-call and "merge" the returned input-capabilities with its own input
capabilities. If the overriding InputCapabilities()
function needs
to get the input-capabilities of any top-level control, it should do so by
calling CCoeControl::RecursivelyMergedInputCapabilities()
on that
control.void HandleStackedControlsResourceChange(TInt aType);
Handles a change to the application's run-time resources for all controls on the control stack. These are resources which are shared across the environment, such as colours or fonts.
Note:
In ER5u this function was protected.
|
protected: CArrayFix<TCoeHelpContext>* AppHelpContextL() const;
Returns a list of relevant contexts within an application help file appropriate for the current state of the application. The array is generated from the application user interface and the controls on the control stack.
|
protected: void HandleWsEventL(const TWsEvent& aEvent,CCoeControl* aDestination);
Handles window server events.
This function is called whenever the window server sends an
event aEvent
(standard or special) to the application. It calls
one of a number of functions, according to the type of the event
received:
For standard key press events this function calls
CCoeControl::OfferKeyEventL()
for each control on the stack,
beginning with the control at the top (position 0) until a control returns
EkeyWasConsumed
. If no control on the stack consumes the key
event, this function then calls HandleKeyEventL()
. Note that
CCoeControl::OfferKeyEventL()
is not called for those controls
whose flag ECoeStackFlagRefusesAllKeys
is set.
For standard pointer events this function calls
CCoeControl::ProcessPointerEventL()
on the control given by
aDestination
.
For standard pointer buffer ready events this function
calls ProcessPointerBufferReadyL()
on the control given by
aDestination
.
For special focus, switch on, user, and message ready
events, this function calls one of the following private virtual
functions:HandleForegroundEventL()HandleSwitchOnEventL()HandleSystemEventL()
HandleMessageReadyL()
(
not available post
ER5u)HandleApplicationSpecificEventL()
.All these functions have
empty default implementations, and should be implemented by derived classes if
required.
|
With the exception of HandleKeyEventL
all of the
virtual functions listed have empty default implementations.
The functions below are called by the system to handle responses to various kinds of events. They are not intended to be called by an application. They are provided to allow application developers to customise system responses to various kinds of events. These events can be handled at the level of the App UI by providing suitable implementations in derived classes.
private: virtual void HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
Handles key events.
This function is called by HandleWsEventL()
if a
key press event occurs and all of the controls on the control stack return
EKeyWasNotConsumed
from OfferKeyEventL()
. It may be
overridden by derived classes.
This function was replaced by another overload after ER5.
|
CCoeAppUi::AddToStackL()
.CCoeAppUi::HandleKeyEventL()
should also override the
InputCapabilities()
virtual function, returning a
TCoeInputCapabilities
object whose attributes correspond to the
behaviour of the HandleKeyEventL()
function. Note that the
overriding InputCapabilities()
function should do a base-call and
"merge" the returned input-capabilities with its own input capabilities. If the
overriding InputCapabilities()
function needs to get the
input-capabilities of any top-level control, it should do so by calling
CCoeControl::RecursivelyMergedInputCapabilities()
on that
control.private: virtual TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
Handles key events.
This function is called by HandleWsEventL()
if a
key press event occurs and all of the controls on the control stack return
EKeyWasNotConsumed
from OfferKeyEventL()
.
Key events come from the window server. Each keyboard key press
generates three separate key events in the order;
EEventKeyDown
, EEventKey
, and
EEventKeyUp
. Most controls are mainly interested in
EEventKey
for handling ordinary events.
This function may be overridden by derived classes.
|
|
private: virtual void HandleForegroundEventL(TBool aForeground);
Handles changes in keyboard focus when an application switches
to foreground. This function is called from HandleWsEventL()
when
an event occurs of type EEventFocusLost
or
EEventFocusGained
.
The function has an empty default implementation, and may be overridden by derived classes.
|
private: virtual void HandleSwitchOnEventL(CCoeControl* aDestination);
Handles the special switch on event.
This function is called by HandleWsEventL()
if the
device is switched on. It has an empty default implementation, and may be
overridden by derived classes.
|
private: virtual void HandleSystemEventL(const TWsEvent& aEvent);
Handles system events generated by the window server. It has an empty default implementation, and may be overridden by derived classes.
|
private: virtual void HandleMessageReadyL();
Handles message ready events generated by the window server. It has an empty default implementation, and may be overridden by derived classes.
private: virtual void HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent);
Handles the specified application-specific event.
CCoeAppUi
calls this function when it gets a window server event
that is not in the system range (i.e type EEventUser
). The type of
event is usually identified by a UID value which some applications are expected
to understand.
The function has an empty default implementation, and may be overridden by derived classes.
|
private: virtual CArrayFix<TCoeHelpContext>* HelpContextL() const;
Gets a list of help contexts for a particular application user interface. This has an empty default implementation.
|
void ActivateViewL(const TVwsViewId& aViewId);
Activates a specified application view, without passing any message.
|
|
void ActivateViewL(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage);
Activates a specified application view, then passes the message
text descriptor aCustomMessage
for a message of type
aCustomMessageId
.
Notes:
Activation works synchronously so that, in general, this method returns when the view is fully activated.
An application defines and publishes the message UIDs that it understands. For example, a contacts application activates an email editor view and passes an email address as a custom message. To do this, the contacts application must use a message UID, and descriptor encoding, that the email application has published as being understandable.
|
|
void RegisterViewL(MCoeView& aView);
Supported from 6.1
Registers the view aView
with the view
architecture. All views should be registered in the appUi
ConstructL()
.
|
void DeregisterView(const MCoeView& aView);
Supported from 6.1
Deregisters the view aView
which is required
before the application exits. Panics if there is no connection to the view
server or if the view does not exist.
|
private: virtual void SetAndDrawFocus(TBool aFocus);
Sets the keyboard focus of a control and then draws it.
CCoeAppUi
calls SetAndDrawFocus()
when it gets a
window server event on focus change, and in some cases when handling focus
changes on the control stack.
The function has an empty default implementation, and may be
overridden by derived classes. It is intended that implementation should set
the value of a focus flag within the control is to the value given by
aFocus
— this flag indicates whether or not the
control has keyboard focus. The function should then draw or change the
appearance of the control to indicate whether or not it currently has
focus.
|