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