|
1 /* |
|
2 * Copyright (c) 2002 - 2006 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 * This class is an extension to the standard Eikon label. |
|
16 * It provides leave-safe SetText() and is able to |
|
17 * clear its background before drawing. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef __CVRLABEL_H__ |
|
23 #define __CVRLABEL_H__ |
|
24 |
|
25 // INCLUDES |
|
26 #include <eiklabel.h> |
|
27 #include <AknUtils.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MAknsSkinInstance; |
|
31 |
|
32 // CLASS DEFINITION |
|
33 /** |
|
34 * This class is an extension to the standard Eikon label. |
|
35 * It provides leave-safe SetText() and is able to |
|
36 * clear its background before drawing. |
|
37 */ |
|
38 NONSHARABLE_CLASS( CVRLabel ) |
|
39 : public CEikLabel |
|
40 { |
|
41 public: // Constructors and destructor |
|
42 |
|
43 /** |
|
44 * Two-phased constructor |
|
45 * @param aContainer Reference to the owning CCoeControl |
|
46 */ |
|
47 static CVRLabel* NewLC( const CCoeControl& aContainer ); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 ~CVRLabel(); |
|
53 |
|
54 private: // Constructors |
|
55 |
|
56 /** |
|
57 * Default constructor. |
|
58 */ |
|
59 inline CVRLabel() {}; |
|
60 |
|
61 /** |
|
62 * 2nd phase constructor. |
|
63 * @param aContainer Reference to the owning CCoeControl |
|
64 */ |
|
65 void ConstructL( const CCoeControl& aContainer ); |
|
66 |
|
67 private: // from CCoeControl |
|
68 |
|
69 /** |
|
70 * Draws this label. |
|
71 * @param aRect The area that needs updating. |
|
72 */ |
|
73 void Draw( const TRect& aRect ) const; |
|
74 |
|
75 public: // New methods |
|
76 |
|
77 /** |
|
78 * Sets the text in this label. |
|
79 * Leave-safe. Panics if aText is too long. |
|
80 * @param aText The new contents. |
|
81 */ |
|
82 void SetText( const TDesC& aText ); |
|
83 |
|
84 /** |
|
85 * Sets the text in this label. |
|
86 * Will draw the label if the given text |
|
87 * is different from the current one. |
|
88 * Leave-safe. Panics if aText is too long. |
|
89 * @param aText The new contents. |
|
90 */ |
|
91 void SetTextAndDraw( const TDesC& aText ); |
|
92 |
|
93 private: |
|
94 // Skin instance. Not owned. |
|
95 MAknsSkinInstance* iSkin; |
|
96 |
|
97 TAknLayoutText iTextLayout; |
|
98 }; |
|
99 |
|
100 #endif // __CVRLABEL_H__ |