webengine/osswebengine/WebKit/s60/webview/WebCursor.cpp
changeset 15 60c5402cb945
parent 11 c8a366e56285
child 35 1f3c3f2f5b0a
equal deleted inserted replaced
11:c8a366e56285 15:60c5402cb945
   200 // -----------------------------------------------------------------------------
   200 // -----------------------------------------------------------------------------
   201 void WebCursor::setCursor(CursorTypes type)
   201 void WebCursor::setCursor(CursorTypes type)
   202 {
   202 {
   203     
   203     
   204     m_type = type;
   204     m_type = type;
   205     if (m_visible && (m_view->brCtl()->settings()->getNavigationType() == SettingsContainer::NavigationTypeCursor)) {
   205     if (m_visible) {
   206         CFbsBitmap*  img = NULL;
   206         CFbsBitmap*  img = NULL;
   207         CFbsBitmap*  msk = NULL;
   207         CFbsBitmap*  msk = NULL;
   208         switch( type )
   208         switch( type )
   209             {
   209             {
   210             case PointerCursor:
   210             case PointerCursor:
   262 // -----------------------------------------------------------------------------
   262 // -----------------------------------------------------------------------------
   263 void WebCursor::cursorUpdate(bool visible)
   263 void WebCursor::cursorUpdate(bool visible)
   264 {
   264 {
   265     if (!m_view || !m_view->brCtl() || !m_view->brCtl()->settings())
   265     if (!m_view || !m_view->brCtl() || !m_view->brCtl()->settings())
   266         return;
   266         return;
       
   267 
       
   268     bool tabbedNavigation = (m_view->brCtl()->settings()->getNavigationType() == SettingsContainer::NavigationTypeTabbed);
       
   269     bool navigationNone = (m_view->brCtl()->settings()->getNavigationType() == SettingsContainer::NavigationTypeNone); 
       
   270     bool cursorNavigation = (m_view->brCtl()->settings()->getNavigationType() == SettingsContainer::NavigationTypeCursor);
       
   271     TBrCtlDefs::TBrCtlElementType elType = m_view->focusedElementType();
   267     //If cursor show mode defined inside cenrep key is no cursor shown in non-tab navigation mode,
   272     //If cursor show mode defined inside cenrep key is no cursor shown in non-tab navigation mode,
   268     //then no need to update the cursor
   273     //then no need to update the cursor
   269     if (m_view->brCtl()->settings()->getNavigationType() != SettingsContainer:: NavigationTypeTabbed &&
   274     if (!tabbedNavigation &&
   270             (m_view->brCtl()->settings()->brctlSetting(TBrCtlDefs::ESettingsCursorShowMode) == TBrCtlDefs::ENoCursor))
   275          (m_view->brCtl()->settings()->brctlSetting(TBrCtlDefs::ESettingsCursorShowMode) == TBrCtlDefs::ENoCursor))
   271         return;
   276         return;
   272     if ( m_view->showCursor() ) {
   277 
   273         m_visible = visible && ((m_view->brCtl()->settings()->getNavigationType() == SettingsContainer::NavigationTypeCursor)|| m_view->focusedElementType() == TBrCtlDefs::EElementSelectMultiBox); // check for tabbedNavigation here because it is called from so many places.
   278     m_visible = visible && ((cursorNavigation && m_view->showCursor()) || 
   274     }
   279                             (tabbedNavigation && (elType == TBrCtlDefs::EElementSelectMultiBox)));
   275 
   280 
   276     resetTransparency();
   281     resetTransparency();
   277     CursorTypes type = PointerCursor;
   282     CursorTypes type = PointerCursor;    
   278     TBrCtlDefs::TBrCtlElementType elType = m_view->focusedElementType();
       
   279 
       
   280     if (m_visible) {
   283     if (m_visible) {
   281         if      (    elType == TBrCtlDefs::EElementNone
   284         if      (    elType == TBrCtlDefs::EElementNone
   282                   || elType == TBrCtlDefs::EElementImageBox
   285                   || elType == TBrCtlDefs::EElementImageBox
   283                   || elType == TBrCtlDefs::EElementBrokenImage )
   286                   || elType == TBrCtlDefs::EElementBrokenImage )
   284             type = PointerCursor;
   287             type = PointerCursor;
   285         else if (    elType == TBrCtlDefs::EElementSmartLinkTel
   288         else if (    elType == TBrCtlDefs::EElementSmartLinkTel
   286                   || elType == TBrCtlDefs::EElementSmartLinkEmail )
   289                   || elType == TBrCtlDefs::EElementSmartLinkEmail )
   287             type = IBeamCursor;
   290             type = IBeamCursor;
   288         else if (    elType == TBrCtlDefs::EElementSelectMultiBox && m_view->brCtl()->settings()->getNavigationType() == SettingsContainer::NavigationTypeTabbed)
   291         else if (    elType == TBrCtlDefs::EElementSelectMultiBox && tabbedNavigation)
   289             type = SelectMultiCursor;
   292             type = SelectMultiCursor;
   290         else
   293         else
   291             type = HandCursor;
   294             type = HandCursor;
   292     }
   295     }
   293 
   296 
   362 // -----------------------------------------------------------------------------
   365 // -----------------------------------------------------------------------------
   363 void WebCursor::setOpaqueUntil(int microsecs)
   366 void WebCursor::setOpaqueUntil(int microsecs)
   364     {
   367     {
   365     setTransparent(false);
   368     setTransparent(false);
   366     m_transtimer->Cancel();
   369     m_transtimer->Cancel();
   367     m_transtimer->Start(microsecs,0,TCallBack(TransparencyTimerCb,this));
   370     
   368     }
   371     if (m_visible)
       
   372         {
       
   373         m_transtimer->Start(microsecs,0,TCallBack(TransparencyTimerCb,this));
       
   374         }
       
   375     }
       
   376 
       
   377 void WebCursor::stopTransparencyTimer()
       
   378     {
       
   379     if (m_transtimer && m_transtimer->IsActive())
       
   380         {
       
   381         m_transtimer->Cancel();
       
   382         }
       
   383     }
       
   384 
   369 
   385 
   370 // -----------------------------------------------------------------------------
   386 // -----------------------------------------------------------------------------
   371 // WebCursor::increaseTransparencyMoveCount
   387 // WebCursor::increaseTransparencyMoveCount
   372 // -----------------------------------------------------------------------------
   388 // -----------------------------------------------------------------------------
   373 void WebCursor::increaseTransparencyMoveCount()
   389 void WebCursor::increaseTransparencyMoveCount()
   501     TRect pfRect = pfv->rect();
   517     TRect pfRect = pfv->rect();
   502     if (ppfv) {// parent frame is not a main frame
   518     if (ppfv) {// parent frame is not a main frame
   503         pfRect = TRect(ppfv->frameCoordsInViewCoords(pfRect.iTl),
   519         pfRect = TRect(ppfv->frameCoordsInViewCoords(pfRect.iTl),
   504                           ppfv->frameCoordsInViewCoords(pfRect.iBr));
   520                           ppfv->frameCoordsInViewCoords(pfRect.iBr));
   505     }
   521     }
   506 
   522     else { 
       
   523         pfRect.SetRect(0, 0, pfRect.iBr.iX * z / 100, pfRect.iBr.iY * z / 100);
       
   524     }
       
   525     
   507     WebFrameView* fv = frame->frameView();
   526     WebFrameView* fv = frame->frameView();
   508     TRect framerect = fv ->rect();
   527     TRect framerect = fv ->rect();
   509     if (frame->parentFrame()) {// frame is not a main frame
   528     if (frame->parentFrame()) {// frame is not a main frame
   510        framerect = TRect(pfv->frameCoordsInViewCoords(framerect.iTl),
   529        framerect = TRect(pfv->frameCoordsInViewCoords(framerect.iTl),
   511                          pfv->frameCoordsInViewCoords(framerect.iBr));
   530                          pfv->frameCoordsInViewCoords(framerect.iBr));
   512     }
   531     }
   513 
   532     else {
       
   533         framerect.SetRect(0, 0, framerect.iBr.iX * z / 100, framerect.iBr.iY * z / 100);
       
   534     }
       
   535     
   514     TRect pfInnerRect = pfRect;
   536     TRect pfInnerRect = pfRect;
   515     innerRect(pfInnerRect);
   537     innerRect(pfInnerRect);
   516     TRect fInnerRect = framerect;
   538     TRect fInnerRect = framerect;
   517     innerRect(fInnerRect);
   539     innerRect(fInnerRect);
   518 
   540 
   774     TRect r;
   796     TRect r;
   775     TPoint point(frame->frameView()->viewCoordsInFrameCoords(m_pos));
   797     TPoint point(frame->frameView()->viewCoordsInFrameCoords(m_pos));
   776     if (m_view && navigableNodeUnderCursor(*frame, point, elType, r)) {
   798     if (m_view && navigableNodeUnderCursor(*frame, point, elType, r)) {
   777         m_view->setFocusedElementType(elType);
   799         m_view->setFocusedElementType(elType);
   778     }
   800     }
       
   801     else {
       
   802         m_view->setFocusedElementType(TBrCtlDefs::EElementNone);
       
   803     }
   779 }
   804 }
   780 
   805 
   781 // -----------------------------------------------------------------------------
   806 // -----------------------------------------------------------------------------
   782 // WebCursor::moveCursor
   807 // WebCursor::moveCursor
   783 // -----------------------------------------------------------------------------
   808 // -----------------------------------------------------------------------------
   879         return;
   904         return;
   880         }
   905         }
   881     }
   906     }
   882 
   907 
   883 
   908 
   884 // -----------------------------------------------------------------------------
   909 bool WebCursor::navigableNodeUnderCursor(WebFrame& webFrame, TPoint& aPoint, TBrCtlDefs::TBrCtlElementType& aElType, TRect& aFocusRect)
   885 // WebCursor::navigableNodeUnderCursor
       
   886 // -----------------------------------------------------------------------------
       
   887 bool WebCursor::navigableNodeUnderCursor(WebFrame& webFrame, TPoint& aPoint, TBrCtlDefs::TBrCtlElementType& aElType, TRect& aFocusRect) const
       
   888 {
   910 {
   889     Frame* coreFrame = core(&webFrame);
   911     Frame* coreFrame = core(&webFrame);
   890     if (!coreFrame->renderer() )
   912     if (!coreFrame->renderer() )
   891         return false;
   913         return false;
   892 
   914 
   893     Element* node = coreFrame->document()->elementFromPoint(aPoint.iX, aPoint.iY);
   915     Element* node = coreFrame->document()->elementFromPoint(aPoint.iX, aPoint.iY);
   894 
   916     m_elementUnderCursor = node;
   895     if (node) {
   917     if (node) {
   896         return coreFrame->bridge()->getTypeFromElement(node, aElType, aFocusRect);
   918         Node* retNode = 0;
       
   919         bool ret = coreFrame->bridge()->getTypeFromElement(node, aElType, aFocusRect, retNode);
       
   920         m_elementUnderCursor = static_cast<Element *>(retNode);
       
   921         return ret;
   897     }
   922     }
   898 
   923 
   899     return false;
   924     return false;
   900 }
   925 }
   901 
   926