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