|
1 /* |
|
2 * Copyright (c) 2002-2004 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 list |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 #ifndef CAKNFEPUICTRLJAPANESECANDIDATEPANE_H |
|
30 #define CAKNFEPUICTRLJAPANESECANDIDATEPANE_H |
|
31 |
|
32 // INCLUDES |
|
33 #include <aknPopup.h> // CAknPopupList |
|
34 #include "AknFepUICtrlCandidatePaneInterface.h" |
|
35 // MAknFepUICtrlCandidatePaneInterface |
|
36 |
|
37 // CONSTANTS |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 // CLASS DECLARATION |
|
41 class CAknFepUIManagerJapanese; |
|
42 |
|
43 /** |
|
44 * CAknFepUICtrlJapaneseCandidatePane class. |
|
45 * |
|
46 * @lib AknFep.lib |
|
47 * @since 2.6 |
|
48 */ |
|
49 NONSHARABLE_CLASS(CAknFepUICtrlJapaneseCandidatePane) : |
|
50 public CAknPopupList, |
|
51 public MAknFepUICtrlCandidatePaneInterface |
|
52 { |
|
53 public: // Constructors and destructor |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 */ |
|
57 static CAknFepUICtrlJapaneseCandidatePane* NewL(CAknFepUIManagerJapanese* aUiMng); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CAknFepUICtrlJapaneseCandidatePane(); |
|
63 |
|
64 public: // New functions |
|
65 /** |
|
66 * Show Pop-up list |
|
67 * @since 2.6 |
|
68 */ |
|
69 void ShowWindow(); |
|
70 |
|
71 /** |
|
72 * Close Pop-up list |
|
73 * @since 2.6 |
|
74 */ |
|
75 void CloseCandidateList(); |
|
76 |
|
77 /** |
|
78 * Specify the cursor position of a pop-up list |
|
79 * @since 2.6 |
|
80 * @param aItemIndex The index of the cursor position |
|
81 * @param aDraw ETrue is redraw. |
|
82 */ |
|
83 void SetCurrentItemIndexL(TInt aItemIndex, TBool aDraw); |
|
84 |
|
85 /** |
|
86 * Specify the display position of a pop-up list |
|
87 * @since 2.6 |
|
88 * @param aOffset Offset of a window display position |
|
89 */ |
|
90 void SetOffsetPosition(TPoint aOffset); |
|
91 |
|
92 public: // Functions from MAknFepUICtrlCandidatePaneInterface |
|
93 /** |
|
94 * From MAknFepUICtrlCandidatePaneInterface |
|
95 * Set position to display candidate list |
|
96 * @since 2.6 |
|
97 * @param aLeftSideOfBaseLine left side of font |
|
98 * @param aHeight font hight |
|
99 * @param aAscent Ascent position |
|
100 */ |
|
101 void SetWindowPosition(const TPoint& aLeftSideOfBaseLine, |
|
102 TInt aHeight, |
|
103 TInt aAscent); |
|
104 |
|
105 /** |
|
106 * From MAknFepUICtrlCandidatePaneInterface |
|
107 * Show candidate list popup window |
|
108 * @since 2.6 |
|
109 * @param aItems array of candidate list |
|
110 * @param aIndex selecting number when displaying |
|
111 * |
|
112 */ |
|
113 void ShowCandidateListL(CDesCArrayFlat* aItems, TInt aIndex, TInt aResourceID=0); |
|
114 |
|
115 /** |
|
116 * From MAknFepUICtrlCandidatePaneInterface |
|
117 * Hide candidate popup window |
|
118 * @since 2.6 |
|
119 */ |
|
120 void HideWindow(); |
|
121 |
|
122 /** |
|
123 * From MAknFepUICtrlCandidatePaneInterface |
|
124 * Return a selected candidate item number currently |
|
125 * @since 2.6 |
|
126 */ |
|
127 TInt CurrentItemIndexOfCandidate(); |
|
128 |
|
129 /** |
|
130 * From MAknFepUICtrlCandidatePaneInterface |
|
131 * Move a current item in an appointed direction |
|
132 * @since 2.6 |
|
133 * @param aDirection direction |
|
134 */ |
|
135 TInt MoveItem(TAknFepUICtrlScroll aDirection); |
|
136 |
|
137 protected: // Functions from CAknPopupList |
|
138 /** |
|
139 * From CAknPopupList Set up a window layout type |
|
140 * @since 2.6 |
|
141 * @param aType Layout type |
|
142 */ |
|
143 virtual void SetupWindowLayout(AknPopupLayouts::TAknPopupLayouts aType); |
|
144 |
|
145 /** |
|
146 * From CAknPopupList Set the title for the selection list |
|
147 * @since 2.6 |
|
148 * @param aAccept |
|
149 */ |
|
150 virtual void AttemptExitL(TBool aAccept); |
|
151 |
|
152 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
153 |
|
154 /** |
|
155 * from CAknPopupList of MEikCommandObserver |
|
156 * @since 3.2 |
|
157 * @param aCommandId aCommandId Event Id from the soft-key |
|
158 */ |
|
159 void ProcessCommandL(TInt aCommandId); |
|
160 |
|
161 protected: // from MEikListBoxObserver |
|
162 /** |
|
163 * Handle pointer up event |
|
164 * |
|
165 * @since S60 V3.2 |
|
166 * @param aListBox ListBox control |
|
167 * @param aEventType |
|
168 * @return None |
|
169 */ |
|
170 virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
171 |
|
172 private: |
|
173 /** |
|
174 * constructor. |
|
175 */ |
|
176 CAknFepUICtrlJapaneseCandidatePane(CAknFepUIManagerJapanese* aUiMng); |
|
177 |
|
178 /** |
|
179 * Symbian 2nd phase constructor can leave. |
|
180 */ |
|
181 void ConstructL(); |
|
182 |
|
183 /** |
|
184 * Set the title for the selection list |
|
185 * @since 2.6 |
|
186 * @param aTitle The character string of a title |
|
187 */ |
|
188 void SetTitleL(const TDesC& aTitle); |
|
189 |
|
190 /** |
|
191 * The handler function for size change |
|
192 * @since 2.6 |
|
193 * @param aDef layout information of popup-window |
|
194 * @param aHeading heading Pane object |
|
195 * @param aListBox listbox object |
|
196 * @param aWindowOwningControl owner control |
|
197 */ |
|
198 void HandleSizeChanged(TAknPopupWindowLayoutDef& aDef, |
|
199 CAknPopupHeadingPane* aHeading, |
|
200 CEikListBox* aListBox, |
|
201 CCoeControl* aWindowOwningControl |
|
202 ); |
|
203 |
|
204 /** |
|
205 * The handler function for Draw |
|
206 * @since 2.6 |
|
207 * @param aEikEnv EikEnv |
|
208 * @param aGc Gc |
|
209 * @param aDef layout information of popup-window |
|
210 * @param aListBox listbox object |
|
211 * @param aHeadingOrNull heading Pane object |
|
212 */ |
|
213 static void HandleDraw(CEikonEnv* aEikEnv, |
|
214 CWindowGc& aGc, |
|
215 const TAknPopupWindowLayoutDef& aDef, |
|
216 CEikListBox* aListBox, |
|
217 CAknPopupHeadingPane* aHeadingOrNull); |
|
218 |
|
219 /** |
|
220 * Set up the information on a pop-up window |
|
221 * @since 2.6 |
|
222 * @param aDef layout information of popup-window |
|
223 * @param aRect rect |
|
224 * @param num total cantidate number |
|
225 */ |
|
226 void CalcPopupMenuWindow(TAknPopupWindowLayoutDef& aDef, |
|
227 const TRect& aRect, |
|
228 TInt num); |
|
229 |
|
230 /** |
|
231 * Set up the information on a pop-up window |
|
232 * @since 2.6 |
|
233 * @param aDef layout information of popup-window |
|
234 * @param num total cantidate number |
|
235 * @param heading ETrue:with heading pane/ EFalse:without heading pane |
|
236 */ |
|
237 void SetupMenuPopupWindow(TAknPopupWindowLayoutDef& aDef, |
|
238 TInt num, |
|
239 TBool heading); |
|
240 |
|
241 /** |
|
242 * The handler function for size and a location |
|
243 * @since 2.6 |
|
244 * @param aDef layout information of popup-window |
|
245 * @param aContentInsidePopup |
|
246 * @param aHeadingOrNull heading pane object |
|
247 */ |
|
248 static void HandleSizeAndPositionOfComponents( |
|
249 const TAknPopupWindowLayoutDef& aDef, |
|
250 CCoeControl* aContentInsidePopup, |
|
251 CAknPopupHeadingPane* aHeadingOrNull); |
|
252 |
|
253 /** |
|
254 * Draws a window shadow |
|
255 * @since 2.6 |
|
256 * @param aCoverRect the area covered by the shadow |
|
257 * @param aSecondShadowRect the area used for second shadow |
|
258 * @param aFirstShadowRect the area of first shadow |
|
259 * @param aOutliineFrameRect the area of black outline frame |
|
260 * @param aInsideAreaRect the area of content inside the window |
|
261 */ |
|
262 static void DrawWindowShadow( |
|
263 CWindowGc& aGc, |
|
264 const TAknLayoutRect& aCoverRect, |
|
265 const TAknLayoutRect& aSecondShadowRect, |
|
266 const TAknLayoutRect& aFirstShadowRect, |
|
267 const TAknLayoutRect& aOutlineFrameRect, |
|
268 const TAknLayoutRect& aInsideAreaRect); |
|
269 |
|
270 /** |
|
271 * This function returns maximum columns to be able to display in listbox, this function |
|
272 * find longest candidate string in candidate list. Return 11 columns in case more than 11 columns, and minimum is 3 columns. |
|
273 * @since 2.6 |
|
274 * @param aModel listbox model object |
|
275 * @return maximum columns |
|
276 */ |
|
277 TInt MaximumColumns(CTextListBoxModel* aModel); |
|
278 |
|
279 /** |
|
280 * This function returns maximum rows to be able to display in listbox. |
|
281 * Maximum is 7 rows and minimum is 3 columns. |
|
282 * @since 2.6 |
|
283 * @param aModel listbox model object |
|
284 * @return maximum line |
|
285 */ |
|
286 TInt MaximumRows(CTextListBoxModel* aModel); |
|
287 |
|
288 /** |
|
289 * Called by the framework to draw the control |
|
290 * @param aRect Rectangle in which the Cone framework believes drawing |
|
291 * is needed |
|
292 */ |
|
293 virtual void Draw(const TRect& aRect) const; |
|
294 |
|
295 /** |
|
296 * Handle key events. When a key event occurs, |
|
297 * CONE calls this function for each control on the control stack, |
|
298 * until one of them returns EKeyWasConsumed to indicate that |
|
299 * it processed the key event. |
|
300 * |
|
301 * @param aKeyEvent The key event. |
|
302 * @param aType The type of the event: |
|
303 * EEventKey, EEventKeyUp or EEventKeyDown. |
|
304 * @return Indicates whether or not the key event was used |
|
305 * by this control. |
|
306 */ |
|
307 virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
308 TEventCode aType); |
|
309 |
|
310 /** |
|
311 * show cba |
|
312 * @since 2.6 |
|
313 */ |
|
314 void ShowWindowCbaL(); |
|
315 |
|
316 /** |
|
317 * Changing the cba |
|
318 * @since 3.2 |
|
319 * @param aResourceID |
|
320 */ |
|
321 void UpdateCbaL(TInt aResourceID); |
|
322 |
|
323 private: // Data |
|
324 TRect iMainPaneRect; |
|
325 TPoint iOffsetPosition; |
|
326 TInt iSrcTextHeight; |
|
327 |
|
328 TInt iMaximumColumns; |
|
329 TInt iMaximumRows; |
|
330 CAknFepUIManagerJapanese* iUiMng; |
|
331 }; |
|
332 |
|
333 #endif // CAKNFEPUICTRLJAPANESECANDIDATEPANE_H |
|
334 |
|
335 // End of File |