|
1 /* |
|
2 * Copyright (c) 2003-2006 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: Implementation class for TextField |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMIDTEXTFIELDEDWIN_H |
|
20 #define CMIDTEXTFIELDEDWIN_H |
|
21 |
|
22 // ========== INCLUDE FILES ================================ |
|
23 |
|
24 // CMIDEdwin inheritance in class declaration |
|
25 #include "CMIDEdwin.h" |
|
26 |
|
27 // ========== FORWARD DECLARATIONS ========================= |
|
28 |
|
29 // ========== CLASS DECLARATION ============================ |
|
30 |
|
31 NONSHARABLE_CLASS(CMIDTextFieldEdwin) : public CMIDEdwin, public MCoeControlObserver |
|
32 { |
|
33 public: |
|
34 static CMIDTextFieldEdwin* NewL(TInt aConstraints,const TDesC& aText,TInt aMaxSize, |
|
35 MMIDDisplayable* aDisplayable, CMIDTextFieldItem* aTextFieldItem=NULL); |
|
36 ~CMIDTextFieldEdwin(); |
|
37 |
|
38 // |
|
39 // From MCoeControlObserver |
|
40 // |
|
41 void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); |
|
42 |
|
43 // |
|
44 // From CCoeControl |
|
45 // |
|
46 void SetContainerWindowL(const CCoeControl& aContainer); |
|
47 |
|
48 // from CMIDEdwin |
|
49 /** |
|
50 * Layouts the CMIDTextFieldEdwin relative to the parent. |
|
51 * |
|
52 * @param aRect the parent rect |
|
53 * @param aLayout multi line layout info |
|
54 */ |
|
55 virtual void DoLayout(const TRect& aRect); |
|
56 |
|
57 void PositionChanged(); |
|
58 protected: // from CMIDEdwin |
|
59 void AddCommandToEdwinL(MMIDCommand& aCommand); |
|
60 |
|
61 private: // Constructors |
|
62 /** |
|
63 * Constructor |
|
64 */ |
|
65 CMIDTextFieldEdwin(TUint aConstraints, MMIDDisplayable* aDisplayable, |
|
66 CMIDTextFieldItem* aTextFieldItem); |
|
67 |
|
68 /** |
|
69 * Second phase constructor |
|
70 * @param aText a text to be set in the field |
|
71 * @param aMaxSize maximum number of characters to allow |
|
72 */ |
|
73 void ConstructL(const TDesC& aText, TInt aMaxSize); |
|
74 |
|
75 #ifdef RD_SCALABLE_UI_V2 |
|
76 /** |
|
77 * Calculate the rect for scrolling TextField text internally |
|
78 * @param aParentRect parent rect from which to calculate scrolling area |
|
79 * @param aLine number of lines to deduct from scrolling |
|
80 * @param aLayout multi line text layout |
|
81 * @return rect that can be scrolled |
|
82 */ |
|
83 TRect LineRect(TRect aParentRect, TInt aLine, TAknMultiLineTextLayout aLayout); |
|
84 /** |
|
85 * Set the rect for scrolling TextField text internally |
|
86 * @param aEdwin the editor |
|
87 * @param aParentRect parent rect from which to calculate scrolling area |
|
88 * @param aLayout multi line text layout |
|
89 * @param aNumberOfLines number of laid out lines |
|
90 */ |
|
91 void SetThisScrollRect(CMIDTextFieldEdwin *aEdwin, TRect aParentRect, TAknMultiLineTextLayout aLayout, TInt aNumberOfLines); |
|
92 |
|
93 #endif // RD_SCALABLE_UI_V2 |
|
94 |
|
95 /** |
|
96 * Get the layout for the Edwin control relative to the parent rect where |
|
97 * the Edwin will be laid out |
|
98 * |
|
99 * @param aRect the parent rectangle where the Edwin is laid out |
|
100 * @param aNumLines how many lines will be displayed |
|
101 * |
|
102 * @return multi line layout structure |
|
103 * @note it changes the supplied rectangle leaving the margins for form2_midp_text_pane |
|
104 */ |
|
105 TAknMultiLineTextLayout GetLayout(TRect& aRect, TInt aNumLines) const; |
|
106 |
|
107 }; |
|
108 |
|
109 #endif // CMIDTEXTFIELDEDWIN_H |