|
1 /* |
|
2 * Copyright (c) 1997-1999 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <lafmain.h> |
|
20 #include <coecntrl.h> |
|
21 #include <AknsUtils.h> |
|
22 |
|
23 EXPORT_C CLafEdwinCustomDrawBase* CLafEdwinCustomDrawBase::NewL(const MLafEnv& aEnv,const CCoeControl& aControl) |
|
24 { // static |
|
25 return new(ELeave) CLafEdwinCustomDrawBase(aEnv,aControl); |
|
26 } |
|
27 |
|
28 EXPORT_C void CLafEdwinCustomDrawBase::DrawBackground(const TParam& aParam,const TRgb& /*aBackground*/,TRect& aDrawn) const |
|
29 { |
|
30 aParam.iGc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
31 aParam.iGc.SetPenStyle(CGraphicsContext::ESolidPen); |
|
32 TRgb color=(iControl.IsDimmed()? iEnv.ControlColor(EColorControlDimmedBackground,iControl) : |
|
33 iEnv.ControlColor(EColorControlBackground,iControl)); |
|
34 aParam.iGc.SetBrushColor(color); |
|
35 aParam.iGc.SetPenColor(color); |
|
36 aParam.iGc.DrawRect(aParam.iDrawRect); |
|
37 aDrawn=aParam.iDrawRect; |
|
38 |
|
39 } |
|
40 |
|
41 EXPORT_C TRgb CLafEdwinCustomDrawBase::SystemColor(TUint /* aColorIndex */,TRgb aDefaultColor) const |
|
42 { |
|
43 return aDefaultColor; |
|
44 } |
|
45 |
|
46 EXPORT_C void CLafEdwinCustomDrawBase::LineSpacingChanged() |
|
47 { |
|
48 } |
|
49 |
|
50 EXPORT_C CLafEdwinCustomDrawBase::CLafEdwinCustomDrawBase(const MLafEnv& aEnv,const CCoeControl& aControl) |
|
51 : iEnv(aEnv), iControl(aControl) |
|
52 {} |
|
53 |
|
54 EXPORT_C CLafEdwinCustomWrapBase* CLafEdwinCustomWrapBase::NewL(const CCoeControl& aControl) |
|
55 /** |
|
56 @publishedPartner |
|
57 @test |
|
58 */ |
|
59 { |
|
60 // static |
|
61 return new (ELeave) CLafEdwinCustomWrapBase(aControl); |
|
62 } |
|
63 |
|
64 EXPORT_C CLafEdwinCustomWrapBase::~CLafEdwinCustomWrapBase() |
|
65 /** |
|
66 @publishedPartner |
|
67 @test |
|
68 */ |
|
69 { |
|
70 } |
|
71 |
|
72 /** |
|
73 Returns the line break class for a character. |
|
74 Return the range of characters including aCode that are known to share this range. |
|
75 |
|
76 The custom wrapping interface returns the default implementation. The overriding implementation |
|
77 could return different value to perform custom line break. |
|
78 |
|
79 */ |
|
80 EXPORT_C TUint CLafEdwinCustomWrapBase::LineBreakClass(TUint aCode,TUint& aRangeStart,TUint& aRangeEnd) const |
|
81 /** |
|
82 @publishedPartner |
|
83 @test |
|
84 */ |
|
85 { |
|
86 TUint temp; |
|
87 temp = MFormCustomWrap::LineBreakClass(aCode,aRangeStart,aRangeEnd); |
|
88 return temp; |
|
89 } |
|
90 /** |
|
91 Return TRUE if a line break is possible between characters of the two specified classes. |
|
92 If aHaveSpaces is TRUE, one or more characters in ESpLineBreakClass was found between the characters |
|
93 in the two specified classes. |
|
94 |
|
95 For the custom implementation here, returns true everytime, ie a line break is possible |
|
96 anywhere. This allows the edwin to break a line anywhere, thus eliminating the jagged |
|
97 white space at the right hand side of the edwin window. |
|
98 */ |
|
99 EXPORT_C TBool CLafEdwinCustomWrapBase::LineBreakPossible(TUint /*aPrevClass*/,TUint /*aNextClass*/,TBool /*aHaveSpaces*/) const |
|
100 /** |
|
101 @publishedPartner |
|
102 @test |
|
103 */ |
|
104 { |
|
105 return ETrue; |
|
106 } |
|
107 |
|
108 /** |
|
109 Return the first (if aForwards is TRUE) or last (if aForwards is FALSE) linebreak in aText, |
|
110 This must be in the range aMinBreakPos...aMaxBreakPos, which is a run of characters in the |
|
111 class ESaLineBreakClass, usually employed for Thai, Lao and Khmer |
|
112 letters, because these scripts don't use word spaces and need dictionary-based line breaking. |
|
113 The break position is returned in aBreakPos, which must be > 0 and < aText.Length() - 1. |
|
114 Return TRUE if a break is found, FALSE otherwise. |
|
115 */ |
|
116 EXPORT_C TBool CLafEdwinCustomWrapBase::GetLineBreakInContext(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos,TBool aForwards,TInt& aBreakPos) const |
|
117 /** |
|
118 @publishedPartner |
|
119 @test |
|
120 */ |
|
121 { |
|
122 TBool temp; |
|
123 temp = MFormCustomWrap::GetLineBreakInContext(aText,aMinBreakPos,aMaxBreakPos,aForwards,aBreakPos); |
|
124 return temp; |
|
125 } |
|
126 |
|
127 // Return TRUE if this character can overhang the measured right end of the line. |
|
128 EXPORT_C TBool CLafEdwinCustomWrapBase::IsHangingCharacter(TUint aChar) const |
|
129 /** |
|
130 @publishedPartner |
|
131 @test |
|
132 */ |
|
133 { |
|
134 TBool temp; |
|
135 temp = MFormCustomWrap::IsHangingCharacter(aChar); |
|
136 return temp; |
|
137 } |
|
138 |
|
139 EXPORT_C void CLafEdwinCustomWrapBase::MFormCustomWrap_Reserved_1() |
|
140 /** |
|
141 @publishedPartner |
|
142 @test |
|
143 */ |
|
144 { |
|
145 // reserved functions, private until used |
|
146 } |
|
147 |
|
148 EXPORT_C void CLafEdwinCustomWrapBase::MFormCustomWrap_Reserved_2() |
|
149 /** |
|
150 @publishedPartner |
|
151 @test |
|
152 */ |
|
153 { |
|
154 // reserved functions, private until used |
|
155 } |
|
156 |
|
157 |
|
158 EXPORT_C CLafEdwinCustomWrapBase::CLafEdwinCustomWrapBase(const CCoeControl& aControl):iControl(aControl) |
|
159 /** |
|
160 @publishedPartner |
|
161 @test |
|
162 */ |
|
163 { |
|
164 } |
|
165 |
|
166 |