1 apgtask.h |
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // 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 |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __APGTASK_H__ |
|
17 #define __APGTASK_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <w32std.h> |
|
21 |
|
22 class RWsSession; |
|
23 struct TKeyEvent; |
|
24 |
|
25 /** @internalTechnology */ |
|
26 static const TInt KApaSystemEventsWithPowerMgmtCapabilityStart = 100; |
|
27 /** @internalTechnology */ |
|
28 static const TInt KApaSystemEventsWithPowerMgmtCapabilityEnd = 199; |
|
29 |
|
30 /** Defines the event types that a TApaTask object can send to its window group. |
|
31 |
|
32 The events are sent by TApaTask::SendSystemEvent() and are handled by CEikAppUi::HandleSystemEventL(). |
|
33 |
|
34 @publishedAll |
|
35 @released |
|
36 @see TApaTask::SendSystemEvent() |
|
37 @see CEikAppUi |
|
38 @see CCoeAppUi::HandleSystemEventL() */ |
|
39 enum TApaSystemEvent |
|
40 { |
|
41 /** The task is being closed. */ |
|
42 EApaSystemEventShutdown=1, |
|
43 /** Reserved for future use. */ |
|
44 EApaSystemEventBackupStarting, |
|
45 /** Reserved for future use. */ |
|
46 EApaSystemEventBackupComplete, |
|
47 /** The task is being brought to the foreground. */ |
|
48 EApaSystemEventBroughtToForeground, |
|
49 /** Close any tasks including system tasks. |
|
50 Events in the range @c KApaSystemEventsWithPowerMgmtCapabilityStart to |
|
51 @c KApaSystemEventsWithPowerMgmtCapabilityEnd requires capability PowerMgmt*/ |
|
52 EApaSystemEventSecureShutdown = KApaSystemEventsWithPowerMgmtCapabilityStart |
|
53 }; |
|
54 |
|
55 #ifdef _UNICODE |
|
56 /** |
|
57 @publishedAll |
|
58 @released |
|
59 */ |
|
60 #define KUidApaMessageSwitchOpenFile KUidApaMessageSwitchOpenFile16 |
|
61 |
|
62 /** |
|
63 @publishedAll |
|
64 @released |
|
65 */ |
|
66 #define KUidApaMessageSwitchCreateFile KUidApaMessageSwitchCreateFile16 |
|
67 |
|
68 /** |
|
69 @publishedAll |
|
70 @released |
|
71 */ |
|
72 #define KUidApaMessageSwitchOpenFileValue KUidApaMessageSwitchOpenFileValue16 |
|
73 |
|
74 /** |
|
75 @publishedAll |
|
76 @released |
|
77 */ |
|
78 #define KUidApaMessageSwitchCreateFileValue KUidApaMessageSwitchCreateFileValue16 |
|
79 #else |
|
80 #define KUidApaMessageSwitchOpenFile KUidApaMessageSwitchOpenFile8 |
|
81 #define KUidApaMessageSwitchCreateFile KUidApaMessageSwitchCreateFile8 |
|
82 #define KUidApaMessageSwitchOpenFileValue KUidApaMessageSwitchOpenFileValue8 |
|
83 #define KUidApaMessageSwitchCreateFileValue KUidApaMessageSwitchCreateFileValue8 |
|
84 #endif |
|
85 |
|
86 /** |
|
87 @internalComponent |
|
88 */ |
|
89 const TInt KUidApaMessageSwitchOpenFileValue16=0x10003A39; |
|
90 |
|
91 /** |
|
92 @internalComponent |
|
93 */ |
|
94 const TUid KUidApaMessageSwitchOpenFile16={KUidApaMessageSwitchOpenFileValue16}; |
|
95 |
|
96 /** |
|
97 @internalComponent |
|
98 */ |
|
99 const TInt KUidApaMessageSwitchCreateFileValue16=0x10003A3A; |
|
100 |
|
101 /** |
|
102 @internalComponent |
|
103 */ |
|
104 const TUid KUidApaMessageSwitchCreateFile16={KUidApaMessageSwitchCreateFileValue16}; |
|
105 |
|
106 class TApaTask |
|
107 /** Application task. |
|
108 |
|
109 A task is a running application. At any one time, for any given application, |
|
110 there may be zero, one, or more tasks running on a device. |
|
111 |
|
112 A task is identified by its association with the running application's window |
|
113 group. |
|
114 |
|
115 An instance of the TApaTaskList class is used to find and access specific |
|
116 tasks. |
|
117 |
|
118 @publishedAll |
|
119 @released |
|
120 @see TApaTaskList |
|
121 @see RWindowGroup |
|
122 @see RWsSession */ |
|
123 { |
|
124 public: |
|
125 |
|
126 IMPORT_C TApaTask(RWsSession& aWsSession); |
|
127 IMPORT_C void SetWgId(TInt aWgId); |
|
128 IMPORT_C TInt WgId() const; |
|
129 IMPORT_C TBool Exists() const; |
|
130 IMPORT_C TThreadId ThreadId() const; |
|
131 IMPORT_C void BringToForeground(); |
|
132 IMPORT_C void SendToBackground(); |
|
133 IMPORT_C void EndTask(); |
|
134 IMPORT_C void KillTask(); |
|
135 IMPORT_C void SendKey(TInt aKeyCode,TInt aModifiers); |
|
136 IMPORT_C void SendKey(const TKeyEvent& aKey); |
|
137 IMPORT_C void SendSystemEvent(TApaSystemEvent aEvent); |
|
138 IMPORT_C TInt SwitchOpenFile(const TDesC& aFilename); |
|
139 IMPORT_C TInt SwitchCreateFile(const TDesC& aFilename); |
|
140 IMPORT_C TInt SendMessage(TUid aUid, const TDesC8& aParams); |
|
141 |
|
142 private: |
|
143 TInt CheckSwitchFile() const; |
|
144 void SendSystemEvent(TApaSystemEvent aEvent, TEventCode aType); |
|
145 private: |
|
146 RWsSession& iWsSession; |
|
147 TInt iWgId; |
|
148 TInt iTApaTask_Reserved1; |
|
149 }; |
|
150 |
|
151 class TApaTaskList |
|
152 /** Accesses tasks running on a device. |
|
153 |
|
154 Tasks can be identified by document, application specific UID or by caption |
|
155 name. |
|
156 |
|
157 Users of this class can also cycle through a set of tasks running a specific |
|
158 application, bringing each one, in turn, into the foreground. |
|
159 |
|
160 @publishedAll |
|
161 @released |
|
162 @see TApaTask */ |
|
163 { |
|
164 public: |
|
165 /** Defines the direction in which tasks are cycled to the foreground. This is used |
|
166 by the CycleTasks() function. |
|
167 |
|
168 @see TApaTaskList::CycleTasks() */ |
|
169 enum TCycleDirection |
|
170 { |
|
171 /** Cycles the task list forwards, i.e. the foreground task is moved to background, |
|
172 bringing the next foremost task to the foreground. */ |
|
173 EForwards, |
|
174 /** Cycles the list backwards, i.e. the task furthest from the foreground is brought |
|
175 to the foreground, pushing what was the foremost task to the next ordinal |
|
176 position. */ |
|
177 EBackwards |
|
178 }; |
|
179 public: |
|
180 IMPORT_C TApaTaskList(RWsSession& aWsSession); |
|
181 IMPORT_C TApaTask FindApp(const TDesC& aAppName); |
|
182 IMPORT_C TApaTask FindDoc(const TDesC& aDocName); |
|
183 IMPORT_C TApaTask FindByPos(TInt aPos); |
|
184 IMPORT_C TApaTask FindApp(TUid aAppUid); |
|
185 IMPORT_C TInt CycleTasks(TUid aAppUid,TCycleDirection aDirection=EForwards); |
|
186 |
|
187 private: |
|
188 void FindByPosL(TApaTask& aTask,TInt aPos); |
|
189 private: |
|
190 RWsSession& iWsSession; |
|
191 TInt iTApaTaskList_Reserved1; |
|
192 }; |
|
193 |
|
194 |
|
195 #endif |