|
1 |
|
2 /* |
|
3 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 * All rights reserved. |
|
5 * This component and the accompanying materials are made available |
|
6 * under the terms of "Eclipse Public License v1.0" |
|
7 * which accompanies this distribution, and is available |
|
8 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 * |
|
10 * Initial Contributors: |
|
11 * Nokia Corporation - initial contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __CSIPLINEGAMECONTAINER_H__ |
|
22 #define __CSIPLINEGAMECONTAINER_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include "SIPExStateViewNotifier.h" |
|
26 #include <eikbctrl.h> |
|
27 #include <coeview.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CEikTextListBox; |
|
31 class CSIPExGameView; |
|
32 class CEikLabel; |
|
33 class CSIPExEngine; |
|
34 class CEikGlobalTextEditor; |
|
35 |
|
36 // CLASS DECLARATIONS |
|
37 /** |
|
38 * A container class for some associated view |
|
39 */ |
|
40 class CSIPExGameContainer |
|
41 : public CEikBorderedControl, |
|
42 public MCoeView, |
|
43 public MSIPExStateViewNotifier |
|
44 { |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Static constructor for CSIPExGameContainer |
|
49 * @param aRect the rectangle this view will be drawn to |
|
50 * @param aGameData The reference to the application engine |
|
51 * @return An instance of CSIPExGameContainer. |
|
52 * The ownership is transferred. |
|
53 */ |
|
54 static CSIPExGameContainer* NewL( const TRect& aRect, CSIPExEngine& aGameData ); |
|
55 |
|
56 /** |
|
57 * Static constructor for CSIPExGameContainer. On return the instance is left to |
|
58 * the CleanupStack. |
|
59 * @param aRect the rectangle this view will be drawn to |
|
60 * @param aGameData The reference to the application engine |
|
61 * @return An instance of CSIPExGameContainer. |
|
62 * The ownership is transferred. |
|
63 */ |
|
64 static CSIPExGameContainer* NewLC( const TRect& aRect, CSIPExEngine& aGameData ); |
|
65 |
|
66 /** |
|
67 * Destructor |
|
68 */ |
|
69 ~CSIPExGameContainer(); |
|
70 |
|
71 private: |
|
72 |
|
73 /** |
|
74 * Static constructor for CSIPExGameContainer |
|
75 * @param aRect Frame rectangle for container. |
|
76 * @param aGameData The reference to the application engine |
|
77 */ |
|
78 void ConstructL( const TRect& aRect, CSIPExEngine& aGameData ); |
|
79 |
|
80 /** |
|
81 * C++ default constructor |
|
82 */ |
|
83 CSIPExGameContainer(); |
|
84 |
|
85 public: // from CCoeControl |
|
86 |
|
87 /** |
|
88 * From CCoeControl. |
|
89 */ |
|
90 TInt CountComponentControls() const; |
|
91 |
|
92 /** |
|
93 * From CCoeControl |
|
94 */ |
|
95 CCoeControl* ComponentControl(TInt aIndex) const; |
|
96 |
|
97 /** |
|
98 * From CCoeControl |
|
99 */ |
|
100 void Draw(const TRect& aRect) const; |
|
101 |
|
102 /** |
|
103 * From CCoeControl |
|
104 */ |
|
105 void SizeChanged(); |
|
106 |
|
107 /** |
|
108 * From CCoeControl |
|
109 */ |
|
110 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
111 |
|
112 public: // from MCoeView |
|
113 /** |
|
114 * From MCoeView |
|
115 */ |
|
116 virtual TVwsViewId ViewId() const; |
|
117 |
|
118 /** |
|
119 * From MCoeView |
|
120 */ |
|
121 virtual void ViewActivatedL(const TVwsViewId& aPrevViewId, |
|
122 TUid aCustomMessageId,const TDesC8& aCustomMessage); |
|
123 |
|
124 /** |
|
125 * From MCoeView |
|
126 */ |
|
127 virtual void ViewDeactivated(); |
|
128 |
|
129 public: // From MStateViewNotifier |
|
130 |
|
131 /** |
|
132 * From MStateViewNotifier |
|
133 * Shows the text in the info editor (CEikGlobalTextEditor) |
|
134 * @param aText A 16-bit text to be set to the info view. |
|
135 */ |
|
136 void ShowInfoL( const TDesC& aText ); |
|
137 |
|
138 /** |
|
139 * From MStateViewNotifier |
|
140 * Shows the text in the info editor (CEikGlobalTextEditor) |
|
141 * @param aText A 8-bit text to be set to the info view. |
|
142 */ |
|
143 void ShowInfoL( const TDesC8& aText ); |
|
144 |
|
145 /** |
|
146 * From MStateViewNotifier |
|
147 * Shows the text in the status view editor (CEikLabel) |
|
148 * @param aText The text to be set to the status view. |
|
149 */ |
|
150 void ShowStatusInfoL( const TDesC& aText ); |
|
151 |
|
152 private: // New functions |
|
153 /** |
|
154 * Counts the rects for components. |
|
155 */ |
|
156 void CountRects(); |
|
157 |
|
158 /** |
|
159 * Creates the text editor and status label. |
|
160 */ |
|
161 void CreateStateViewEditorL(); |
|
162 |
|
163 /** |
|
164 * Creates the game view. |
|
165 */ |
|
166 void CreateGameViewL(); |
|
167 |
|
168 private: // Data |
|
169 |
|
170 // Component areas |
|
171 TRect iGameAreaRect; |
|
172 TRect iStatusLblRect; |
|
173 TRect iEditorRect; |
|
174 |
|
175 // Info text area. Area where all info texts can be drawn. |
|
176 CEikGlobalTextEditor* iEditor; |
|
177 |
|
178 // Label where game state text can be set. |
|
179 CEikLabel* iStatusLbl; |
|
180 |
|
181 // The game board view. |
|
182 CSIPExGameView* iGameView; |
|
183 |
|
184 // Not owned: The pointer to the game engine. |
|
185 CSIPExEngine* iGameEngine; |
|
186 }; |
|
187 |
|
188 #endif // __CSIPLINEGAMECONTAINER_H__ |
|
189 |
|
190 // End of file |