66
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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: Defines custom drawing for text editor edwin.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CMIDTEXTEDITOREDWINCUSTOMDRAW_H
|
|
20 |
#define CMIDTEXTEDITOREDWINCUSTOMDRAW_H
|
|
21 |
|
|
22 |
// INTERNAL INCLUDES
|
|
23 |
#include "CMIDTextEditorEdwin.h"
|
|
24 |
|
|
25 |
// EXTERNAL INCLUDES
|
|
26 |
#include <lafmain.h>
|
|
27 |
|
|
28 |
// CLASS DESCRIPTION
|
|
29 |
/**
|
|
30 |
* Defines custom drawing for text editor edwin.
|
|
31 |
*
|
|
32 |
* Currently, only selection color is handled in this class. All other
|
|
33 |
* drawing is delegated to the parent custom drawer.
|
|
34 |
*/
|
|
35 |
NONSHARABLE_CLASS(CMIDTextEditorEdwinCustomDraw) :
|
|
36 |
public CLafEdwinCustomDrawBase
|
|
37 |
{
|
|
38 |
|
|
39 |
public: // Constructors and destructor
|
|
40 |
|
|
41 |
/**
|
|
42 |
* Two-phased constructor. Creates an instance from this class
|
|
43 |
* The caller takes the ownership of the returned instance
|
|
44 |
*
|
|
45 |
* @param aLafEnv Reference to LAF interface.
|
|
46 |
* @param Reference to the parent custom drawer.
|
|
47 |
* @param aEdwin The editor window to which this custom draw
|
|
48 |
* is associated to.
|
|
49 |
* @return New instance from this class
|
|
50 |
*/
|
|
51 |
CMIDTextEditorEdwinCustomDraw(
|
|
52 |
const MLafEnv& aLafEnv,
|
|
53 |
const MFormCustomDraw& aParentDraw,
|
|
54 |
const CMIDTextEditorEdwin& aEdwin);
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Destructor.
|
|
58 |
*/
|
|
59 |
virtual ~CMIDTextEditorEdwinCustomDraw();
|
|
60 |
|
|
61 |
public: // From CLafEdwinCustomDrawBase
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Called by the editor FW in order to draw the background for
|
|
65 |
* the editor window.
|
|
66 |
*
|
|
67 |
* Currently ignores any drawing related to background.
|
|
68 |
*
|
|
69 |
* @param aParam Drawing parameters
|
|
70 |
* @param aBackground Default background colour
|
|
71 |
* @param aDrawn On return, the rectangle to which the function has
|
|
72 |
* drawn
|
|
73 |
* @since S60 5.0
|
|
74 |
*/
|
|
75 |
void DrawBackground(
|
|
76 |
const TParam& aParam,
|
|
77 |
const TRgb& aBackground,
|
|
78 |
TRect& aDrawn) const;
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Called by the editor FW in order to draw the line
|
|
82 |
* graphics for the editor window.
|
|
83 |
*
|
|
84 |
* Currently delegates the drawing to the parent custom drawer.
|
|
85 |
*
|
|
86 |
* @param aParam Drawing parameters
|
|
87 |
* @param aLineInfo The line information.
|
|
88 |
* @since S60 5.0
|
|
89 |
*/
|
|
90 |
void DrawLineGraphics(
|
|
91 |
const TParam& aParam,
|
|
92 |
const TLineInfo& aLineInfo) const;
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Called by the editor FW in order to draw the the content of
|
|
96 |
* the editor.
|
|
97 |
*
|
|
98 |
* Currently delegates the drawing to the parent custom drawer.
|
|
99 |
*
|
|
100 |
* @param aParam Drawing parameters.
|
|
101 |
* @param aLineInfo The line information.
|
|
102 |
* @param aFormat The current character format.
|
|
103 |
* @param aText The content to draw.
|
|
104 |
* @param aTextOrigin The origin of the text.
|
|
105 |
* @param aExtraPixels The amount of extra pixels.
|
|
106 |
* @since S60 5.0
|
|
107 |
*/
|
|
108 |
void DrawText(
|
|
109 |
const TParam& aParam,
|
|
110 |
const TLineInfo& aLineInfo,
|
|
111 |
const TCharFormat& aFormat,
|
|
112 |
const TDesC& aText,
|
|
113 |
const TPoint& aTextOrigin,
|
|
114 |
TInt aExtraPixels) const;
|
|
115 |
|
|
116 |
#ifdef RD_JAVA_S60_RELEASE_9_2
|
|
117 |
/**
|
|
118 |
* Called by the editor FW in order to draw the the content of
|
|
119 |
* the editor.
|
|
120 |
*
|
|
121 |
* Currently delegates the drawing to the parent custom drawer.
|
|
122 |
*
|
|
123 |
* @param aParam Drawing parameters.
|
|
124 |
* @param aLineInfo The line information.
|
|
125 |
* @param aFormat The current character format.
|
|
126 |
* @param aText The content to draw.
|
|
127 |
* @param aStart
|
|
128 |
* @param aEnd
|
|
129 |
* @param aTextOrigin The origin of the text.
|
|
130 |
* @param aExtraPixels The amount of extra pixels.
|
|
131 |
* @since S60 5.0
|
|
132 |
*/
|
|
133 |
void DrawText(
|
|
134 |
const TParam& aParam,
|
|
135 |
const TLineInfo& aLineInfo,
|
|
136 |
const TCharFormat& aFormat,
|
|
137 |
const TDesC& aText,
|
|
138 |
const TInt aStart,
|
|
139 |
const TInt aEnd,
|
|
140 |
const TPoint& aTextOrigin,
|
|
141 |
TInt aExtraPixels) const;
|
|
142 |
#endif
|
|
143 |
|
|
144 |
/**
|
|
145 |
* Retrieves the system color for the specified color index.
|
|
146 |
*
|
|
147 |
* @param aColorIndex The index of the color to be returned.
|
|
148 |
* @param aDefaultColor The default color for the specified index.
|
|
149 |
* @return The system's (or custom) color for the specified color
|
|
150 |
* index.
|
|
151 |
* @since S60 5.0
|
|
152 |
*/
|
|
153 |
TRgb SystemColor(
|
|
154 |
TUint aColorIndex,
|
|
155 |
TRgb aDefaultColor) const;
|
|
156 |
|
|
157 |
private: // Own functions
|
|
158 |
/**
|
|
159 |
* Gets proper clipping rect used during scaling. Returned rect is
|
|
160 |
* intersection of canvas rect and iEditorRect.
|
|
161 |
*
|
|
162 |
* @return The proper clipping rect during scaling
|
|
163 |
* @since S60 5.0
|
|
164 |
*/
|
|
165 |
const TRect GetClippingRectForScaling() const;
|
|
166 |
|
|
167 |
private: // Data
|
|
168 |
|
|
169 |
// Reference to the editor window. Used.
|
|
170 |
const CMIDTextEditorEdwin& iEdwin;
|
|
171 |
|
|
172 |
// Reference to the parent drawer. Used.
|
|
173 |
const MFormCustomDraw& iParentDraw;
|
|
174 |
};
|
|
175 |
|
|
176 |
#endif // CMIDTEXTEDITOREDWINCUSTOMDRAW_H
|
|
177 |
|
|
178 |
// End of file
|