| 522 | } |
| 523 | |
| 524 | void CScrollBarUI::DoEvent(TEventUI& event) |
| 525 | { |
| 526 | if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) { |
| 527 | if( m_pOwner != NULL ) m_pOwner->DoEvent(event); |
| 528 | else CControlUI::DoEvent(event); |
| 529 | return; |
| 530 | } |
| 531 | |
| 532 | if( event.Type == UIEVENT_SETFOCUS ) |
| 533 | { |
| 534 | return; |
| 535 | } |
| 536 | if( event.Type == UIEVENT_KILLFOCUS ) |
| 537 | { |
| 538 | return; |
| 539 | } |
| 540 | if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK ) |
| 541 | { |
| 542 | if( !IsEnabled() ) return; |
| 543 | |
| 544 | m_nLastScrollOffset = 0; |
| 545 | m_nScrollRepeatDelay = 0; |
| 546 | m_pManager->SetTimer(this, DEFAULT_TIMERID, 50U); |
| 547 | |
| 548 | if( ::PtInRect(&m_rcButton1, event.ptMouse) ) { |
| 549 | m_uButton1State |= UISTATE_PUSHED; |
| 550 | if( !m_bHorizontal ) { |
| 551 | if( m_pOwner != NULL ) m_pOwner->LineUp(); |
| 552 | else SetScrollPos(m_nScrollPos - m_nLineSize); |
| 553 | } |
| 554 | else { |
| 555 | if( m_pOwner != NULL ) m_pOwner->LineLeft(); |
| 556 | else SetScrollPos(m_nScrollPos - m_nLineSize); |
| 557 | } |
| 558 | } |
| 559 | else if( ::PtInRect(&m_rcButton2, event.ptMouse) ) { |
| 560 | m_uButton2State |= UISTATE_PUSHED; |
| 561 | if( !m_bHorizontal ) { |
| 562 | if( m_pOwner != NULL ) m_pOwner->LineDown(); |
| 563 | else SetScrollPos(m_nScrollPos + m_nLineSize); |
| 564 | } |
| 565 | else { |
| 566 | if( m_pOwner != NULL ) m_pOwner->LineRight(); |
| 567 | else SetScrollPos(m_nScrollPos + m_nLineSize); |
| 568 | } |
| 569 | } |
| 570 | else if( ::PtInRect(&m_rcThumb, event.ptMouse) ) { |
| 571 | m_uThumbState |= UISTATE_CAPTURED | UISTATE_PUSHED; |
| 572 | ptLastMouse = event.ptMouse; |
| 573 | m_nLastScrollPos = m_nScrollPos; |
| 574 | } |
| 575 | else { |
| 576 | if( !m_bHorizontal ) { |
| 577 | if( event.ptMouse.y < m_rcThumb.top ) { |
| 578 | if( m_pOwner != NULL ) m_pOwner->PageUp(); |
| 579 | else SetScrollPos(m_nScrollPos + m_rcItem.top - m_rcItem.bottom); |
| 580 | } |
| 581 | else if ( event.ptMouse.y > m_rcThumb.bottom ){ |
nothing calls this directly
no test coverage detected