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