| 39 | } |
| 40 | |
| 41 | void CTextUI::DoEvent(TEventUI& event) |
| 42 | { |
| 43 | if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) { |
| 44 | if( m_pParent != NULL ) m_pParent->DoEvent(event); |
| 45 | else CLabelUI::DoEvent(event); |
| 46 | return; |
| 47 | } |
| 48 | |
| 49 | if( event.Type == UIEVENT_SETCURSOR ) { |
| 50 | for( int i = 0; i < m_nLinks; i++ ) { |
| 51 | if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) { |
| 52 | ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND))); |
| 53 | return; |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK && IsEnabled() ) { |
| 58 | for( int i = 0; i < m_nLinks; i++ ) { |
| 59 | if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) { |
| 60 | Invalidate(); |
| 61 | return; |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | if( event.Type == UIEVENT_BUTTONUP && IsEnabled() ) { |
| 66 | for( int i = 0; i < m_nLinks; i++ ) { |
| 67 | if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) { |
| 68 | m_pManager->SendNotify(this, DUI_MSGTYPE_LINK, i); |
| 69 | return; |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | if( event.Type == UIEVENT_CONTEXTMENU ) |
| 74 | { |
| 75 | return; |
| 76 | } |
| 77 | // When you move over a link |
| 78 | if( m_nLinks > 0 && event.Type == UIEVENT_MOUSEMOVE && IsEnabled() ) { |
| 79 | int nHoverLink = -1; |
| 80 | for( int i = 0; i < m_nLinks; i++ ) { |
| 81 | if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) { |
| 82 | nHoverLink = i; |
| 83 | break; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | if(m_nHoverLink != nHoverLink) { |
| 88 | m_nHoverLink = nHoverLink; |
| 89 | Invalidate(); |
| 90 | return; |
| 91 | } |
| 92 | } |
| 93 | if( event.Type == UIEVENT_MOUSELEAVE ) { |
| 94 | if( m_nLinks > 0 && IsEnabled() ) { |
| 95 | if(m_nHoverLink != -1) { |
| 96 | m_nHoverLink = -1; |
| 97 | Invalidate(); |
| 98 | return; |
nothing calls this directly
no test coverage detected