| 30 | } |
| 31 | |
| 32 | void CButtonUI::DoEvent(TEventUI& event) |
| 33 | { |
| 34 | if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) { |
| 35 | if( m_pParent != NULL ) m_pParent->DoEvent(event); |
| 36 | else CLabelUI::DoEvent(event); |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | if( event.Type == UIEVENT_SETFOCUS ) |
| 41 | { |
| 42 | Invalidate(); |
| 43 | } |
| 44 | if( event.Type == UIEVENT_KILLFOCUS ) |
| 45 | { |
| 46 | Invalidate(); |
| 47 | } |
| 48 | if( event.Type == UIEVENT_KEYDOWN ) |
| 49 | { |
| 50 | if (IsKeyboardEnabled()) { |
| 51 | if( event.chKey == VK_SPACE || event.chKey == VK_RETURN ) { |
| 52 | Activate(); |
| 53 | return; |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK ) |
| 58 | { |
| 59 | if( ::PtInRect(&m_rcItem, event.ptMouse) && IsEnabled() ) { |
| 60 | m_uButtonState |= UISTATE_PUSHED | UISTATE_CAPTURED; |
| 61 | Invalidate(); |
| 62 | } |
| 63 | return; |
| 64 | } |
| 65 | if( event.Type == UIEVENT_MOUSEMOVE ) |
| 66 | { |
| 67 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) { |
| 68 | if( ::PtInRect(&m_rcItem, event.ptMouse) ) m_uButtonState |= UISTATE_PUSHED; |
| 69 | else m_uButtonState &= ~UISTATE_PUSHED; |
| 70 | Invalidate(); |
| 71 | } |
| 72 | return; |
| 73 | } |
| 74 | if( event.Type == UIEVENT_BUTTONUP ) |
| 75 | { |
| 76 | if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) { |
| 77 | if( ::PtInRect(&m_rcItem, event.ptMouse) ) Activate(); |
| 78 | m_uButtonState &= ~(UISTATE_PUSHED | UISTATE_CAPTURED); |
| 79 | Invalidate(); |
| 80 | } |
| 81 | return; |
| 82 | } |
| 83 | if( event.Type == UIEVENT_CONTEXTMENU ) |
| 84 | { |
| 85 | if( IsContextMenuUsed() ) { |
| 86 | m_pManager->SendNotify(this, DUI_MSGTYPE_MENU, event.wParam, event.lParam); |
| 87 | } |
| 88 | return; |
| 89 | } |
nothing calls this directly
no test coverage detected