|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 #ifndef POPUPFSM_H |
|
18 #define POPUPFSM_H |
|
19 |
|
20 // EXTERNAL INCLUDES |
|
21 #include <e32base.h> |
|
22 |
|
23 // FORWARD DECLARATIONS |
|
24 class TPopupFSM; |
|
25 class MPopupFSMActions; |
|
26 |
|
27 // CLASS DEFINITIONS |
|
28 /** |
|
29 * Popup state machine |
|
30 */ |
|
31 class TPopupFSM |
|
32 { |
|
33 /** |
|
34 * Base class for states |
|
35 */ |
|
36 class TPopupStateBase |
|
37 { |
|
38 public: // New methods |
|
39 virtual void HandleForeground( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
40 virtual void HandleUpdate( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
41 virtual void HandleRequestCompleted( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
42 virtual void HandleReset( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
43 virtual void HandleBackground( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
44 virtual void HandleGotFocus( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
45 virtual void HandleLostFocus( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
46 }; |
|
47 |
|
48 /** |
|
49 * State class TNotSetOffFocus |
|
50 */ |
|
51 class TNotSetOffFocus : public TPopupStateBase |
|
52 { |
|
53 protected: // Methods derived from TPopupState |
|
54 void HandleUpdate( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
55 void HandleGotFocus( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
56 void HandleForeground( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
57 }; |
|
58 |
|
59 /** |
|
60 * State class TSetOffFocus |
|
61 */ |
|
62 class TSetOffFocus : public TPopupStateBase |
|
63 { |
|
64 protected: // Methods derived from TPopupState |
|
65 void HandleGotFocus( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
66 void HandleReset( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
67 }; |
|
68 |
|
69 /** |
|
70 * State class TGettingFocus |
|
71 */ |
|
72 class TGettingFocus : public TPopupStateBase |
|
73 { |
|
74 protected: // Methods derived from TPopupState |
|
75 void HandleRequestCompleted( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
76 void HandleReset( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
77 void HandleLostFocus( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
78 }; |
|
79 |
|
80 /** |
|
81 * State class TLosingFocus |
|
82 */ |
|
83 class TLosingFocus : public TPopupStateBase |
|
84 { |
|
85 protected: // Methods derived from TPopupState |
|
86 void HandleRequestCompleted( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
87 void HandleReset( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
88 void HandleGotFocus( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
89 }; |
|
90 |
|
91 /** |
|
92 * State class TNotSetOnFocus |
|
93 */ |
|
94 class TNotSetOnFocus : public TPopupStateBase |
|
95 { |
|
96 protected: // Methods derived from TPopupState |
|
97 void HandleUpdate( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
98 void HandleLostFocus( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
99 void HandleBackground( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
100 void HandleForeground( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
101 }; |
|
102 |
|
103 /** |
|
104 * State class TVisible |
|
105 */ |
|
106 class TVisible : public TPopupStateBase |
|
107 { |
|
108 protected: // Methods derived from TPopupState |
|
109 void HandleUpdate( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
110 void HandleReset( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
111 void HandleLostFocus( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
112 void HandleRequestCompleted( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
113 void HandleBackground( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
114 }; |
|
115 |
|
116 /** |
|
117 * State class TNotVisible |
|
118 */ |
|
119 class TNotVisible : public TPopupStateBase |
|
120 { |
|
121 protected: // Methods derived from TPopupState |
|
122 void HandleUpdate( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
123 void HandleReset( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
124 void HandleLostFocus( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
125 }; |
|
126 |
|
127 /** |
|
128 * State class TBackgroundNotSetOnFocus |
|
129 */ |
|
130 class TBackgroundNotSetOnFocus : public TPopupStateBase |
|
131 { |
|
132 protected: // Methods derived from TPopupState |
|
133 void HandleForeground( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
134 void HandleUpdate( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
135 }; |
|
136 |
|
137 /** |
|
138 * State class TBackgroundSetOnFocus |
|
139 */ |
|
140 class TBackgroundSetOnFocus : public TPopupStateBase |
|
141 { |
|
142 protected: // Methods derived from TPopupState |
|
143 void HandleReset( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
144 void HandleForeground( TPopupFSM* aPopupFSM, MPopupFSMActions& aPopupFSMActions ); |
|
145 }; |
|
146 |
|
147 |
|
148 public: // Constructors |
|
149 TPopupFSM( MPopupFSMActions& aPopupFSMActions ); |
|
150 |
|
151 public: // New methods |
|
152 void HandleForeground(); |
|
153 void HandleUpdate(); |
|
154 void HandleRequestCompleted(); |
|
155 void HandleReset(); |
|
156 void HandleBackground(); |
|
157 void HandleGotFocus(); |
|
158 void HandleLostFocus(); |
|
159 |
|
160 private: // New methods |
|
161 void SetState( TPopupStateBase* aNewState ); |
|
162 |
|
163 private: // Data |
|
164 //Ref: |
|
165 TPopupStateBase* iCurrentState; |
|
166 MPopupFSMActions& iPopupFSMActions; |
|
167 |
|
168 //Own: |
|
169 TNotSetOffFocus iNotSetOffFocus; |
|
170 TSetOffFocus iSetOffFocus; |
|
171 TGettingFocus iGettingFocus; |
|
172 TLosingFocus iLosingFocus; |
|
173 TNotSetOnFocus iNotSetOnFocus; |
|
174 TVisible iVisible; |
|
175 TNotVisible iNotVisible; |
|
176 TBackgroundNotSetOnFocus iBackgroundNotSetOnFocus; |
|
177 TBackgroundSetOnFocus iBackgroundSetOnFocus; |
|
178 private: // Friend class definitions |
|
179 friend class TNotSetOffFocus; |
|
180 friend class TSetOffFocus; |
|
181 friend class TGettingFocus; |
|
182 friend class TLosingFocus; |
|
183 friend class TNotSetOnFocus; |
|
184 friend class TVisible; |
|
185 friend class TNotVisible; |
|
186 friend class TBackgroundNotSetOnFocus; |
|
187 friend class TBackgroundSetOnFocus; |
|
188 }; |
|
189 |
|
190 #endif // POPUPFSM_H |
|
191 |
|
192 // End of file |