|
1 /* |
|
2 * Copyright (c) 2007-2008 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: textview class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _CIMCVAPPTEXTVIEWCONTROL_H |
|
20 #define _CIMCVAPPTEXTVIEWCONTROL_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <eiksbobs.h> // MEikScrollBarObserver |
|
24 #include <eikbctrl.h> |
|
25 #include <frmtlay.h> // TCursorSelection |
|
26 #include "mimcvapptextview.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CTextLayout; |
|
30 class CTextView; |
|
31 class CEikScrollBarFrame; |
|
32 class CAknsBasicBackgroundControlContext; |
|
33 class CIMCVAppCustomDraw; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 /** |
|
38 * Text viewer component |
|
39 * @since 5.0 |
|
40 */ |
|
41 class CIMCVAppTextViewControl : public CCoeControl, |
|
42 public MIMCVAppTextView, |
|
43 public MEikScrollBarObserver |
|
44 { |
|
45 |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * @param aRect Draw area |
|
51 * @param aParent Parent control |
|
52 * @param aTextLayout Text to be viewed |
|
53 * @return Instance of this class |
|
54 */ |
|
55 static CIMCVAppTextViewControl* NewL( const TRect& aRect, |
|
56 const CCoeControl& aParent, |
|
57 MLayDoc* aTextLayout ); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CIMCVAppTextViewControl(); |
|
63 |
|
64 |
|
65 void UpdateChatViewL (); |
|
66 /** |
|
67 * Update the view |
|
68 */ |
|
69 |
|
70 void SmileyDialogLaunched (TBool aLaunched); |
|
71 |
|
72 void UpdateViewL(); |
|
73 |
|
74 protected: // New functions |
|
75 |
|
76 /** |
|
77 * Updates scrollbars |
|
78 */ |
|
79 void UpdateScrollBarsL( TBool aScrollDraw = ETrue ); |
|
80 |
|
81 |
|
82 /** |
|
83 * Set highlight state |
|
84 */ |
|
85 void SetHighlighted( TBool aIsHighlighted ); |
|
86 |
|
87 /** |
|
88 * Get scrollbars |
|
89 */ |
|
90 const CEikScrollBarFrame* ScrollBarFrame(); |
|
91 |
|
92 /** |
|
93 * Finds the document position which is located at aPoint |
|
94 * @param aPoint Location to find |
|
95 * @return Document position or |
|
96 * KErrNotFound if not found |
|
97 */ |
|
98 TInt FindDocPos( TPoint aPoint ); |
|
99 protected: // Functions from MIMCVAppTextView |
|
100 |
|
101 /** |
|
102 * @see MIMCVAppTextView |
|
103 */ |
|
104 void HandleFormatChangedL( TCursorSelection& aChanged, |
|
105 TBool aPreserverFocus = EFalse ); |
|
106 |
|
107 /** |
|
108 * @see MIMCVAppTextView |
|
109 */ |
|
110 void HandleInsertDeleteL( TCursorSelection& aChanged, |
|
111 TInt aDeletedChars ); |
|
112 |
|
113 /** |
|
114 * @see MIMCVAppTextView |
|
115 */ |
|
116 void HandleAdditionL( TBool aFirst, |
|
117 TCursorSelection& aSelection, |
|
118 TBool aTop ); |
|
119 |
|
120 |
|
121 /** |
|
122 * @see MIMCVAppTextView |
|
123 */ |
|
124 void ScrollVisibleL( TCursorSelection& aSelection, TBool aTop ); |
|
125 |
|
126 /** |
|
127 * @see MIMCVAppTextView |
|
128 */ |
|
129 TCursorSelection ScrollSelection(); |
|
130 |
|
131 /** |
|
132 * @see MIMCVAppTextView |
|
133 */ |
|
134 void ScrollLinesL( TInt aAmount ); |
|
135 |
|
136 /** |
|
137 * @see MIMCVAppTextView |
|
138 */ |
|
139 public: |
|
140 |
|
141 TBool IsVisible( TInt aPos ); |
|
142 |
|
143 /** |
|
144 * @see MIMCVAppTextView |
|
145 */ |
|
146 protected: |
|
147 TBool ParagraphFits( TInt aPos ); |
|
148 |
|
149 /** |
|
150 * @see MIMCVAppTextView |
|
151 */ |
|
152 void Redraw(); |
|
153 |
|
154 /** |
|
155 * @see MIMCVAppTextView |
|
156 */ |
|
157 void SetPenBehaviour( TPenBehaviour aPen ); |
|
158 |
|
159 /** |
|
160 * @see MIMCVAppTextView |
|
161 */ |
|
162 MIMCVAppTextView::TPenBehaviour PenBehaviour(); |
|
163 |
|
164 /** |
|
165 * @see MIMCVAppTextView |
|
166 */ |
|
167 void ProcessStylusEventL( const TPointerEvent& aPointerEvent ); |
|
168 |
|
169 /** |
|
170 * @see MIMCVAppTextView |
|
171 */ |
|
172 void HandleGlobalChangeNoRedrawL( |
|
173 TViewYPosQualifier aYPosQualifier = TViewYPosQualifier() ); |
|
174 |
|
175 |
|
176 public: // from MObjectProvider |
|
177 |
|
178 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
179 |
|
180 protected: // from MEikScrollBarObserver |
|
181 |
|
182 void HandleScrollEventL( CEikScrollBar* aScrollBar, |
|
183 TEikScrollEvent aEventType ); |
|
184 |
|
185 protected: // Functions from CCoeControl |
|
186 |
|
187 /** |
|
188 * @see CCoeControl |
|
189 */ |
|
190 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
191 TEventCode aType ); |
|
192 |
|
193 /** |
|
194 * @see CCoeControl |
|
195 */ |
|
196 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
|
197 |
|
198 /** |
|
199 * @see CCoeControl |
|
200 */ |
|
201 void Draw( const TRect& aRect ) const; |
|
202 |
|
203 /** |
|
204 * @see CCoeControl |
|
205 */ |
|
206 void SizeChanged(); |
|
207 |
|
208 /** |
|
209 * @see CCoeControl |
|
210 */ |
|
211 TInt CountComponentControls() const; |
|
212 |
|
213 |
|
214 /** |
|
215 * @see CCoeControl |
|
216 */ |
|
217 CCoeControl* ComponentControl(TInt aIndex) const; |
|
218 |
|
219 |
|
220 protected: |
|
221 |
|
222 /** |
|
223 * C++ default constructor. |
|
224 */ |
|
225 CIMCVAppTextViewControl(); |
|
226 |
|
227 /** |
|
228 * By default Symbian 2nd phase constructor is private. |
|
229 * @param aRect Draw area |
|
230 * @param aParent Parent control |
|
231 * @param aTextLayout Text to be viewed |
|
232 */ |
|
233 void ConstructL( const TRect& aRect, const CCoeControl& aParent, |
|
234 MLayDoc* aTextLayout ); |
|
235 |
|
236 |
|
237 private: // Data |
|
238 |
|
239 // Owns. rectangle in which to view text |
|
240 TRect iViewRect; |
|
241 |
|
242 // Owns. text layout |
|
243 CTextLayout* iLayout; |
|
244 |
|
245 // Owns. text view |
|
246 CTextView* iTextView; |
|
247 |
|
248 // Owns. custom drawer for skins |
|
249 CIMCVAppCustomDraw* iCustomDraw; |
|
250 |
|
251 // Owns. scroll bar container |
|
252 CEikScrollBarFrame* iScrollBar; |
|
253 |
|
254 // Is control in stack? |
|
255 TBool iAddedToStack; |
|
256 |
|
257 //owns |
|
258 CAknsBasicBackgroundControlContext* iBgContext; // Skin background control context |
|
259 |
|
260 // Own. Clipping region to prevent flickering |
|
261 RRegion* iClipping; |
|
262 |
|
263 // Highlight state inside text view |
|
264 TBool iIsHighlighted; |
|
265 |
|
266 // Determines how this contol reacts to pointer events |
|
267 TPenBehaviour iPenType; |
|
268 |
|
269 TBool iSmileyDialogLaunched; |
|
270 |
|
271 }; |
|
272 |
|
273 #endif // _CIMCVAPPTEXTVIEWCONTROL_H |
|
274 |
|
275 // End of File |
|
276 |