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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #if !defined(__APGWGNAM_H__)
17 #define __APGWGNAM_H__
19 #if !defined(__W32STD_H__)
23 class CApaWindowGroupName : public CBase
24 /** Gives access to the name of a window group and the information encoded by that
27 A window group is associated with a task, i.e. a running application. The
28 window group's name encodes four pieces of information for that task:
30 the name of the document that the task is handling,
34 the application specific UID, as eight hexadecimal characters,
36 status information for the task, as two hexadecimal characters.
42 enum { EMaxLength=13+2*KMaxFileName };
44 IMPORT_C ~CApaWindowGroupName();
45 IMPORT_C static CApaWindowGroupName* NewL(const RWsSession& aWsSession);
46 IMPORT_C static CApaWindowGroupName* NewLC(const RWsSession& aWsSession);
47 IMPORT_C static CApaWindowGroupName* NewL(const RWsSession& aWsSession, TInt aWgId);
48 IMPORT_C static CApaWindowGroupName* NewLC(const RWsSession& aWsSession, TInt aWgId);
49 IMPORT_C static CApaWindowGroupName* New(const RWsSession& aWsSession, HBufC* aWgName);
50 IMPORT_C static CApaWindowGroupName* NewL(const RWsSession& aWsSession, const TDesC& aWgName);
51 IMPORT_C static CApaWindowGroupName* NewLC(const RWsSession& aWsSession, const TDesC& aWgName);
52 IMPORT_C void ConstructFromWgIdL(TInt aWgId);
54 IMPORT_C void SetWindowGroupNameL(const TDesC& aWgName);
55 IMPORT_C void SetWindowGroupName(HBufC* aWgName);
57 IMPORT_C static void FindByAppUid(TUid aAppUid, RWsSession& aWsSession, TInt& aPrevWgId);
58 IMPORT_C static void FindByCaption(const TDesC& aCaption, RWsSession& aWsSession, TInt& aPrevWgId);
59 IMPORT_C static void FindByDocName(const TDesC& aDocName, RWsSession& aWsSession, TInt& aPrevWgId);
61 IMPORT_C void SetBusy(TBool aBusy);
62 IMPORT_C TBool IsBusy() const;
63 IMPORT_C void SetSystem(TBool aSystem);
64 IMPORT_C TBool IsSystem() const;
65 IMPORT_C void SetDocNameIsAFile(TBool aDocNameIsAFile);
66 IMPORT_C TBool DocNameIsAFile() const;
67 IMPORT_C void SetRespondsToShutdownEvent(TBool aRespondsToShutdownEvent);
68 IMPORT_C TBool RespondsToShutdownEvent() const;
69 IMPORT_C void SetRespondsToSwitchFilesEvent(TBool aRespondsToSwitchFilesEvent);
70 IMPORT_C TBool RespondsToSwitchFilesEvent() const;
71 IMPORT_C void SetHidden(TBool aIsHidden);
72 IMPORT_C TBool Hidden() const;
73 IMPORT_C void SetAppReady(TBool aIsReady);
74 IMPORT_C TBool IsAppReady() const;
76 IMPORT_C void SetAppUid(TUid aAppUid);
77 IMPORT_C TUid AppUid() const;
79 IMPORT_C void SetCaptionL(const TDesC& aCaption);
80 IMPORT_C TPtrC Caption() const;
82 IMPORT_C void SetDocNameL(const TDesC& aDocName);
83 IMPORT_C TPtrC DocName() const;
85 IMPORT_C TInt SetWindowGroupName(RWindowGroup& aGroupWin) const;
86 IMPORT_C TPtrC WindowGroupName() const;
88 enum TApaStatus { ESystem =0x01, EBusy =0x02, EDocNameNotAFile =0x04
89 ,EDoesNotRespondToShutdownEvent=0x08, EDoesNotRespondToSwitchFilesEvent=0x10
90 ,EIsHidden=0x20, EAppReady=0x40 };
91 enum TApaDelimiter { EEndStatus=1, EEndUid, EEndCaption, ELast=EEndCaption }; // ELast must be last and same as predecessor
93 CApaWindowGroupName(const RWsSession& aWsSession);
95 void DefaultConstructL();
96 void WriteStatusToName();
97 void GetStatusFromName();
98 TInt FindDelimiter(TApaDelimiter aDelim) const;
99 void ReAllocIfNecessaryL(TInt aExtraLengthReqd);
103 const RWsSession& iWsSession;