|
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 CEikEdwin |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef _XNTEXTEDITORADAPTER_H |
|
19 #define _XNTEXTEDITORADAPTER_H |
|
20 |
|
21 // System includes |
|
22 #include <e32base.h> |
|
23 |
|
24 // User includes |
|
25 #include "xncontroladapter.h" |
|
26 #include "xnuienginepluginif.h" |
|
27 |
|
28 // Forward declarations |
|
29 class CXnNodePluginIf; |
|
30 class CEikEdwin; |
|
31 class CXnTextEditorPublisher; |
|
32 class CXnAppUiAdapter; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 class CXnTextEditorAdapter : public CXnControlAdapter, public MCoeControlBackground |
|
36 { |
|
37 public: |
|
38 // constructor and destructor |
|
39 |
|
40 /** |
|
41 * 2 phase construction. |
|
42 */ |
|
43 static CXnTextEditorAdapter* NewL( |
|
44 CXnControlAdapter* aParent, CXnNodePluginIf& aNode ); |
|
45 |
|
46 /** |
|
47 * Destructor. |
|
48 */ |
|
49 ~CXnTextEditorAdapter(); |
|
50 |
|
51 public: |
|
52 // New functions |
|
53 |
|
54 /** |
|
55 * Gets editor |
|
56 * |
|
57 * @since S60 5.0 |
|
58 * @return Editor, ownership is not transfered |
|
59 */ |
|
60 CEikEdwin* Editor() const { return iEditor; }; |
|
61 |
|
62 /** |
|
63 * Set text to the text field |
|
64 * |
|
65 * @since S60 5.0 |
|
66 * @param aText Text to set |
|
67 */ |
|
68 void SetTextL( const TDesC& aText ); |
|
69 |
|
70 /** |
|
71 * Return the text of the text field |
|
72 * |
|
73 * @since S60 5.0 |
|
74 * @return Text, ownership is transfered |
|
75 */ |
|
76 HBufC* Text() const; |
|
77 |
|
78 /** |
|
79 * Handles editor events |
|
80 * |
|
81 * @since S60 5.2 |
|
82 * @param aReason, editor event |
|
83 */ |
|
84 void HandleEditorEvent( TInt aReason ); |
|
85 |
|
86 public: // from base classes |
|
87 |
|
88 /** |
|
89 * See CCoeControl documentation |
|
90 */ |
|
91 TInt CountComponentControls() const; |
|
92 |
|
93 /** |
|
94 * See CCoeControl documentation |
|
95 */ |
|
96 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
97 |
|
98 /** |
|
99 * See CCoeControl documentation |
|
100 */ |
|
101 void SizeChanged(); |
|
102 |
|
103 /** |
|
104 * See CCoeControl documentation |
|
105 */ |
|
106 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
107 |
|
108 /** |
|
109 * See CXnControlAdapter documentation |
|
110 */ |
|
111 TBool RefusesFocusLoss() const; |
|
112 |
|
113 /** |
|
114 * See CCoeControl documentation |
|
115 */ |
|
116 void FocusChanged( TDrawNow aDrawNow ); |
|
117 |
|
118 /** |
|
119 * See CCoeControl documentation |
|
120 */ |
|
121 void Draw( const TRect& aRect ) const; |
|
122 |
|
123 /** |
|
124 * See CCoeControl documentation |
|
125 */ |
|
126 void HandleResourceChange( TInt aType ); |
|
127 |
|
128 /** |
|
129 * See CCoeControl documentation |
|
130 */ |
|
131 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
132 |
|
133 /** |
|
134 * See CCoeAppUiBase. |
|
135 */ |
|
136 void HandleScreenDeviceChangedL(); |
|
137 |
|
138 private: // from base classes |
|
139 |
|
140 /** |
|
141 * See MCoeControlBackground documentation |
|
142 */ |
|
143 void Draw( CWindowGc& aGc, const CCoeControl& aControl, |
|
144 const TRect& aRect ) const; |
|
145 |
|
146 private: |
|
147 // private constrcutors |
|
148 |
|
149 CXnTextEditorAdapter( CXnControlAdapter* aParent, CXnNodePluginIf& aNode ); |
|
150 |
|
151 void ConstructL(); |
|
152 |
|
153 private: |
|
154 // new functions |
|
155 |
|
156 void SetPropertiesL(); |
|
157 |
|
158 void SetEditorMarginPropertiesL(); |
|
159 |
|
160 private: |
|
161 // data |
|
162 /** Parent control, not owned */ |
|
163 CXnControlAdapter* iParent; |
|
164 /** UI node, not owned */ |
|
165 CXnNodePluginIf& iNode; |
|
166 /** UI engine, not owned */ |
|
167 TXnUiEnginePluginIf* iUiEngine; |
|
168 /** Appui adapter, not owned */ |
|
169 CXnAppUiAdapter* iAppui; |
|
170 /** Editor, owned */ |
|
171 CEikEdwin* iEditor; |
|
172 /** CPS publisher wrapper, owned */ |
|
173 CXnTextEditorPublisher* iEditorPublisher; |
|
174 // Font, owned */ |
|
175 CFont* iFont; |
|
176 /** Flag to indicate whether the font needs to be released or not */ |
|
177 TBool iReleaseFont; |
|
178 /** Max line amount */ |
|
179 TInt iMaxLines; |
|
180 /** Flag to indicate whether focus loss is refused */ |
|
181 TBool iRefusesFocusLoss; |
|
182 /** Split input states*/ |
|
183 TInt iSplitInputFlags; |
|
184 }; |
|
185 |
|
186 #endif // _XNTEXTEDITORADAPTER_H |
|
187 |
|
188 // End of File |