1 /* |
|
2 * Copyright (c) 2007 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 the License "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 * Declaration of class CBrowserAppViewBase. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef BROWSER_APP_VIEW_BASE_H |
|
22 #define BROWSER_APP_VIEW_BASE_H |
|
23 |
|
24 // INCLUDE FILES |
|
25 #include <aknview.h> |
|
26 |
|
27 // FORWARD DECLARATION |
|
28 |
|
29 class MApiProvider; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Class to encapsulate a softkey pair made up of an Command ID and Resource qtn |
|
35 */ |
|
36 class TSKPair |
|
37 { |
|
38 public: |
|
39 /** |
|
40 * Constructor. |
|
41 * @param NONE. command and qtn are set to default. |
|
42 */ |
|
43 TSKPair(); |
|
44 |
|
45 /** |
|
46 * Constructor. |
|
47 * @param Command and Resource IDs |
|
48 */ |
|
49 TSKPair(TInt aId,TInt aRsc); |
|
50 |
|
51 /** |
|
52 * check to see if command/qtn are not currently set to the default assignment |
|
53 */ |
|
54 TBool IsAssigned(); |
|
55 |
|
56 /** |
|
57 * define an == operator to check pair equality |
|
58 * @param TSK pair |
|
59 */ |
|
60 TBool operator==(TSKPair aSKPair); |
|
61 |
|
62 /** |
|
63 * define an = operator for assignment |
|
64 * @param TSK pair |
|
65 */ |
|
66 void operator=(TSKPair aSKPair); |
|
67 |
|
68 /** |
|
69 * a function to set the pair directly |
|
70 * @param Command and Resource Ids |
|
71 */ |
|
72 void setPair(TInt aId, TInt aRsc); |
|
73 |
|
74 /** |
|
75 * retrieve the command ID |
|
76 */ |
|
77 TInt id() { return iCmdId; } |
|
78 |
|
79 /** |
|
80 * retrieve the qtn resource ID |
|
81 */ |
|
82 TInt qtn() { return iQtnRsc; } |
|
83 private: |
|
84 |
|
85 /** |
|
86 * private variables to hold command and resource ids |
|
87 */ |
|
88 TInt iCmdId; |
|
89 TInt iQtnRsc; |
|
90 }; |
|
91 |
|
92 /** |
|
93 * Base class all of the browser's views. Allows CBA setting and holds pointer |
|
94 * to API provider. |
|
95 * @lib Browser.app |
|
96 * @since Series 60 1.2 |
|
97 */ |
|
98 class CBrowserViewBase : public CAknView |
|
99 { |
|
100 public: // construction |
|
101 |
|
102 /** |
|
103 * Constructor. |
|
104 * @param aApiProvider The API provider |
|
105 */ |
|
106 CBrowserViewBase( MApiProvider& aApiProvider ); |
|
107 |
|
108 public: // new methods |
|
109 |
|
110 /** |
|
111 * Get the API provider. |
|
112 * @since Series 60 1.2 |
|
113 * @return The API provider |
|
114 */ |
|
115 MApiProvider& ApiProvider(); |
|
116 |
|
117 /** |
|
118 * Update the view's CBA, according to its current state. |
|
119 * This will call the view's CommandSetResourceIdL to get the |
|
120 * command set's resource id and then change the command set to that. |
|
121 * Note, there is no Push/Pop of CBA-s! The CBA which changes is always |
|
122 * that of the view; that is, if there is another CBA Push()-ed on top |
|
123 * of it (e.g. dialogs etc.), that will be unchanged. |
|
124 * @since Series 60 1.2 |
|
125 */ |
|
126 void UpdateCbaL(); |
|
127 |
|
128 /** |
|
129 * Switch cba visibility, checking landscape state |
|
130 * @param aVisible Visibility |
|
131 */ |
|
132 void MakeCbaVisible(TBool aVisible); |
|
133 |
|
134 /** |
|
135 * Update goto pane, if it is present in the view. |
|
136 * @since Series 60 1.2 |
|
137 */ |
|
138 virtual void UpdateGotoPaneL(); |
|
139 |
|
140 /** |
|
141 * Clear CBA. |
|
142 * @since Series 60 1.2 |
|
143 */ |
|
144 void ClearCbaL(); |
|
145 |
|
146 /** |
|
147 * Return command set id, to be displayed. |
|
148 * Derived classes should implement this method. |
|
149 * @since Series 60 1.2 |
|
150 * @return |
|
151 * - 0 if the command set should not be changed\n |
|
152 * - Otherwise, the desired command set's resource id |
|
153 */ |
|
154 virtual TInt CommandSetResourceIdL() = 0; |
|
155 |
|
156 /** |
|
157 * Set command set lsk,rsk,msk dynamically via pointers. |
|
158 * Derived classes should implement, though it can be empty. |
|
159 * If it does nothing, empty softkeys will be assigned |
|
160 * @since 5.0 |
|
161 */ |
|
162 virtual void CommandSetResourceDynL(TSKPair &lsk, TSKPair &rsk, TSKPair &msk) = 0; |
|
163 |
|
164 /** |
|
165 * Handles client rect changes |
|
166 */ |
|
167 virtual void HandleClientRectChange() = 0; |
|
168 |
|
169 /** |
|
170 * Gets the id of the previous active view. |
|
171 */ |
|
172 inline TUid GetPreviousViewID() |
|
173 { return iPreviousViewID; } |
|
174 |
|
175 /** |
|
176 * Sets the id of the previous active view. |
|
177 * @param aUid UID of previous view |
|
178 */ |
|
179 inline void SetPreviousViewID(TUid aUid) |
|
180 { iPreviousViewID = aUid; } |
|
181 |
|
182 /** |
|
183 * gets the current view's id |
|
184 */ |
|
185 virtual TUid Id() const = 0; |
|
186 |
|
187 virtual void LaunchSearchApplicationL( const TDesC& aSearchString ); |
|
188 //private: |
|
189 protected: |
|
190 |
|
191 MApiProvider& iApiProvider; // API provider |
|
192 |
|
193 // Id of the view which was active before this view. |
|
194 TUid iPreviousViewID; |
|
195 |
|
196 |
|
197 private: |
|
198 // For each child view class, track |
|
199 // the last command set, dynamic lsk,rsk,msk settings |
|
200 // to update CBA as little as possible |
|
201 TInt iLastCommandSet; |
|
202 TSKPair iLastLSK; |
|
203 TSKPair iLastRSK; |
|
204 TSKPair iLastMSK; |
|
205 }; |
|
206 |
|
207 #endif// End of File |
|