14 * Description: UI controller manager |
14 * Description: UI controller manager |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #ifndef C_AIUICONTROLLERMANAGER_H |
19 #ifndef _AIUICONTROLLERMANAGER_H |
20 #define C_AIUICONTROLLERMANAGER_H |
20 #define _AIUICONTROLLERMANAGER_H |
21 |
21 |
|
22 // System includes |
|
23 #include <e32base.h> |
22 |
24 |
23 #include <e32base.h> |
25 // User includes |
24 #include "aiuiframeworkobserver.h" |
|
25 #include "aicontentmodel.h" |
|
26 #include "aifwdefs.h" |
|
27 |
26 |
|
27 // Forward declarations |
28 class CAiUiController; |
28 class CAiUiController; |
29 class CAiContentPublisher; |
29 class CAiContentPublisher; |
30 class MAiMainUiController; |
30 class MAiMainUiController; |
31 class MAiFwEventHandler; |
|
32 class CRepository; |
31 class CRepository; |
33 class CCoeEnv; |
32 class CCoeEnv; |
|
33 class CAiFw; |
|
34 class MAiFwStateHandler; |
34 |
35 |
|
36 // Class declaration |
35 /** |
37 /** |
36 * @ingroup group_aifw |
38 * @ingroup group_aifw |
37 * |
39 * |
38 * Active Idle UI Controller manager. |
40 * Active Idle UI Controller manager. |
39 * |
41 * |
40 * @since S60 3.2 |
42 * @since S60 5.2 |
41 */ |
43 */ |
42 NONSHARABLE_CLASS( CAiUiControllerManager ) : public CBase, |
44 NONSHARABLE_CLASS( CAiUiControllerManager ) : public CBase |
43 public MAiUiFrameworkObserver |
|
44 { |
45 { |
45 public: // Constructors and destructor |
46 public: |
|
47 // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 */ |
|
52 static CAiUiControllerManager* NewL( CAiFw* aAiFw ); |
|
53 |
|
54 /** |
|
55 * Destructor |
|
56 */ |
|
57 ~CAiUiControllerManager(); |
|
58 |
|
59 public: |
|
60 // new functions |
|
61 |
|
62 /** |
|
63 * Gets UI controllers |
|
64 * |
|
65 * @since S60 5.2 |
|
66 * @return Array of UI controllers |
|
67 */ |
|
68 RPointerArray< CAiUiController >& UiControllers() const; |
|
69 |
|
70 /** |
|
71 * Actives UI by calling ActivateUI() for each UI controller |
|
72 * |
|
73 * @since S60 5.2 |
|
74 */ |
|
75 void ActivateUI(); |
|
76 |
|
77 /** |
|
78 * Gets the main UI controller |
|
79 * |
|
80 * @since S60 5.2 |
|
81 * @return Main UI controller |
|
82 */ |
|
83 MAiMainUiController& MainUiController() const; |
|
84 |
|
85 /** |
|
86 * Queries whether aUiController is the main UI controller |
|
87 * |
|
88 * @since S60 5.2 |
|
89 * @return ETrue if main UI controller, EFalse otherwise |
|
90 */ |
|
91 TBool IsMainUiController( CAiUiController& aUiController ) const; |
|
92 |
|
93 /** |
|
94 * Calls RunApplicationL for the main UI controller. |
|
95 * |
|
96 * @since S60 5.2 |
|
97 */ |
|
98 void RunApplicationL(); |
|
99 |
|
100 /** |
|
101 * Calls LoadUIDefinitionL for each UI controller. |
|
102 * |
|
103 * @since S60 5.2 |
|
104 */ |
|
105 void LoadUIDefinition(); |
|
106 |
|
107 /** |
|
108 * Returns the main UI Controller's CONE environment object. |
|
109 * |
|
110 * @since S60 5.2 |
|
111 * @return Control Environment |
|
112 */ |
|
113 CCoeEnv& CoeEnv() const; |
|
114 |
|
115 /** |
|
116 * Destroys all UI controllers except the main controller. |
|
117 * |
|
118 * @since S60 5.2 |
|
119 */ |
|
120 void DestroySecondaryUiControllers(); |
|
121 |
|
122 /** |
|
123 * Exits main UI controller |
|
124 * |
|
125 * @since S60 5.2 |
|
126 */ |
|
127 void ExitMainController(); |
|
128 |
|
129 /** |
|
130 * Sets Fw state handler for each UI conttroller |
|
131 * |
|
132 * @since S60 5.2 |
|
133 * @param aHandler State handler to set |
|
134 */ |
|
135 void SetStateHandler( MAiFwStateHandler& aHandler ); |
|
136 |
|
137 private: |
|
138 // private constructors |
46 |
139 |
47 static CAiUiControllerManager* NewL(); |
140 /** |
48 ~CAiUiControllerManager(); |
141 * Leaving constructor |
49 |
142 */ |
50 public: // New functions |
143 void ConstructL( CAiFw* aAiFw ); |
51 |
|
52 /** |
|
53 * Returns all UI controllers in an array. |
|
54 */ |
|
55 RPointerArray< CAiUiController >& UiControllers() const; |
|
56 |
|
57 /** |
|
58 * Calls ActivateUI() for all UI controllers. |
|
59 */ |
|
60 void ActivateUI(); |
|
61 |
|
62 /** |
|
63 * Returns the main ui controller object. |
|
64 */ |
|
65 MAiMainUiController& MainUiController() const; |
|
66 |
|
67 /** |
|
68 * Returns true if aUiController is the main UI controller. |
|
69 */ |
|
70 TBool IsMainUiController(CAiUiController& aUiController) const; |
|
71 |
|
72 /** |
|
73 * Sets framework event handler for all UI controllers. |
|
74 */ |
|
75 void SetEventHandler(MAiFwEventHandler& aEventHandler); |
|
76 |
|
77 /** |
|
78 * Calls RunApplicationL for the main UI controller. |
|
79 */ |
|
80 void RunApplicationL(); |
|
81 |
|
82 /** |
|
83 * Calls LoadUIDefinitionL for all UI controllers. |
|
84 */ |
|
85 void LoadUIDefinition(); |
|
86 |
|
87 /** |
|
88 * Returns the main UI Controller's CONE environment object. |
|
89 */ |
|
90 CCoeEnv& CoeEnv() const; |
|
91 |
|
92 /** |
|
93 * Destroys all UI controllers except the main controller. |
|
94 */ |
|
95 void DestroySecondaryUiControllers(); |
|
96 |
|
97 /** |
|
98 * Adds an UI Framework observer. No duplicates are allowed. |
|
99 */ |
|
100 void AddObserverL( MAiUiFrameworkObserver& aUiFwObserver ); |
|
101 |
|
102 /** |
|
103 * Removes an UI Framework observer. |
|
104 */ |
|
105 void RemoveObserver( MAiUiFrameworkObserver& aUiFwObserver ); |
|
106 |
|
107 /** |
|
108 * Removes plugin from UI. |
|
109 */ |
|
110 void RemovePluginFromUI( CAiContentPublisher& aPlugin ); |
|
111 |
|
112 /** |
|
113 * Exits main UI controller |
|
114 */ |
|
115 void ExitMainController(); |
|
116 |
|
117 private: // From MAiUiFrameworkObserver |
|
118 |
144 |
119 void HandleResourceChange( TInt aType ); |
145 /** |
120 void HandleForegroundEvent( TBool aForeground ); |
146 * C++ default constructor |
121 |
147 */ |
122 private: // Constructors |
148 CAiUiControllerManager(); |
123 |
149 |
124 CAiUiControllerManager(); |
150 private: |
125 void ConstructL(); |
151 // new functions |
126 |
152 |
127 private: // new functions |
153 void LoadMainControllerL( CRepository& aRepository ); |
128 |
154 void LoadSecondaryControllersL( CRepository& aRepository ); |
129 void LoadMainControllerL(CRepository& aCenRepConfig); |
155 |
130 void LoadSecondaryControllersL(CRepository& aCenRepConfig); |
156 private: |
131 |
157 // data |
132 private: // data |
158 |
133 /** |
159 /** UI controllers, Owned */ |
134 * UI controller array. |
160 mutable RPointerArray< CAiUiController > iUiControllerArray; |
135 * Own. |
161 /** Main UI controller, Owned by the above array */ |
136 */ |
162 MAiMainUiController* iMainUiController; |
137 mutable RPointerArray<CAiUiController> iUiControllerArray; |
163 /** List of created UI controllers */ |
138 |
164 RArray< TInt > iCreatedUICList; |
139 /** |
165 |
140 * Main UI controller for app session. Owned in above array. |
166 private: |
141 */ |
167 // friend class |
142 MAiMainUiController* iMainUiController; |
168 |
143 |
169 #ifdef _AIFW_UNIT_TEST |
144 /** |
170 friend class UT_AiUiControllerManager; |
145 * List of UI framework observers to delegate events |
171 #endif |
146 */ |
|
147 RPointerArray<MAiUiFrameworkObserver> iUiFrameworkObservers; |
|
148 |
|
149 /** |
|
150 * List to check for duplicated creations. |
|
151 */ |
|
152 RArray<TInt> iCreatedUICList; |
|
153 }; |
172 }; |
154 |
173 |
155 #endif // C_AIUICONTROLLERMANAGER_H |
174 #endif // _AIUICONTROLLERMANAGER_H |
156 |
175 |