35 #include "xnodt.h" |
35 #include "xnodt.h" |
36 #include "xnproperty.h" |
36 #include "xnproperty.h" |
37 #include "xnnodeimpl.h" |
37 #include "xnnodeimpl.h" |
38 #include "xnnode.h" |
38 #include "xnnode.h" |
39 #include "xntype.h" |
39 #include "xntype.h" |
40 #include "xnbgcontrol.h" |
|
41 #include "xnfocuscontrol.h" |
40 #include "xnfocuscontrol.h" |
42 #include "xneditor.h" |
41 #include "xneditor.h" |
43 #include "xnbackgroundmanager.h" |
42 #include "xnbackgroundmanager.h" |
44 |
43 |
45 #include "xnviewadapter.h" |
44 #include "xnviewadapter.h" |
246 |
245 |
247 // Base class CAknViewAppUi takes ownership of iViewAdapter |
246 // Base class CAknViewAppUi takes ownership of iViewAdapter |
248 iAppUiAdapter.AddViewL( this ); |
247 iAppUiAdapter.AddViewL( this ); |
249 iAppUiAdapter.SetDefaultViewL( *this ); |
248 iAppUiAdapter.SetDefaultViewL( *this ); |
250 |
249 |
251 iBgControl = CXnBgControl::NewL(); |
|
252 iBgControl->SetMopParent( this ); |
|
253 |
|
254 iBgManager = CXnBackgroundManager::NewL( iAppUiAdapter.ViewManager(), |
250 iBgManager = CXnBackgroundManager::NewL( iAppUiAdapter.ViewManager(), |
255 iAppUiAdapter.ViewManager().Editor().HspsWrapper() ); |
251 iAppUiAdapter.ViewManager().Editor().HspsWrapper() ); |
256 |
252 |
257 iFocusControl = CXnFocusControl::NewL( iAppUiAdapter ); |
253 iFocusControl = CXnFocusControl::NewL( iAppUiAdapter ); |
258 |
254 |
324 { |
320 { |
325 return iEventDispatcher; |
321 return iEventDispatcher; |
326 } |
322 } |
327 |
323 |
328 // ----------------------------------------------------------------------------- |
324 // ----------------------------------------------------------------------------- |
329 // CXnViewAdapter::BgControl |
|
330 // Returns bg control. |
|
331 // ----------------------------------------------------------------------------- |
|
332 // |
|
333 CCoeControl& CXnViewAdapter::BgControl() const |
|
334 { |
|
335 return *iBgControl; |
|
336 } |
|
337 |
|
338 // ----------------------------------------------------------------------------- |
|
339 // CXnViewAdapter::BgManager |
325 // CXnViewAdapter::BgManager |
340 // Returns background manager. |
326 // Returns background manager. |
341 // ----------------------------------------------------------------------------- |
327 // ----------------------------------------------------------------------------- |
342 // |
328 // |
343 CXnBackgroundManager& CXnViewAdapter::BgManager() const |
329 CXnBackgroundManager& CXnViewAdapter::BgManager() const |
344 { |
330 { |
345 return *iBgManager; |
331 return *iBgManager; |
346 } |
332 } |
347 |
333 |
348 // ----------------------------------------------------------------------------- |
334 // ----------------------------------------------------------------------------- |
349 // CXnViewAdapter::BgControl |
335 // CXnViewAdapter::FocusControl |
350 // Returns focus control. |
336 // Returns focus control. |
351 // ----------------------------------------------------------------------------- |
337 // ----------------------------------------------------------------------------- |
352 // |
338 // |
353 CXnFocusControl& CXnViewAdapter::FocusControl() const |
339 CXnFocusControl& CXnViewAdapter::FocusControl() const |
354 { |
340 { |
384 |
370 |
385 iFlags.Set( EIsActivated ); |
371 iFlags.Set( EIsActivated ); |
386 |
372 |
387 iAppUiAdapter.AddToStackL( *this, iEventDispatcher ); |
373 iAppUiAdapter.AddToStackL( *this, iEventDispatcher ); |
388 |
374 |
|
375 // enable statuspane transparancy |
|
376 CEikStatusPane* sp( iAppUiAdapter.StatusPane() ); |
|
377 |
389 CEikButtonGroupContainer* bgc( iAppUiAdapter.Cba() ); |
378 CEikButtonGroupContainer* bgc( iAppUiAdapter.Cba() ); |
390 |
379 |
391 if ( bgc ) |
380 if ( bgc ) |
392 { |
381 { |
393 // EventDispatcher will handle sotkey keyevents |
382 // EventDispatcher will handle sotkey keyevents |
394 CEikCba* cba( |
383 CEikCba* cba( |
395 static_cast< CEikCba* >( bgc->ButtonGroup() ) ); |
384 static_cast< CEikCba* >( bgc->ButtonGroup() ) ); |
396 |
385 |
397 iAppUiAdapter.RemoveFromStack( cba ); |
386 iAppUiAdapter.RemoveFromStack( cba ); |
398 } |
387 } |
399 |
388 |
400 iBgControl->MakeVisible( ETrue ); |
|
401 iBgManager->MakeVisible( ETrue ); |
389 iBgManager->MakeVisible( ETrue ); |
402 |
390 |
403 // Set status pane layout |
391 // Set status pane layout |
404 CXnViewData& viewData( iAppUiAdapter.ViewManager().ActiveViewData() ); |
392 CXnViewData& viewData( iAppUiAdapter.ViewManager().ActiveViewData() ); |
405 CXnProperty* prop( viewData.Node()->LayoutNode()->GetPropertyL( |
393 CXnProperty* prop( viewData.Node()->LayoutNode()->GetPropertyL( |
408 // Is there status pane declaration available |
396 // Is there status pane declaration available |
409 TInt spane( DetermineStatusPaneLayout( prop ) ); |
397 TInt spane( DetermineStatusPaneLayout( prop ) ); |
410 |
398 |
411 if ( spane != KErrNotFound ) |
399 if ( spane != KErrNotFound ) |
412 { |
400 { |
413 CEikStatusPane* sp( iAppUiAdapter.StatusPane() ); |
|
414 |
|
415 if ( sp && sp->CurrentLayoutResId() != spane ) |
401 if ( sp && sp->CurrentLayoutResId() != spane ) |
416 { |
402 { |
417 sp->SwitchLayoutL( spane ); |
403 sp->SwitchLayoutL( spane ); |
418 sp->ApplyCurrentSettingsL(); |
404 sp->ApplyCurrentSettingsL(); |
419 } |
405 } |
420 } |
406 } |
421 |
407 |
|
408 if ( sp && !sp->IsTransparent() ) |
|
409 { |
|
410 sp->EnableTransparent( ETrue ); |
|
411 sp->DrawNow(); |
|
412 } |
|
413 |
422 if ( iFlags.IsSet( EIsFirstActivation ) ) |
414 if ( iFlags.IsSet( EIsFirstActivation ) ) |
423 { |
415 { |
424 // Set the active container |
416 // Set the active container |
425 ActivateContainerL( iAppUiAdapter.ViewManager().ActiveViewData() ); |
417 ActivateContainerL( iAppUiAdapter.ViewManager().ActiveViewData() ); |
426 |
418 |
495 |
487 |
496 iAppUiAdapter.RemoveFromStack( iEventDispatcher ); |
488 iAppUiAdapter.RemoveFromStack( iEventDispatcher ); |
497 |
489 |
498 TRAP_IGNORE( DeactivateContainerL() ); |
490 TRAP_IGNORE( DeactivateContainerL() ); |
499 |
491 |
500 iBgControl->MakeVisible( EFalse ); |
|
501 iBgManager->MakeVisible( EFalse ); |
492 iBgManager->MakeVisible( EFalse ); |
502 |
493 |
503 iFocusControl->MakeVisible( EFalse ); |
494 iFocusControl->MakeVisible( EFalse ); |
504 |
495 |
505 iFlags.Clear( EIsActivated ); |
496 iFlags.Clear( EIsActivated ); |
512 // Activates container |
503 // Activates container |
513 // ----------------------------------------------------------------------------- |
504 // ----------------------------------------------------------------------------- |
514 // |
505 // |
515 void CXnViewAdapter::ActivateContainerL( CXnViewData& aContainer, |
506 void CXnViewAdapter::ActivateContainerL( CXnViewData& aContainer, |
516 TBool aEnterEditState ) |
507 TBool aEnterEditState ) |
517 { |
508 { |
518 if ( iContainer == &aContainer || iFlags.IsSet( EIsDestructionRunning ) ) |
509 if ( !iAppUiAdapter.ViewManager().UiStartupPhaseAllDone() ) |
|
510 { |
|
511 return; |
|
512 } |
|
513 |
|
514 if ( iContainer == &aContainer || iFlags.IsSet( EIsDestructionRunning ) ) |
519 { |
515 { |
520 return; |
516 return; |
521 } |
517 } |
522 |
518 |
|
519 const CXnViewData* previous( iContainer ); |
|
520 |
523 // Deactivate previous |
521 // Deactivate previous |
524 DeactivateContainerL(); |
522 DeactivateContainerL(); |
525 |
523 |
526 if ( iFlags.IsClear( EIsActivated ) ) |
524 if ( iFlags.IsClear( EIsActivated ) ) |
527 { |
525 { |
528 // Some other view than this in this appui is currently active, |
526 // Some other view than this in this appui is currently active, |
529 // postpone container activation |
527 // postpone container activation |
530 return; |
528 return; |
531 } |
529 } |
532 |
530 |
533 // Update |
531 // Update |
534 iContainer = &aContainer; |
532 iContainer = &aContainer; |
535 |
533 |
536 // Disable layout and redraw until container activation is done |
534 // Disable layout and redraw until container activation is done |
537 iAppUiAdapter.UiEngine().DisableRenderUiLC(); |
535 iAppUiAdapter.UiEngine().DisableRenderUiLC(); |
538 |
536 |
553 iFlags.Clear( EIsInCall ); |
551 iFlags.Clear( EIsInCall ); |
554 |
552 |
555 // This container is in-call state |
553 // This container is in-call state |
556 NotifyInCallStateChaged( ETrue ); |
554 NotifyInCallStateChaged( ETrue ); |
557 } |
555 } |
558 |
556 |
|
557 if ( aEnterEditState || iAppUiAdapter.UiEngine().IsEditMode() ) |
|
558 { |
|
559 EnterEditStateL( aContainer, ETrue ); |
|
560 } |
|
561 else |
|
562 { |
|
563 EnterEditStateL( aContainer, EFalse ); |
|
564 } |
|
565 |
559 iAppUiAdapter.ViewManager().NotifyContainerChangedL( aContainer ); |
566 iAppUiAdapter.ViewManager().NotifyContainerChangedL( aContainer ); |
560 |
567 |
561 if ( aEnterEditState || iAppUiAdapter.UiEngine().IsEditMode() ) |
568 if ( previous && iContainer ) |
562 { |
569 { |
563 EnterEditStateL( aContainer, ETrue ); |
570 iBgManager->WallpaperChanged( *previous, *iContainer ); |
564 } |
|
565 else |
|
566 { |
|
567 EnterEditStateL( aContainer, EFalse ); |
|
568 } |
571 } |
569 |
572 |
570 CXnControlAdapter* adapter( node->Control() ); |
573 CXnControlAdapter* adapter( node->Control() ); |
571 |
574 adapter->MakeVisible( ETrue ); |
572 iBgControl->SetCompoundControl( adapter ); |
575 |
573 |
|
574 iAppUiAdapter.UiEngine().RenderUIL(); |
576 iAppUiAdapter.UiEngine().RenderUIL(); |
575 |
577 |
576 CleanupStack::PopAndDestroy(); // DisableRenderUiLC |
578 CleanupStack::PopAndDestroy(); // DisableRenderUiLC |
577 } |
579 } |
578 |
580 |
579 // ----------------------------------------------------------------------------- |
581 // ----------------------------------------------------------------------------- |
580 // CXnViewAdapter::ActivateDefaultContainerL |
582 // CXnViewAdapter::ActivateDefaultContainerL |
581 // Activates default container |
583 // Activates default container |
819 CleanupStack::PopAndDestroy( &controls ); |
822 CleanupStack::PopAndDestroy( &controls ); |
820 } |
823 } |
821 } |
824 } |
822 |
825 |
823 // ----------------------------------------------------------------------------- |
826 // ----------------------------------------------------------------------------- |
824 // CXnViewAdapter::UpdateRskByModeL() |
827 // CXnViewAdapter::UpdateRskByUiStateL() |
825 // |
828 // |
826 // ----------------------------------------------------------------------------- |
829 // ----------------------------------------------------------------------------- |
827 // |
830 // |
828 void CXnViewAdapter::UpdateRskByModeL() |
831 void CXnViewAdapter::UpdateRskByUiStateL( const CXnViewData& aViewData ) |
829 { |
832 { |
830 CXnNode* menubar( iAppUiAdapter.UiEngine().MenuBarNode() ); |
833 CXnNode* menubar( NULL ); |
|
834 |
|
835 CXnDomNode* view( aViewData.Node() ); |
|
836 |
|
837 if ( view && view->LayoutNode() ) |
|
838 { |
|
839 RPointerArray< CXnNode >& children( view->LayoutNode()->Children() ); |
|
840 |
|
841 for ( TInt count = children.Count() - 1; count >= 0 ; --count ) |
|
842 { |
|
843 CXnNode* node( children[count] ); |
|
844 |
|
845 // Check that the given type of a control is parent |
|
846 // (or ancestor) of this control |
|
847 const TDesC8& type( node->Type()->Type() ); |
|
848 |
|
849 if ( type == KMenuBar ) |
|
850 { |
|
851 menubar = node; |
|
852 break; |
|
853 } |
|
854 } |
|
855 } |
831 |
856 |
832 if( menubar ) |
857 if( menubar ) |
833 { |
858 { |
834 const TDesC8* state( NULL ); |
859 const TDesC8* state( NULL ); |
835 |
860 |
863 if( ( mode && *state == mode->StringValue() ) && |
888 if( ( mode && *state == mode->StringValue() ) && |
864 ( type && type->StringValue().Compare( XnPropertyNames::softkey::type::KRight ) == 0 ) ) |
889 ( type && type->StringValue().Compare( XnPropertyNames::softkey::type::KRight ) == 0 ) ) |
865 { |
890 { |
866 menuIf->SetSoftKeyL( &node->PluginIfL() , XnMenuInterface::MXnMenuInterface::ERight ); |
891 menuIf->SetSoftKeyL( &node->PluginIfL() , XnMenuInterface::MXnMenuInterface::ERight ); |
867 node->SetDirtyL( XnDirtyLevel::ERender ); |
892 node->SetDirtyL( XnDirtyLevel::ERender ); |
|
893 |
|
894 TRAP_IGNORE( iAppUiAdapter.UiEngine().RefreshMenuL() ); |
868 } |
895 } |
869 } |
896 } |
870 } |
897 } |
871 } |
898 } |
872 } |
899 } |