|
1 // Copyright (c) 1999-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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Definition of base class for all objects |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __OBJECT_H__ |
|
19 #define __OBJECT_H__ |
|
20 |
|
21 #include <e32std.h> |
|
22 #include <e32base.h> |
|
23 #include "w32cmd.h" |
|
24 #include "screen.h" |
|
25 |
|
26 class CWsClient; |
|
27 class CWsRootWindow; |
|
28 |
|
29 /** |
|
30 CWsObject is the base class for the server-side objects that are visible to the client. |
|
31 |
|
32 The client refers to these objects via a handle that is passed to it by the server. |
|
33 The association between handles and CWsObject instances is stored by the TWsObject class. |
|
34 |
|
35 Derived classes must implement the CommandL() function so that it handles the requests |
|
36 the client sent. |
|
37 |
|
38 Each client session has a list of all its CWsObject instances. When creating an instance of |
|
39 a class derived from CWsObject the NewObjL() function must be called to add the new |
|
40 object to the list. The CWsObject destructor takes care of removing the object from the list. |
|
41 |
|
42 @see TWsObject |
|
43 @see CWsClient |
|
44 @internalComponent |
|
45 @released |
|
46 */ |
|
47 class CWsObject : public CBase |
|
48 { |
|
49 public: |
|
50 CWsObject(CWsClient* aOwner,WH_HANDLES aType); |
|
51 ~CWsObject(); |
|
52 virtual void CommandL(TInt aOpcode, const TAny *aCmdData)=0; |
|
53 virtual void CloseObject(); |
|
54 TInt LogHandle() const; |
|
55 void NewObjL(); |
|
56 void RemoveFromIndex(); |
|
57 inline WH_HANDLES Type() const; |
|
58 inline CWsClient *WsOwner() const; |
|
59 inline void SetWsOwner(CWsClient *aOwner); |
|
60 void OwnerPanic(TClientPanic aPanic) const; |
|
61 protected: |
|
62 void SetReply(TInt aReply); |
|
63 |
|
64 private: |
|
65 WH_HANDLES iType; |
|
66 protected: |
|
67 /** Each client has a list of all its CWsObject instances. The CWsObject |
|
68 has a pointer to its owner so that it can update the list when it is created and |
|
69 when it is destroyed. */ |
|
70 CWsClient *iWsOwner; |
|
71 }; |
|
72 |
|
73 class CWsScreenObject : public CWsObject |
|
74 { |
|
75 public: |
|
76 inline CWsScreenObject(CWsClient *aOwner,WH_HANDLES aType,CScreen* aScreen); |
|
77 inline CScreen* Screen() const; |
|
78 inline CWsRootWindow* RootWindow() const; |
|
79 |
|
80 protected: |
|
81 CScreen* iScreen; |
|
82 }; |
|
83 |
|
84 |
|
85 // |
|
86 // inlines // |
|
87 // |
|
88 |
|
89 // |
|
90 // CWsObject |
|
91 // |
|
92 inline CWsClient *CWsObject::WsOwner() const |
|
93 {return(iWsOwner);} |
|
94 inline void CWsObject::SetWsOwner(CWsClient *aOwner) |
|
95 {iWsOwner=aOwner;} |
|
96 inline WH_HANDLES CWsObject::Type() const |
|
97 {return(iType);} |
|
98 // |
|
99 // CWsScreenObject |
|
100 // |
|
101 inline CWsScreenObject::CWsScreenObject(CWsClient *aOwner,WH_HANDLES aType,CScreen* aScreen) : CWsObject(aOwner,aType), iScreen(aScreen) |
|
102 {} |
|
103 inline CScreen* CWsScreenObject::Screen() const |
|
104 {return iScreen;} |
|
105 inline CWsRootWindow* CWsScreenObject::RootWindow() const |
|
106 {return iScreen->RootWindow();} |
|
107 #endif |