|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This is the header file for the CClockMainView class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CLOCK_MAIN_VIEW_H__ |
|
19 #define __CLOCK_MAIN_VIEW_H__ |
|
20 |
|
21 // System includes |
|
22 #include <aknview.h> |
|
23 |
|
24 // User includes |
|
25 #include "clkcommon.h" |
|
26 #include "clkmdlobserver.h" |
|
27 |
|
28 // Forward declarations |
|
29 class CClockMainContainer; |
|
30 class CClockAlarmArray; |
|
31 class CClkUiAlarmModel; |
|
32 class CClkUiAlarmIdleObserver; |
|
33 class CClockAppUi; |
|
34 |
|
35 // Class declaration |
|
36 /** |
|
37 * @class CClockMainView |
|
38 * @brief The CAknView inheriting class. |
|
39 * @exe clock.exe |
|
40 */ |
|
41 class CClockMainView : public CAknView, |
|
42 public MClkModelObserver |
|
43 { |
|
44 public: // Constructor and destructor |
|
45 |
|
46 /** |
|
47 * @brief Create a CClockMainView object. Performs the first phase of 2-phase construction. |
|
48 * @param aAlarmModel The alarm model. |
|
49 * @return CClockMainView* A pointer to the created instance of CClockMainView |
|
50 */ |
|
51 static CClockMainView* NewL( CClkUiAlarmModel* aAlarmModel ); |
|
52 |
|
53 /** |
|
54 * @brief Destructor |
|
55 */ |
|
56 ~CClockMainView(); |
|
57 |
|
58 public: // From base classes |
|
59 |
|
60 /** |
|
61 * @brief From CAknView. Returns this view Id. |
|
62 * @return TUid The id of the view. |
|
63 */ |
|
64 TUid Id() const; |
|
65 |
|
66 /** |
|
67 * @param aCommand The id of the command to be handled. |
|
68 * @brief From MEikCommandObserver. Handles a user command relating to this view. |
|
69 */ |
|
70 void HandleCommandL( TInt aCommand ); |
|
71 |
|
72 /** |
|
73 * @brief From MClkUiMdlObserver. Notification obtained from the model for changes. |
|
74 * @param aReason The cause of notification. |
|
75 */ |
|
76 void HandleUpdateL( TInt aReason ); |
|
77 |
|
78 /** |
|
79 * @brief From MEikMenuObserver. Dynamically initializes the menu items. |
|
80 * @param aResourceId The resource which triggered the action. |
|
81 * @param aMenuPane Pointer to the menupane of type CEikMenuPane. |
|
82 */ |
|
83 void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
84 |
|
85 /** |
|
86 * @brief From MEikMenuObserver. Dynamically initializes the menubar. |
|
87 * @param aResourceId The resource which triggered the action. |
|
88 * @param aMenuBar Pointer to the menupane of type CEikMenuBar. |
|
89 */ |
|
90 void DynInitMenuBarL( TInt aResourceId, CEikMenuBar* aMenuBar ); |
|
91 |
|
92 /** |
|
93 * @brief From CEikAppUi. |
|
94 * Called when the application switches from foreground to background and vice versa. |
|
95 * @param aForeground ETrue if foreground, EFalse if sent to background. |
|
96 */ |
|
97 void HandleForegroundEventL( TBool aForeground ); |
|
98 |
|
99 public: // New functions |
|
100 |
|
101 /** |
|
102 * @brief Returns the application rect to the container. |
|
103 * @return TRect The application rect. |
|
104 */ |
|
105 TRect GetApplicationRect(); |
|
106 |
|
107 /** |
|
108 * @brief Handles the environment changes. Called from CClockAppUi. |
|
109 * @param aEnvChanged Of type TClockEnvChanged. |
|
110 */ |
|
111 void HandleEnvChangeL( TClockEnvChanged aEnvChanged ); |
|
112 |
|
113 /** |
|
114 * @brief Checks if the alarm editor is already open. |
|
115 * @return ETrue if the alarm editor is already open, EFalse otherwise. |
|
116 */ |
|
117 TBool IsAlarmEditorOpen(); |
|
118 |
|
119 /** |
|
120 * @brief Returns the application's appui. |
|
121 * @return CClockAppUi The pointer to the clock application ui. |
|
122 */ |
|
123 CClockAppUi* ClockApplicationUi(); |
|
124 |
|
125 protected: // From base classes |
|
126 |
|
127 /** |
|
128 * @discussion From CAknView. Activates this view. |
|
129 * @see CAknView. |
|
130 */ |
|
131 void DoActivateL( const TVwsViewId& aPrevViewId, |
|
132 TUid aCustomMessageId, |
|
133 const TDesC8& aCustomMessage ); |
|
134 |
|
135 /** |
|
136 * @brief From CAknView. Deactivates this view. |
|
137 */ |
|
138 void DoDeactivate(); |
|
139 |
|
140 private: // New functions |
|
141 |
|
142 /** |
|
143 * @brief Performs the second phase of 2-phase construction. May leave. |
|
144 * @param aAlarmModel The alarm model. |
|
145 */ |
|
146 void ConstructL( CClkUiAlarmModel* aAlarmModel); |
|
147 |
|
148 /** |
|
149 * @brief C++ default constructor |
|
150 */ |
|
151 CClockMainView(); |
|
152 |
|
153 /** |
|
154 * @brief Displays the alarm editor for the user to set the alarm. |
|
155 */ |
|
156 void SetNewAlarmL(); |
|
157 |
|
158 /** |
|
159 * @brief Deletes the selected alarm. |
|
160 */ |
|
161 void RemoveAlarmL(); |
|
162 |
|
163 /** |
|
164 * @brief Activates the focused alarm item in the list. |
|
165 */ |
|
166 void ActivateAlarmL(); |
|
167 |
|
168 /** |
|
169 * @brief Deactivates the focused alarm item in the list. |
|
170 */ |
|
171 void DeactivateAlarmL(); |
|
172 |
|
173 /** |
|
174 * @brief Resets the focused alarm item in the list. |
|
175 */ |
|
176 void ResetAlarmL(); |
|
177 |
|
178 private: // Data |
|
179 |
|
180 /** |
|
181 * @var iContainer |
|
182 * @brief The container object. |
|
183 */ |
|
184 CClockMainContainer* iContainer; |
|
185 |
|
186 /** |
|
187 * @var iAlarmArray |
|
188 * @brief The alarms array. |
|
189 */ |
|
190 CClockAlarmArray* iAlarmArray; |
|
191 |
|
192 /** |
|
193 * @var iAlarmInfo |
|
194 * @brief Holds the alarm information entered by the user in the editor. |
|
195 */ |
|
196 SClkAlarmInfo iAlarmInfo; |
|
197 |
|
198 /** |
|
199 * @var iAlarmId |
|
200 * @brief The alarm id of the latest alarm. |
|
201 */ |
|
202 TAlarmId iAlarmId; |
|
203 |
|
204 /** |
|
205 * @var iAlarmModel |
|
206 * @brief The alarm model object. |
|
207 */ |
|
208 CClkUiAlarmModel* iAlarmModel; |
|
209 |
|
210 /** |
|
211 * @var iModelObserver |
|
212 * @brief The model observer. |
|
213 */ |
|
214 CClkUiAlarmIdleObserver* iModelObserver; |
|
215 |
|
216 /** |
|
217 * @var iOpenedByMSK |
|
218 * @brief Flag which indicates if the menu was opened by the MSK or not. |
|
219 */ |
|
220 TBool iOpenedByMSK; |
|
221 |
|
222 /** |
|
223 * @var iAlarmEditorOpen |
|
224 * @brief Flag which indicates if the alarm editor is open or not. |
|
225 */ |
|
226 TBool iAlarmEditorOpen; |
|
227 |
|
228 }; |
|
229 |
|
230 #endif // __CLOCK_MAIN_VIEW_H__ |
|
231 |
|
232 // End of file |