|
1 /******************************************************************************* |
|
2 * Copyright (c) 2007, 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. This program and the accompanying materials |
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
|
5 * which accompanies this distribution, and is available at |
|
6 * http://www.eclipse.org/legal/epl-v10.html |
|
7 * |
|
8 * Contributors: |
|
9 * Nokia Corporation - S60 implementation |
|
10 *******************************************************************************/ |
|
11 |
|
12 #include <eikedwin.h> |
|
13 #include <lafmain.h> |
|
14 #include "swtedwincustomdrawer.h" |
|
15 |
|
16 // ======== MEMBER FUNCTIONS ======== |
|
17 |
|
18 |
|
19 // ----------------------------------------------------------------------------- |
|
20 // CSwtEdwinCustomDrawer::CSwtEdwinCustomDrawer |
|
21 // ----------------------------------------------------------------------------- |
|
22 // |
|
23 CSwtEdwinCustomDrawer::CSwtEdwinCustomDrawer( |
|
24 const MLafEnv& aLafEnv, |
|
25 const MFormCustomDraw* aParentDraw, |
|
26 const CEikEdwin& aEdwin) : |
|
27 CLafEdwinCustomDrawBase(aLafEnv, aEdwin), |
|
28 iEdwin(aEdwin), iEdWinDrawer(aParentDraw) |
|
29 { |
|
30 ASSERT(iEdWinDrawer); |
|
31 } |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CSwtEdwinCustomDrawer::~CSwtEdwinCustomDrawer |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CSwtEdwinCustomDrawer::~CSwtEdwinCustomDrawer() |
|
38 { |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CSwtEdwinCustomDrawer::SetClippingRect |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 void CSwtEdwinCustomDrawer::SetClippingRect(const TRect& aRect) |
|
46 { |
|
47 iClippingRect = aRect; |
|
48 } |
|
49 |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CSwtEdwinCustomDrawer::DrawBackground |
|
53 // From CLafEdwinCustomDrawBase |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 void CSwtEdwinCustomDrawer::DrawBackground( |
|
57 const TParam& aParam, |
|
58 const TRgb& aBackground, |
|
59 TRect& aDrawn) const |
|
60 { |
|
61 if (!iEdwin.IsVisible()) |
|
62 { |
|
63 return; |
|
64 } |
|
65 aParam.iGc.SetClippingRect(iClippingRect); |
|
66 iEdWinDrawer->DrawBackground(aParam, aBackground, aDrawn); |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CSwtEdwinCustomDrawer::DrawLineGraphics |
|
71 // From CLafEdwinCustomDrawBase |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 void CSwtEdwinCustomDrawer::DrawLineGraphics( |
|
75 const TParam& aParam, |
|
76 const TLineInfo& aLineInfo) const |
|
77 { |
|
78 if (!iEdwin.IsVisible()) |
|
79 { |
|
80 return; |
|
81 } |
|
82 aParam.iGc.SetClippingRect(iClippingRect); |
|
83 iEdWinDrawer->DrawLineGraphics(aParam, aLineInfo); |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CSwtEdwinCustomDrawer::DrawText |
|
88 // From CLafEdwinCustomDrawBase |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 void CSwtEdwinCustomDrawer::DrawText( |
|
92 const TParam& aParam, |
|
93 const TLineInfo& aLineInfo, |
|
94 const TCharFormat& aFormat, |
|
95 const TDesC& aText, |
|
96 const TPoint& aTextOrigin, |
|
97 TInt aExtraPixels) const |
|
98 { |
|
99 if (!iEdwin.IsVisible()) |
|
100 { |
|
101 return; |
|
102 } |
|
103 aParam.iGc.SetClippingRect(iClippingRect); |
|
104 iEdWinDrawer->DrawText( |
|
105 aParam, |
|
106 aLineInfo, |
|
107 aFormat, |
|
108 aText, |
|
109 aTextOrigin, |
|
110 aExtraPixels); |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CSwtEdwinCustomDrawer::DrawText |
|
115 // From CLafEdwinCustomDrawBase |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 #ifdef RD_JAVA_S60_RELEASE_9_2 |
|
119 void CSwtEdwinCustomDrawer::DrawText( |
|
120 const TParam& aParam, |
|
121 const TLineInfo& aLineInfo, |
|
122 const TCharFormat& aFormat, |
|
123 const TDesC& aText, |
|
124 const TInt aStart, |
|
125 const TInt aEnd, |
|
126 const TPoint& aTextOrigin, |
|
127 TInt aExtraPixels) const |
|
128 { |
|
129 if (!iEdwin.IsVisible()) |
|
130 { |
|
131 return; |
|
132 } |
|
133 aParam.iGc.SetClippingRect(iClippingRect); |
|
134 iEdWinDrawer->DrawText( |
|
135 aParam, |
|
136 aLineInfo, |
|
137 aFormat, |
|
138 aText, |
|
139 aStart, |
|
140 aEnd, |
|
141 aTextOrigin, |
|
142 aExtraPixels); |
|
143 } |
|
144 #endif |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // CSwtEdwinCustomDrawer::SystemColor |
|
148 // From CLafEdwinCustomDrawBase |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 TRgb CSwtEdwinCustomDrawer::SystemColor( |
|
152 TUint aColorIndex, |
|
153 TRgb aDefaultColor) const |
|
154 { |
|
155 return iEdWinDrawer->SystemColor(aColorIndex, aDefaultColor); |
|
156 } |