|
1 /* |
|
2 * Copyright (c) 2005 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: Utility class for creating tab groups. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef GSTABHELPER_H |
|
20 #define GSTABHELPER_H |
|
21 |
|
22 #include "gsplugininterface.h" |
|
23 #include "gstabbedviewowner.h" |
|
24 |
|
25 #include <AknTabObserver.h> |
|
26 #include <e32base.h> |
|
27 #include <e32cmn.h> |
|
28 |
|
29 |
|
30 // Forward declarations |
|
31 class CAknNavigationControlContainer; |
|
32 class CAknNavigationDecorator; |
|
33 class CAknTabGroup; |
|
34 class MGSTabbedView; |
|
35 |
|
36 |
|
37 /** |
|
38 * CGSTabHelper is used to create dynamic tabs from either |
|
39 * - CGSPluginInterface* array (plugins) |
|
40 * - MGSTabbedView* interface Array (local views owned by plugin). |
|
41 * |
|
42 * How to use: |
|
43 * |
|
44 * 1. Call CreateTabGroupL() from the plugin's/view's DoActivate(). Providing an |
|
45 * array of all the plugins/views which should be in the tab group including |
|
46 * the plugin/view itself. |
|
47 * |
|
48 * 2. Call RemoveTabGroup() from the plugin's/view's DoDeactivate(). |
|
49 * |
|
50 * 3. It is recommended to use CGSTabHelper* as an member variable owned by the |
|
51 * plugin/view class. |
|
52 * |
|
53 * @lib GSFramework.lib |
|
54 * @since Series60_3.1 |
|
55 */ |
|
56 class CGSTabHelper : public CBase, public MAknTabObserver |
|
57 { |
|
58 public: // Constructors & destructors |
|
59 |
|
60 /** |
|
61 * Symbian OS two-phased constructor |
|
62 * @return |
|
63 */ |
|
64 IMPORT_C static CGSTabHelper* NewL(); |
|
65 |
|
66 /** |
|
67 * Symbian OS two-phased constructor |
|
68 * @return |
|
69 */ |
|
70 IMPORT_C static CGSTabHelper* NewLC(); |
|
71 |
|
72 /** |
|
73 * Destructor. |
|
74 */ |
|
75 IMPORT_C ~CGSTabHelper(); |
|
76 |
|
77 public: // New |
|
78 |
|
79 /** |
|
80 * This function is for views implementing MGSTabbedViewOwner. Such may |
|
81 * be needed in case view needs to update its selected item according to |
|
82 * tab selection. |
|
83 * |
|
84 * Creates and adds a tab group to navipane. The number of visible tabs |
|
85 * is 4 unless there are less tabbed views in which case the number of |
|
86 * tabs equal the number of tabbed views. |
|
87 * |
|
88 * @param aActiveViewUid UID of the view whose tab should be activated |
|
89 * when the tab group is added to the navi pane. |
|
90 * @param aTabOwner Reference to the owner of the tabbed views. |
|
91 */ |
|
92 IMPORT_C void CreateTabGroupL( TUid aActiveViewUid, |
|
93 MGSTabbedViewOwner* aTabOwner ); |
|
94 |
|
95 /** |
|
96 * This function is for plugin implementation. |
|
97 * |
|
98 * Creates and adds a tab group to navipane. The number of visible tabs |
|
99 * is 4 unless there are less tabbed views in which case the number of |
|
100 * tabs equal the number of tabbed views. |
|
101 * |
|
102 * @param aActiveViewUid UID of the view whose tab should be activated |
|
103 * when the tab group is added to the navi pane. |
|
104 * @param aTabbedViews References to the views which belong to the tab |
|
105 * group. |
|
106 */ |
|
107 IMPORT_C void CreateTabGroupL( |
|
108 TUid aActiveViewUid, |
|
109 CArrayPtrFlat<CGSPluginInterface>* aTabbedViews ); |
|
110 |
|
111 /** |
|
112 * This function is for local view implementation. |
|
113 * |
|
114 * Creates and adds a tab group to navipane. The number of visible tabs |
|
115 * is 4 unless there are less tabbed views in which case the number of |
|
116 * tabs equal the number of tabbed views. |
|
117 * |
|
118 * @param aActiveViewUid UID of the view whose tab should be activated |
|
119 * when the tab group is added to the navi pane. |
|
120 * @param aTabbedViews References to the views which belong to the tab |
|
121 * group. |
|
122 */ |
|
123 IMPORT_C void CreateTabGroupL( |
|
124 TUid aActiveViewUid, |
|
125 CArrayPtrFlat<MGSTabbedView>* aTabbedViews ); |
|
126 |
|
127 /** |
|
128 * Removes the topmost tab group from navi pane. |
|
129 */ |
|
130 IMPORT_C void RemoveTabGroup(); |
|
131 |
|
132 public: // From MAknTabObserver |
|
133 |
|
134 /** |
|
135 * See base class. |
|
136 */ |
|
137 IMPORT_C void TabChangedL( TInt aIndex ); |
|
138 |
|
139 protected: // New |
|
140 |
|
141 /** |
|
142 * C++ default constructor. |
|
143 */ |
|
144 CGSTabHelper(); |
|
145 |
|
146 /** |
|
147 * Symbian OS default constructor. |
|
148 */ |
|
149 void ConstructL(); |
|
150 |
|
151 private: // Data |
|
152 |
|
153 // Container for navigation control object. |
|
154 CAknNavigationControlContainer* iNaviContainer; |
|
155 |
|
156 // Navigation decorator object. Created and owned. |
|
157 CAknNavigationDecorator* iNaviDecorator; |
|
158 |
|
159 // Tab group. |
|
160 CAknTabGroup* iTabGroup; |
|
161 |
|
162 // Pointer to App UI. Not owned. |
|
163 CAknViewAppUi* iAppUi; |
|
164 |
|
165 // Pointer to owner (parent) of the tabbed views. |
|
166 MGSTabbedViewOwner* iTabOwner; |
|
167 }; |
|
168 |
|
169 #endif // GSTABHELPER_H |
|
170 // End of File |