diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-09-17 21:49:21 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-09-20 12:10:44 +0200 |
commit | b22d4785310eac35696df771803dfba0871a50ac (patch) | |
tree | 56e394a3c38a2e1f17530fbc18dd8e6b3c5d5098 /vcl/source/control/scrbar.cxx | |
parent | 3e2370260f2b79c43b4f8a86b123861aa95d3ef2 (diff) |
clean up ambiguous confusing rectangle APIs like IsInside()
Reading 'rectA.IsInside( rectB )' kind of suggests that the code
checks whether 'rectA is inside rectB', but it's actually the other
way around. Rename IsInside() -> Contains(), IsOver() -> Overlaps(),
which should make it clear which way the logic goes.
Change-Id: I9347450fe7dc34c96df6d636a4e3e660de1801ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122271
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'vcl/source/control/scrbar.cxx')
-rw-r--r-- | vcl/source/control/scrbar.cxx | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index d929ec00ba9a..e1e92b236f21 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -731,7 +731,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, aControlRegion, rMousePos, bIsInside )? bIsInside: - maBtn1Rect.IsInside( rMousePos ) ) + maBtn1Rect.Contains( rMousePos ) ) { bAction = bCallAction; mnStateFlags |= SCRBAR_STATE_BTN1_DOWN; @@ -744,7 +744,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, aControlRegion, rMousePos, bIsInside )? bIsInside: - maBtn2Rect.IsInside( rMousePos ) ) + maBtn2Rect.Contains( rMousePos ) ) { bAction = bCallAction; mnStateFlags |= SCRBAR_STATE_BTN2_DOWN; @@ -758,7 +758,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft: ControlPart::TrackVertUpper, maPage1Rect, rMousePos, bIsInside )? bIsInside: - maPage1Rect.IsInside( rMousePos ) ) + maPage1Rect.Contains( rMousePos ) ) { bAction = bCallAction; mnStateFlags |= SCRBAR_STATE_PAGE1_DOWN; @@ -772,7 +772,7 @@ void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction ) if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzRight: ControlPart::TrackVertLower, maPage2Rect, rMousePos, bIsInside )? bIsInside: - maPage2Rect.IsInside( rMousePos ) ) + maPage2Rect.Contains( rMousePos ) ) { bAction = bCallAction; mnStateFlags |= SCRBAR_STATE_PAGE2_DOWN; @@ -863,7 +863,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, aControlRegion, rMousePos, bIsInside )? bIsInside: - maBtn1Rect.IsInside( rMousePos ) ) + maBtn1Rect.Contains( rMousePos ) ) { if (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) ) { @@ -874,7 +874,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) else if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, aControlRegion, rMousePos, bIsInside )? bIsInside: - maBtn2Rect.IsInside( rMousePos ) ) + maBtn2Rect.Contains( rMousePos ) ) { if (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) ) { @@ -886,7 +886,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) { bool bThumbHit = GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::ThumbHorz : ControlPart::ThumbVert, maThumbRect, rMousePos, bIsInside ) - ? bIsInside : maThumbRect.IsInside( rMousePos ); + ? bIsInside : maThumbRect.Contains( rMousePos ); bool bThumbAction = bWarp || bPage; @@ -939,7 +939,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt ) if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper, maPage1Rect, rMousePos, bIsInside )? bIsInside: - maPage1Rect.IsInside( rMousePos ) ) + maPage1Rect.Contains( rMousePos ) ) { meScrollType = ScrollType::PageUp; } @@ -1220,30 +1220,30 @@ tools::Rectangle* ScrollBar::ImplFindPartRect( const Point& rPt ) if( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp, aControlRegion, rPt, bIsInside )? bIsInside: - maBtn1Rect.IsInside( rPt ) ) + maBtn1Rect.Contains( rPt ) ) return &maBtn1Rect; else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown, aControlRegion, rPt, bIsInside )? bIsInside: - maBtn2Rect.IsInside( rPt ) ) + maBtn2Rect.Contains( rPt ) ) return &maBtn2Rect; // HitTestNativeScrollbar, see remark at top of file else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal ? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper, maPage1Rect, rPt, bIsInside)? bIsInside: - maPage1Rect.IsInside( rPt ) ) + maPage1Rect.Contains( rPt ) ) return &maPage1Rect; // HitTestNativeScrollbar, see remark at top of file else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal ? ControlPart::TrackHorzRight : ControlPart::TrackVertLower, maPage2Rect, rPt, bIsInside)? bIsInside: - maPage2Rect.IsInside( rPt ) ) + maPage2Rect.Contains( rPt ) ) return &maPage2Rect; // HitTestNativeScrollbar, see remark at top of file else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal ? ControlPart::ThumbHorz : ControlPart::ThumbVert, maThumbRect, rPt, bIsInside)? bIsInside: - maThumbRect.IsInside( rPt ) ) + maThumbRect.Contains( rPt ) ) return &maThumbRect; else return nullptr; |