webengine/osswebengine/WebKit/s60/webview/WebPageFullScreenHandler.cpp
branchRCL_3
changeset 49 919f36ff910f
parent 48 79859ed3eea9
equal deleted inserted replaced
48:79859ed3eea9 49:919f36ff910f
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include <../bidi.h>
    20 #include <../bidi.h>
    21 #include <aknappui.h>
    21 #include <aknAppUi.h>
    22 #include <AknUtils.h>
    22 #include <aknutils.h>
    23 #include "StaticObjectsContainer.h"
    23 #include "StaticObjectsContainer.h"
    24 #include "WebCannedImages.h"
    24 #include "WebCannedImages.h"
    25 #include "WebPageFullScreenHandler.h"
    25 #include "WebPageFullScreenHandler.h"
    26 #include "WebView.h"
    26 #include "WebView.h"
    27 #include "BrCtl.h"
    27 #include "BrCtl.h"
    28 
    28 
    29 using namespace WebCore;
    29 using namespace WebCore;
    30 
    30 
    31 const int KFullScreenButtonHeight = 60;
    31 const int KFullScreenButtonOffset = 50;
    32 const int KFullScreenButtonWidth = 60;
    32 const int KFullScreenButtonBuff  = 15;
    33 const int KFullScreenButtonBuff  = 5;
       
    34 
    33 
    35 // -----------------------------------------------------------------------------
    34 // -----------------------------------------------------------------------------
    36 // WebPageFullScreenHandler::NewL
    35 // WebPageFullScreenHandler::NewL
    37 // The two-phase Symbian constructor
    36 // The two-phase Symbian constructor
    38 // -----------------------------------------------------------------------------
    37 // -----------------------------------------------------------------------------
    64 void WebPageFullScreenHandler::ConstructL()
    63 void WebPageFullScreenHandler::ConstructL()
    65 {
    64 {
    66     m_buttonIcon = StaticObjectsContainer::instance()->webCannedImages()->getImage(WebCannedImages::EImageEscFullScreen);
    65     m_buttonIcon = StaticObjectsContainer::instance()->webCannedImages()->getImage(WebCannedImages::EImageEscFullScreen);
    67     TPoint pos = CalculatePosition();
    66     TPoint pos = CalculatePosition();
    68     BaseConstructL(m_webView, pos, m_buttonIcon.m_img, m_buttonIcon.m_msk, ETrue);
    67     BaseConstructL(m_webView, pos, m_buttonIcon.m_img, m_buttonIcon.m_msk, ETrue);
       
    68      if (AknLayoutUtils::PenEnabled()) {
       
    69          DrawableWindow()->SetPointerGrab(ETrue);
       
    70      }
    69     Hide();   
    71     Hide();   
    70 }
    72 }
    71 
    73 
    72 // -----------------------------------------------------------------------------
    74 // -----------------------------------------------------------------------------
    73 // Destructor
    75 // Destructor
    85     
    87     
    86     pos -= iconSize;
    88     pos -= iconSize;
    87     pos -= TPoint(KFullScreenButtonBuff, KFullScreenButtonBuff);
    89     pos -= TPoint(KFullScreenButtonBuff, KFullScreenButtonBuff);
    88     //pos -= m_webView->PositionRelativeToScreen();
    90     //pos -= m_webView->PositionRelativeToScreen();
    89     return pos;
    91     return pos;
       
    92 }
       
    93 
       
    94 TSize WebPageFullScreenHandler::CalculateSize()
       
    95 {
       
    96     TSize size = m_buttonIcon.m_img->SizeInPixels();
       
    97     size += TSize(KFullScreenButtonBuff, KFullScreenButtonBuff);
       
    98     return size;
    90 }
    99 }
    91 
   100 
    92 //-------------------------------------------------------------------------------
   101 //-------------------------------------------------------------------------------
    93 // WebPageFullScreenHandler::showEscBtnL
   102 // WebPageFullScreenHandler::showEscBtnL
    94 // Draws the full screen button on the screen
   103 // Draws the full screen button on the screen
   121 void WebPageFullScreenHandler::SizeChanged(void)
   130 void WebPageFullScreenHandler::SizeChanged(void)
   122 {
   131 {
   123     if (AknLayoutUtils::PenEnabled()) {
   132     if (AknLayoutUtils::PenEnabled()) {
   124         TPoint pos = CalculatePosition();
   133         TPoint pos = CalculatePosition();
   125         SetPos(pos);
   134         SetPos(pos);
       
   135         TSize size = CalculateSize();
       
   136         SetSizeWithoutNotification(size);
   126     }
   137     }
   127 }
   138 }
   128 
   139 
   129 //-------------------------------------------------------------------------------
   140 //-------------------------------------------------------------------------------
   130 // WebPageFullScreenHandler::fullScreenMode
   141 // WebPageFullScreenHandler::fullScreenMode
   145            m_isTouchDown = ETrue;
   156            m_isTouchDown = ETrue;
   146            break;
   157            break;
   147 
   158 
   148        case TPointerEvent::EButton1Up:
   159        case TPointerEvent::EButton1Up:
   149            {
   160            {
   150            if (m_isTouchDown) {
   161            	TPoint fsPostion = PositionRelativeToScreen();
   151                Hide();
   162             TRect fsRect = TRect(fsPostion,Size());
   152                m_webView->notifyFullscreenModeChangeL( false );
   163             fsRect = TRect(fsRect.iTl - TPoint(KFullScreenButtonOffset,KFullScreenButtonOffset), fsRect.iBr);
   153            }
   164            	TPoint pointerPosition = fsPostion + aPointerEvent.iPosition;
   154            m_isTouchDown = EFalse;
   165            	if( fsRect.Contains(pointerPosition))
       
   166            	{
       
   167              if (m_isTouchDown) {
       
   168                   Hide();
       
   169                   m_webView->notifyFullscreenModeChangeL( false );
       
   170                }
       
   171                m_isTouchDown = EFalse;
       
   172             }
   155            }
   173            }
   156            break;          
   174            break;          
   157         }       
   175         }       
   158 }
   176 }
   159 
   177