|
1 /* |
|
2 * Copyright (c) 2002-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: Header file for the CCbsUiMsgViewContainer class. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __CCBSUIMSGVIEWCONTAINER_H |
|
21 #define __CCBSUIMSGVIEWCONTAINER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <coecntrl.h> |
|
25 |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CCbsUiMsgView; |
|
29 class CEikRichTextEditor; |
|
30 class CRichText; |
|
31 class CCbsUiMsgView; |
|
32 class CEikButtonGroupContainer; |
|
33 class CEikScrollBarFrame; |
|
34 class CAknsBasicBackgroundControlContext; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 /** |
|
38 * It is the container class viewing messages. |
|
39 */ |
|
40 class CCbsUiMsgViewContainer : public CCoeControl, |
|
41 public MEikScrollBarObserver |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 * |
|
48 * @param aMsgView Referenceo to message view. |
|
49 * @param aRect Rectangle, which container can use. |
|
50 */ |
|
51 static CCbsUiMsgViewContainer* NewL( |
|
52 CCbsUiMsgView& aMsgView, |
|
53 const TRect& aRect ); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 ~CCbsUiMsgViewContainer(); |
|
59 |
|
60 public: // From CCoeControl |
|
61 |
|
62 /** |
|
63 * Returns the numbers of components. |
|
64 * |
|
65 * @return Number of components in the container |
|
66 */ |
|
67 TInt CountComponentControls() const; |
|
68 |
|
69 /** |
|
70 * Returns a component. |
|
71 * |
|
72 * @param aIndex component index which is required |
|
73 * @return required component |
|
74 */ |
|
75 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
76 |
|
77 /** |
|
78 * Sets new rectangle to the editor. |
|
79 */ |
|
80 void SizeChanged(); |
|
81 |
|
82 /** |
|
83 * Handles a needed key events. |
|
84 * |
|
85 * @param aKeyEvent what kind of key produced this event |
|
86 * @param aType Which kind of action produced this event |
|
87 * @return EKeyWasConsumed |
|
88 */ |
|
89 TKeyResponse OfferKeyEventL( |
|
90 const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
91 |
|
92 /** |
|
93 * Gets the control's help context. |
|
94 * |
|
95 * @param aContext The control's help context |
|
96 */ |
|
97 void GetHelpContext(TCoeHelpContext& aContext) const; |
|
98 |
|
99 public: // New functions |
|
100 |
|
101 /** |
|
102 * Gets new message from messag view and sets the editor. |
|
103 */ |
|
104 void UpdateMessageL( const TDesC& aMessage ); |
|
105 |
|
106 /** |
|
107 * Returns the text in Rich Text editor. |
|
108 * |
|
109 * @return the text |
|
110 */ |
|
111 CRichText* GetEditor() const; |
|
112 |
|
113 /** |
|
114 * Copies the message to clipboard. |
|
115 */ |
|
116 void CopyToClipboardL() const; |
|
117 |
|
118 /** |
|
119 * From CCoeControl Receives notification on resource changes |
|
120 * @param aType type of the resource change |
|
121 */ |
|
122 void HandleResourceChange( TInt aType ); |
|
123 |
|
124 /** |
|
125 * From MEikScrollBarObserver Receives and handles |
|
126 * scroll bar events |
|
127 * @param aScrollBar A pointer to scrollbar which created the event |
|
128 * @param aEventType The event occured on the scroll bar |
|
129 */ |
|
130 void HandleScrollEventL( CEikScrollBar* aScrollBar, TEikScrollEvent aEventType ); |
|
131 |
|
132 private: // New functions |
|
133 |
|
134 /** |
|
135 * Sets the viewing component to read only mode |
|
136 * |
|
137 * @param aReadOnly value to set to |
|
138 */ |
|
139 void SetReadOnly( TBool aReadOnly ); |
|
140 |
|
141 /** |
|
142 * Sets the contents of viewing component |
|
143 * |
|
144 * @param aBuf A new content for editor. |
|
145 */ |
|
146 void SetData16L( const TDesC& aBuf ); |
|
147 |
|
148 /** |
|
149 * Sets the contents of viewing component |
|
150 * |
|
151 * @param aText Text to be inserted. |
|
152 */ |
|
153 void SetDataContentL( CRichText& aText ); |
|
154 |
|
155 /** |
|
156 * Created a new editor. |
|
157 * |
|
158 * @return Component for viewing |
|
159 */ |
|
160 CEikRichTextEditor* CreateEditorL() const; |
|
161 |
|
162 /** |
|
163 * Clears the area between CEikRichTextEditor and Client regtangle. |
|
164 * |
|
165 * @param aRect Outer rect. |
|
166 */ |
|
167 void Draw( const TRect& aRect ) const; |
|
168 |
|
169 /** |
|
170 * Initializes a variables, which are needed to create |
|
171 * scroll indicator. Has to be called every time the |
|
172 * content of the message has changed. |
|
173 */ |
|
174 void InitializeMessageInfoL(); |
|
175 |
|
176 /** |
|
177 * Creates scroll bar indicator. |
|
178 */ |
|
179 void CreateScrollBarFrameL(); |
|
180 |
|
181 /** |
|
182 * Updates the scroll indicator based on the iCurrentScreen and |
|
183 * information, which has been set in the InitializeMessageInfoL() |
|
184 */ |
|
185 void UpdateScrollIndicatorL() const; |
|
186 |
|
187 /** |
|
188 * Updates the current screen position. |
|
189 * |
|
190 * @param aIncrease direction where to modify current screen |
|
191 */ |
|
192 void UpdateCurrentScreen( TBool aIncrease ); |
|
193 |
|
194 /** |
|
195 * Scrolls message up. |
|
196 */ |
|
197 void ScrollMessageUpL(); |
|
198 |
|
199 /** |
|
200 * Scrolls message down. |
|
201 */ |
|
202 void ScrollMessageDownL(); |
|
203 |
|
204 private: |
|
205 |
|
206 /** |
|
207 * Constructor. |
|
208 * |
|
209 * @param aListView reference to the msg view. |
|
210 */ |
|
211 CCbsUiMsgViewContainer( CCbsUiMsgView& aListView ); |
|
212 |
|
213 /** |
|
214 * Two-phased constructor. |
|
215 * |
|
216 * @param aRect Rect to be used by this container. |
|
217 */ |
|
218 void ConstructL( const TRect& aRect ); |
|
219 |
|
220 private: // Data |
|
221 |
|
222 // It is the view class |
|
223 CCbsUiMsgView& iMsgView; |
|
224 |
|
225 // It is the component for viewing message |
|
226 CEikRichTextEditor* iEditor; |
|
227 |
|
228 // ScrollBarFrame |
|
229 CEikScrollBarFrame* iSBFrame; |
|
230 |
|
231 // How many screens the message contains. |
|
232 TInt iNumberOfScreens; |
|
233 |
|
234 // Current message screen. It is updated every time |
|
235 // the page is changed. |
|
236 TInt iCurrentScreen; |
|
237 |
|
238 CAknsBasicBackgroundControlContext* iBackGroundControlContext; |
|
239 |
|
240 }; |
|
241 |
|
242 |
|
243 #endif // __CCBSUIMSGVIEWCONTAINER_H |
|
244 |
|
245 // End of file |