|
1 /* |
|
2 * Copyright (c) 2002 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: Declaration of customized editor control. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NPDRICHTEXTEDITOR_H |
|
20 #define NPDRICHTEXTEDITOR_H |
|
21 |
|
22 // INCLUDES |
|
23 //#include <eikedwin.h> //CEikEdwin |
|
24 #include <eikrted.h> // for CEikRichTextEditor |
|
25 #include "NpdEdwinExposer.h" |
|
26 #include "NpdEdwinBase.h" |
|
27 // FORWARD DECLARATIONS |
|
28 |
|
29 class CNotepadEdwinLines; |
|
30 class CNotepadDialogBase; |
|
31 //class CAknsFrameBackgroundControlContext; |
|
32 //class CNotepadEdwinBase; |
|
33 // CLASS DECLARATION |
|
34 /** |
|
35 * Customized editable window control. |
|
36 * CNotepadEdwin is an editable window control class customized to implement |
|
37 * the LAF of Notepad. |
|
38 * |
|
39 * @lib NpdLib.lib |
|
40 * @see CNotepadEditorDialog |
|
41 */ |
|
42 NONSHARABLE_CLASS(CNotepadRichTextEditor) : public CEikRichTextEditor, |
|
43 public MNotepadEdwinExposer |
|
44 { |
|
45 public: // New function |
|
46 |
|
47 /** |
|
48 * Sets the layout of the edwin and the scrollbar. |
|
49 * |
|
50 */ |
|
51 void DoEditorLayoutL(); |
|
52 |
|
53 /** |
|
54 * Initialize the editor. |
|
55 * This function should be called from dialog's PostLayoutDynInitL. |
|
56 * |
|
57 */ |
|
58 void InitNotepadEditorL( |
|
59 CEikDialog* aParent, |
|
60 CNotepadEdwinLines* aEdwinLines = NULL); |
|
61 |
|
62 /** |
|
63 * Construct CNotepadEdwinBase. |
|
64 * This function should be called after construction |
|
65 * |
|
66 */ |
|
67 void ConstructBaseL(CNotepadDialogBase* aBaseDialog); |
|
68 |
|
69 /** |
|
70 * Restrict format area of the editor to visible lines only. |
|
71 * This function calls iTextLayout->SetAmountToFormat(). |
|
72 * |
|
73 */ |
|
74 inline void SetAmountToFormat(TInt aDocumentSizeInCharacters); |
|
75 |
|
76 /** |
|
77 * Gets an object whose type is encapsulated by |
|
78 * the specified TTypeUid object. |
|
79 * |
|
80 */ |
|
81 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
82 |
|
83 /** |
|
84 * Destructor. |
|
85 * |
|
86 */ |
|
87 ~CNotepadRichTextEditor(); |
|
88 |
|
89 protected: // Functions from base classes |
|
90 |
|
91 /** |
|
92 * From MEikEdwinObserver. |
|
93 * Override to implement dynamically changing decoration. |
|
94 * |
|
95 * @param aEdwin edwin to observe |
|
96 * @param aEventType type of edwin event. |
|
97 */ |
|
98 //void HandleEdwinEventL(CEikEdwin* aEdwin, TEdwinEvent aEventType); |
|
99 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
100 |
|
101 public: |
|
102 /** |
|
103 * Set background color specified by LAF. |
|
104 */ |
|
105 void SetBackgroundColorL(); |
|
106 |
|
107 // Functions from base classes |
|
108 |
|
109 /** |
|
110 * From CCoeControl. |
|
111 * Call when a certain resource has changed. |
|
112 * We only handle KEikColorResourceChange. |
|
113 * |
|
114 * @param aType type of event. |
|
115 */ |
|
116 void HandleResourceChange(TInt aType); |
|
117 private: |
|
118 /** |
|
119 * From CCoeControl. |
|
120 * Call when a certain resource has changed. |
|
121 * We only handle KEikColorResourceChange. |
|
122 * |
|
123 * @param aType type of event. |
|
124 */ |
|
125 void Draw(const TRect& aRect) const; |
|
126 |
|
127 |
|
128 /** |
|
129 * From MEdwinExposer |
|
130 * Called by iEdwinBase to get iLayout |
|
131 */ |
|
132 CTextLayout& GetLayout(); |
|
133 |
|
134 /** |
|
135 * From MEdwinExposer |
|
136 * Called by iEdwinBase to get iTextView |
|
137 */ |
|
138 CTextView& GetTextView(); |
|
139 |
|
140 /** |
|
141 * From MEdwinExposer |
|
142 * Called by iEdwinBase to call SetCanDrawOutsideRect() |
|
143 */ |
|
144 void CallSetCanDrawOutsideRect(); |
|
145 |
|
146 /** |
|
147 * From MEdwinExposer |
|
148 * Called by iEdwinBase to get iCoeEnv |
|
149 */ |
|
150 CCoeEnv& GetCoeEnv(); |
|
151 |
|
152 private: // Data |
|
153 |
|
154 CNotepadEdwinBase* iEdwinBase; |
|
155 CNotepadDialogBase* iBaseDialog; |
|
156 }; |
|
157 |
|
158 #include "NpdRichTextEditor.inl" |
|
159 #endif // NPDRichTextEditor_H |
|
160 |
|
161 // End of File |