williamr@4
|
1 |
/*
|
williamr@4
|
2 |
* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@4
|
3 |
* All rights reserved.
|
williamr@4
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@4
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@4
|
8 |
*
|
williamr@4
|
9 |
* Initial Contributors:
|
williamr@4
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@4
|
11 |
*
|
williamr@4
|
12 |
* Contributors:
|
williamr@4
|
13 |
*
|
williamr@4
|
14 |
* Description: A default control in the status pane's title pane.
|
williamr@4
|
15 |
*
|
williamr@4
|
16 |
*/
|
williamr@4
|
17 |
|
williamr@4
|
18 |
|
williamr@4
|
19 |
#ifndef C_AKNTITLE_H
|
williamr@4
|
20 |
#define C_AKNTITLE_H
|
williamr@4
|
21 |
|
williamr@4
|
22 |
#include <AknControl.h>
|
williamr@4
|
23 |
#include <coeccntx.h>
|
williamr@4
|
24 |
|
williamr@4
|
25 |
class CEikLabel;
|
williamr@4
|
26 |
class CEikImage;
|
williamr@4
|
27 |
class CAknTitlePaneExtension;
|
williamr@4
|
28 |
class CAknTitlePaneLabel;
|
williamr@4
|
29 |
class MAknTitlePaneObserver;
|
williamr@4
|
30 |
class TAknTextLineLayout;
|
williamr@4
|
31 |
|
williamr@4
|
32 |
/**
|
williamr@4
|
33 |
* A default control in the status pane's title pane.
|
williamr@4
|
34 |
*
|
williamr@4
|
35 |
* @lib avkon.lib
|
williamr@4
|
36 |
*/
|
williamr@4
|
37 |
class CAknTitlePane : public CAknControl, public MCoeControlContext
|
williamr@4
|
38 |
{
|
williamr@4
|
39 |
public:
|
williamr@4
|
40 |
/**
|
williamr@4
|
41 |
* Constructor.
|
williamr@4
|
42 |
*/
|
williamr@4
|
43 |
IMPORT_C CAknTitlePane();
|
williamr@4
|
44 |
|
williamr@4
|
45 |
/**
|
williamr@4
|
46 |
* Destructor.
|
williamr@4
|
47 |
*/
|
williamr@4
|
48 |
IMPORT_C ~CAknTitlePane();
|
williamr@4
|
49 |
|
williamr@4
|
50 |
/**
|
williamr@4
|
51 |
* 2nd phase constructor.
|
williamr@4
|
52 |
*/
|
williamr@4
|
53 |
IMPORT_C void ConstructL();
|
williamr@4
|
54 |
|
williamr@4
|
55 |
/**
|
williamr@4
|
56 |
* Read title pane data from resource file and show it in
|
williamr@4
|
57 |
* the status pane's title pane.
|
williamr@4
|
58 |
*/
|
williamr@4
|
59 |
IMPORT_C void ConstructFromResourceL( TResourceReader& aReader );
|
williamr@4
|
60 |
|
williamr@4
|
61 |
/**
|
williamr@4
|
62 |
* Set a text and show it in the status pane's title pane.
|
williamr@4
|
63 |
* Descriptor is copied to the title pane control and ownership of
|
williamr@4
|
64 |
* the original descriptor is left to the application.
|
williamr@4
|
65 |
*
|
williamr@4
|
66 |
* @param aText Text to be shown on the title pane.
|
williamr@4
|
67 |
*/
|
williamr@4
|
68 |
IMPORT_C void SetTextL( const TDesC& aText );
|
williamr@4
|
69 |
|
williamr@4
|
70 |
/**
|
williamr@4
|
71 |
* Sets text to the title pane.
|
williamr@4
|
72 |
*
|
williamr@4
|
73 |
* @param aText New text. This object takes ownership of @c aText.
|
williamr@4
|
74 |
*/
|
williamr@4
|
75 |
IMPORT_C void SetText( HBufC* aText );
|
williamr@4
|
76 |
|
williamr@4
|
77 |
/**
|
williamr@4
|
78 |
* Set a text and show it in the status pane's title pane.
|
williamr@4
|
79 |
* If whole text does not fit into titlepane, it will be scrolled once
|
williamr@4
|
80 |
* and then shown in truncated form.
|
williamr@4
|
81 |
*
|
williamr@4
|
82 |
* Descriptor is copied to the title pane control and ownership
|
williamr@4
|
83 |
* of the original descriptor is left to the application.
|
williamr@4
|
84 |
*
|
williamr@4
|
85 |
* @since 3.0
|
williamr@4
|
86 |
*
|
williamr@4
|
87 |
* @param aText Text to be shown on the title pane.
|
williamr@4
|
88 |
* @param aScroll If @c ETrue text is scrolled when needed, otherwise not.
|
williamr@4
|
89 |
*
|
williamr@4
|
90 |
*/
|
williamr@4
|
91 |
IMPORT_C void SetTextL( const TDesC& aText, TBool aScroll );
|
williamr@4
|
92 |
|
williamr@4
|
93 |
/**
|
williamr@4
|
94 |
* Sets text to the title pane. If whole text does not fit into titlepane,
|
williamr@4
|
95 |
* it will be scrolled once and then shown in truncated form.
|
williamr@4
|
96 |
*
|
williamr@4
|
97 |
* @since 3.0
|
williamr@4
|
98 |
*
|
williamr@4
|
99 |
* @param aText New text. This object takes ownership of @c aText.
|
williamr@4
|
100 |
* If @c NULL is given then already existing text's
|
williamr@4
|
101 |
* scrollability will be changed according to @c aScroll.
|
williamr@4
|
102 |
* @param aScroll If ETrue text is scrolled when needed, otherwise not.
|
williamr@4
|
103 |
*/
|
williamr@4
|
104 |
IMPORT_C void SetText( HBufC* aText, TBool aScroll );
|
williamr@4
|
105 |
|
williamr@4
|
106 |
/**
|
williamr@4
|
107 |
* Returns text currently in the status pane's title pane.
|
williamr@4
|
108 |
* Ownership is not transferred.
|
williamr@4
|
109 |
*
|
williamr@4
|
110 |
* @return Text currently shown in the title pane.
|
williamr@4
|
111 |
*/
|
williamr@4
|
112 |
inline const TDesC* Text() const;
|
williamr@4
|
113 |
|
williamr@4
|
114 |
/**
|
williamr@4
|
115 |
* Set a picture to the title pane and show it in the
|
williamr@4
|
116 |
* status pane's title pane.
|
williamr@4
|
117 |
* Title pane object takes ownership of the picture.
|
williamr@4
|
118 |
* If @c NULL bitmap is passed, previously set image is shown.
|
williamr@4
|
119 |
*
|
williamr@4
|
120 |
* @param aBitmap Bitmap to be set on the title pane.
|
williamr@4
|
121 |
* @param aMaskBitmap Mask of the bitmap.
|
williamr@4
|
122 |
*/
|
williamr@4
|
123 |
IMPORT_C void SetPicture( const CFbsBitmap* aBitmap,
|
williamr@4
|
124 |
const CFbsBitmap* aMaskBitmap = NULL );
|
williamr@4
|
125 |
|
williamr@4
|
126 |
/**
|
williamr@4
|
127 |
* Set a picture from file and show it in the status pane's title pane.
|
williamr@4
|
128 |
*
|
williamr@4
|
129 |
* @param aFileName Name of the bitmap file.
|
williamr@4
|
130 |
* @param aMainId Index of the bitmap in the bitmap file.
|
williamr@4
|
131 |
* @param aMaskId Index of the bitmap's mask in the bitmap file.
|
williamr@4
|
132 |
*/
|
williamr@4
|
133 |
IMPORT_C void SetPictureFromFileL( const TDesC& aFileName,
|
williamr@4
|
134 |
TInt aMainId,
|
williamr@4
|
135 |
TInt aMaskId = -1 );
|
williamr@4
|
136 |
|
williamr@4
|
137 |
/**
|
williamr@4
|
138 |
* Set a small picture to the title pane and show it in the
|
williamr@4
|
139 |
* status pane's title pane together with text.
|
williamr@4
|
140 |
*
|
williamr@4
|
141 |
* Title pane object takes ownership of the picture.
|
williamr@4
|
142 |
*
|
williamr@4
|
143 |
* If @c NULL bitmap is passed, previously set image is used.
|
williamr@4
|
144 |
*
|
williamr@4
|
145 |
* @since 3.0
|
williamr@4
|
146 |
*
|
williamr@4
|
147 |
* @param aBitmap Bitmap to be set on the title pane.
|
williamr@4
|
148 |
* @param aMaskBitmap Mask of the bitmap.
|
williamr@4
|
149 |
* @param aVisible If @c ETrue, picture is set visible. Otherwise only text is shown.
|
williamr@4
|
150 |
*/
|
williamr@4
|
151 |
IMPORT_C void SetSmallPicture( const CFbsBitmap* aBitmap,
|
williamr@4
|
152 |
const CFbsBitmap* aMaskBitmap,
|
williamr@4
|
153 |
TBool aVisible );
|
williamr@4
|
154 |
|
williamr@4
|
155 |
/**
|
williamr@4
|
156 |
* Set data from resource file and show it in the status pane's title pane.
|
williamr@4
|
157 |
*
|
williamr@4
|
158 |
* @param aReader Resource reader of the title pane data.
|
williamr@4
|
159 |
*/
|
williamr@4
|
160 |
IMPORT_C void SetFromResourceL( TResourceReader& aReader );
|
williamr@4
|
161 |
|
williamr@4
|
162 |
/**
|
williamr@4
|
163 |
* Set default value to the status pane's title pane.
|
williamr@4
|
164 |
* Default value is the name of currently active application.
|
williamr@4
|
165 |
*/
|
williamr@4
|
166 |
IMPORT_C void SetTextToDefaultL();
|
williamr@4
|
167 |
|
williamr@4
|
168 |
/**
|
williamr@4
|
169 |
* Gets the maximum amount of text rows that title pane is able to display simultaneously
|
williamr@4
|
170 |
* in the currently active status pane layout. Typically the return value is
|
williamr@4
|
171 |
* either 2 (default portrait mode layout) or 1 (landscape mode layouts).
|
williamr@4
|
172 |
* In the extended status pane layouts the maximum number of lines is always 1.
|
williamr@4
|
173 |
*
|
williamr@4
|
174 |
* Since release 3.2, regardless of the status pane layout,
|
williamr@4
|
175 |
* the maximum number of lines is always 1.
|
williamr@4
|
176 |
*
|
williamr@4
|
177 |
* @since 3.1
|
williamr@4
|
178 |
*
|
williamr@4
|
179 |
* @return Maximum number of visible text lines.
|
williamr@4
|
180 |
*/
|
williamr@4
|
181 |
IMPORT_C TInt MaxNumberOfVisibleTextRows() const;
|
williamr@4
|
182 |
|
williamr@4
|
183 |
/**
|
williamr@4
|
184 |
* Sets the number of text rows that can be used to display the text.
|
williamr@4
|
185 |
* The largest allowed value is the the value returned from MaxNumberOfVisibleTextRows() and
|
williamr@4
|
186 |
* the minimum value is always 1.
|
williamr@4
|
187 |
*
|
williamr@4
|
188 |
* @since 3.1
|
williamr@4
|
189 |
*
|
williamr@4
|
190 |
* @param aRows Number of rows that can be used to display the text.
|
williamr@4
|
191 |
*/
|
williamr@4
|
192 |
IMPORT_C void SetNumberOfVisibleTextRows( TInt aRows );
|
williamr@4
|
193 |
|
williamr@4
|
194 |
public: // From base class @c MCoeControlContext.
|
williamr@4
|
195 |
|
williamr@4
|
196 |
/**
|
williamr@4
|
197 |
* Allows to modify graphics context before @c Draw.
|
williamr@4
|
198 |
*
|
williamr@4
|
199 |
* @param aGc Graphics context to be modified.
|
williamr@4
|
200 |
*/
|
williamr@4
|
201 |
IMPORT_C virtual void PrepareContext( CWindowGc& aGc ) const;
|
williamr@4
|
202 |
|
williamr@4
|
203 |
protected: // From base class @c CCoeControl.
|
williamr@4
|
204 |
|
williamr@4
|
205 |
/**
|
williamr@4
|
206 |
* Handles the size change events.
|
williamr@4
|
207 |
*/
|
williamr@4
|
208 |
IMPORT_C virtual void SizeChanged();
|
williamr@4
|
209 |
|
williamr@4
|
210 |
/**
|
williamr@4
|
211 |
* Handles the position change events.
|
williamr@4
|
212 |
*/
|
williamr@4
|
213 |
IMPORT_C virtual void PositionChanged();
|
williamr@4
|
214 |
|
williamr@4
|
215 |
/**
|
williamr@4
|
216 |
* Handles a change to the control's resources which are shared across
|
williamr@4
|
217 |
* the environment, e.g. skin change.
|
williamr@4
|
218 |
*
|
williamr@4
|
219 |
* @param aType Event type.
|
williamr@4
|
220 |
*/
|
williamr@4
|
221 |
IMPORT_C virtual void HandleResourceChange( TInt aType );
|
williamr@4
|
222 |
|
williamr@4
|
223 |
/**
|
williamr@4
|
224 |
* Returns number of controls inside the title pane control.
|
williamr@4
|
225 |
*
|
williamr@4
|
226 |
* @return Number of component controls.
|
williamr@4
|
227 |
*/
|
williamr@4
|
228 |
IMPORT_C virtual TInt CountComponentControls() const;
|
williamr@4
|
229 |
|
williamr@4
|
230 |
/**
|
williamr@4
|
231 |
* Returns a control determined by control index.
|
williamr@4
|
232 |
*
|
williamr@4
|
233 |
* @param aIndex Index of a control to be returned.
|
williamr@4
|
234 |
*
|
williamr@4
|
235 |
* @return Pointer to the control.
|
williamr@4
|
236 |
*/
|
williamr@4
|
237 |
IMPORT_C virtual CCoeControl* ComponentControl(TInt aIndex) const;
|
williamr@4
|
238 |
|
williamr@4
|
239 |
public: // From base class @c CCoeControl.
|
williamr@4
|
240 |
|
williamr@4
|
241 |
/**
|
williamr@4
|
242 |
* Handles pointer events.
|
williamr@4
|
243 |
*
|
williamr@4
|
244 |
* @param aPointerEvent Pointer event to be handled.
|
williamr@4
|
245 |
*/
|
williamr@4
|
246 |
IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent );
|
williamr@4
|
247 |
|
williamr@4
|
248 |
public: // New methods
|
williamr@4
|
249 |
|
williamr@4
|
250 |
/**
|
williamr@4
|
251 |
* Sets observer for title pane events.
|
williamr@4
|
252 |
*
|
williamr@4
|
253 |
* @param aObserver Pointer to title pane observer.
|
williamr@4
|
254 |
*/
|
williamr@4
|
255 |
IMPORT_C void SetTitlePaneObserver( MAknTitlePaneObserver* aObserver );
|
williamr@4
|
256 |
|
williamr@4
|
257 |
private: // From base class @c CAknControl.
|
williamr@4
|
258 |
|
williamr@4
|
259 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
williamr@4
|
260 |
|
williamr@4
|
261 |
public:
|
williamr@4
|
262 |
|
williamr@4
|
263 |
/**
|
williamr@4
|
264 |
* Gets title text label.
|
williamr@4
|
265 |
* @internal
|
williamr@4
|
266 |
*/
|
williamr@4
|
267 |
CEikLabel* TextLabel();
|
williamr@4
|
268 |
|
williamr@4
|
269 |
/**
|
williamr@4
|
270 |
* Gets the title image.
|
williamr@4
|
271 |
* @internal
|
williamr@4
|
272 |
*/
|
williamr@4
|
273 |
CEikImage* TitleImage();
|
williamr@4
|
274 |
|
williamr@4
|
275 |
private:
|
williamr@4
|
276 |
|
williamr@4
|
277 |
void CommonConstructL();
|
williamr@4
|
278 |
TUid AppUid() const;
|
williamr@4
|
279 |
|
williamr@4
|
280 |
TInt FormatTitlePaneLabelL( const TInt aOneLineLayoutWidth,
|
williamr@4
|
281 |
const TInt aTwoLineLayoutWidth,
|
williamr@4
|
282 |
const CFont* aOneLineFont,
|
williamr@4
|
283 |
const CFont* aTwoLineFont );
|
williamr@4
|
284 |
|
williamr@4
|
285 |
void ReadFromResourceFileL( TResourceReader& aReader );
|
williamr@4
|
286 |
void SetSmallPictureFromFileL( const TDesC& aFileName, TInt aMainId, TInt aMaskId = -1 );
|
williamr@4
|
287 |
|
williamr@4
|
288 |
private: // From base class @c CCoeControl.
|
williamr@4
|
289 |
|
williamr@4
|
290 |
IMPORT_C virtual void Draw( const TRect& aRect ) const;
|
williamr@4
|
291 |
|
williamr@4
|
292 |
protected:
|
williamr@4
|
293 |
|
williamr@4
|
294 |
MAknTitlePaneObserver* iTitlePaneObserver;
|
williamr@4
|
295 |
|
williamr@4
|
296 |
private:
|
williamr@4
|
297 |
void SizeChangedInNormalStatusPane();
|
williamr@4
|
298 |
void SizeChangedInExtendedStatusPane();
|
williamr@4
|
299 |
void SizeChangedInFlatStatusPane();
|
williamr@4
|
300 |
void SizeChangedInStaconPane();
|
williamr@4
|
301 |
RWindow* StatuspaneContainerWindow() const;
|
williamr@4
|
302 |
void SetupTitleLabelEffectL();
|
williamr@4
|
303 |
void SetContainerWindowNonFading( TBool aNonFading );
|
williamr@4
|
304 |
|
williamr@4
|
305 |
void SetupStaconPaneScrollEffectL();
|
williamr@4
|
306 |
void SetupFlatStatusPaneScrollEffectL();
|
williamr@4
|
307 |
void SetupNormalStatusPaneScrollEffectL();
|
williamr@4
|
308 |
void SetupFlatStatusPaneFadeEffectL();
|
williamr@4
|
309 |
void SetupExtendedStatusPaneScrollEffectL();
|
williamr@4
|
310 |
void SetupNoEffectL();
|
williamr@4
|
311 |
|
williamr@4
|
312 |
TBool TextFits( TAknTextLineLayout& aTextLayout );
|
williamr@4
|
313 |
|
williamr@4
|
314 |
private: // Member data
|
williamr@4
|
315 |
|
williamr@4
|
316 |
HBufC* iTitleText;
|
williamr@4
|
317 |
HBufC* iDefaultTitleText;
|
williamr@4
|
318 |
CAknTitlePaneLabel* iTitleLabel;
|
williamr@4
|
319 |
TBool iImageShown;
|
williamr@4
|
320 |
CAknTitlePaneExtension* iExtension;
|
williamr@4
|
321 |
};
|
williamr@4
|
322 |
|
williamr@4
|
323 |
inline const TDesC* CAknTitlePane::Text() const
|
williamr@4
|
324 |
{
|
williamr@4
|
325 |
return( iTitleText );
|
williamr@4
|
326 |
}
|
williamr@4
|
327 |
|
williamr@4
|
328 |
#endif // C_AKNTITLE_H
|