1 /* |
|
2 * Copyright (c) 2002-2005 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: candidate stands for every cell in drop down list |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CANDIDATE_H |
|
20 #define C_CANDIDATE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <w32std.h> |
|
24 |
|
25 // class forward decalaration |
|
26 class CFont; |
|
27 class MFepCtrlDropdownListContext; |
|
28 |
|
29 /** |
|
30 * The following class packs the info and operation of every cell |
|
31 * |
|
32 * the class encapsulates all properties and methods of the cell which |
|
33 * is the basic unit the drop down list |
|
34 * |
|
35 * @lib FepCtrlDropdownList.lib |
|
36 * @since S60 v3.2 |
|
37 */ |
|
38 NONSHARABLE_CLASS(CCandidate) : public CBase |
|
39 { |
|
40 |
|
41 public: |
|
42 |
|
43 static CCandidate* NewL(const TDesC& aString, |
|
44 MFepCtrlDropdownListContext* aOwner); |
|
45 |
|
46 /** |
|
47 * Destructor |
|
48 * |
|
49 * @since S60 v3.2 |
|
50 */ |
|
51 virtual ~CCandidate(); |
|
52 |
|
53 /** |
|
54 * Get Candidate |
|
55 * |
|
56 * @since S60 v3.2 |
|
57 * @param aString Candidate string |
|
58 * @return Candidate string |
|
59 */ |
|
60 const TDesC& GetCandidate(); |
|
61 |
|
62 /** |
|
63 * Get rectangle of the candidate |
|
64 * |
|
65 * @since S60 v3.2 |
|
66 * @return Rectangle occupied by candidate string. |
|
67 */ |
|
68 const TRect& GetRect() const; |
|
69 |
|
70 |
|
71 /** |
|
72 * Move rectangle of the candidate |
|
73 * |
|
74 * @since S60 v3.2 |
|
75 * @return None. |
|
76 */ |
|
77 void Move(const TPoint& aOffsetPoint); |
|
78 |
|
79 /** |
|
80 * Set position of the candidate rectangle |
|
81 * |
|
82 * @since S60 v3.2 |
|
83 * @param aLeftTopPosition the left top point |
|
84 * @param aWidthForOneUnit the width of one cell |
|
85 * @param aHeight the height of one cell |
|
86 * @param aTextFont the font which will be used for draw text |
|
87 * @return the columns the cell occupies. |
|
88 */ |
|
89 TInt SetPositionL(const TPoint& aLeftTopPosition, |
|
90 TInt aWidthForOneUnit, |
|
91 TInt aHeight, |
|
92 const CFont* aTextFont, |
|
93 TInt aCellHorizontalMargin); |
|
94 |
|
95 /** |
|
96 * draw the text for the candidate |
|
97 * |
|
98 * @since S60 v3.2 |
|
99 * @param aGc graphics context |
|
100 * @param aAlignment the alighment style, can be any of ECenter, ELeft, ERight |
|
101 * @param aTextColor the color for the text |
|
102 * @param aSpecialTextColor the color for special text |
|
103 * @param aFixedText the fixed text, it has default value of KNullDesC16 |
|
104 * @return the columns the cell occupies. |
|
105 */ |
|
106 virtual void DrawText(CFbsBitGc& aGc, |
|
107 const CGraphicsContext::TTextAlign aAlignment, |
|
108 const TInt aTextMargin, |
|
109 TRgb aTextColor, |
|
110 TRgb aSpecialTextColor, |
|
111 const TDesC& aFixedText = KNullDesC16); |
|
112 |
|
113 TInt CalculateDisplayTextL(const TInt aWidthForOneUnit, |
|
114 const CFont* aTextFont, |
|
115 TInt aColNum); |
|
116 private: // Method |
|
117 /** |
|
118 * Constructor |
|
119 * |
|
120 * @since S60 v3.2 |
|
121 * @param aString Candidate string |
|
122 */ |
|
123 CCandidate(const TDesC& aString, MFepCtrlDropdownListContext* aOwner); |
|
124 void ConstructL(); |
|
125 /** |
|
126 * draw the text for the candidate |
|
127 * |
|
128 * @since S60 v3.2 |
|
129 * @param aWidthForOneUnit the width of one cell |
|
130 * @param aTextFont the font which will be used for drawing the text |
|
131 * @return the columns the cell occupies. |
|
132 */ |
|
133 TInt CalculateCells(const TInt aWidthForOneUnit, |
|
134 const CFont* aTextFont, |
|
135 const TDesC& aText); |
|
136 |
|
137 // TInt CalculateDisplayTextL(const TInt aWidthForOneUnit, |
|
138 // const CFont* aTextFont, |
|
139 // TInt aColNum); |
|
140 |
|
141 private: // Data |
|
142 |
|
143 /** |
|
144 * the candidate text |
|
145 */ |
|
146 const TDesC& iCandidate; |
|
147 // used when candidate may be truncated |
|
148 HBufC* iDisplayText; |
|
149 |
|
150 /** |
|
151 * the baseline offset used for drawing the text |
|
152 */ |
|
153 TInt iBaselineOffset; |
|
154 |
|
155 /** |
|
156 * the rectangle of the candidate |
|
157 */ |
|
158 TRect iRect; |
|
159 |
|
160 /** |
|
161 * the font which will be used for drawing the text |
|
162 * Not own. |
|
163 */ |
|
164 const CFont* iTextFont; |
|
165 |
|
166 // not own |
|
167 MFepCtrlDropdownListContext* iOwner; |
|
168 }; |
|
169 |
|
170 #endif // C_CANDIDATE_H |
|
171 |
|
172 // End Of File |
|