|
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 NPDEDWINBASE_H |
|
20 #define NPDEDWINBASE_H |
|
21 |
|
22 #include "NpdEdwinExposer.h" |
|
23 |
|
24 // INCLUDES |
|
25 #include <eikedwin.h> //CEikEdwin |
|
26 // FORWARD DECLARATIONS |
|
27 #include <eikedwob.h> |
|
28 |
|
29 |
|
30 class CNotepadEdwinLines; |
|
31 class CAknsFrameBackgroundControlContext; |
|
32 class CAknsBasicBackgroundControlContext; |
|
33 class CEikDialog; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 /** |
|
37 * Customized editable window control. |
|
38 * CNotepadEdwin is an editable window control class customized to implement |
|
39 * the LAF of Notepad. |
|
40 * |
|
41 * @lib NpdLib.lib |
|
42 * @see CNotepadEditorDialog |
|
43 */ |
|
44 NONSHARABLE_CLASS(CNotepadEdwinBase) : public CBase, |
|
45 public MEikEdwinObserver |
|
46 { |
|
47 public: // New function |
|
48 |
|
49 /** |
|
50 * Constructor |
|
51 * |
|
52 */ |
|
53 CNotepadEdwinBase(); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 * |
|
58 */ |
|
59 ~CNotepadEdwinBase(); |
|
60 |
|
61 /** |
|
62 * Gets Edwin control from Derived class |
|
63 * |
|
64 */ |
|
65 void Share(CEikEdwin* aEdwin, MNotepadEdwinExposer* aEdwinExposer); |
|
66 |
|
67 /** |
|
68 * Sets the layout of the edwin and the scrollbar. |
|
69 * |
|
70 */ |
|
71 void DoEditorLayoutL(); |
|
72 |
|
73 /** |
|
74 * Initialize the editor. |
|
75 * This function should be called from dialog's PostLayoutDynInitL. |
|
76 * |
|
77 */ |
|
78 void InitNotepadEditorL( |
|
79 CEikDialog* aParent, |
|
80 TBool aIsRichTextEditor, CNotepadEdwinLines* aEdwinLines); |
|
81 |
|
82 /** |
|
83 * Restrict format area of the editor to visible lines only. |
|
84 * This function calls iTextLayout->SetAmountToFormat(). |
|
85 * |
|
86 */ |
|
87 inline void SetAmountToFormat(TInt aDocumentSizeInCharacters); |
|
88 |
|
89 /** |
|
90 * Gets an object whose type is encapsulated by |
|
91 * the specified TTypeUid object. |
|
92 * |
|
93 */ |
|
94 TBool SupplyMopObject(TTypeUid aId,TTypeUid::Ptr& aPtr); |
|
95 |
|
96 protected: // Functions from base classes |
|
97 |
|
98 /** |
|
99 * From MEikEdwinObserver. |
|
100 * Override to implement dynamically changing decoration. |
|
101 * |
|
102 * @param aEdwin edwin to observe |
|
103 * @param aEventType type of edwin event. |
|
104 */ |
|
105 void HandleEdwinEventL(CEikEdwin* aEdwin, TEdwinEvent aEventType); |
|
106 |
|
107 public: |
|
108 /** |
|
109 * Set background color specified by LAF. |
|
110 */ |
|
111 void SetBackgroundColorL(); |
|
112 |
|
113 // Functions from base classes |
|
114 |
|
115 /** |
|
116 * From CCoeControl. |
|
117 * Call when a certain resource has changed. |
|
118 * @param aType type of event. |
|
119 */ |
|
120 void HandleResourceChange(TInt aType); |
|
121 |
|
122 /** |
|
123 * From CCoeControl. |
|
124 * Call when a certain resource has changed. |
|
125 * We only handle KEikColorResourceChange. |
|
126 * |
|
127 * @param aType type of event. |
|
128 */ |
|
129 void Draw(const TRect& aRect) const; |
|
130 |
|
131 private: |
|
132 |
|
133 /** |
|
134 * Updates the scroll layout |
|
135 */ |
|
136 void UpdateScrollLayout(); |
|
137 |
|
138 private: // Data |
|
139 TRect iBackgroundRect; |
|
140 CEikDialog*iParent; |
|
141 CEikEdwin* iEdwin; //not own |
|
142 MNotepadEdwinExposer* iEdwinExposer; //not own |
|
143 CNotepadEdwinLines* iEdwinLines; // not own |
|
144 CAknsFrameBackgroundControlContext* iBgContext; // Owned |
|
145 CAknsBasicBackgroundControlContext* iSkinContext; |
|
146 TBool iIsRichTextEditor; |
|
147 TBool iIsFirstTimeDrawEditor; |
|
148 TInt iTextLength; |
|
149 TInt iPreTextLength; |
|
150 |
|
151 TPoint iPointAtCursor; |
|
152 TInt iLineNumByYCoordinate; |
|
153 TInt iPreLineNumByYCoordinate; |
|
154 }; |
|
155 |
|
156 #include "NpdEdwinBase.inl" |
|
157 #endif // NPDEDWIN_H |
|
158 |
|
159 // End of File |