1.1 --- a/epoc32/include/apgtask.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/apgtask.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,195 @@
1.4 -apgtask.h
1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +#ifndef __APGTASK_H__
1.21 +#define __APGTASK_H__
1.22 +
1.23 +#include <e32base.h>
1.24 +#include <w32std.h>
1.25 +
1.26 +class RWsSession;
1.27 +struct TKeyEvent;
1.28 +
1.29 +/** @internalTechnology */
1.30 +static const TInt KApaSystemEventsWithPowerMgmtCapabilityStart = 100;
1.31 +/** @internalTechnology */
1.32 +static const TInt KApaSystemEventsWithPowerMgmtCapabilityEnd = 199;
1.33 +
1.34 +/** Defines the event types that a TApaTask object can send to its window group.
1.35 +
1.36 +The events are sent by TApaTask::SendSystemEvent() and are handled by CEikAppUi::HandleSystemEventL().
1.37 +
1.38 +@publishedAll
1.39 +@released
1.40 +@see TApaTask::SendSystemEvent()
1.41 +@see CEikAppUi
1.42 +@see CCoeAppUi::HandleSystemEventL() */
1.43 +enum TApaSystemEvent
1.44 + {
1.45 + /** The task is being closed. */
1.46 + EApaSystemEventShutdown=1,
1.47 + /** Reserved for future use. */
1.48 + EApaSystemEventBackupStarting,
1.49 + /** Reserved for future use. */
1.50 + EApaSystemEventBackupComplete,
1.51 + /** The task is being brought to the foreground. */
1.52 + EApaSystemEventBroughtToForeground,
1.53 + /** Close any tasks including system tasks.
1.54 + Events in the range @c KApaSystemEventsWithPowerMgmtCapabilityStart to
1.55 + @c KApaSystemEventsWithPowerMgmtCapabilityEnd requires capability PowerMgmt*/
1.56 + EApaSystemEventSecureShutdown = KApaSystemEventsWithPowerMgmtCapabilityStart
1.57 + };
1.58 +
1.59 +#ifdef _UNICODE
1.60 +/**
1.61 +@publishedAll
1.62 +@released
1.63 +*/
1.64 +#define KUidApaMessageSwitchOpenFile KUidApaMessageSwitchOpenFile16
1.65 +
1.66 +/**
1.67 +@publishedAll
1.68 +@released
1.69 +*/
1.70 +#define KUidApaMessageSwitchCreateFile KUidApaMessageSwitchCreateFile16
1.71 +
1.72 +/**
1.73 +@publishedAll
1.74 +@released
1.75 +*/
1.76 +#define KUidApaMessageSwitchOpenFileValue KUidApaMessageSwitchOpenFileValue16
1.77 +
1.78 +/**
1.79 +@publishedAll
1.80 +@released
1.81 +*/
1.82 +#define KUidApaMessageSwitchCreateFileValue KUidApaMessageSwitchCreateFileValue16
1.83 +#else
1.84 +#define KUidApaMessageSwitchOpenFile KUidApaMessageSwitchOpenFile8
1.85 +#define KUidApaMessageSwitchCreateFile KUidApaMessageSwitchCreateFile8
1.86 +#define KUidApaMessageSwitchOpenFileValue KUidApaMessageSwitchOpenFileValue8
1.87 +#define KUidApaMessageSwitchCreateFileValue KUidApaMessageSwitchCreateFileValue8
1.88 +#endif
1.89 +
1.90 +/**
1.91 +@internalComponent
1.92 +*/
1.93 +const TInt KUidApaMessageSwitchOpenFileValue16=0x10003A39;
1.94 +
1.95 +/**
1.96 +@internalComponent
1.97 +*/
1.98 +const TUid KUidApaMessageSwitchOpenFile16={KUidApaMessageSwitchOpenFileValue16};
1.99 +
1.100 +/**
1.101 +@internalComponent
1.102 +*/
1.103 +const TInt KUidApaMessageSwitchCreateFileValue16=0x10003A3A;
1.104 +
1.105 +/**
1.106 +@internalComponent
1.107 +*/
1.108 +const TUid KUidApaMessageSwitchCreateFile16={KUidApaMessageSwitchCreateFileValue16};
1.109 +
1.110 +class TApaTask
1.111 +/** Application task.
1.112 +
1.113 +A task is a running application. At any one time, for any given application,
1.114 +there may be zero, one, or more tasks running on a device.
1.115 +
1.116 +A task is identified by its association with the running application's window
1.117 +group.
1.118 +
1.119 +An instance of the TApaTaskList class is used to find and access specific
1.120 +tasks.
1.121 +
1.122 +@publishedAll
1.123 +@released
1.124 +@see TApaTaskList
1.125 +@see RWindowGroup
1.126 +@see RWsSession */
1.127 + {
1.128 +public:
1.129 +
1.130 + IMPORT_C TApaTask(RWsSession& aWsSession);
1.131 + IMPORT_C void SetWgId(TInt aWgId);
1.132 + IMPORT_C TInt WgId() const;
1.133 + IMPORT_C TBool Exists() const;
1.134 + IMPORT_C TThreadId ThreadId() const;
1.135 + IMPORT_C void BringToForeground();
1.136 + IMPORT_C void SendToBackground();
1.137 + IMPORT_C void EndTask();
1.138 + IMPORT_C void KillTask();
1.139 + IMPORT_C void SendKey(TInt aKeyCode,TInt aModifiers);
1.140 + IMPORT_C void SendKey(const TKeyEvent& aKey);
1.141 + IMPORT_C void SendSystemEvent(TApaSystemEvent aEvent);
1.142 + IMPORT_C TInt SwitchOpenFile(const TDesC& aFilename);
1.143 + IMPORT_C TInt SwitchCreateFile(const TDesC& aFilename);
1.144 + IMPORT_C TInt SendMessage(TUid aUid, const TDesC8& aParams);
1.145 +
1.146 +private:
1.147 + TInt CheckSwitchFile() const;
1.148 + void SendSystemEvent(TApaSystemEvent aEvent, TEventCode aType);
1.149 +private:
1.150 + RWsSession& iWsSession;
1.151 + TInt iWgId;
1.152 + TInt iTApaTask_Reserved1;
1.153 + };
1.154 +
1.155 +class TApaTaskList
1.156 +/** Accesses tasks running on a device.
1.157 +
1.158 +Tasks can be identified by document, application specific UID or by caption
1.159 +name.
1.160 +
1.161 +Users of this class can also cycle through a set of tasks running a specific
1.162 +application, bringing each one, in turn, into the foreground.
1.163 +
1.164 +@publishedAll
1.165 +@released
1.166 +@see TApaTask */
1.167 + {
1.168 +public:
1.169 + /** Defines the direction in which tasks are cycled to the foreground. This is used
1.170 + by the CycleTasks() function.
1.171 +
1.172 + @see TApaTaskList::CycleTasks() */
1.173 + enum TCycleDirection
1.174 + {
1.175 + /** Cycles the task list forwards, i.e. the foreground task is moved to background,
1.176 + bringing the next foremost task to the foreground. */
1.177 + EForwards,
1.178 + /** Cycles the list backwards, i.e. the task furthest from the foreground is brought
1.179 + to the foreground, pushing what was the foremost task to the next ordinal
1.180 + position. */
1.181 + EBackwards
1.182 + };
1.183 +public:
1.184 + IMPORT_C TApaTaskList(RWsSession& aWsSession);
1.185 + IMPORT_C TApaTask FindApp(const TDesC& aAppName);
1.186 + IMPORT_C TApaTask FindDoc(const TDesC& aDocName);
1.187 + IMPORT_C TApaTask FindByPos(TInt aPos);
1.188 + IMPORT_C TApaTask FindApp(TUid aAppUid);
1.189 + IMPORT_C TInt CycleTasks(TUid aAppUid,TCycleDirection aDirection=EForwards);
1.190 +
1.191 +private:
1.192 + void FindByPosL(TApaTask& aTask,TInt aPos);
1.193 +private:
1.194 + RWsSession& iWsSession;
1.195 + TInt iTApaTaskList_Reserved1;
1.196 + };
1.197 +
1.198 +
1.199 +#endif