| 349 | } |
| 350 | |
| 351 | void Notebook::HandleMouseMoveEvent( int x, int y ) { |
| 352 | float padding( Context::Get().GetEngine().GetProperty<float>( "Padding", shared_from_this() ) ); |
| 353 | float border_width( Context::Get().GetEngine().GetProperty<float>( "BorderWidth", shared_from_this() ) ); |
| 354 | float scroll_button_size( Context::Get().GetEngine().GetProperty<float>( "ScrollButtonSize", shared_from_this() ) ); |
| 355 | |
| 356 | auto old_prelight_tab = m_prelight_tab; |
| 357 | m_prelight_tab = -1; |
| 358 | |
| 359 | auto old_forward_scroll_prelight = m_forward_scroll_prelight; |
| 360 | auto old_backward_scroll_prelight = m_backward_scroll_prelight; |
| 361 | |
| 362 | m_forward_scroll_prelight = false; |
| 363 | m_backward_scroll_prelight = false; |
| 364 | |
| 365 | if( !GetDisplayedTabCount() ) { |
| 366 | return; |
| 367 | } |
| 368 | |
| 369 | sf::Vector2f tab_size( GetNthTabLabel( 0 )->GetAllocation().size.x, GetNthTabLabel( 0 )->GetAllocation().size.y ); |
| 370 | |
| 371 | sf::FloatRect scroll_button_allocation( GetAllocation() ); |
| 372 | |
| 373 | if( GetFirstDisplayedTab() != 0 ) { |
| 374 | // Handle backward scrolling button. |
| 375 | switch( GetTabPosition() ) { |
| 376 | case TabPosition::TOP: |
| 377 | scroll_button_allocation.position.x += 0.f; |
| 378 | scroll_button_allocation.position.y += 0.f; |
| 379 | scroll_button_allocation.size.x = scroll_button_size; |
| 380 | scroll_button_allocation.size.y = tab_size.y + 2.f * ( padding + border_width ); |
| 381 | break; |
| 382 | case TabPosition::BOTTOM: |
| 383 | scroll_button_allocation.position.x += 0.f; |
| 384 | scroll_button_allocation.position.y += GetAllocation().size.y - ( scroll_button_size + padding ); |
| 385 | scroll_button_allocation.size.x = scroll_button_size; |
| 386 | scroll_button_allocation.size.y = tab_size.y + 2.f * ( padding + border_width ); |
| 387 | break; |
| 388 | case TabPosition::LEFT: |
| 389 | scroll_button_allocation.position.x += 0.f; |
| 390 | scroll_button_allocation.position.y += 0.f; |
| 391 | scroll_button_allocation.size.x = tab_size.x + 2.f * ( padding + border_width ); |
| 392 | scroll_button_allocation.size.y = scroll_button_size; |
| 393 | break; |
| 394 | case TabPosition::RIGHT: |
| 395 | scroll_button_allocation.position.x += ( GetAllocation().size.x - ( tab_size.x + 2.f * ( padding + border_width ) ) ); |
| 396 | scroll_button_allocation.position.y += 0.f; |
| 397 | scroll_button_allocation.size.x = tab_size.x + 2.f * ( padding + border_width ); |
| 398 | scroll_button_allocation.size.y = scroll_button_size; |
| 399 | break; |
| 400 | } |
| 401 | |
| 402 | if( scroll_button_allocation.contains( sf::Vector2f( sf::Vector2( x, y ) ) ) ) { |
| 403 | m_backward_scroll_prelight = true; |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | if( GetFirstDisplayedTab() + GetDisplayedTabCount() < GetPageCount() ) { |
| 408 | // Handle forward scrolling button. |
nothing calls this directly
no outgoing calls
no test coverage detected