2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Implementation of the query control for multiline queries
21 #ifndef __AKN_MULTILINE_QUERY_CONTROL_H
22 #define __AKN_MULTILINE_QUERY_CONTROL_H
26 #include <aknQueryControl.h>
34 class TAknWindowLineLayout;
37 * Multiline query control class.
39 class CAknMultilineQueryControl : public CAknQueryControl
41 public: // Constructors and destructor
45 IMPORT_C CAknMultilineQueryControl();
50 IMPORT_C virtual ~CAknMultilineQueryControl();
52 public://new API functions
54 * Set number of prompt lines to controls.
55 * This have to call before setting sizs of the components
57 * @param aNbrOfPromptLinesFirstLine Numbers of lines in first prompt text
58 * @param aNbrOfPromptLinesSecondLine Numbers of lines in Second prompt text
60 IMPORT_C void SetNbrOfPromptLines(TInt aNbrOfPromptLinesFirstLine, TInt aNbrOfPromptLinesSecondLine);
63 * Return true if control is the first query in the dialog
65 IMPORT_C TBool IsFirst() const;
68 * Return true if control is the second query in the dialog
70 IMPORT_C TBool IsSecond() const;
72 public: //Functions from CAknQueryControl
75 * Get pointer to query controls control (editor)
77 * @param aLayout Controls layout (for multiline queries use
78 * EMultiDataFirstEdwin, EMultiDataSecondEdwin...)
79 * @return Pointer to control, NULL if not found
81 IMPORT_C virtual CCoeControl* ControlByLayoutOrNull(TInt aLayout);
83 public: // Functions from CCoeControl
86 * From CCoeControl Give the control a mimimum size.
88 * @return The minimum size required by the control.
90 IMPORT_C TSize MinimumSize();
94 * Handles pointer events
95 * @param aPointerEvent The pointer event.
97 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
100 IMPORT_C void HandleResourceChange(TInt aType);
106 * Manage indexes into LAF tables
111 TIndex(const TLinePosition& aLinePos, TInt aFirstQueryPromptLines,TInt aSecondQueryPromptLines);
114 TInt MainPanePQDCWindow() const;
115 TInt CDCQPWindowLine1() const;
116 TInt CDCQPWindowLine2() const;
117 TInt CDCQPWindowLine3() const;
118 TInt CDCQPWindowRectangles() const;
119 TInt CDCQPWindowLine5() const;
121 TInt CDCQPWindowTextsLine1(TInt aLineNum) const;
122 TInt CDCQPWindowTextsLine2() const;
123 TInt CDCQPWindowTextsLine3(TInt aLineNum) const;
124 TInt CDCQPWindowTextsLine4() const;
126 TInt CDCPQWindowGraphicsLine5() const;
129 const TInt LinePos() const { return iLinePos; }
132 TInt FirstQueryPromptLines() const;
133 TInt SecondQueryPromptLines() const;
135 void SelfTest() const;
138 TLinePosition iLinePos;
139 TInt iFirstQueryPromptLines;
140 TInt iSecondQueryPromptLines;
143 protected: // From CAknQueryControl
145 * Set line widths for query prompt
147 void SetLineWidthsL();
150 * Read the query data from resource file
152 void ConstructQueryL(TResourceReader& aRes);
155 * Layout rectangle (shift up and left by margins)
159 private://From CCoeControl
161 void Draw(const TRect& aRect) const;
166 IMPORT_C void* ExtensionInterface( TUid aInterface );
168 private: //Layout methods
169 void LayoutPrompt(const TLayoutMethod& aLayoutM);
170 void LayoutSeparator(const TLayoutMethod& aLayoutM);
172 void LayoutEditor(const TLayoutMethod& aLayoutM);
173 void LayoutEditorFrame(const TLayoutMethod& aLayoutM);
174 void LayoutEditorIndicator(const TLayoutMethod& aLayoutM);
177 * Return window layout depending on Layout
178 * Window layout is done by the dialog
180 void WindowLayout( TAknWindowLineLayout& aLayout ) const;
182 private: //Implementation methods
183 void SetLinePosition();
184 TInt16 FirstLineHeight() const;
185 TInt16 SecondLineHeight() const;
188 TAknLayoutRect iLayoutLineBetweenEntryFields; /// Layout rect for line between two entry fields
189 TLinePosition iLinePos;
190 TInt iFirstQueryPromptLines;
191 TInt iSecondQueryPromptLines;
197 * Derived Multiline query control class.
201 class CAknExtMultilineQueryControl : public CAknExtQueryControl
203 public: // Constructors and destructor
207 IMPORT_C CAknExtMultilineQueryControl();
212 IMPORT_C virtual ~CAknExtMultilineQueryControl();
214 public://new API functions
216 * Set number of prompt lines to controls.
217 * This have to call before setting sizs of the components
219 * @param aNbrOfPromptLinesFirstLine Numbers of lines in first prompt text
220 * @param aNbrOfPromptLinesSecondLine Numbers of lines in Second prompt text
222 IMPORT_C void SetNbrOfPromptLines(TInt aNbrOfPromptLinesFirstLine, TInt aNbrOfPromptLinesSecondLine);
225 * Return true if control is the first query in the dialog
227 IMPORT_C TBool IsFirst() const;
230 * Return true if control is the second query in the dialog
232 IMPORT_C TBool IsSecond() const;
234 public: //Functions from CAknQueryControl
237 * Get pointer to query controls control (editor)
239 * @param aLayout Controls layout (for multiline queries use
240 * EMultiDataFirstIpEd, EMultiDataSecondIpEd...)
241 * @return Pointer to control, NULL if not found
243 IMPORT_C virtual CCoeControl* ControlByLayoutOrNull(TInt aLayout);
245 public: // Functions from CCoeControl
248 * From CCoeControl Give the control a mimimum size.
250 * @return The minimum size required by the control.
252 IMPORT_C TSize MinimumSize();
256 * Handles pointer events
257 * @param aPointerEvent The pointer event.
259 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
261 IMPORT_C void HandleResourceChange(TInt aType);
267 * Manage indexes into LAF tables
272 TIndex(const TLinePosition& aLinePos, TInt aFirstQueryPromptLines,TInt aSecondQueryPromptLines);
275 TInt MainPanePQDCWindow() const;
276 TInt CDCQPWindowLine1() const;
277 TInt CDCQPWindowLine2() const;
278 TInt CDCQPWindowLine3() const;
279 TInt CDCQPWindowRectangles() const;
280 TInt CDCQPWindowLine5() const;
282 TInt CDCQPWindowTextsLine1(TInt aLineNum) const;
283 TInt CDCQPWindowTextsLine2() const;
284 TInt CDCQPWindowTextsLine3(TInt aLineNum) const;
285 TInt CDCQPWindowTextsLine4() const;
287 TInt CDCPQWindowGraphicsLine5() const;
290 const TInt LinePos() const { return iLinePos; }
293 TInt FirstQueryPromptLines() const;
294 TInt SecondQueryPromptLines() const;
296 void SelfTest() const;
299 TLinePosition iLinePos;
300 TInt iFirstQueryPromptLines;
301 TInt iSecondQueryPromptLines;
304 protected: // From CAknQueryControl
306 * Set line widths for query prompt
308 void SetLineWidthsL();
311 * Read the query data from resource file
313 void ConstructQueryL(TResourceReader& aRes);
316 * Layout rectangle (shift up and left by margins)
320 private://From CCoeControl
322 void Draw(const TRect& aRect) const;
327 IMPORT_C void* ExtensionInterface( TUid aInterface );
329 private: //Layout methods
330 void LayoutPrompt(const TLayoutMethod& aLayoutM);
331 void LayoutSeparator(const TLayoutMethod& aLayoutM);
333 void LayoutEditor(const TLayoutMethod& aLayoutM);
334 void LayoutEditorFrame(const TLayoutMethod& aLayoutM);
335 void LayoutEditorIndicator(const TLayoutMethod& aLayoutM);
338 * Return window layout depending on Layout
339 * Window layout is done by the dialog
341 void WindowLayout( TAknWindowLineLayout& aLayout ) const;
343 private: //Implementation methods
344 void SetLinePosition();
345 TInt16 FirstLineHeight() const;
346 TInt16 SecondLineHeight() const;
348 TAknLayoutRect iLayoutLineBetweenEntryFields; /// Layout rect for line between two entry fields
349 TLinePosition iLinePos;
350 TInt iFirstQueryPromptLines;
351 TInt iSecondQueryPromptLines;