|
1 /* |
|
2 * Copyright (c) 2005-2007 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 for CFepUiLayout |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <w32std.h> |
|
20 #include <s32mem.h> |
|
21 #include <peninputcmd.h> |
|
22 #include "peninputcmdparamext.h" |
|
23 #include "peninputlayout.h" |
|
24 #include "peninputlayoutbutton.h" |
|
25 #include "peninputlayoutrootctrl.h" |
|
26 |
|
27 #include <aknfeppeninputenums.h> |
|
28 #include <AknDef.h> |
|
29 #include <AknsConstants.h> |
|
30 #include <coemain.h> |
|
31 |
|
32 #ifdef RD_TACTILE_FEEDBACK |
|
33 #include <touchfeedback.h> |
|
34 #include <featmgr.h> |
|
35 #endif //RD_TACTILE_FEEDBACK |
|
36 // ======== MEMBER FUNCTIONS ======== |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // CFepUiLayout::CFepUiLayout |
|
40 // Constructor |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 EXPORT_C CFepUiLayout::CFepUiLayout(MLayoutOwner* aLayoutOwner) |
|
44 :iLayoutOwner(aLayoutOwner), |
|
45 iDragbarNum(0),iLockedArea(TRect(0,0,0,0)), |
|
46 iLayoutReady(EFalse) |
|
47 { |
|
48 TPixelsTwipsAndRotation ptSize; |
|
49 CCoeEnv::Static()->ScreenDevice()-> |
|
50 GetDefaultScreenSizeAndRotation(ptSize); |
|
51 //set the screen size in case any one need use it. |
|
52 iScreenSize = ptSize.iPixelSize; |
|
53 #ifdef RD_TACTILE_FEEDBACK |
|
54 iTactileSupported = EFalse; |
|
55 #endif // RD_TACTILE_FEEDBACK |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CFepUiLayout::~CFepUiLayout |
|
60 // Destructor |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 EXPORT_C CFepUiLayout::~CFepUiLayout() |
|
64 { |
|
65 #ifdef RD_TACTILE_FEEDBACK |
|
66 //remove all registered area |
|
67 SignalOwner(ESignalDeRegisterAllFeedbackArea); |
|
68 #endif // RD_TACTILE_FEEDBACK |
|
69 delete iRootCtrl; |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // CFepUiLayout::BaseConstructL |
|
74 // Do basic contructor |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 EXPORT_C void CFepUiLayout::BaseConstructL() |
|
78 { |
|
79 iRootCtrl = CFepUiLayoutRootCtrl::NewL(this); |
|
80 __ASSERT_DEBUG(iLayoutOwner,User::Leave(EUiLayoutNotReady)); |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // CFepUiLayout::HandleEventL |
|
85 // handle event from window server |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 EXPORT_C TBool CFepUiLayout::HandleEventL(TEventType aType, const TAny* aData) |
|
89 { |
|
90 TRawEvent event=*(static_cast<const TRawEvent*>(aData)); |
|
91 if(ERawEvent == aType) |
|
92 { |
|
93 //handle raw key event |
|
94 if(TRawEvent::EKeyUp == event.Type() || TRawEvent::EKeyDown == event.Type()) |
|
95 { |
|
96 return HandleRawKeyEventL(event); |
|
97 } |
|
98 else |
|
99 { |
|
100 if(TRawEvent::EButton1Down == event.Type()) |
|
101 { |
|
102 if(!iRootCtrl->CtrlCapPointer() && |
|
103 !LayoutOwner()->LayoutRect().Contains(event.Pos())) |
|
104 { |
|
105 //point outside of ui layout |
|
106 OnPointerEventOutsideLayout(event); |
|
107 return EFalse; |
|
108 } |
|
109 } |
|
110 } |
|
111 } |
|
112 |
|
113 TBool handled = iRootCtrl->HandleEventL(aType,aData); |
|
114 return handled; |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // CFepUiLayout::SendEditorTextAndCursorPosL |
|
119 // handle layout command |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 void CFepUiLayout::SendEditorTextAndCursorPosL(TUint8* aData) |
|
123 { |
|
124 RDesReadStream readStream; |
|
125 |
|
126 TPtr8 countPtr( aData, 2*sizeof(TInt), 2*sizeof(TInt) ); |
|
127 readStream.Open(countPtr); |
|
128 CleanupClosePushL(readStream); |
|
129 const TInt dataCount = readStream.ReadInt32L(); |
|
130 const TInt textCount = readStream.ReadInt32L(); |
|
131 CleanupStack::PopAndDestroy(&readStream); |
|
132 |
|
133 TPtr8 ptr( aData+2*sizeof(TInt), dataCount+textCount, dataCount+textCount ); |
|
134 readStream.Open(ptr); |
|
135 CleanupClosePushL(readStream); |
|
136 |
|
137 HBufC8* dataBuf = HBufC8::NewLC(dataCount); |
|
138 TPtr8 dataBufPtr = dataBuf->Des(); |
|
139 readStream.ReadL(dataBufPtr, dataCount); |
|
140 |
|
141 TFepInputContextFieldData* pIcfData = |
|
142 reinterpret_cast<TFepInputContextFieldData*>(const_cast<TUint8*>(dataBufPtr.Ptr())); |
|
143 |
|
144 HBufC8* textBuf = HBufC8::NewLC(textCount); |
|
145 TPtr8 textBufPtr = textBuf->Des(); |
|
146 readStream.ReadL(textBufPtr, textCount); |
|
147 pIcfData->iText.Set( reinterpret_cast<const TUint16*>(textBufPtr.Ptr()), |
|
148 textCount/2); |
|
149 |
|
150 OnAppEditorTextComing(*pIcfData); |
|
151 |
|
152 CleanupStack::PopAndDestroy(textBuf); |
|
153 CleanupStack::PopAndDestroy(dataBuf); |
|
154 CleanupStack::PopAndDestroy(&readStream); |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // CFepUiLayout::HandleCommand |
|
159 // handle layout command |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 EXPORT_C TInt CFepUiLayout::HandleCommand(TInt aCmd, TUint8* aData) |
|
163 { |
|
164 TInt ret = KErrNone; |
|
165 switch( aCmd ) |
|
166 { |
|
167 case ECmdPenInputSendEditorTextAndCurPos: |
|
168 { |
|
169 TRAP_IGNORE(SendEditorTextAndCursorPosL(aData)); |
|
170 } |
|
171 break; |
|
172 default: |
|
173 { |
|
174 ret = -1; |
|
175 } |
|
176 break; |
|
177 } |
|
178 return ret; |
|
179 } |
|
180 |
|
181 // --------------------------------------------------------------------------- |
|
182 // CFepUiLayout::InitL |
|
183 // Initialize the layout |
|
184 // --------------------------------------------------------------------------- |
|
185 // |
|
186 EXPORT_C TRect CFepUiLayout::Init() |
|
187 { |
|
188 //Init control |
|
189 TRect r = iRootCtrl->InitControl(); |
|
190 r.Move( Position() ); |
|
191 for(TInt i = 0; i < iDragbarNum; i++) |
|
192 { |
|
193 iDragbarList[i]->AddPositionObserver(static_cast<MPositionObserver*> |
|
194 (iRootCtrl)); |
|
195 } |
|
196 //iLayoutReady = ETrue; |
|
197 return r; |
|
198 } |
|
199 |
|
200 // --------------------------------------------------------------------------- |
|
201 // CFepUiLayout::AddControlL |
|
202 // Add a control to layout |
|
203 // --------------------------------------------------------------------------- |
|
204 // |
|
205 EXPORT_C void CFepUiLayout::AddControlL(CFepUiBaseCtrl* aControl, |
|
206 TBool aEventObserverFlag) |
|
207 { |
|
208 if(!aControl) |
|
209 return; |
|
210 |
|
211 iRootCtrl->AddControlL(aControl); |
|
212 //add event observer |
|
213 if(aEventObserverFlag) |
|
214 aControl->AddEventObserver(this); |
|
215 } |
|
216 |
|
217 // --------------------------------------------------------------------------- |
|
218 // CFepUiLayout::AddControlL |
|
219 // Add a control to layout |
|
220 // --------------------------------------------------------------------------- |
|
221 // |
|
222 EXPORT_C void CFepUiLayout::AddControlL(CCoeControl* aControl, |
|
223 TBool aEventObserverFlag) |
|
224 { |
|
225 if(!aControl) |
|
226 return; |
|
227 |
|
228 CFepUiBaseCtrl* ctrl = iRootCtrl->AddControlL(aControl); |
|
229 //add event observer |
|
230 if(aEventObserverFlag && ctrl) |
|
231 ctrl->AddEventObserver(this); |
|
232 } |
|
233 |
|
234 |
|
235 // --------------------------------------------------------------------------- |
|
236 // CFepUiLayout::RemoveControl |
|
237 // Remove a control to layout |
|
238 // --------------------------------------------------------------------------- |
|
239 // |
|
240 EXPORT_C void CFepUiLayout::RemoveControl(CFepUiBaseCtrl* aControl) |
|
241 { |
|
242 if(!aControl) |
|
243 return; |
|
244 //check whether the control is a dragbar |
|
245 if(aControl->IsKindOfControl(ECtrlDragBar)) |
|
246 { |
|
247 for(TInt i = 0; i < iDragbarNum; i++) |
|
248 { |
|
249 if(aControl == iDragbarList[i]) |
|
250 { |
|
251 iDragbarNum --; |
|
252 for(TInt j = i+1; j < iDragbarNum; j++) |
|
253 { |
|
254 iDragbarList[j-1] = iDragbarList[j]; |
|
255 } |
|
256 break; |
|
257 } |
|
258 } |
|
259 } |
|
260 //Remove from event list |
|
261 if(aControl) |
|
262 aControl->RemoveEventObserver(this); |
|
263 |
|
264 //remove control |
|
265 iRootCtrl->RemoveControl(aControl); |
|
266 //aControl is deleted, so reset the pointer. |
|
267 aControl = 0; |
|
268 } |
|
269 |
|
270 // --------------------------------------------------------------------------- |
|
271 // CFepUiLayout::Draw |
|
272 // Draw layout |
|
273 // --------------------------------------------------------------------------- |
|
274 // |
|
275 EXPORT_C void CFepUiLayout::Draw() |
|
276 { |
|
277 iRootCtrl->Draw(); |
|
278 |
|
279 } |
|
280 |
|
281 // --------------------------------------------------------------------------- |
|
282 // CFepUiLayout::HandleRawKeyEventL |
|
283 // Handle key event |
|
284 // --------------------------------------------------------------------------- |
|
285 // |
|
286 EXPORT_C TBool CFepUiLayout::HandleRawKeyEventL(const TRawEvent& /*aKeyEvent*/) |
|
287 { |
|
288 //let application process the key. |
|
289 return EFalse; |
|
290 } |
|
291 |
|
292 // --------------------------------------------------------------------------- |
|
293 // CFepUiLayout::SignalOwner |
|
294 // Report event to owner |
|
295 // (other items were commented in a header). |
|
296 // --------------------------------------------------------------------------- |
|
297 // |
|
298 EXPORT_C void CFepUiLayout::SignalOwner(TInt aEventType, const TDesC& aEventData) |
|
299 { |
|
300 iLayoutOwner->SignalOwner(aEventType,aEventData); |
|
301 } |
|
302 |
|
303 // --------------------------------------------------------------------------- |
|
304 // CFepUiLayout::OnAppEditorTextComing |
|
305 // Set editor area text when application send text to ui layout |
|
306 // (other items were commented in a header). |
|
307 // --------------------------------------------------------------------------- |
|
308 // |
|
309 EXPORT_C TInt CFepUiLayout::OnAppEditorTextComing(const TFepInputContextFieldData& /*aData*/) |
|
310 { |
|
311 //do nothing |
|
312 return KErrNone; |
|
313 } |
|
314 |
|
315 // --------------------------------------------------------------------------- |
|
316 // CFepUiLayout::GetEditorMaxLength |
|
317 // Get the max editor length of the input context field |
|
318 // (other items were commented in a header). |
|
319 // --------------------------------------------------------------------------- |
|
320 // |
|
321 EXPORT_C TInt CFepUiLayout::GetInputContextFieldMaxLen() |
|
322 { |
|
323 return iRootCtrl->GetInputContextFieldMaxLen(); |
|
324 } |
|
325 |
|
326 // --------------------------------------------------------------------------- |
|
327 // CFepUiLayout::IsValidDestination |
|
328 // Test whether the rect conflicts with other controls |
|
329 // (other items were commented in a header). |
|
330 // --------------------------------------------------------------------------- |
|
331 // |
|
332 EXPORT_C TBool CFepUiLayout::IsValidDestination(const TRect& aRect, |
|
333 CDragBar* aDragBar, TBool& aVInfo,TBool& aHInfo,TBool aFlag) |
|
334 { |
|
335 //default implementation. |
|
336 if(aFlag) //layout is moving |
|
337 { |
|
338 TRect screen(TPoint(0,0),iScreenSize); |
|
339 |
|
340 screen.Intersection(aRect); |
|
341 if(screen != aRect) //any part of dragbar can't be outside of screen |
|
342 { |
|
343 aVInfo = EFalse; |
|
344 aHInfo = EFalse; |
|
345 return EFalse; |
|
346 } |
|
347 else |
|
348 { |
|
349 aVInfo = ETrue; |
|
350 aHInfo = ETrue; |
|
351 return ETrue; |
|
352 } |
|
353 } |
|
354 |
|
355 //check for component moving |
|
356 return iRootCtrl->IsValidDestination(aRect,aDragBar,aVInfo,aHInfo); |
|
357 } |
|
358 |
|
359 |
|
360 // ----------------------------------------------------------------------------- |
|
361 // CFepUiLayout::SetRect |
|
362 // Set layout rect |
|
363 // ----------------------------------------------------------------------------- |
|
364 // |
|
365 EXPORT_C void CFepUiLayout::SetRect(const TRect& aRect) |
|
366 { |
|
367 TRect layoutRect = Rect(); |
|
368 layoutRect.Move(Position()); |
|
369 if(layoutRect != aRect) |
|
370 { |
|
371 iRootCtrl->SetRect(aRect); |
|
372 LayoutOwner()->LayoutSizeChanged( aRect.Size() ); |
|
373 LayoutOwner()->SetPosition( aRect.iTl ); |
|
374 iRootCtrl->GraphicDeviceSizeChanged(); |
|
375 } |
|
376 } |
|
377 |
|
378 // --------------------------------------------------------------------------- |
|
379 // CFepUiLayout::Rect |
|
380 // Deprecated function |
|
381 // Get layout rect |
|
382 // (other items were commented in a header). |
|
383 // --------------------------------------------------------------------------- |
|
384 // |
|
385 EXPORT_C TRect CFepUiLayout::Rect() |
|
386 { |
|
387 return iRootCtrl->Rect(); |
|
388 } |
|
389 |
|
390 // --------------------------------------------------------------------------- |
|
391 // CFepUiLayout::Position |
|
392 // Get layout start position |
|
393 // (other items were commented in a header). |
|
394 // --------------------------------------------------------------------------- |
|
395 // |
|
396 EXPORT_C TPoint CFepUiLayout::Position() |
|
397 { |
|
398 return LayoutOwner()->LayoutRect().iTl; |
|
399 } |
|
400 |
|
401 // --------------------------------------------------------------------------- |
|
402 // CFepUiLayout::SetAppEditorCursor |
|
403 // Handle changing app editor cursor event |
|
404 // (other items were commented in a header). |
|
405 // --------------------------------------------------------------------------- |
|
406 // |
|
407 EXPORT_C void CFepUiLayout::SetAppEditorCursor(const TCursorSelection& aCurSel, |
|
408 TBool aReqMoreText) |
|
409 { |
|
410 TPtrC16 ptr; |
|
411 |
|
412 TInt size = sizeof(TBool) + sizeof(TCursorSelection) + 1; |
|
413 |
|
414 TUint8* packedData = new TUint8[size]; |
|
415 if(!packedData) |
|
416 return; |
|
417 |
|
418 TInt cpLen = sizeof(TCursorSelection); |
|
419 Mem::Copy(packedData,&aCurSel,cpLen); |
|
420 Mem::Copy(packedData+cpLen,&aReqMoreText,sizeof(TBool)); |
|
421 |
|
422 ptr.Set(reinterpret_cast<TUint16*>(packedData),size / 2); |
|
423 |
|
424 SignalOwner(ESignalSetAppEditorCursor,ptr); |
|
425 |
|
426 delete []packedData; |
|
427 } |
|
428 |
|
429 // --------------------------------------------------------------------------- |
|
430 // CFepUiLayout::Destroy |
|
431 // Destroy the layout |
|
432 // (other items were commented in a header). |
|
433 // --------------------------------------------------------------------------- |
|
434 // |
|
435 EXPORT_C void CFepUiLayout::Destroy() |
|
436 { |
|
437 delete this; |
|
438 } |
|
439 |
|
440 // --------------------------------------------------------------------------- |
|
441 // CFepUiLayout::OnActivate |
|
442 // Response to layout activation |
|
443 // (other items were commented in a header). |
|
444 // --------------------------------------------------------------------------- |
|
445 // |
|
446 EXPORT_C void CFepUiLayout::OnActivate() |
|
447 { |
|
448 iLayoutReady = ETrue; |
|
449 iRootCtrl->OnActivate(); |
|
450 #ifdef RD_TACTILE_FEEDBACK |
|
451 iTactileSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback ); |
|
452 #endif // RD_TACTILE_FEEDBACK |
|
453 } |
|
454 |
|
455 // --------------------------------------------------------------------------- |
|
456 // CFepUiLayout::OnDeActivate |
|
457 // Response to layout de-activation |
|
458 // (other items were commented in a header). |
|
459 // --------------------------------------------------------------------------- |
|
460 // |
|
461 EXPORT_C void CFepUiLayout::OnDeActivate() |
|
462 { |
|
463 iLayoutReady = EFalse; |
|
464 iRootCtrl->OnDeActivate(); |
|
465 } |
|
466 // --------------------------------------------------------------------------- |
|
467 // CFepUiLayout::SetLayoutPos |
|
468 // Set layout position |
|
469 // (other items were commented in a header). |
|
470 // --------------------------------------------------------------------------- |
|
471 // |
|
472 EXPORT_C void CFepUiLayout::SetLayoutPos(const TPoint& aPt) |
|
473 { |
|
474 if(aPt != Position()) |
|
475 iLayoutOwner->SetPosition(aPt); |
|
476 } |
|
477 |
|
478 // --------------------------------------------------------------------------- |
|
479 // CFepUiLayout::EnableLayoutMoving |
|
480 // Enable that the layout can be dragged by a dragbar |
|
481 // (other items were commented in a header). |
|
482 // --------------------------------------------------------------------------- |
|
483 // |
|
484 EXPORT_C void CFepUiLayout::EnableLayoutMoving(CDragBar* aDragbar) |
|
485 { |
|
486 if(aDragbar && (iDragbarNum < KMaxDragBarNum)) |
|
487 { |
|
488 for(TInt i = 0; i < iDragbarNum; i++) |
|
489 { |
|
490 if(aDragbar == iDragbarList[i]) |
|
491 return; //do nothing if already there |
|
492 } |
|
493 iDragbarList[iDragbarNum] = aDragbar; |
|
494 iDragbarNum++; |
|
495 //set rootcontrol as an observer of the dragbar |
|
496 aDragbar->AddEventObserver(iRootCtrl); |
|
497 } |
|
498 } |
|
499 |
|
500 |
|
501 // --------------------------------------------------------------------------- |
|
502 // CFepUiLayout::SetShadowRect |
|
503 // Set layout's shadow rect |
|
504 // (other items were commented in a header). |
|
505 // --------------------------------------------------------------------------- |
|
506 // |
|
507 EXPORT_C void CFepUiLayout::SetShadowRect(const TRect& aRect) |
|
508 { |
|
509 iRootCtrl->SetShadowRect(aRect); |
|
510 } |
|
511 |
|
512 // --------------------------------------------------------------------------- |
|
513 // CFepUiLayout::SetShadowAreaRect |
|
514 // Set layout's shadow rect for an area |
|
515 // (other items were commented in a header). |
|
516 // --------------------------------------------------------------------------- |
|
517 // |
|
518 EXPORT_C void CFepUiLayout::SetShadowAreaRect(const TRect& aRect, |
|
519 TShadowBitmapIndex aIndex) |
|
520 { |
|
521 iRootCtrl->SetShadowAreaRect(aRect,aIndex); |
|
522 } |
|
523 |
|
524 // CFepUiLayout::SetShadowBmp |
|
525 // set layout's shadow bitmap |
|
526 // (other items were commented in a header). |
|
527 // --------------------------------------------------------------------------- |
|
528 // |
|
529 EXPORT_C void CFepUiLayout::SetShadowBmp(CFbsBitmap* aBmp,CFbsBitmap* aMaskBmp, |
|
530 TShadowBitmapIndex aIndex) |
|
531 { |
|
532 iRootCtrl->SetShadowBmp(aBmp,aMaskBmp,aIndex); |
|
533 } |
|
534 |
|
535 // CFepUiLayout::LockArea |
|
536 // Lock an area |
|
537 // (other items were commented in a header). |
|
538 // --------------------------------------------------------------------------- |
|
539 // |
|
540 EXPORT_C void CFepUiLayout::LockArea(const TRect& aRect, CFepUiBaseCtrl* aOwner) |
|
541 { |
|
542 iLockedArea = aRect; |
|
543 iLockedAreaOwner = aOwner; |
|
544 } |
|
545 |
|
546 // CFepUiLayout::UnLockArea |
|
547 // unlock an area |
|
548 // (other items were commented in a header). |
|
549 // --------------------------------------------------------------------------- |
|
550 // |
|
551 EXPORT_C void CFepUiLayout::UnLockArea(const TRect& /*aRect*/, |
|
552 CFepUiBaseCtrl* aCtrl) |
|
553 { |
|
554 if(aCtrl == iLockedAreaOwner) |
|
555 { |
|
556 iLockedArea.SetRect(0,0,0,0); |
|
557 } |
|
558 } |
|
559 // --------------------------------------------------------------------------- |
|
560 // CFepUiLayout::UpdateArea |
|
561 // Update layout area |
|
562 // (other items were commented in a header). |
|
563 // --------------------------------------------------------------------------- |
|
564 // |
|
565 EXPORT_C void CFepUiLayout::UpdateArea(const CFepUiBaseCtrl* aCtrl, |
|
566 const TRect& aRect,TBool aUpdateFlag,TBool aImmedFlag) |
|
567 { |
|
568 //do nothing if it's locked and aCtrl is not the owner. |
|
569 TBool bUpdate = ETrue; |
|
570 if(!iLockedArea.IsEmpty() ) |
|
571 { |
|
572 bUpdate = EFalse; |
|
573 if( iLockedAreaOwner == aCtrl ) |
|
574 { |
|
575 bUpdate = ETrue; |
|
576 } |
|
577 else if( iLockedAreaOwner->IsKindOfControl(ECtrlControlGroup) ) |
|
578 { |
|
579 CControlGroup* ctrlGroup = static_cast<CControlGroup*>(iLockedAreaOwner); |
|
580 if( ctrlGroup->ControlList().Find( aCtrl ) != KErrNotFound ) |
|
581 { |
|
582 bUpdate = ETrue; |
|
583 } |
|
584 } |
|
585 } |
|
586 if( bUpdate ) |
|
587 { |
|
588 if(iRootCtrl!=aCtrl) |
|
589 iRootCtrl->RedrawRectIfNeeded(aRect,const_cast<CFepUiBaseCtrl*>(aCtrl)); |
|
590 iLayoutOwner->UpdateArea(aRect,aUpdateFlag,aImmedFlag); |
|
591 } |
|
592 } |
|
593 |
|
594 // --------------------------------------------------------------------------- |
|
595 // CFepUiLayout::OnPointerEventOutsideLayout |
|
596 // Call back when the pointer down/up event happends outside of the layout |
|
597 // (other items were commented in a header). |
|
598 // --------------------------------------------------------------------------- |
|
599 // |
|
600 EXPORT_C TBool CFepUiLayout::OnPointerEventOutsideLayout( |
|
601 const TRawEvent& /*aEvent*/) |
|
602 { |
|
603 //doesn't process the event |
|
604 return EFalse; |
|
605 } |
|
606 |
|
607 // --------------------------------------------------------------------------- |
|
608 // CFepUiLayout::IsSemiTransparencyRequired |
|
609 // Tell whether this layout require trancparency |
|
610 // (other items were commented in a header). |
|
611 // --------------------------------------------------------------------------- |
|
612 // |
|
613 TBool CFepUiLayout::IsSemiTransparencyRequired(const RPointerArray<CFepUiBaseCtrl>& |
|
614 aCtrlList) |
|
615 { |
|
616 TBool ret = EFalse; |
|
617 for(TInt i = 0; i < aCtrlList.Count() && !ret; i++) |
|
618 { |
|
619 //is a control group? |
|
620 if(aCtrlList[i]->IsKindOfControl(ECtrlControlGroup)) |
|
621 { |
|
622 //check each control |
|
623 CControlGroup* ctrlGroup = static_cast<CControlGroup*>(aCtrlList[i]); |
|
624 ret = IsSemiTransparencyRequired(ctrlGroup->ControlList()); |
|
625 } |
|
626 else |
|
627 { |
|
628 if(aCtrlList[i]->IsKindOfControl(ECtrlTransparentHwrWnd)) |
|
629 { |
|
630 ret = ETrue; |
|
631 } |
|
632 } |
|
633 } |
|
634 return ret; |
|
635 } |
|
636 |
|
637 // --------------------------------------------------------------------------- |
|
638 // CFepUiLayout::SemiTransparencyRequired |
|
639 // Tell whether this layout require trancparency |
|
640 // (other items were commented in a header). |
|
641 // --------------------------------------------------------------------------- |
|
642 // |
|
643 EXPORT_C TBool CFepUiLayout::SemiTransparencyRequired() |
|
644 { |
|
645 return IsSemiTransparencyRequired(ControlList()); |
|
646 } |
|
647 |
|
648 // --------------------------------------------------------------------------- |
|
649 // CFepUiLayout::OnResourceChange |
|
650 // Handle system resource change |
|
651 // (other items were commented in a header). |
|
652 // --------------------------------------------------------------------------- |
|
653 // |
|
654 EXPORT_C TInt CFepUiLayout::OnResourceChange(TInt aType) |
|
655 { |
|
656 TInt err = KErrNone; |
|
657 switch(aType) |
|
658 { |
|
659 case KEikDynamicLayoutVariantSwitch: |
|
660 { |
|
661 TPixelsTwipsAndRotation ptSize; |
|
662 CCoeEnv::Static()->ScreenDevice()-> |
|
663 GetDefaultScreenSizeAndRotation(ptSize); |
|
664 iScreenSize = ptSize.iPixelSize; |
|
665 err = SizeChanged(&ptSize); |
|
666 } |
|
667 break; |
|
668 case KAknsMessageSkinChange: |
|
669 err = OnSkinChange(); |
|
670 default: |
|
671 break; |
|
672 } |
|
673 //let controls to handle resource change |
|
674 iRootCtrl->HandleResourceChange(aType); |
|
675 return err; |
|
676 |
|
677 } |
|
678 |
|
679 // --------------------------------------------------------------------------- |
|
680 // CFepUiLayout::SizeChanged |
|
681 // Handle screen size change |
|
682 // (other items were commented in a header). |
|
683 // --------------------------------------------------------------------------- |
|
684 // |
|
685 EXPORT_C TInt CFepUiLayout::SizeChanged(const TAny* /*aData*/) |
|
686 { |
|
687 //do nothing |
|
688 return KErrNone; |
|
689 } |
|
690 |
|
691 // --------------------------------------------------------------------------- |
|
692 // CFepUiLayout::OnSkinChange |
|
693 // Handle skin change |
|
694 // --------------------------------------------------------------------------- |
|
695 // |
|
696 EXPORT_C TInt CFepUiLayout::OnSkinChange() |
|
697 { |
|
698 //ask root control to handle skin change |
|
699 TRAP_IGNORE(iRootCtrl->ConstructFromResourceL()); |
|
700 return KErrNone; |
|
701 } |
|
702 |
|
703 |
|
704 |
|
705 // --------------------------------------------------------------------------- |
|
706 // CFepUiLayout::RegisterFeedbackArea |
|
707 // Register the feedback area |
|
708 // --------------------------------------------------------------------------- |
|
709 // |
|
710 EXPORT_C void CFepUiLayout::RegisterFeedbackArea(TInt aId,const TRect& aRect) |
|
711 { |
|
712 #ifdef RD_TACTILE_FEEDBACK |
|
713 TTactileFeedbackArea area= {aId,aRect,TRect(0,0,0,0)}; |
|
714 TPtrC data(reinterpret_cast<TUint16*>(&area),sizeof(area)/2); |
|
715 SignalOwner(ESignalRegisterFeedbackArea,data); |
|
716 #endif // RD_TACTILE_FEEDBACK |
|
717 } |
|
718 |
|
719 // --------------------------------------------------------------------------- |
|
720 // CFepUiLayout::RegisterFeedbackArea |
|
721 // Register the feedback area |
|
722 // Advanced Tactile feedback REQ417-47932 |
|
723 // --------------------------------------------------------------------------- |
|
724 // |
|
725 EXPORT_C void CFepUiLayout::RegisterFeedbackArea(TInt aId,const TRect& aRect, TInt aTactileType) |
|
726 { |
|
727 #ifdef RD_TACTILE_FEEDBACK |
|
728 TTactileFeedbackArea area= {aId,aRect,TRect(0,0,0,0),aTactileType}; |
|
729 TPtrC data(reinterpret_cast<TUint16*>(&area),sizeof(area)/2); |
|
730 SignalOwner(ESignalRegisterFeedbackArea,data); |
|
731 #endif // RD_TACTILE_FEEDBACK |
|
732 } |
|
733 |
|
734 // --------------------------------------------------------------------------- |
|
735 // CFepUiLayout::DeRegisterFeedbackArea |
|
736 // De-Register the feedback area |
|
737 // --------------------------------------------------------------------------- |
|
738 // |
|
739 EXPORT_C void CFepUiLayout::DeRegisterFeedbackArea(TInt aId,const TRect& aRect) |
|
740 { |
|
741 #ifdef RD_TACTILE_FEEDBACK |
|
742 TTactileFeedbackArea area= {aId,aRect,TRect(0,0,0,0)}; |
|
743 TPtrC data(reinterpret_cast<TUint16*>(&area),sizeof(area)/2); |
|
744 SignalOwner(ESignalDeRegisterFeedbackArea,data); |
|
745 #endif // RD_TACTILE_FEEDBACK |
|
746 } |
|
747 |
|
748 |
|
749 // --------------------------------------------------------------------------- |
|
750 // CFepUiLayout::ChangeFeedbackArea |
|
751 // De-Register the feedback area |
|
752 // --------------------------------------------------------------------------- |
|
753 // |
|
754 EXPORT_C void CFepUiLayout::ChangeFeedbackArea(TInt aId,const TRect& aNew, |
|
755 const TRect& aOld) |
|
756 { |
|
757 #ifdef RD_TACTILE_FEEDBACK |
|
758 if(aNew == aOld) |
|
759 return; |
|
760 |
|
761 TInt InvalidType = 0; |
|
762 TTactileFeedbackArea area= {aId,aNew,aOld,InvalidType}; |
|
763 TPtrC data(reinterpret_cast<TUint16*>(&area),sizeof(area)/2); |
|
764 SignalOwner(ESignalChangeFeedbackArea,data); |
|
765 #endif // RD_TACTILE_FEEDBACK |
|
766 } |
|
767 |
|
768 // --------------------------------------------------------------------------- |
|
769 // CFepUiLayout::ChangeFeedbackType |
|
770 // De-Register the feedback area |
|
771 // --------------------------------------------------------------------------- |
|
772 // |
|
773 |
|
774 EXPORT_C void CFepUiLayout::ChangeFeedbackType(TInt aId, TInt aNewTactileType) |
|
775 { |
|
776 #ifdef RD_TACTILE_FEEDBACK |
|
777 TTactileFeedbackArea area= {aId,TRect(0,0,0,0),TRect(0,0,0,0),aNewTactileType}; |
|
778 TPtrC data(reinterpret_cast<TUint16*>(&area),sizeof(area)/2); |
|
779 SignalOwner(ESignalChangeFeedbackType,data); |
|
780 #endif // RD_TACTILE_FEEDBACK |
|
781 } |
|
782 |
|
783 |
|
784 // --------------------------------------------------------------------------- |
|
785 // CFepUiLayout::SupportTactileFeedback |
|
786 // This function can be used to check, whether touch feedback is |
|
787 // supported at all in the device. |
|
788 // --------------------------------------------------------------------------- |
|
789 // |
|
790 EXPORT_C TBool CFepUiLayout::SupportTactileFeedback() |
|
791 { |
|
792 TBool tactileSupported; |
|
793 #ifdef RD_TACTILE_FEEDBACK |
|
794 tactileSupported = iTactileSupported; |
|
795 #endif // RD_TACTILE_FEEDBACK |
|
796 return tactileSupported; |
|
797 } |
|
798 |
|
799 // --------------------------------------------------------------------------- |
|
800 // CFepUiLayout::DoTactileFeedback |
|
801 // Gives instant feedback. |
|
802 // --------------------------------------------------------------------------- |
|
803 // |
|
804 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType) |
|
805 { |
|
806 #ifdef RD_TACTILE_FEEDBACK |
|
807 MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType); |
|
808 #endif // RD_TACTILE_FEEDBACK |
|
809 } |
|
810 |
|
811 // --------------------------------------------------------------------------- |
|
812 // CFepUiLayout::DoTactileFeedback |
|
813 // Gives instant feedback. |
|
814 // --------------------------------------------------------------------------- |
|
815 // |
|
816 EXPORT_C void CFepUiLayout::DoTactileFeedback(TInt aType, TBool aVibraEnable, TBool aAudioEnable) |
|
817 { |
|
818 #ifdef RD_TACTILE_FEEDBACK |
|
819 if (aAudioEnable && aVibraEnable) |
|
820 { |
|
821 MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType); |
|
822 } |
|
823 else |
|
824 { |
|
825 TBool vibraEnabled = MTouchFeedback::Instance()->FeedbackEnabledForThisApp( ETouchFeedbackVibra ); |
|
826 TBool audioEnabled = MTouchFeedback::Instance()->FeedbackEnabledForThisApp( ETouchFeedbackAudio ); |
|
827 |
|
828 MTouchFeedback::Instance()->SetFeedbackEnabledForThisApp(aVibraEnable, aAudioEnable); |
|
829 MTouchFeedback::Instance()->InstantFeedback((TTouchLogicalFeedback)aType); |
|
830 MTouchFeedback::Instance()->SetFeedbackEnabledForThisApp(vibraEnabled, audioEnabled); |
|
831 } |
|
832 #endif // RD_TACTILE_FEEDBACK |
|
833 } |
|
834 |
|
835 // --------------------------------------------------------------------------- |
|
836 // CFepUiLayout::GetEnabledPluginMode |
|
837 // --------------------------------------------------------------------------- |
|
838 // |
|
839 EXPORT_C TInt CFepUiLayout::GetEnabledPluginMode( ) |
|
840 { |
|
841 |
|
842 TInt mode = 0; |
|
843 TPtrC data( reinterpret_cast<TUint16*>(&mode) ,sizeof( TInt )/sizeof( TUint16) ); |
|
844 |
|
845 iLayoutOwner->SignalOwner( ESignalGetAllowedInputMode,data ); |
|
846 |
|
847 return mode; |
|
848 } |
|
849 |
|
850 // --------------------------------------------------------------------------- |
|
851 // CFepUiLayout::HandleAppInfoChange |
|
852 // --------------------------------------------------------------------------- |
|
853 // |
|
854 EXPORT_C void CFepUiLayout::HandleAppInfoChange(const TDesC& /*aInfo*/, |
|
855 TPeninputAppInfo /*aType*/) |
|
856 { |
|
857 //do nothing |
|
858 } |
|
859 |
|
860 // --------------------------------------------------------------------------- |
|
861 // CFepUiLayout::SetPositionFromOutside |
|
862 // --------------------------------------------------------------------------- |
|
863 // |
|
864 EXPORT_C void CFepUiLayout::SetPositionFromOutside(const TPoint& /*aNewPos*/) |
|
865 { |
|
866 //do nothing |
|
867 } |
|
868 |
|
869 EXPORT_C CFepUiCursor* CFepUiLayout::CreateCursor() |
|
870 { |
|
871 return iRootCtrl->CreateCursor(); |
|
872 } |
|
873 //end of file |