TApaTask Class Reference

class TApaTask

Application task.

A task is a running application. At any one time, for any given application, there may be zero, one, or more tasks running on a device.

A task is identified by its association with the running application's window group.

An instance of the TApaTaskList class is used to find and access specific tasks.

TApaTaskList RWindowGroup RWsSession

Public Member Functions
TApaTask(RWsSession &)
IMPORT_C voidBringToForeground()
IMPORT_C voidEndTask()
IMPORT_C TBoolExists()
IMPORT_C voidKillTask()
IMPORT_C voidSendKey(TInt, TInt)
IMPORT_C voidSendKey(const TKeyEvent &)
IMPORT_C TIntSendMessage(TUid, const TDesC8 &)
IMPORT_C voidSendSystemEvent(TApaSystemEvent)
IMPORT_C voidSendToBackground()
IMPORT_C voidSetWgId(TInt)
IMPORT_C TIntSwitchCreateFile(const TDesC &)
IMPORT_C TIntSwitchOpenFile(const TDesC &)
IMPORT_C TThreadIdThreadId()
IMPORT_C TIntWgId()
Private Member Functions
TInt CheckSwitchFile()
voidSendSystemEvent(TApaSystemEvent, TEventCode)
Private Attributes
TInt iTApaTask_Reserved1
TInt iWgId
RWsSession &iWsSession

Constructor & Destructor Documentation

TApaTask(RWsSession &)

IMPORT_CTApaTask(RWsSession &aWsSession)

Constructs an empty task object, taking a reference to a window server session.

An object of this type is constructed by an instance of the TApaTaskList class.

The object represents a task when it is assigned a task's window group ID.

TApaTaskList

Parameters

RWsSession & aWsSessionThe window server session.

Member Functions Documentation

BringToForeground()

IMPORT_C voidBringToForeground()

Brings this task to the foreground.

If the task uses the View architecture, then the task's top view is activated.

CheckSwitchFile()

TInt CheckSwitchFile()const [private]

EndTask()

IMPORT_C voidEndTask()

Requests normal closing of this task.

capability
PowerMgmt is required to close system tasks.

Exists()

IMPORT_C TBoolExists()const

Tests whether this TApaTask object is empty. This object represents the state of the task at the time at which it was constructed and is not subsequently updated. Therefore, this does not indicate that the task itself exists and should not be used to test whether or not a particular task is running or not.

TApaTaskList::FindDoc() TApaTaskList::FindApp() TApaTaskList::FindByPos()

KillTask()

IMPORT_C voidKillTask()
Kills this task.
capability
PowerMgmt

SendKey(TInt, TInt)

IMPORT_C voidSendKey(TIntaKeyCode,
TIntaModifiers
)

Sends a key event encapsulating the specified character code and specified modifier keys state to the task's window group.

Key events are handled by the UI framework, specifically by CCoeAppui::HandleWsEventL().

capability
SwEvent
CCoeAppUi::HandleWsEventL()

Parameters

TInt aKeyCodeThe character code.
TInt aModifiersState of the modifier keys.

SendKey(const TKeyEvent &)

IMPORT_C voidSendKey(const TKeyEvent &aKey)

Sends the specified key event to the task's window group.

Key events are handled by the UI framework, specifically by CCoeAppui::HandleWsEventL().

capability
SwEvent
CCoeAppUi::HandleWsEventL() TKeyEvent

Parameters

const TKeyEvent & aKeyThe key event.

SendMessage(TUid, const TDesC8 &)

IMPORT_C TIntSendMessage(TUidaUid,
const TDesC8 &aParams
)

Sends a message to this task's window group.

The message is handled by the UI framework, specifically by CEikAppUI::ProcessMessageL().

CEikAppUi::ProcessMessageL() TEventCode TWsEvent RWindowGroup::FetchMessage()

Parameters

TUid aUidThe UID identifying the message. By default, the UI framework recognizes only two messages, KUidApaMessageSwitchOpenFileValue and KUidApaMessageSwitchCreateFileValue.
const TDesC8 & aParamsThe message. The format and meaning of the message depends on the specific type as identified by the UID.

SendSystemEvent(TApaSystemEvent)

IMPORT_C voidSendSystemEvent(TApaSystemEventaEvent)

Sends a system event to this task's window group.

Events are handled by the UI framework, specifically by CEikAppUi::HandleSystemEventL().

capability
SwEvent
CEikAppUi CCoeAppUi::HandleSystemEventL() TApaSystemEvent

Parameters

TApaSystemEvent aEventThe event type.

SendSystemEvent(TApaSystemEvent, TEventCode)

voidSendSystemEvent(TApaSystemEventaEvent,
TEventCodeaType
)[private]

Parameters

TApaSystemEvent aEvent
TEventCode aType

SendToBackground()

IMPORT_C voidSendToBackground()

Sends this task to the background.

The task whose window group is at the next ordinal position is brought up to the foreground. In addition, the new foreground task's top view is activated, if it uses the View architecture.

SetWgId(TInt)

IMPORT_C voidSetWgId(TIntaWgId)

Sets this task's window group ID.

Parameters

TInt aWgIdThe ID to be assigned.

SwitchCreateFile(const TDesC &)

IMPORT_C TIntSwitchCreateFile(const TDesC &aFilename)

Requests the task to close its existing document, and to create and open a new document.

An application (task) may handle the request by overriding CEikAppUi::CreateFileL() if required.

Parameters

const TDesC & aFilenameThe name of the new document.

SwitchOpenFile(const TDesC &)

IMPORT_C TIntSwitchOpenFile(const TDesC &aFilename)

Requests the task to close its existing document, and to open an existing document.

An application (task) may handle the request by overriding CEikAppUi::OpenFileL() if required.

Parameters

const TDesC & aFilenameThe name of the document to be opened.

ThreadId()

IMPORT_C TThreadIdThreadId()const

Gets the ID of this task's thread

WgId()

IMPORT_C TIntWgId()const

Gets the ID of this task's window group.

Member Data Documentation

TInt iTApaTask_Reserved1

TInt iTApaTask_Reserved1[private]

TInt iWgId

TInt iWgId[private]

RWsSession & iWsSession

RWsSession &iWsSession[private]