|
1 /* |
|
2 * Copyright (c) 2005-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: Wrapper class for CEikLabel. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef _XNTEXTADAPTER_H |
|
21 #define _XNTEXTADAPTER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "xncontroladapter.h" |
|
25 #include <e32base.h> |
|
26 #include <eiklabel.h> |
|
27 #include <AknPictographDrawerInterface.h> // for japanese variants |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CXnNodePluginIf; |
|
31 class CAknPictographInterface; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 /** |
|
35 * @ingroup group_xntextfactory |
|
36 * @lib xn3textfactory.lib |
|
37 * @since Series 60 3.1 |
|
38 */ |
|
39 class CXnTextAdapter : public CXnControlAdapter, |
|
40 public MAknPictographAnimatorCallBack |
|
41 { |
|
42 public: |
|
43 /** |
|
44 * 2 phase construction. |
|
45 */ |
|
46 static CXnTextAdapter* NewL(CXnControlAdapter* aParent, CXnNodePluginIf& aNode); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 virtual ~CXnTextAdapter(); |
|
52 |
|
53 public: // New functions |
|
54 /** |
|
55 * Sets the new content to the underlying CEikLabel |
|
56 * @param aText The new content |
|
57 */ |
|
58 void SetTextL(const TDesC& aText); |
|
59 |
|
60 /** |
|
61 * Returns the text contained in the underlying CEikLabel |
|
62 * @return TDesC* The text |
|
63 */ |
|
64 const TDesC* Text() const; |
|
65 |
|
66 public: // from base classes |
|
67 TInt CountComponentControls() const; |
|
68 CCoeControl* ComponentControl(TInt aIndex) const; |
|
69 virtual void SizeChanged(); |
|
70 virtual void SkinChanged(); |
|
71 |
|
72 /** |
|
73 * From CXnControlAdapter Handles the property changes. |
|
74 * @since Series 60 3.1 |
|
75 * @return void. |
|
76 */ |
|
77 void DoHandlePropertyChangeL(CXnProperty* aProperty = NULL); |
|
78 |
|
79 /** |
|
80 * From CCoeControl Handles the resource change. |
|
81 * @since Series 60 3.1 |
|
82 * @param aType A type of the resource change |
|
83 * @return void. |
|
84 */ |
|
85 void HandleScreenDeviceChangedL(); |
|
86 |
|
87 /** |
|
88 * See CCoeControl documentation |
|
89 */ |
|
90 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
|
91 |
|
92 /** |
|
93 * See MAknPictographInterface documentation |
|
94 */ |
|
95 void DrawPictographArea(); |
|
96 |
|
97 /** |
|
98 * See CXnControlAdapter documentation |
|
99 */ |
|
100 TSize MeasureAdaptiveContentL( const TSize& aAvailableSize ); |
|
101 |
|
102 private: |
|
103 |
|
104 CXnTextAdapter(CXnControlAdapter* aParent, CXnNodePluginIf& aNode); |
|
105 void ConstructL(); |
|
106 void ConstructTextL(); |
|
107 virtual void Draw(const TRect& aRect) const; |
|
108 |
|
109 void UpdateBackgroundL() const; |
|
110 void DrawBackground(const TRect& aRect, CWindowGc& aGc) const; |
|
111 TInt RestrictSizeL(); |
|
112 |
|
113 void SetLineSpacingL( TInt aReference ); |
|
114 TSize MeasureTextL( const TSize& aAvailableSize ); |
|
115 void UpdateTextL( const TDesC* aText ); |
|
116 void UpdateTextL( const TDesC8& aText ); |
|
117 |
|
118 /** |
|
119 * Sets text properties, such as color, font, etc. |
|
120 * @param aNode UI node |
|
121 * @return ETrue if text needs reconstruction, EFalse otherwise |
|
122 */ |
|
123 TBool SetTextPropertiesL( CXnNodePluginIf& aNode ); |
|
124 |
|
125 /** |
|
126 * Same as SizeChanged(), but this is an L function. |
|
127 */ |
|
128 void SizeChangedL(); |
|
129 |
|
130 |
|
131 private: |
|
132 CEikLabel* iLabel; // Label to draw text |
|
133 CXnControlAdapter* iParent; // Parent control, not owned |
|
134 CXnNodePluginIf& iNode; // UI node, not owned |
|
135 CFont* iFont; // Used font, owned |
|
136 TBool iReleaseFont; // Whether the font needs to be released or not. |
|
137 TUint8 iFlags; // Flags for text properties |
|
138 CAknPictographInterface* iPictographInterface; // Pictograph interface. |
|
139 CWindowGc* iGc; // Window graphics context. Not own. |
|
140 mutable CFbsBitmap* iBackgroundBitmap; // Pointer to background bitmap. Own. |
|
141 TInt iMaxLines; //Max lines for wrapped text string |
|
142 HBufC* iText; |
|
143 }; |
|
144 |
|
145 |
|
146 |
|
147 #endif // XNTEXTADAPTER_H |
|
148 |
|
149 // End of File |