|
1 /* |
|
2 * Copyright (c) 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: Provides the CAknFepUiSpellContainer methods. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 // INCLUDE FILES |
|
30 #include <eikgted.h> // for CEikGlobalTextEditor |
|
31 #include <eiktxlbm.h> // for CTextListBoxModel |
|
32 #include <eikclbd.h> // for CColumnListBoxData |
|
33 #include <eikbtgpc.h> // for CEikButtonGroupContainer |
|
34 #include <barsread.h> // for TResourceReader |
|
35 #include <eikclb.h> // for CEikColumnListBox |
|
36 #include <aknnotewrappers.h> // for CAknInformationNote |
|
37 #include <appapaclayout.cdl.h> // for Layout stuff |
|
38 #include <StringLoader.h> |
|
39 #include <aknlayoutscalable_apps.cdl.h> |
|
40 #include <layoutmetadata.cdl.h> |
|
41 |
|
42 #include "aknfepuispellcontainer.h" |
|
43 #include "aknfepuispellinputpane.h" |
|
44 |
|
45 // CONSTANTS |
|
46 const TInt KNumberOfContainerControl = 1; |
|
47 |
|
48 // Enumarations |
|
49 enum TControls |
|
50 { |
|
51 EInputPane |
|
52 }; |
|
53 |
|
54 // ================= MEMBER FUNCTIONS ====================== |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // CAknFepUiSpellContainer::CAknFepUiSpellContainer |
|
58 // (other items were commented in a header) |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 CAknFepUiSpellContainer::CAknFepUiSpellContainer() |
|
62 :iInputPane( NULL ) |
|
63 { |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CAknFepUiSpellContainer::InputPane |
|
68 // (other items were commented in a header) |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 CAknFepUiSpellInputPane* CAknFepUiSpellContainer::InputPane() |
|
72 { |
|
73 return iInputPane; |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CAknFepUiSpellContainer::SetInputWinObserver |
|
78 // (other items were commented in a header) |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 void CAknFepUiSpellContainer::SetInputWinObserver( MEikEdwinObserver* aObserver ) |
|
82 { |
|
83 iInputPane->SetInputWinObserver(aObserver); |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // CAknFepUiSpellContainer::SetInputWinFocus |
|
88 // (other items were commented in a header) |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 void CAknFepUiSpellContainer::SetInputWinFocus( TBool aFocus ) |
|
92 { |
|
93 if ( IsFocused() == aFocus ) |
|
94 { |
|
95 if ( !aFocus ) |
|
96 { |
|
97 iEikonEnv->EikAppUi()->RemoveFromStack( this ); |
|
98 } |
|
99 return; |
|
100 } |
|
101 |
|
102 // When release focus, remove from stack. |
|
103 if( aFocus ) |
|
104 { |
|
105 TRAP_IGNORE(iEikonEnv->EikAppUi()->AddToStackL( this, ECoeStackPriorityDialog )); |
|
106 } |
|
107 else |
|
108 { |
|
109 SetFocus( EFalse ); |
|
110 iEikonEnv->EikAppUi()->RemoveFromStack( this ); |
|
111 } |
|
112 } |
|
113 // --------------------------------------------------------------------------- |
|
114 // CAknFepUiSpellContainer::ConstructL |
|
115 // (other items were commented in a header) |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 void CAknFepUiSpellContainer::ConstructL(const TInt aEditorFlag, |
|
119 const TInt aEditorCase, const TInt aEditorSCTResID, const TBool aIsSplitEditor ) |
|
120 { |
|
121 CreateWindowL(); |
|
122 |
|
123 iInputPane = CAknFepUiSpellInputPane::NewL( this, aEditorFlag, aEditorCase, |
|
124 aEditorSCTResID, aIsSplitEditor ); |
|
125 |
|
126 iInputPane->SetMopParent(this); |
|
127 |
|
128 iInputPane->SetFocus( ETrue ); |
|
129 SetContainerRect(); |
|
130 |
|
131 iEikonEnv->EikAppUi()->AddToStackL(this,ECoeStackPriorityDialog); |
|
132 ActivateL(); |
|
133 } |
|
134 |
|
135 // --------------------------------------------------------------------------- |
|
136 // CAknFepUiSpellContainer::NewL |
|
137 // (other items were commented in a header) |
|
138 // --------------------------------------------------------------------------- |
|
139 // |
|
140 CAknFepUiSpellContainer* CAknFepUiSpellContainer::NewL(const TInt aEditorFlag, |
|
141 const TInt aEditorCase, const TInt aEditorSCTResID, const TBool aSplitEditor ) |
|
142 { |
|
143 CAknFepUiSpellContainer* self = new ( ELeave ) CAknFepUiSpellContainer(); |
|
144 CleanupStack::PushL( self ); |
|
145 |
|
146 self->SetMopParent(CEikonEnv::Static()->EikAppUi()); |
|
147 self->ConstructL(aEditorFlag, aEditorCase, aEditorSCTResID, aSplitEditor ); |
|
148 |
|
149 CleanupStack::Pop(); |
|
150 |
|
151 return self; |
|
152 } |
|
153 |
|
154 // --------------------------------------------------------------------------- |
|
155 // CAknFepUiSpellContainer::~CAknFepUiSpellContainer |
|
156 // (other items were commented in a header) |
|
157 // --------------------------------------------------------------------------- |
|
158 // |
|
159 CAknFepUiSpellContainer::~CAknFepUiSpellContainer() |
|
160 { |
|
161 iEikonEnv->EikAppUi()->RemoveFromStack(this); |
|
162 |
|
163 delete iInputPane; |
|
164 iInputPane = NULL; |
|
165 } |
|
166 |
|
167 // --------------------------------------------------------------------------- |
|
168 // CAknFepUiSpellContainer::CountComponentControls |
|
169 // (other items were commented in a header) |
|
170 // --------------------------------------------------------------------------- |
|
171 // |
|
172 TInt CAknFepUiSpellContainer::CountComponentControls() const |
|
173 { |
|
174 return KNumberOfContainerControl; |
|
175 } |
|
176 |
|
177 // --------------------------------------------------------------------------- |
|
178 // CAknFepUiSpellContainer::ComponentControl |
|
179 // (other items were commented in a header) |
|
180 // --------------------------------------------------------------------------- |
|
181 // |
|
182 CCoeControl* CAknFepUiSpellContainer::ComponentControl( TInt aIndex ) const |
|
183 { |
|
184 switch ( aIndex ) |
|
185 { |
|
186 case EInputPane: |
|
187 { |
|
188 return iInputPane; |
|
189 } |
|
190 default: |
|
191 { |
|
192 return NULL; |
|
193 } |
|
194 } |
|
195 } |
|
196 |
|
197 // --------------------------------------------------------------------------- |
|
198 // CAknFepUiSpellContainer::Draw |
|
199 // (other items were commented in a header) |
|
200 // --------------------------------------------------------------------------- |
|
201 // |
|
202 void CAknFepUiSpellContainer::Draw( const TRect& /*aRect*/ ) const |
|
203 { |
|
204 } |
|
205 |
|
206 // --------------------------------------------------------------------------- |
|
207 // CAknFepUiSpellContainer::InputCapabilities |
|
208 // (other items were commented in a header) |
|
209 // --------------------------------------------------------------------------- |
|
210 // |
|
211 TCoeInputCapabilities CAknFepUiSpellContainer::InputCapabilities() const |
|
212 { |
|
213 if ( iInputPane && iInputPane->IsFocused()) |
|
214 { |
|
215 return iInputPane->InputCapabilities(); |
|
216 } |
|
217 |
|
218 return ENone; |
|
219 } |
|
220 |
|
221 // --------------------------------------------------------------------------- |
|
222 // CAknFepUiSpellContainer::OfferKeyEventL |
|
223 // (other items were commented in a header) |
|
224 // --------------------------------------------------------------------------- |
|
225 // |
|
226 TKeyResponse CAknFepUiSpellContainer::OfferKeyEventL( |
|
227 const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
228 { |
|
229 if ( iInputPane && iInputPane->IsFocused()) |
|
230 { |
|
231 return iInputPane->OfferKeyEventL( aKeyEvent, aType ); |
|
232 } |
|
233 |
|
234 return EKeyWasNotConsumed; |
|
235 } |
|
236 |
|
237 // --------------------------------------------------------------------------- |
|
238 // CAknFepUiSpellContainer::SizeChanged |
|
239 // (other items were commented in a header) |
|
240 // --------------------------------------------------------------------------- |
|
241 // |
|
242 void CAknFepUiSpellContainer::SizeChanged() |
|
243 { |
|
244 iInputPane->SetRect(Rect()); |
|
245 } |
|
246 |
|
247 // --------------------------------------------------------------------------- |
|
248 // CAknFepUiSpellContainer::SetContainerRect |
|
249 // (other items were commented in a header) |
|
250 // --------------------------------------------------------------------------- |
|
251 // |
|
252 void CAknFepUiSpellContainer::FocusChanged(TDrawNow aDrawNow) |
|
253 { |
|
254 TBool bFocused = IsFocused() ? ETrue : EFalse; |
|
255 |
|
256 if ( ComponentControl( 0 ) ) |
|
257 { |
|
258 ComponentControl( 0 )->SetFocus( bFocused, aDrawNow ); |
|
259 } |
|
260 } |
|
261 |
|
262 // --------------------------------------------------------------------------- |
|
263 // CAknFepUiSpellContainer::SetContainerRect |
|
264 // (other items were commented in a header) |
|
265 // --------------------------------------------------------------------------- |
|
266 // |
|
267 void CAknFepUiSpellContainer::SetContainerRect() |
|
268 { |
|
269 TAknWindowLineLayout appWnd = AknLayoutScalable_Apps::application_window().LayoutLine(); |
|
270 TAknWindowLineLayout mainPane; |
|
271 if ( Layout_Meta_Data::IsLandscapeOrientation()) |
|
272 { |
|
273 mainPane = AknLayoutScalable_Apps::main_pane(4).LayoutLine(); |
|
274 } |
|
275 else |
|
276 { |
|
277 mainPane = AknLayoutScalable_Apps::main_pane(0).LayoutLine(); |
|
278 } |
|
279 |
|
280 TAknLayoutRect mainPaneRect; |
|
281 mainPaneRect.LayoutRect(appWnd.Rect(), mainPane); |
|
282 |
|
283 mainPaneRect.Rect(); |
|
284 |
|
285 TInt ay = mainPaneRect.Rect().iTl.iY + |
|
286 ((mainPaneRect.Rect().iBr.iY - mainPaneRect.Rect().iTl.iY) / 5)*4; |
|
287 |
|
288 TRect containerRect(0, ay, mainPaneRect.Rect().iBr.iX, mainPaneRect.Rect().iBr.iY); |
|
289 TRect tempRect = TRect(0,0,1,1); |
|
290 SetRect(tempRect); |
|
291 } |
|
292 |
|
293 // End of File |