|
1 /* |
|
2 * Copyright (c) 2008 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: Wrapper class for Search Field. Handles search field . |
|
15 * activation, deactivation and size. Wrapper is a window owning |
|
16 * control. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef CMPXCOMMONCONTAINERSEARCHFIELDWRAPPER_H |
|
22 #define CMPXCOMMONCONTAINERSEARCHFIELDWRAPPER_H |
|
23 |
|
24 #include <coecntrl.h> |
|
25 |
|
26 class CMPXCommonContainerSearchField; |
|
27 |
|
28 /** |
|
29 * Class for handling Search Field events. |
|
30 */ |
|
31 NONSHARABLE_CLASS( MMPXCommonContainerSearchFieldObserver ) |
|
32 { |
|
33 |
|
34 public: |
|
35 |
|
36 /** |
|
37 * Call when filtering word changes. Causes filtering to be updated. |
|
38 * Calling with zero-length filtering word stops filtering. |
|
39 * |
|
40 * @param aWord New filtering word. |
|
41 */ |
|
42 virtual void NewFilteringWordL( const TDesC& aWord ) = 0; |
|
43 }; |
|
44 |
|
45 /** |
|
46 * Window owning control for wrapping CMPXCommonContainerSearchField. |
|
47 * |
|
48 */ |
|
49 NONSHARABLE_CLASS( CMPXCommonContainerSearchFieldWrapper ) : public CCoeControl |
|
50 { |
|
51 public: |
|
52 /** |
|
53 * Creates Search Field Wrapper. |
|
54 * |
|
55 * @param aObserver Observer |
|
56 */ |
|
57 static CMPXCommonContainerSearchFieldWrapper* NewL( MMPXCommonContainerSearchFieldObserver* aObserver ); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CMPXCommonContainerSearchFieldWrapper(); |
|
63 |
|
64 /** |
|
65 * Checks if Search Field is active. |
|
66 * |
|
67 * @return ETrue if Search Field is active / visible. |
|
68 */ |
|
69 TBool IsSearchFieldActive(); |
|
70 |
|
71 /** |
|
72 * Activates Search Field. |
|
73 */ |
|
74 void ActivateSearchFieldL(); |
|
75 |
|
76 /** |
|
77 * Deactivates Search Field, if active / visible. |
|
78 */ |
|
79 void DeactivateSearchField(); |
|
80 |
|
81 /** |
|
82 * Returns rectangle that list (widget) should use. |
|
83 * |
|
84 * @param aSearchVisible ETrue if Search Field is visible, list's |
|
85 * rectangle is smaller in this case. |
|
86 * @param aClientRect component's view's client rectangle. |
|
87 * @return Rectangle for list (widget). |
|
88 */ |
|
89 TRect GetListRect( TBool aSearchVisible, TRect aClientRect ); |
|
90 |
|
91 /** |
|
92 * Returns rectangle that Search Field should use. |
|
93 * |
|
94 * @param aSearchVisible ETrue if Search Field is visible. |
|
95 * @param aClientRect component's view's client rectangle. |
|
96 * @return Rectangle for Search Field. |
|
97 */ |
|
98 TRect GetSearchFieldRect( TBool aSearchVisible, TRect aClientRect ); |
|
99 |
|
100 /** |
|
101 * Called by CMPXCommonContainerSearchField when Find key word changes. |
|
102 * |
|
103 * @param aFindWord New Find key word. |
|
104 */ |
|
105 void FindKeywordL( const TDesC& aFindWord ); |
|
106 |
|
107 /** |
|
108 * Returns view's client rectangle. |
|
109 * |
|
110 * @return View's client rectangle. |
|
111 */ |
|
112 TRect& ClientRect(); |
|
113 |
|
114 /** |
|
115 * Call when view's client rectangle changes. |
|
116 * |
|
117 * @param aClientRect New size of view's client rectangle. |
|
118 */ |
|
119 void SetClientRect( const TRect& aClientRect ); |
|
120 |
|
121 public: // From CCoeControl |
|
122 |
|
123 /** |
|
124 * From CCoeControl |
|
125 */ |
|
126 CCoeControl *ComponentControl( TInt aIndex ) const; |
|
127 |
|
128 /** |
|
129 * From CCoeControl |
|
130 */ |
|
131 TInt CountComponentControls() const; |
|
132 |
|
133 /** |
|
134 * From CCoeControl |
|
135 */ |
|
136 void SizeChanged(); |
|
137 |
|
138 protected: |
|
139 |
|
140 /** |
|
141 * Constructor. |
|
142 * |
|
143 * @param aObserver Observer |
|
144 */ |
|
145 CMPXCommonContainerSearchFieldWrapper( MMPXCommonContainerSearchFieldObserver* aObserver ); |
|
146 |
|
147 /** |
|
148 * 2nd phase constructor. |
|
149 */ |
|
150 void ConstructL(); |
|
151 |
|
152 protected: |
|
153 |
|
154 /** |
|
155 * Search field bserver. |
|
156 * Not own. |
|
157 */ |
|
158 MMPXCommonContainerSearchFieldObserver* iObserver; |
|
159 |
|
160 /** |
|
161 * Pointer to the actual Search Field component. |
|
162 * Own. |
|
163 */ |
|
164 CMPXCommonContainerSearchField* iSearchField; |
|
165 |
|
166 /** |
|
167 * View's client rectangle. |
|
168 */ |
|
169 TRect iClientRect; |
|
170 }; |
|
171 |
|
172 #endif // CMPXCOMMONCONTAINERSEARCHFIELDWRAPPER_H |