LibreOffice Module vcl (master) 1
scrbar.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <vcl/event.hxx>
21#include <vcl/decoview.hxx>
22#include <vcl/timer.hxx>
23#include <vcl/settings.hxx>
25#include <vcl/vclevent.hxx>
26
27#include <sal/log.hxx>
28
29/* #i77549#
30 HACK: for scrollbars in case of thumb rect, page up and page down rect we
31 abuse the HitTestNativeScrollbar interface. All theming engines but macOS
32 are actually able to draw the thumb according to our internal representation.
33 However macOS draws a little outside. The canonical way would be to enhance the
34 HitTestNativeScrollbar passing a ScrollbarValue additionally so all necessary
35 information is available in the call.
36 .
37 However since there is only this one small exception we will deviate a little and
38 instead pass the respective rect as control region to allow for a small correction.
39
40 So all places using HitTestNativeScrollbar on ControlPart::ThumbHorz, ControlPart::ThumbVert,
41 ControlPart::TrackHorzLeft, ControlPart::TrackHorzRight, ControlPart::TrackVertUpper, ControlPart::TrackVertLower
42 do not use the control rectangle as region but the actual part rectangle, making
43 only small deviations feasible.
44*/
45
46#include "thumbpos.hxx"
47
48#define SCRBAR_DRAW_BTN1 (sal_uInt16(0x0001))
49#define SCRBAR_DRAW_BTN2 (sal_uInt16(0x0002))
50#define SCRBAR_DRAW_PAGE1 (sal_uInt16(0x0004))
51#define SCRBAR_DRAW_PAGE2 (sal_uInt16(0x0008))
52#define SCRBAR_DRAW_THUMB (sal_uInt16(0x0010))
53#define SCRBAR_DRAW_BACKGROUND (sal_uInt16(0x0020))
54
55#define SCRBAR_STATE_BTN1_DOWN (sal_uInt16(0x0001))
56#define SCRBAR_STATE_BTN1_DISABLE (sal_uInt16(0x0002))
57#define SCRBAR_STATE_BTN2_DOWN (sal_uInt16(0x0004))
58#define SCRBAR_STATE_BTN2_DISABLE (sal_uInt16(0x0008))
59#define SCRBAR_STATE_PAGE1_DOWN (sal_uInt16(0x0010))
60#define SCRBAR_STATE_PAGE2_DOWN (sal_uInt16(0x0020))
61#define SCRBAR_STATE_THUMB_DOWN (sal_uInt16(0x0040))
62
63#define SCRBAR_VIEW_STYLE (WB_3DLOOK | WB_HORZ | WB_VERT)
64
66{
67 AutoTimer maTimer { "vcl::ScrollBar mpData->maTimer" };
68 bool mbHide;
69};
70
71void ScrollBar::ImplInit( vcl::Window* pParent, WinBits nStyle )
72{
73 mpData = nullptr;
75 mnThumbPixPos = 0;
77 mnMinRange = 0;
78 mnMaxRange = 100;
79 mnThumbPos = 0;
80 mnVisibleSize = 0;
81 mnLineSize = 1;
82 mnPageSize = 1;
83 mnDelta = 0;
84 mnStateFlags = 0;
86 mbCalcSize = true;
87 mbFullDrag = false;
88
89 ImplInitStyle( nStyle );
90 Control::ImplInit( pParent, nStyle, nullptr );
91
93 SetSizePixel( Size( nScrollSize, nScrollSize ) );
94}
95
97{
98 if ( nStyle & WB_DRAG )
99 mbFullDrag = true;
100 else
101 mbFullDrag = bool(GetSettings().GetStyleSettings().GetDragFullOptions() & DragFullOptions::Scroll);
102}
103
106{
107 ImplInit( pParent, nStyle );
108}
109
111{
112 disposeOnce();
113}
114
116{
117 mpData.reset();
119}
120
121void ScrollBar::ImplUpdateRects( bool bUpdate )
122{
123 mnStateFlags &= ~SCRBAR_STATE_BTN1_DISABLE;
124 mnStateFlags &= ~SCRBAR_STATE_BTN2_DISABLE;
125
126 if ( mnThumbPixRange )
127 {
128 if ( GetStyle() & WB_HORZ )
129 {
132 if ( !mnThumbPixPos )
134 else
138 else
139 {
142 }
143 }
144 else
145 {
148 if ( !mnThumbPixPos )
150 else
154 else
155 {
158 }
159 }
160 }
161 else
162 {
163 if ( GetStyle() & WB_HORZ )
164 {
165 const tools::Long nSpace = maTrackRect.Right() - maTrackRect.Left();
166 if ( nSpace > 0 )
167 {
169 maPage1Rect.SetRight( maTrackRect.Left() + (nSpace/2) );
172 }
173 }
174 else
175 {
176 const tools::Long nSpace = maTrackRect.Bottom() - maTrackRect.Top();
177 if ( nSpace > 0 )
178 {
180 maPage1Rect.SetBottom( maTrackRect.Top() + (nSpace/2) );
183 }
184 }
185 }
186
188 {
189 // disable scrollbar buttons only in VCL's own 'theme'
190 // as it is uncommon on other platforms
191 if ( mnThumbPos == mnMinRange )
195 }
196
197 if ( bUpdate )
198 {
199 Invalidate();
200 }
201}
202
204{
205 // Calculate position
206 tools::Long nCalcThumbPos;
207 nCalcThumbPos = ImplMulDiv( nPixPos, mnMaxRange-mnVisibleSize-mnMinRange,
209 nCalcThumbPos += mnMinRange;
210 return nCalcThumbPos;
211}
212
214{
215 tools::Long nCalcThumbPos;
216
217 // Calculate position
220
221 // At the start and end of the ScrollBar, we try to show the display correctly
222 if ( !nCalcThumbPos && (mnThumbPos > mnMinRange) )
223 nCalcThumbPos = 1;
224 if ( nCalcThumbPos &&
225 ((nCalcThumbPos+mnThumbPixSize) >= mnThumbPixRange) &&
227 nCalcThumbPos--;
228
229 return nCalcThumbPos;
230}
231
232void ScrollBar::ImplCalc( bool bUpdate )
233{
234 const Size aSize = GetOutputSizePixel();
235 const tools::Long nMinThumbSize = GetSettings().GetStyleSettings().GetMinThumbSize();
236
237 if ( mbCalcSize )
238 {
239 Size aOldSize = getCurrentCalcSize();
240
241 const tools::Rectangle aControlRegion( Point(0,0), aSize );
242 tools::Rectangle aBtn1Region, aBtn2Region, aTrackRegion, aBoundingRegion;
243
244 // reset rectangles to empty *and* (0,0) position
248
249 if ( GetStyle() & WB_HORZ )
250 {
252 aControlRegion, ControlState::NONE, ImplControlValue(), aBoundingRegion, aBtn1Region ) &&
254 aControlRegion, ControlState::NONE, ImplControlValue(), aBoundingRegion, aBtn2Region ) )
255 {
256 maBtn1Rect = aBtn1Region;
257 maBtn2Rect = aBtn2Region;
258 }
259 else
260 {
261 Size aBtnSize( aSize.Height(), aSize.Height() );
263 maBtn2Rect.SetLeft( aSize.Width()-aSize.Height() );
264 maBtn1Rect.SetSize( aBtnSize );
265 maBtn2Rect.SetSize( aBtnSize );
266 }
267
269 aControlRegion, ControlState::NONE, ImplControlValue(), aBoundingRegion, aTrackRegion ) )
270 maTrackRect = aTrackRegion;
271 else
273
274 // Check if available space is big enough for thumb ( min thumb size = ScrBar width/height )
276 if( mnThumbPixRange > 0 )
277 {
282 }
283 else
284 mnThumbPixRange = 0;
285 }
286 else // WB_VERT
287 {
289 aControlRegion, ControlState::NONE, ImplControlValue(), aBoundingRegion, aBtn1Region ) &&
291 aControlRegion, ControlState::NONE, ImplControlValue(), aBoundingRegion, aBtn2Region ) )
292 {
293 maBtn1Rect = aBtn1Region;
294 maBtn2Rect = aBtn2Region;
295 }
296 else
297 {
298 const Size aBtnSize( aSize.Width(), aSize.Width() );
300 maBtn2Rect.SetTop( aSize.Height()-aSize.Width() );
301 maBtn1Rect.SetSize( aBtnSize );
302 maBtn2Rect.SetSize( aBtnSize );
303 }
304
306 aControlRegion, ControlState::NONE, ImplControlValue(), aBoundingRegion, aTrackRegion ) )
307 maTrackRect = aTrackRegion;
308 else
310
311 // Check if available space is big enough for thumb
313 if( mnThumbPixRange > 0 )
314 {
319 }
320 else
321 mnThumbPixRange = 0;
322 }
323
324 mbCalcSize = false;
325
326 Size aNewSize = getCurrentCalcSize();
327 if (aOldSize != aNewSize)
328 {
329 queue_resize();
330 }
331 }
332
333 if ( mnThumbPixRange )
334 {
335 // Calculate values
336 if ( (mnVisibleSize >= (mnMaxRange-mnMinRange)) ||
337 ((mnMaxRange-mnMinRange) <= 0) )
338 {
340 mnThumbPixPos = 0;
342 }
343 else
344 {
345 if ( mnVisibleSize )
347 else
348 {
349 if ( GetStyle() & WB_HORZ )
351 else
353 }
354 if ( mnThumbPixSize < nMinThumbSize )
355 mnThumbPixSize = nMinThumbSize;
359 }
360 }
361
362 // If we're ought to output again and we have been triggered
363 // a Paint event via an Action, we don't output directly,
364 // but invalidate everything
365 if ( bUpdate && HasPaintEvent() )
366 {
367 Invalidate();
368 bUpdate = false;
369 }
370 ImplUpdateRects( bUpdate );
371}
372
373void ScrollBar::Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags )
374{
375 Point aPos = pDev->LogicToPixel( rPos );
376
377 pDev->Push();
378 pDev->SetMapMode();
379 if ( !(nFlags & SystemTextColorFlags::Mono) )
380 {
381 // DecoView uses the FaceColor...
382 AllSettings aSettings = pDev->GetSettings();
383 StyleSettings aStyleSettings = aSettings.GetStyleSettings();
384 if ( IsControlBackground() )
385 aStyleSettings.SetFaceColor( GetControlBackground() );
386 else
387 aStyleSettings.SetFaceColor( GetSettings().GetStyleSettings().GetFaceColor() );
388
389 aSettings.SetStyleSettings( aStyleSettings );
390 pDev->SetSettings( aSettings );
391 }
392
393 // For printing:
394 // - calculate the size of the rects
395 // - because this is zero-based add the correct offset
396 // - print
397 // - force recalculate
398
399 if ( mbCalcSize )
400 ImplCalc( false );
401
402 maBtn1Rect+=aPos;
403 maBtn2Rect+=aPos;
404 maThumbRect+=aPos;
405 maTrackRect+=aPos;
406 maPage1Rect+=aPos;
407 maPage2Rect+=aPos;
408
409 ImplDraw(*pDev);
410 pDev->Pop();
411
412 mbCalcSize = true;
413}
414
415bool ScrollBar::ImplDrawNative(vcl::RenderContext& rRenderContext, sal_uInt16 nSystemTextColorFlags)
416{
417 ScrollbarValue scrValue;
418
420 if (!bNativeOK)
421 return false;
422
423 bool bHorz = (GetStyle() & WB_HORZ) != 0;
424
425 // Draw the entire background if the control supports it
427 {
430
431 scrValue.mnMin = mnMinRange;
432 scrValue.mnMax = mnMaxRange;
433 scrValue.mnCur = mnThumbPos;
434 scrValue.mnVisibleSize = mnVisibleSize;
435 scrValue.maThumbRect = maThumbRect;
436 scrValue.maButton1Rect = maBtn1Rect;
437 scrValue.maButton2Rect = maBtn2Rect;
443
444 if (IsMouseOver())
445 {
447 if (pRect)
448 {
449 if (pRect == &maThumbRect)
451 else if (pRect == &maBtn1Rect)
453 else if (pRect == &maBtn2Rect)
455 }
456 }
457
458 tools::Rectangle aCtrlRegion;
459 aCtrlRegion.Union(maBtn1Rect);
460 aCtrlRegion.Union(maBtn2Rect);
461 aCtrlRegion.Union(maPage1Rect);
462 aCtrlRegion.Union(maPage2Rect);
463 aCtrlRegion.Union(maThumbRect);
464
465 tools::Rectangle aRequestedRegion(Point(0,0), GetOutputSizePixel());
466 // if the actual native control region is smaller then the region that
467 // we requested the control to draw in, then draw a background rectangle
468 // to avoid drawing artifacts in the uncovered region
469 if (aCtrlRegion.GetWidth() < aRequestedRegion.GetWidth() ||
470 aCtrlRegion.GetHeight() < aRequestedRegion.GetHeight())
471 {
472 Color aFaceColor = rRenderContext.GetSettings().GetStyleSettings().GetFaceColor();
473 rRenderContext.SetFillColor(aFaceColor);
474 rRenderContext.SetLineColor(aFaceColor);
475 rRenderContext.DrawRect(aRequestedRegion);
476 }
477
479 aCtrlRegion, nState, scrValue, OUString());
480 }
481 else
482 {
483 if ((nSystemTextColorFlags & SCRBAR_DRAW_PAGE1) || (nSystemTextColorFlags & SCRBAR_DRAW_PAGE2))
484 {
487 tools::Rectangle aCtrlRegion1(maPage1Rect);
488 tools::Rectangle aCtrlRegion2(maPage2Rect);
491 ControlState nState2 = nState1;
492
495
496 if (IsMouseOver())
497 {
499 if (pRect)
500 {
501 if (pRect == &maPage1Rect)
502 nState1 |= ControlState::ROLLOVER;
503 else if (pRect == &maPage2Rect)
504 nState2 |= ControlState::ROLLOVER;
505 }
506 }
507
508 if (nSystemTextColorFlags & SCRBAR_DRAW_PAGE1)
509 bNativeOK = rRenderContext.DrawNativeControl(ControlType::Scrollbar, part1, aCtrlRegion1, nState1, scrValue, OUString());
510
511 if (nSystemTextColorFlags & SCRBAR_DRAW_PAGE2)
512 bNativeOK = rRenderContext.DrawNativeControl(ControlType::Scrollbar, part2, aCtrlRegion2, nState2, scrValue, OUString());
513 }
514 if ((nSystemTextColorFlags & SCRBAR_DRAW_BTN1) || (nSystemTextColorFlags & SCRBAR_DRAW_BTN2))
515 {
518 tools::Rectangle aCtrlRegion1(maBtn1Rect);
519 tools::Rectangle aCtrlRegion2(maBtn2Rect);
521 ControlState nState2 = nState1;
522
523 if (!Window::IsEnabled() || !IsEnabled())
524 nState1 = (nState2 &= ~ControlState::ENABLED);
525 else
526 nState1 = (nState2 |= ControlState::ENABLED);
527
530
532 nState1 &= ~ControlState::ENABLED;
534 nState2 &= ~ControlState::ENABLED;
535
536 if (IsMouseOver())
537 {
539 if (pRect)
540 {
541 if (pRect == &maBtn1Rect)
542 nState1 |= ControlState::ROLLOVER;
543 else if (pRect == &maBtn2Rect)
544 nState2 |= ControlState::ROLLOVER;
545 }
546 }
547
548 if (nSystemTextColorFlags & SCRBAR_DRAW_BTN1)
549 bNativeOK = rRenderContext.DrawNativeControl(ControlType::Scrollbar, part1, aCtrlRegion1, nState1, scrValue, OUString());
550
551 if (nSystemTextColorFlags & SCRBAR_DRAW_BTN2)
552 bNativeOK = rRenderContext.DrawNativeControl(ControlType::Scrollbar, part2, aCtrlRegion2, nState2, scrValue, OUString());
553 }
554 if ((nSystemTextColorFlags & SCRBAR_DRAW_THUMB) && !maThumbRect.IsEmpty())
555 {
557 tools::Rectangle aCtrlRegion(maThumbRect);
558
561
562 if (HasFocus())
564
565 if (IsMouseOver())
566 {
568 if (pRect && pRect == &maThumbRect)
570 }
571
573 aCtrlRegion, nState, scrValue, OUString());
574 }
575 }
576 return bNativeOK;
577}
578
580{
581 DecorationView aDecoView(&rRenderContext);
582 tools::Rectangle aTempRect;
583 DrawButtonFlags nStyle;
584 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
585 SymbolType eSymbolType;
586 bool bEnabled = IsEnabled();
587
588 // Finish some open calculations (if any)
589 if (mbCalcSize)
590 ImplCalc(false);
591
592 //vcl::Window *pWin = NULL;
593 //if (rRenderContext.GetOutDevType() == OUTDEV_WINDOW)
594 // pWin = static_cast<vcl::Window*>(&rRenderContext);
595
596 // Draw the entire control if the native theme engine needs it
598 {
599 ImplDrawNative(rRenderContext, SCRBAR_DRAW_BACKGROUND);
600 return;
601 }
602
603 if (!ImplDrawNative(rRenderContext, SCRBAR_DRAW_BTN1))
604 {
607 nStyle |= DrawButtonFlags::Pressed;
608 aTempRect = aDecoView.DrawButton( PixelToLogic(maBtn1Rect), nStyle );
609 ImplCalcSymbolRect( aTempRect );
611 if ((mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) || !bEnabled)
612 nSymbolStyle |= DrawSymbolFlags::Disable;
613 if (GetStyle() & WB_HORZ)
614 eSymbolType = SymbolType::SPIN_LEFT;
615 else
616 eSymbolType = SymbolType::SPIN_UP;
617 aDecoView.DrawSymbol(aTempRect, eSymbolType, rStyleSettings.GetButtonTextColor(), nSymbolStyle);
618 }
619
620 if (!ImplDrawNative(rRenderContext, SCRBAR_DRAW_BTN2))
621 {
624 nStyle |= DrawButtonFlags::Pressed;
625 aTempRect = aDecoView.DrawButton(PixelToLogic(maBtn2Rect), nStyle);
626 ImplCalcSymbolRect(aTempRect);
628 if ((mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) || !bEnabled)
629 nSymbolStyle |= DrawSymbolFlags::Disable;
630 if (GetStyle() & WB_HORZ)
631 eSymbolType = SymbolType::SPIN_RIGHT;
632 else
633 eSymbolType = SymbolType::SPIN_DOWN;
634 aDecoView.DrawSymbol(aTempRect, eSymbolType, rStyleSettings.GetButtonTextColor(), nSymbolStyle);
635 }
636
637 rRenderContext.SetLineColor();
638
639 if (!ImplDrawNative(rRenderContext, SCRBAR_DRAW_THUMB))
640 {
641 if (!maThumbRect.IsEmpty())
642 {
643 if (bEnabled)
644 {
646 aTempRect = aDecoView.DrawButton(PixelToLogic(maThumbRect), nStyle);
647 }
648 else
649 {
650 rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
651 rRenderContext.DrawRect(PixelToLogic(maThumbRect));
652 }
653 }
654 }
655
656 if (!ImplDrawNative(rRenderContext, SCRBAR_DRAW_PAGE1))
657 {
659 rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
660 else
661 rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
662 rRenderContext.DrawRect(PixelToLogic(maPage1Rect));
663 }
664 if (!ImplDrawNative(rRenderContext, SCRBAR_DRAW_PAGE2))
665 {
667 rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
668 else
669 rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
670 rRenderContext.DrawRect(PixelToLogic(maPage2Rect));
671 }
672}
673
674tools::Long ScrollBar::ImplScroll( tools::Long nNewPos, bool bCallEndScroll )
675{
676 tools::Long nOldPos = mnThumbPos;
677 SetThumbPos( nNewPos );
678 tools::Long nDelta = mnThumbPos-nOldPos;
679 if ( nDelta )
680 {
681 mnDelta = nDelta;
682 Scroll();
683 if ( bCallEndScroll )
684 EndScroll();
685 mnDelta = 0;
686 }
687 return nDelta;
688}
689
691{
692 tools::Long nDelta = 0;
693
694 switch ( meScrollType )
695 {
697 nDelta = ImplScroll( mnThumbPos-mnLineSize, bCallEndScroll );
698 break;
699
701 nDelta = ImplScroll( mnThumbPos+mnLineSize, bCallEndScroll );
702 break;
703
705 nDelta = ImplScroll( mnThumbPos-mnPageSize, bCallEndScroll );
706 break;
707
709 nDelta = ImplScroll( mnThumbPos+mnPageSize, bCallEndScroll );
710 break;
711 default:
712 ;
713 }
714
715 return nDelta;
716}
717
718void ScrollBar::ImplDoMouseAction( const Point& rMousePos, bool bCallAction )
719{
720 sal_uInt16 nOldStateFlags = mnStateFlags;
721 bool bAction = false;
722 bool bHorizontal = ( GetStyle() & WB_HORZ ) != 0;
723 bool bIsInside = false;
724
725 Point aPoint( 0, 0 );
726 tools::Rectangle aControlRegion( aPoint, GetOutputSizePixel() );
727
728 switch ( meScrollType )
729 {
731 if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp,
732 aControlRegion, rMousePos, bIsInside )?
733 bIsInside:
734 maBtn1Rect.Contains( rMousePos ) )
735 {
736 bAction = bCallAction;
738 }
739 else
740 mnStateFlags &= ~SCRBAR_STATE_BTN1_DOWN;
741 break;
742
744 if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown,
745 aControlRegion, rMousePos, bIsInside )?
746 bIsInside:
747 maBtn2Rect.Contains( rMousePos ) )
748 {
749 bAction = bCallAction;
751 }
752 else
753 mnStateFlags &= ~SCRBAR_STATE_BTN2_DOWN;
754 break;
755
757 // HitTestNativeScrollbar, see remark at top of file
758 if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft: ControlPart::TrackVertUpper,
759 maPage1Rect, rMousePos, bIsInside )?
760 bIsInside:
761 maPage1Rect.Contains( rMousePos ) )
762 {
763 bAction = bCallAction;
765 }
766 else
767 mnStateFlags &= ~SCRBAR_STATE_PAGE1_DOWN;
768 break;
769
771 // HitTestNativeScrollbar, see remark at top of file
772 if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzRight: ControlPart::TrackVertLower,
773 maPage2Rect, rMousePos, bIsInside )?
774 bIsInside:
775 maPage2Rect.Contains( rMousePos ) )
776 {
777 bAction = bCallAction;
779 }
780 else
781 mnStateFlags &= ~SCRBAR_STATE_PAGE2_DOWN;
782 break;
783 default:
784 ;
785 }
786
787 if ( nOldStateFlags != mnStateFlags )
788 Invalidate();
789 if ( bAction )
790 ImplDoAction( false );
791}
792
793void ScrollBar::ImplDragThumb( const Point& rMousePos )
794{
795 tools::Long nMovePix;
796 if ( GetStyle() & WB_HORZ )
797 nMovePix = rMousePos.X()-(maThumbRect.Left()+mnMouseOff);
798 else
799 nMovePix = rMousePos.Y()-(maThumbRect.Top()+mnMouseOff);
800
801 // Move thumb if necessary
802 if ( !nMovePix )
803 return;
804
805 mnThumbPixPos += nMovePix;
806 if ( mnThumbPixPos < 0 )
807 mnThumbPixPos = 0;
810 tools::Long nOldPos = mnThumbPos;
813 if ( !(mbFullDrag && (nOldPos != mnThumbPos)) )
814 return;
815
816 // When dragging in windows the repaint request gets starved so dragging
817 // the scrollbar feels slower than it actually is. Let's force an immediate
818 // repaint of the scrollbar.
820 {
821 Invalidate();
823 }
824 else
826
827 mnDelta = mnThumbPos-nOldPos;
828 Scroll();
829 mnDelta = 0;
830}
831
833{
835 bool bWarp = bPrimaryWarps ? rMEvt.IsLeft() : rMEvt.IsMiddle();
836 bool bPrimaryWarping = bWarp && rMEvt.IsLeft();
837 bool bPage = bPrimaryWarps ? rMEvt.IsRight() : rMEvt.IsLeft();
838
839 if (!rMEvt.IsLeft() && !rMEvt.IsMiddle() && !rMEvt.IsRight())
840 return;
841
842 Point aPosPixel;
843 if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MapUnit::MapTwip)
844 {
845 // rMEvt coordinates are in twips.
848 MapMode aMapMode = GetMapMode();
849 aMapMode.SetOrigin(Point(0, 0));
850 SetMapMode(aMapMode);
851 aPosPixel = LogicToPixel(rMEvt.GetPosPixel());
852 GetOutDev()->Pop();
853 }
854 const Point& rMousePos = (GetMapMode().GetMapUnit() != MapUnit::MapTwip ? rMEvt.GetPosPixel() : aPosPixel);
856 bool bHorizontal = ( GetStyle() & WB_HORZ ) != 0;
857 bool bIsInside = false;
858 bool bDragToMouse = false;
859
860 Point aPoint( 0, 0 );
861 tools::Rectangle aControlRegion( aPoint, GetOutputSizePixel() );
862
863 if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp,
864 aControlRegion, rMousePos, bIsInside )?
865 bIsInside:
866 maBtn1Rect.Contains( rMousePos ) )
867 {
868 if (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) )
869 {
872 }
873 }
874 else if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown,
875 aControlRegion, rMousePos, bIsInside )?
876 bIsInside:
877 maBtn2Rect.Contains( rMousePos ) )
878 {
879 if (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) )
880 {
883 }
884 }
885 else
886 {
888 maThumbRect, rMousePos, bIsInside )
889 ? bIsInside : maThumbRect.Contains( rMousePos );
890
891 bool bThumbAction = bWarp || bPage;
892
893 bool bDragHandling = bWarp || (bThumbHit && bThumbAction);
894 if( bDragHandling )
895 {
896 if( mpData )
897 {
898 mpData->mbHide = true; // disable focus blinking
899 if (HasFocus())
900 {
901 mnStateFlags |= SCRBAR_DRAW_THUMB; // paint without focus
902 Invalidate();
903 }
904 }
905
907 {
908 nTrackFlags = StartTrackingFlags::NONE;
910
911 // calculate mouse offset
912 if (bWarp && (!bThumbHit || !bPrimaryWarping))
913 {
914 bDragToMouse = true;
915 if ( GetStyle() & WB_HORZ )
917 else
919 }
920 else
921 {
922 if ( GetStyle() & WB_HORZ )
923 mnMouseOff = rMousePos.X()-maThumbRect.Left();
924 else
925 mnMouseOff = rMousePos.Y()-maThumbRect.Top();
926 }
927
929 Invalidate();
930 }
931 }
932 else if(bPage && (!GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzArea : ControlPart::TrackVertArea,
933 aControlRegion, rMousePos, bIsInside ) ||
934 bIsInside) )
935 {
937
938 // HitTestNativeScrollbar, see remark at top of file
939 if ( GetOutDev()->HitTestNativeScrollbar( bHorizontal? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper,
940 maPage1Rect, rMousePos, bIsInside )?
941 bIsInside:
942 maPage1Rect.Contains( rMousePos ) )
943 {
945 }
946 else
947 {
949 }
950 }
951 }
952
953 // Should we start Tracking?
955 return;
956
957 // store original position for cancel and EndScroll delta
959 // #92906# Call StartTracking() before ImplDoMouseAction(), otherwise
960 // MouseButtonUp() / EndTracking() may be called if somebody is spending
961 // a lot of time in the scroll handler
962 StartTracking( nTrackFlags );
963 ImplDoMouseAction( rMousePos );
964
965 if( bDragToMouse )
966 ImplDragThumb( rMousePos );
967
968}
969
971{
972 if ( rTEvt.IsTrackingEnded() )
973 {
974 // Restore Button and PageRect status
975 sal_uInt16 nOldStateFlags = mnStateFlags;
979 if ( nOldStateFlags != mnStateFlags )
980 Invalidate();
981
982 // Restore the old ThumbPosition when canceled
983 if ( rTEvt.IsTrackingCanceled() )
984 {
985 tools::Long nOldPos = mnThumbPos;
987 mnDelta = mnThumbPos-nOldPos;
988 Scroll();
989 }
990
992 {
993 // On a SCROLLDRAG we recalculate the Thumb, so that it's back to a
994 // rounded ThumbPosition
995 ImplCalc();
996
997 if ( !mbFullDrag && (mnStartPos != mnThumbPos) )
998 {
1000 Scroll();
1001 mnDelta = 0;
1002 }
1003 }
1004
1006 EndScroll();
1007 mnDelta = 0;
1009
1010 if( mpData )
1011 mpData->mbHide = false; // re-enable focus blinking
1012 }
1013 else
1014 {
1015 Point aPosPixel;
1016 if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MapUnit::MapTwip)
1017 {
1018 // rTEvt coordinates are in twips.
1020 EnableMapMode();
1021 MapMode aMapMode = GetMapMode();
1022 aMapMode.SetOrigin(Point(0, 0));
1023 SetMapMode(aMapMode);
1024 aPosPixel = LogicToPixel(rTEvt.GetMouseEvent().GetPosPixel());
1025 GetOutDev()->Pop();
1026 }
1027 const Point rMousePos = (GetMapMode().GetMapUnit() != MapUnit::MapTwip ? rTEvt.GetMouseEvent().GetPosPixel() : aPosPixel);
1028
1029 // Dragging is treated in a special way
1031 ImplDragThumb( rMousePos );
1032 else
1033 ImplDoMouseAction( rMousePos, rTEvt.IsTrackingRepeat() );
1034
1035 // If ScrollBar values are translated in a way that there's
1036 // nothing left to track, we cancel here
1037 if ( !IsVisible() || (mnVisibleSize >= (mnMaxRange-mnMinRange)) )
1038 EndTracking();
1039 }
1040}
1041
1042void ScrollBar::KeyInput( const KeyEvent& rKEvt )
1043{
1044 if ( !rKEvt.GetKeyCode().GetModifier() )
1045 {
1046 switch ( rKEvt.GetKeyCode().GetCode() )
1047 {
1048 case KEY_HOME:
1049 DoScroll( 0 );
1050 break;
1051
1052 case KEY_END:
1053 DoScroll( GetRangeMax() );
1054 break;
1055
1056 case KEY_LEFT:
1057 case KEY_UP:
1059 break;
1060
1061 case KEY_RIGHT:
1062 case KEY_DOWN:
1064 break;
1065
1066 case KEY_PAGEUP:
1068 break;
1069
1070 case KEY_PAGEDOWN:
1072 break;
1073
1074 default:
1075 Control::KeyInput( rKEvt );
1076 break;
1077 }
1078 }
1079 else
1080 Control::KeyInput( rKEvt );
1081}
1082
1084{
1085 rRenderContext.SetBackground();
1086}
1087
1089{
1090 ImplDraw(rRenderContext);
1091}
1092
1094{
1095 Control::Move();
1096 mbCalcSize = true;
1097 if (IsReallyVisible())
1098 ImplCalc(false);
1099 Invalidate();
1100}
1101
1103{
1105 mbCalcSize = true;
1106 if ( IsReallyVisible() )
1107 ImplCalc( false );
1108 Invalidate();
1109}
1110
1111IMPL_LINK_NOARG(ScrollBar, ImplAutoTimerHdl, Timer *, void)
1112{
1113 if( mpData && mpData->mbHide )
1114 return;
1115 ImplInvert();
1116}
1117
1119{
1121 if( aRect.GetWidth() > 5 )
1122 {
1123 aRect.AdjustLeft(2 );
1124 aRect.AdjustRight( -2 );
1125 }
1126 if( aRect.GetHeight() > 5 )
1127 {
1128 aRect.AdjustTop(2 );
1129 aRect.AdjustBottom( -2 );
1130 }
1131
1132 GetOutDev()->Invert( aRect );
1133}
1134
1136{
1137 if( !mpData )
1138 {
1139 mpData.reset(new ImplScrollBarData);
1140 mpData->maTimer.SetInvokeHandler( LINK( this, ScrollBar, ImplAutoTimerHdl ) );
1141 mpData->mbHide = false;
1142 }
1143 ImplInvert(); // react immediately
1144 mpData->maTimer.SetTimeout( GetSettings().GetStyleSettings().GetCursorBlinkTime() );
1145 if (mpData->maTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME)
1146 mpData->maTimer.Start();
1148}
1149
1151{
1152 if( mpData )
1153 mpData->maTimer.Stop();
1154 Invalidate();
1155
1157}
1158
1160{
1162
1164 ImplCalc( false );
1165 else if ( nType == StateChangedType::Data )
1166 {
1167 if ( IsReallyVisible() && IsUpdateMode() )
1168 ImplCalc();
1169 }
1170 else if ( nType == StateChangedType::UpdateMode )
1171 {
1172 if ( IsReallyVisible() && IsUpdateMode() )
1173 {
1174 ImplCalc( false );
1175 Invalidate();
1176 }
1177 }
1178 else if ( nType == StateChangedType::Enable )
1179 {
1180 if ( IsReallyVisible() && IsUpdateMode() )
1181 Invalidate();
1182 }
1183 else if ( nType == StateChangedType::Style )
1184 {
1186 if ( IsReallyVisible() && IsUpdateMode() )
1187 {
1188 if ( (GetPrevStyle() & SCRBAR_VIEW_STYLE) !=
1190 {
1191 mbCalcSize = true;
1192 ImplCalc( false );
1193 Invalidate();
1194 }
1195 }
1196 }
1197}
1198
1200{
1201 Control::DataChanged( rDCEvt );
1202
1203 if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
1204 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
1205 {
1206 mbCalcSize = true;
1207 ImplCalc( false );
1208 Invalidate();
1209 }
1210}
1211
1213{
1214 bool bHorizontal = ( GetStyle() & WB_HORZ ) != 0;
1215 bool bIsInside = false;
1216
1217 Point aPoint( 0, 0 );
1218 tools::Rectangle aControlRegion( aPoint, GetOutputSizePixel() );
1219
1220 if( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonRight: ControlPart::ButtonLeft): ControlPart::ButtonUp,
1221 aControlRegion, rPt, bIsInside )?
1222 bIsInside:
1223 maBtn1Rect.Contains( rPt ) )
1224 return &maBtn1Rect;
1225 else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal? (IsRTLEnabled()? ControlPart::ButtonLeft: ControlPart::ButtonRight): ControlPart::ButtonDown,
1226 aControlRegion, rPt, bIsInside )?
1227 bIsInside:
1228 maBtn2Rect.Contains( rPt ) )
1229 return &maBtn2Rect;
1230 // HitTestNativeScrollbar, see remark at top of file
1231 else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal ? ControlPart::TrackHorzLeft : ControlPart::TrackVertUpper,
1232 maPage1Rect, rPt, bIsInside)?
1233 bIsInside:
1234 maPage1Rect.Contains( rPt ) )
1235 return &maPage1Rect;
1236 // HitTestNativeScrollbar, see remark at top of file
1237 else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal ? ControlPart::TrackHorzRight : ControlPart::TrackVertLower,
1238 maPage2Rect, rPt, bIsInside)?
1239 bIsInside:
1240 maPage2Rect.Contains( rPt ) )
1241 return &maPage2Rect;
1242 // HitTestNativeScrollbar, see remark at top of file
1243 else if( GetOutDev()->HitTestNativeScrollbar( bHorizontal ? ControlPart::ThumbHorz : ControlPart::ThumbVert,
1244 maThumbRect, rPt, bIsInside)?
1245 bIsInside:
1246 maThumbRect.Contains( rPt ) )
1247 return &maThumbRect;
1248 else
1249 return nullptr;
1250}
1251
1253{
1254 if( rNEvt.GetType() == NotifyEventType::MOUSEMOVE )
1255 {
1256 const MouseEvent* pMouseEvt = rNEvt.GetMouseEvent();
1257 if( pMouseEvt && !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() )
1258 {
1259 // Trigger a redraw if mouse over state has changed
1261 {
1264 if( pRect != pLastRect || pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow() )
1265 {
1266 vcl::Region aRgn( GetOutDev()->GetActiveClipRegion() );
1267 vcl::Region aClipRegion;
1268
1269 if ( pRect )
1270 aClipRegion.Union( *pRect );
1271 if ( pLastRect )
1272 aClipRegion.Union( *pLastRect );
1273
1274 // Support for 3-button scroll bars
1276 if ( bHas3Buttons && ( pRect == &maBtn1Rect || pLastRect == &maBtn1Rect ) )
1277 {
1278 aClipRegion.Union( maBtn2Rect );
1279 }
1280
1281 GetOutDev()->SetClipRegion( aClipRegion );
1282 Invalidate(aClipRegion.GetBoundRect());
1283
1284 GetOutDev()->SetClipRegion( aRgn );
1285 }
1286 }
1287 }
1288 }
1289
1290 return Control::PreNotify(rNEvt);
1291}
1292
1294{
1296}
1297
1299{
1301}
1302
1304{
1306 return 0;
1307
1308 SAL_INFO("vcl.scrollbar", "DoScroll(" << nNewPos << ")");
1310 tools::Long nDelta = ImplScroll( nNewPos, true );
1312 return nDelta;
1313}
1314
1316{
1318 (eScrollType == ScrollType::DontKnow) ||
1319 (eScrollType == ScrollType::Drag) )
1320 return 0;
1321
1322 meScrollType = eScrollType;
1323 tools::Long nDelta = ImplDoAction( true );
1325 return nDelta;
1326}
1327
1329{
1330 SetRange( Range( nNewRange, GetRangeMax() ) );
1331}
1332
1334{
1335 SetRange( Range( GetRangeMin(), nNewRange ) );
1336}
1337
1338void ScrollBar::SetRange( const Range& rRange )
1339{
1340 // Adapt Range
1341 Range aRange = rRange;
1342 aRange.Normalize();
1343 tools::Long nNewMinRange = aRange.Min();
1344 tools::Long nNewMaxRange = aRange.Max();
1345
1346 // If Range differs, set a new one
1347 if ( (mnMinRange == nNewMinRange) && (mnMaxRange == nNewMaxRange))
1348 return;
1349
1350 mnMinRange = nNewMinRange;
1351 mnMaxRange = nNewMaxRange;
1352
1353 // Adapt Thumb
1356 if ( mnThumbPos < mnMinRange )
1358
1360}
1361
1363{
1364 if ( nNewThumbPos > mnMaxRange-mnVisibleSize )
1365 nNewThumbPos = mnMaxRange-mnVisibleSize;
1366 if ( nNewThumbPos < mnMinRange )
1367 nNewThumbPos = mnMinRange;
1368
1369 if ( mnThumbPos != nNewThumbPos )
1370 {
1371 mnThumbPos = nNewThumbPos;
1373 }
1374}
1375
1377{
1378 if ( mnVisibleSize != nNewSize )
1379 {
1380 mnVisibleSize = nNewSize;
1381
1382 // Adapt Thumb
1385 if ( mnThumbPos < mnMinRange )
1388 }
1389}
1390
1392{
1393 if (mbCalcSize)
1394 const_cast<ScrollBar*>(this)->ImplCalc(false);
1395
1396 Size aRet = getCurrentCalcSize();
1397
1398 const tools::Long nMinThumbSize = GetSettings().GetStyleSettings().GetMinThumbSize();
1399
1400 if (GetStyle() & WB_HORZ)
1401 {
1402 aRet.setWidth( maBtn1Rect.GetWidth() + nMinThumbSize + maBtn2Rect.GetWidth() );
1403 }
1404 else
1405 {
1406 aRet.setHeight( maBtn1Rect.GetHeight() + nMinThumbSize + maBtn2Rect.GetHeight() );
1407 }
1408
1409 return aRet;
1410}
1411
1413{
1414 tools::Rectangle aCtrlRegion;
1415 aCtrlRegion.Union(maBtn1Rect);
1416 aCtrlRegion.Union(maBtn2Rect);
1417 aCtrlRegion.Union(maPage1Rect);
1418 aCtrlRegion.Union(maPage2Rect);
1419 aCtrlRegion.Union(maThumbRect);
1420 return aCtrlRegion.GetSize();
1421}
1422
1424{
1425 return !IsEnabled() || !IsInputEnabled() || IsInModalMode();
1426}
1427
1429{
1430 Window::ImplInit( pParent, nStyle, nullptr );
1431
1432 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
1433 tools::Long nScrollSize = rStyleSettings.GetScrollBarSize();
1434 SetSizePixel(Size(nScrollSize, nScrollSize));
1435}
1436
1439{
1440 ImplInit( pParent, nStyle );
1441}
1442
1444{
1445 if (rRenderContext.IsBackground())
1446 {
1447 Color aColor = rRenderContext.GetSettings().GetStyleSettings().GetFaceColor();
1448 ApplyControlBackground(rRenderContext, aColor);
1449 }
1450}
1451
1453{
1454 Window::StateChanged( nType );
1455
1457 {
1458 Invalidate();
1459 }
1460}
1461
1463{
1464 Window::DataChanged( rDCEvt );
1465
1466 if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
1467 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
1468 {
1469 Invalidate();
1470 }
1471}
1472
1473/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SystemTextColorFlags
const StyleSettings & GetStyleSettings() const
void SetStyleSettings(const StyleSettings &rSet)
An auto-timer is a multi-shot timer re-emitting itself at interval until destroyed or stopped.
Definition: timer.hxx:67
Definition: ctrl.hxx:80
bool ImplCallEventListenersAndHandler(VclEventId nEvent, std::function< void()> const &callHandler)
this calls both our event listeners, and a specified handler
Definition: ctrl.cxx:301
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:256
virtual void Resize() override
Definition: ctrl.cxx:77
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: ctrl.cxx:61
DataChangedEventType GetType() const
Definition: event.hxx:362
AllSettingsFlags GetFlags() const
Definition: event.hxx:363
tools::Rectangle DrawButton(const tools::Rectangle &rRect, DrawButtonFlags nStyle)
Definition: decoview.cxx:894
void DrawSymbol(const tools::Rectangle &rRect, SymbolType eType, const Color &rColor, DrawSymbolFlags nStyle=DrawSymbolFlags::NONE)
Definition: decoview.cxx:768
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:57
void SetOrigin(const Point &rOrigin)
Definition: mapmod.cxx:138
MapUnit GetMapUnit() const
Definition: mapmod.cxx:181
bool IsEnterWindow() const
Definition: event.hxx:138
bool IsSynthetic() const
Definition: event.hxx:142
bool IsLeaveWindow() const
Definition: event.hxx:140
bool IsRight() const
Definition: event.hxx:153
sal_uInt16 GetButtons() const
Definition: event.hxx:147
const Point & GetPosPixel() const
Definition: event.hxx:123
bool IsMiddle() const
Definition: event.hxx:151
bool IsModifierChanged() const
Definition: event.hxx:144
bool IsLeft() const
Definition: event.hxx:149
const MouseEvent * GetMouseEvent() const
Definition: event.hxx:324
NotifyEventType GetType() const
Definition: event.hxx:308
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
virtual void SetSettings(const AllSettings &rSettings)
Definition: outdev.cxx:215
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:50
void Invert(const tools::Rectangle &rRect, InvertFlags nFlags=InvertFlags::NONE)
Definition: rect.cxx:148
void SetLineColor()
Definition: line.cxx:37
void SetMapMode()
Definition: map.cxx:597
void SetFillColor()
Definition: fill.cxx:29
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:879
bool HitTestNativeScrollbar(ControlPart nPart, const tools::Rectangle &rControlRegion, const Point &aPos, bool &rIsInside) const
Query the native control to determine if it was acted upon.
bool IsBackground() const
Definition: outdev.hxx:526
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
Definition: stack.cxx:32
void SetBackground()
Definition: background.cxx:27
void Pop()
Definition: stack.cxx:91
bool DrawNativeControl(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, const OUString &aCaption, const Color &rBackgroundColor=COL_AUTO)
Request rendering of a particular control and/or part.
const AllSettings & GetSettings() const
Definition: outdev.hxx:288
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
constexpr tools::Long Y() const
constexpr tools::Long X() const
tools::Long Max() const
void Normalize()
tools::Long Min() const
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: scrbar.cxx:1443
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: scrbar.cxx:1462
virtual void StateChanged(StateChangedType nType) override
Definition: scrbar.cxx:1452
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle)
Definition: scrbar.cxx:1428
ScrollBarBox(vcl::Window *pParent, WinBits nStyle=0)
Definition: scrbar.cxx:1437
ScrollType meScrollType
Definition: scrbar.hxx:57
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: scrbar.cxx:115
virtual void GetFocus() override
Definition: scrbar.cxx:1135
void SetThumbPos(tools::Long nThumbPos) override
Definition: scrbar.cxx:1362
bool mbFullDrag
Definition: scrbar.hxx:59
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: scrbar.cxx:1088
void SetRange(const Range &rRange) override
Definition: scrbar.cxx:1338
sal_uInt16 mnStateFlags
Definition: scrbar.hxx:56
SAL_DLLPRIVATE void ImplDragThumb(const Point &rMousePos)
Definition: scrbar.cxx:793
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: scrbar.cxx:1199
Link< ScrollBar *, void > maScrollHdl
Definition: scrbar.hxx:60
tools::Long mnMinRange
Definition: scrbar.hxx:49
void EndScroll()
Definition: scrbar.cxx:1298
void SetRangeMin(tools::Long nNewRange) override
Definition: scrbar.cxx:1328
tools::Long mnVisibleSize
Definition: scrbar.hxx:52
SAL_DLLPRIVATE Size getCurrentCalcSize() const
Definition: scrbar.cxx:1412
virtual void Resize() override
Definition: scrbar.cxx:1102
tools::Rectangle maBtn1Rect
Definition: scrbar.hxx:37
virtual void Tracking(const TrackingEvent &rTEvt) override
Definition: scrbar.cxx:970
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: scrbar.cxx:1042
std::unique_ptr< ImplScrollBarData > mpData
Definition: scrbar.hxx:43
tools::Rectangle maThumbRect
Definition: scrbar.hxx:41
void Scroll()
Definition: scrbar.cxx:1293
SAL_DLLPRIVATE void ImplInitStyle(WinBits nStyle)
Definition: scrbar.cxx:96
tools::Long mnThumbPixPos
Definition: scrbar.hxx:47
virtual void LoseFocus() override
Definition: scrbar.cxx:1150
bool Inactive() const override
Definition: scrbar.cxx:1423
tools::Long DoScroll(tools::Long nNewPos) override
Definition: scrbar.cxx:1303
SAL_DLLPRIVATE tools::Long ImplDoAction(bool bCallEndScroll)
Definition: scrbar.cxx:690
void SetVisibleSize(tools::Long nNewSize) override
Definition: scrbar.cxx:1376
tools::Rectangle maTrackRect
Definition: scrbar.hxx:42
void SetRangeMax(tools::Long nNewRange) override
Definition: scrbar.cxx:1333
tools::Long mnStartPos
Definition: scrbar.hxx:44
SAL_DLLPRIVATE void ImplDoMouseAction(const Point &rPos, bool bCallAction=true)
Definition: scrbar.cxx:718
tools::Rectangle maBtn2Rect
Definition: scrbar.hxx:38
SAL_DLLPRIVATE void ImplInvert()
Definition: scrbar.cxx:1118
SAL_DLLPRIVATE tools::Long ImplScroll(tools::Long nNewPos, bool bCallEndScroll)
Definition: scrbar.cxx:674
ScrollBar(vcl::Window *pParent, WinBits nStyle=WB_VERT)
Definition: scrbar.cxx:104
SAL_DLLPRIVATE tools::Long ImplCalcThumbPos(tools::Long nPixPos) const
Definition: scrbar.cxx:203
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: scrbar.cxx:1252
tools::Long mnThumbPos
Definition: scrbar.hxx:51
SAL_DLLPRIVATE tools::Rectangle * ImplFindPartRect(const Point &rPt)
Definition: scrbar.cxx:1212
tools::Rectangle maPage2Rect
Definition: scrbar.hxx:40
tools::Long GetRangeMin() const override
Definition: scrbar.hxx:111
tools::Long DoScrollAction(ScrollType eScrollType)
Definition: scrbar.cxx:1315
tools::Long mnMouseOff
Definition: scrbar.hxx:45
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle)
Definition: scrbar.cxx:71
SAL_DLLPRIVATE tools::Long ImplCalcThumbPosPix(tools::Long nPos) const
Definition: scrbar.cxx:213
virtual void Move() override
Definition: scrbar.cxx:1093
SAL_DLLPRIVATE void ImplDraw(vcl::RenderContext &rRenderContext)
Definition: scrbar.cxx:579
tools::Long mnPageSize
Definition: scrbar.hxx:54
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: scrbar.cxx:1083
virtual void StateChanged(StateChangedType nType) override
Definition: scrbar.cxx:1159
tools::Long mnThumbPixSize
Definition: scrbar.hxx:48
tools::Long mnDelta
Definition: scrbar.hxx:55
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: scrbar.cxx:832
tools::Long mnMaxRange
Definition: scrbar.hxx:50
tools::Long mnThumbPixRange
Definition: scrbar.hxx:46
virtual Size GetOptimalSize() const override
Definition: scrbar.cxx:1391
tools::Long mnLineSize
Definition: scrbar.hxx:53
bool mbCalcSize
Definition: scrbar.hxx:58
SAL_DLLPRIVATE bool ImplDrawNative(vcl::RenderContext &rRenderContext, sal_uInt16 SystemTextColorFlags)
Definition: scrbar.cxx:415
Link< ScrollBar *, void > maEndScrollHdl
Definition: scrbar.hxx:61
virtual void Draw(OutputDevice *pDev, const Point &rPos, SystemTextColorFlags nFlags) override
Definition: scrbar.cxx:373
tools::Rectangle maPage1Rect
Definition: scrbar.hxx:39
SAL_DLLPRIVATE void ImplCalc(bool bUpdate=true)
Definition: scrbar.cxx:232
SAL_DLLPRIVATE void ImplUpdateRects(bool bUpdate=true)
Definition: scrbar.cxx:121
virtual ~ScrollBar() override
Definition: scrbar.cxx:110
tools::Long GetRangeMax() const override
Definition: scrbar.hxx:113
ControlState mnButton1State
tools::Rectangle maThumbRect
tools::Rectangle maButton1Rect
ControlState mnThumbState
tools::Long mnVisibleSize
ControlState mnButton2State
tools::Rectangle maButton2Rect
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
sal_Int32 GetScrollBarSize() const
void SetFaceColor(const Color &rColor)
const Color & GetShadowColor() const
bool GetPrimaryButtonWarpsSlider() const
const Color & GetCheckedColor() const
sal_Int32 GetMinThumbSize() const
const Color & GetFaceColor() const
const Color & GetButtonTextColor() const
Definition: timer.hxx:27
bool IsTrackingEnded() const
Definition: event.hxx:261
bool IsTrackingRepeat() const
Definition: event.hxx:259
bool IsTrackingCanceled() const
Definition: event.hxx:263
const MouseEvent & GetMouseEvent() const
Definition: event.hxx:257
constexpr tools::Long GetWidth() const
bool Contains(const Point &rPOINT) const
constexpr void SetLeft(tools::Long v)
constexpr void SetTop(tools::Long v)
constexpr tools::Long Top() const
void SetSize(const Size &)
constexpr void SetRight(tools::Long v)
constexpr Size GetSize() const
constexpr tools::Long Right() const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
constexpr void SetBottom(tools::Long v)
constexpr Point TopRight() const
constexpr tools::Long GetHeight() const
tools::Rectangle & Union(const tools::Rectangle &rRect)
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
constexpr bool IsEmpty() const
constexpr Point BottomLeft() const
sal_uInt16 GetCode() const
Definition: keycod.hxx:49
sal_uInt16 GetModifier() const
Definition: keycod.hxx:52
tools::Rectangle GetBoundRect() const
Definition: region.cxx:1219
void Union(const tools::Rectangle &rRegion)
Definition: region.cxx:507
bool IsReallyVisible() const
Definition: window2.cxx:1133
virtual void GetFocus()
Definition: window.cxx:1841
void StartTracking(StartTrackingFlags nFlags=StartTrackingFlags::NONE)
Definition: window2.cxx:252
bool IsInputEnabled() const
Definition: window2.cxx:1153
void PaintImmediately()
Definition: paint.cxx:1268
Point LogicToPixel(const Point &rLogicPt) const
Definition: window3.cxx:131
WinBits GetPrevStyle() const
Definition: window2.cxx:984
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
Definition: window2.cxx:293
bool IsMouseOver() const
Definition: mouse.cxx:596
bool SupportsDoubleBuffering() const
Can the widget derived from this Window do the double-buffering via RenderContext properly?
Definition: window.cxx:3860
void ApplyControlBackground(vcl::RenderContext &rRenderContext, const Color &rDefaultColor)
Definition: window2.cxx:558
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1288
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1353
bool IsUpdateMode() const
Definition: window2.cxx:1199
bool HasFocus() const
Definition: window.cxx:2981
bool GetNativeControlRegion(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion) const
Query the native control's actual drawing region (including adornment)
Definition: window3.cxx:79
Point GetLastPointerPosPixel()
Definition: mouse.cxx:552
void SetMapMode()
Definition: window3.cxx:125
bool IsMapModeEnabled() const
Definition: window3.cxx:106
WinBits GetStyle() const
Definition: window2.cxx:979
const AllSettings & GetSettings() const
Definition: window3.cxx:129
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1805
virtual void Move()
Definition: window.cxx:1833
virtual bool PreNotify(NotifyEvent &rNEvt)
Definition: event.cxx:52
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
Definition: window3.cxx:74
const MapMode & GetMapMode() const
Definition: window3.cxx:99
::OutputDevice const * GetOutDev() const
Definition: window.cxx:567
bool IsInModalMode() const
A window is in modal mode if one of its children or subchildren is a running modal window (a modal di...
Definition: window.cxx:3597
bool IsRTLEnabled() const
Definition: window3.cxx:127
Point PixelToLogic(const Point &rDevicePt) const
Definition: window3.cxx:161
Size GetOutputSizePixel() const
Definition: window3.cxx:89
bool IsControlBackground() const
Definition: window2.cxx:1113
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
Point GetPointerPosPixel()
Definition: mouse.cxx:540
virtual void LoseFocus()
Definition: window.cxx:1855
const Color & GetControlBackground() const
Definition: window2.cxx:1108
bool HasPaintEvent() const
Definition: paint.cxx:1241
bool IsVisible() const
Definition: window2.cxx:1128
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1143
void EnableMapMode(bool bEnable=true)
Definition: window3.cxx:105
static SAL_DLLPRIVATE void ImplCalcSymbolRect(tools::Rectangle &rRect)
Definition: brdwin.cxx:44
bool IsEnabled() const
Definition: window2.cxx:1148
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
Definition: window.cxx:941
SAL_DLLPRIVATE void CompatStateChanged(StateChangedType nStateChange)
Definition: window.cxx:3898
DrawButtonFlags
Definition: decoview.hxx:54
DrawSymbolFlags
Definition: decoview.hxx:35
sal_Int32 nState
constexpr sal_uInt16 KEY_HOME
Definition: keycodes.hxx:114
constexpr sal_uInt16 KEY_LEFT
Definition: keycodes.hxx:112
constexpr sal_uInt16 KEY_PAGEDOWN
Definition: keycodes.hxx:117
constexpr sal_uInt16 KEY_UP
Definition: keycodes.hxx:111
constexpr sal_uInt16 KEY_RIGHT
Definition: keycodes.hxx:113
constexpr sal_uInt16 KEY_DOWN
Definition: keycodes.hxx:110
constexpr sal_uInt16 KEY_PAGEUP
Definition: keycodes.hxx:116
constexpr sal_uInt16 KEY_END
Definition: keycodes.hxx:115
sal_uInt16 nPos
#define SAL_INFO(area, stream)
MapUnit GetMapUnit()
long Long
QPRO_FUNC_TYPE nType
#define SCRBAR_STATE_BTN1_DISABLE
Definition: scrbar.cxx:56
#define SCRBAR_STATE_PAGE2_DOWN
Definition: scrbar.cxx:60
#define SCRBAR_DRAW_BACKGROUND
Definition: scrbar.cxx:53
#define SCRBAR_STATE_BTN2_DISABLE
Definition: scrbar.cxx:58
#define SCRBAR_STATE_THUMB_DOWN
Definition: scrbar.cxx:61
#define SCRBAR_DRAW_THUMB
Definition: scrbar.cxx:52
#define SCRBAR_DRAW_BTN1
Definition: scrbar.cxx:48
#define SCRBAR_VIEW_STYLE
Definition: scrbar.cxx:63
#define SCRBAR_DRAW_PAGE1
Definition: scrbar.cxx:50
#define SCRBAR_STATE_BTN2_DOWN
Definition: scrbar.cxx:57
#define SCRBAR_DRAW_PAGE2
Definition: scrbar.cxx:51
#define SCRBAR_DRAW_BTN2
Definition: scrbar.cxx:49
IMPL_LINK_NOARG(ScrollBar, ImplAutoTimerHdl, Timer *, void)
Definition: scrbar.cxx:1111
#define SCRBAR_STATE_BTN1_DOWN
Definition: scrbar.cxx:55
#define SCRBAR_STATE_PAGE1_DOWN
Definition: scrbar.cxx:59
#define STYLE_CURSOR_NOBLINKTIME
Definition: settings.hxx:206
AutoTimer maTimer
Definition: scrbar.cxx:67
tools::Long ImplMulDiv(tools::Long nNumber, tools::Long nNumerator, tools::Long nDenominator)
Definition: thumbpos.hxx:12
SymbolType
Definition: vclenum.hxx:74
ScrollType
Definition: vclenum.hxx:372
@ ScrollbarEndScroll
StartTrackingFlags
Definition: window.hxx:265
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109
WinBits const WB_DRAG
Definition: wintypes.hxx:152
WindowType
Definition: wintypes.hxx:27
WinBits const WB_HORZ
Definition: wintypes.hxx:144