javauis/eswt_akn/eswtdirectcontent/native/src/swtdccontrol.cpp
branchRCL_3
changeset 60 6c158198356e
parent 25 9ac0a0a7da70
equal deleted inserted replaced
59:e5618cc85d74 60:6c158198356e
    37 
    37 
    38 enum TDcEvent
    38 enum TDcEvent
    39 {
    39 {
    40     ERedraw,
    40     ERedraw,
    41     ESetFullScreen,
    41     ESetFullScreen,
    42     EUpdateFullScreen
    42     EUpdateFullScreen,
       
    43     EFixUIOrientation,
       
    44     EUnFixUIOrientation
    43 };
    45 };
    44 
    46 
    45 ///////////////////////////////////////////////////////////////////////////////
    47 ///////////////////////////////////////////////////////////////////////////////
    46 CSwtDCControl::CSwtDCControl(MSwtDisplay& aDisplay,
    48 CSwtDCControl::CSwtDCControl(MSwtDisplay& aDisplay,
    47                              TSwtPeer aPeer,
    49                              TSwtPeer aPeer,
    51 #ifdef SWTDCCONTROL_DSA_ENABLED
    53 #ifdef SWTDCCONTROL_DSA_ENABLED
    52         , iDSAccess(NULL)
    54         , iDSAccess(NULL)
    53         , iDsaWasStartedAlready(EFalse)
    55         , iDsaWasStartedAlready(EFalse)
    54 #endif
    56 #endif
    55         , iDcObserver(NULL)
    57         , iDcObserver(NULL)
       
    58         , iFixedOrientationSet(EFalse)
    56 {
    59 {
    57     SetFocusing(EFalse);
    60     SetFocusing(EFalse);
    58 }
    61 }
    59 
    62 
    60 CSwtDCControl::~CSwtDCControl()
    63 CSwtDCControl::~CSwtDCControl()
    81 
    84 
    82     if (iDcObserver)
    85     if (iDcObserver)
    83     {
    86     {
    84         delete iDcObserver;
    87         delete iDcObserver;
    85         iDcObserver = NULL;
    88         iDcObserver = NULL;
       
    89     }
       
    90 
       
    91     if (iFixedOrientationSet)
       
    92     {
       
    93         iDisplay.UiUtils().UnRegisterFixScreenOrientation();
       
    94         iFixedOrientationSet = EFalse;
    86     }
    95     }
    87 
    96 
    88     DEBUG("CSwtDCControl::~CSwtDCControl()-");
    97     DEBUG("CSwtDCControl::~CSwtDCControl()-");
    89 }
    98 }
    90 
    99 
   541 TRect CSwtDCControl::MdcContainerWindowRect() const
   550 TRect CSwtDCControl::MdcContainerWindowRect() const
   542 {
   551 {
   543     return GetShell().Control()->GetBounds();
   552     return GetShell().Control()->GetBounds();
   544 }
   553 }
   545 
   554 
       
   555 void CSwtDCControl::MdcFixUIOrientation(TBool aEnableFix)
       
   556 {
       
   557     if (aEnableFix)
       
   558     {
       
   559         iDcObserver->InvokeDcEvent(*this, EFixUIOrientation);
       
   560     }
       
   561     else
       
   562     {
       
   563         iDcObserver->InvokeDcEvent(*this, EUnFixUIOrientation);
       
   564     }
       
   565 }
       
   566 
   546 #ifdef SWTDCCONTROL_DSA_ENABLED
   567 #ifdef SWTDCCONTROL_DSA_ENABLED
   547 void CSwtDCControl::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/)
   568 void CSwtDCControl::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/)
   548 {
   569 {
   549     // DSA needs to be started in order to get correct drawing region
   570     // DSA needs to be started in order to get correct drawing region
   550     TRAPD(err, iDSAccess->StartL());
   571     TRAPD(err, iDSAccess->StartL());
   797  * the framebuffer of content is NULL.
   818  * the framebuffer of content is NULL.
   798  */
   819  */
   799 TBool CSwtDCControl::IsFrameBufferUsed() const
   820 TBool CSwtDCControl::IsFrameBufferUsed() const
   800 {
   821 {
   801     return iContent && iContent->MdcFrameBuffer() != 0;
   822     return iContent && iContent->MdcFrameBuffer() != 0;
       
   823 }
       
   824 
       
   825 void CSwtDCControl::FixUIOrientation()
       
   826 {
       
   827     if (!iFixedOrientationSet)
       
   828     {
       
   829         iDisplay.UiUtils().RegisterFixScreenOrientation();
       
   830         iFixedOrientationSet = ETrue;
       
   831     }
       
   832 }
       
   833 
       
   834 void CSwtDCControl::UnFixUIOrientation()
       
   835 {
       
   836     if (iFixedOrientationSet)
       
   837     {
       
   838         iDisplay.UiUtils().UnRegisterFixScreenOrientation();
       
   839         iFixedOrientationSet = EFalse;
       
   840     }
   802 }
   841 }
   803 
   842 
   804 /**
   843 /**
   805  * Receives asynchronous events from iDcObserver
   844  * Receives asynchronous events from iDcObserver
   806  */
   845  */
   815         SetFullScreenState();
   854         SetFullScreenState();
   816         break;
   855         break;
   817     case EUpdateFullScreen:
   856     case EUpdateFullScreen:
   818         UpdateFullScreenState();
   857         UpdateFullScreenState();
   819         break;
   858         break;
       
   859     case EFixUIOrientation:
       
   860         FixUIOrientation();
       
   861         break;
       
   862     case EUnFixUIOrientation:
       
   863         UnFixUIOrientation();
       
   864         break;
   820     }
   865     }
   821 }
   866 }
   822 
   867 
   823 // End of file
   868 // End of file