LibreOffice Module vcl (master)  1
slider.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 <slider.hxx>
23 #include <vcl/settings.hxx>
24 
25 #include "thumbpos.hxx"
26 
27 #define SLIDER_STATE_CHANNEL1_DOWN (sal_uInt16(0x0001))
28 #define SLIDER_STATE_CHANNEL2_DOWN (sal_uInt16(0x0002))
29 #define SLIDER_STATE_THUMB_DOWN (sal_uInt16(0x0004))
30 
31 #define SLIDER_THUMB_SIZE 9
32 #define SLIDER_CHANNEL_SIZE 4
33 #define SLIDER_CHANNEL_HALFSIZE 2
34 
35 #define SLIDER_HEIGHT 16
36 
37 #define SLIDER_VIEW_STYLE (WB_3DLOOK | WB_HORZ | WB_VERT)
38 
39 void Slider::ImplInit( vcl::Window* pParent, WinBits nStyle )
40 {
41  mnThumbPixOffset = 0;
42  mnThumbPixRange = 0;
43  mnThumbPixPos = 0; // between mnThumbPixOffset and mnThumbPixOffset+mnThumbPixRange
46  mnChannelPixTop = 0;
48 
49  mnMinRange = 0;
50  mnMaxRange = 100;
51  mnThumbPos = 0;
52  mnLineSize = 1;
53  mnPageSize = 1;
54  mnStateFlags = 0;
56  mbCalcSize = true;
57 
58  Control::ImplInit( pParent, nStyle, nullptr );
59 
62 }
63 
64 Slider::Slider( vcl::Window* pParent, WinBits nStyle ) :
66 {
67  ImplInit( pParent, nStyle );
68 }
69 
71 {
72  disposeOnce();
73 }
74 
76 {
77  vcl::Window* pParent = GetParent();
79  {
82  SetPaintTransparent( true );
83  SetBackground();
84  }
85  else
86  {
89  SetPaintTransparent( false );
90 
91  if ( IsControlBackground() )
93  else
94  SetBackground( pParent->GetBackground() );
95  }
96 }
97 
98 void Slider::ImplUpdateRects( bool bUpdate )
99 {
100  tools::Rectangle aOldThumbRect = maThumbRect;
101  bool bInvalidateAll = false;
102 
103  if ( mnThumbPixRange )
104  {
105  if ( GetStyle() & WB_HORZ )
106  {
109  if ( 0 < maThumbRect.Left() )
110  {
111  maChannel1Rect.SetLeft( 0 );
115  }
116  else
118  if ( mnChannelPixRange-1 > maThumbRect.Right() )
119  {
124  }
125  else
127 
128  const tools::Rectangle aControlRegion(tools::Rectangle(Point(), Size(mnThumbSize, 10)));
129  tools::Rectangle aThumbBounds, aThumbContent;
131  aControlRegion, ControlState::NONE, ImplControlValue(),
132  aThumbBounds, aThumbContent ) )
133  {
134  maThumbRect.SetLeft( mnThumbPixPos - aThumbBounds.GetWidth()/2 );
135  maThumbRect.SetRight( maThumbRect.Left() + aThumbBounds.GetWidth() - 1 );
136  bInvalidateAll = true;
137  }
138  }
139  else
140  {
143  if ( 0 < maThumbRect.Top() )
144  {
145  maChannel1Rect.SetTop( 0 );
149  }
150  else
153  {
158  }
159  else
161 
162  const tools::Rectangle aControlRegion(tools::Rectangle(Point(), Size(10, mnThumbSize)));
163  tools::Rectangle aThumbBounds, aThumbContent;
165  aControlRegion, ControlState::NONE, ImplControlValue(),
166  aThumbBounds, aThumbContent ) )
167  {
168  maThumbRect.SetTop( mnThumbPixPos - aThumbBounds.GetHeight()/2 );
169  maThumbRect.SetBottom( maThumbRect.Top() + aThumbBounds.GetHeight() - 1 );
170  bInvalidateAll = true;
171  }
172  }
173  }
174  else
175  {
179  }
180 
181  if ( !bUpdate )
182  return;
183 
184  if ( aOldThumbRect == maThumbRect )
185  return;
186 
187  if( bInvalidateAll )
189  else
190  {
191  vcl::Region aInvalidRegion( aOldThumbRect );
192  aInvalidRegion.Union( maThumbRect );
193 
194  if( !IsBackground() && GetParent() )
195  {
196  const Point aPos( GetPosPixel() );
197  aInvalidRegion.Move( aPos.X(), aPos.Y() );
199  }
200  else
201  Invalidate( aInvalidRegion );
202  }
203 }
204 
205 long Slider::ImplCalcThumbPos( long nPixPos )
206 {
207  // calculate position
208  long nCalcThumbPos;
209  nCalcThumbPos = ImplMulDiv( nPixPos-mnThumbPixOffset, mnMaxRange-mnMinRange, mnThumbPixRange-1 );
210  nCalcThumbPos += mnMinRange;
211  return nCalcThumbPos;
212 }
213 
215 {
216  // calculate position
217  long nCalcThumbPos;
218  nCalcThumbPos = ImplMulDiv( nPos-mnMinRange, mnThumbPixRange-1, mnMaxRange-mnMinRange );
219  // at the beginning and end we try to display Slider correctly
220  if ( !nCalcThumbPos && (mnThumbPos > mnMinRange) )
221  nCalcThumbPos = 1;
222  if ( nCalcThumbPos &&
223  (nCalcThumbPos == mnThumbPixRange-1) &&
224  (mnThumbPos < mnMaxRange) )
225  nCalcThumbPos--;
226  return nCalcThumbPos+mnThumbPixOffset;
227 }
228 
229 void Slider::ImplCalc( bool bUpdate )
230 {
231  bool bInvalidateAll = false;
232 
233  if (mbCalcSize)
234  {
235  if (GetStyle() & WB_HORZ)
236  {
237  const tools::Rectangle aControlRegion(tools::Rectangle(Point(), Size(SLIDER_THUMB_SIZE, 10)));
238  tools::Rectangle aThumbBounds, aThumbContent;
240  aControlRegion, ControlState::NONE, ImplControlValue(),
241  aThumbBounds, aThumbContent))
242  {
243  mnThumbSize = aThumbBounds.GetWidth();
244  }
245  else
246  {
248  }
249  }
250  else
251  {
252  const tools::Rectangle aControlRegion(tools::Rectangle(Point(), Size(10, SLIDER_THUMB_SIZE)));
253  tools::Rectangle aThumbBounds, aThumbContent;
255  aControlRegion, ControlState::NONE, ImplControlValue(),
256  aThumbBounds, aThumbContent))
257  {
258  mnThumbSize = aThumbBounds.GetHeight();
259  }
260  else
261  {
263  }
264  }
265 
266  long nOldChannelPixRange = mnChannelPixRange;
267  long nOldChannelPixTop = mnChannelPixTop;
268  long nOldChannelPixBottom = mnChannelPixBottom;
269  long nCalcWidth;
270  long nCalcHeight;
271 
275 
276  Size aSize = GetOutputSizePixel();
277  if ( GetStyle() & WB_HORZ )
278  {
279  nCalcWidth = aSize.Width();
280  nCalcHeight = aSize.Height();
281  maThumbRect.SetTop( 0 );
282  maThumbRect.SetBottom( aSize.Height()-1 );
283  }
284  else
285  {
286  nCalcWidth = aSize.Height();
287  nCalcHeight = aSize.Width();
288  maThumbRect.SetLeft( 0 );
289  maThumbRect.SetRight( aSize.Width()-1 );
290  }
291 
292  if (nCalcWidth >= mnThumbSize)
293  {
295  mnThumbPixRange = nCalcWidth - mnThumbSize;
296  mnThumbPixPos = 0;
297  mnChannelPixRange = nCalcWidth;
298  mnChannelPixTop = (nCalcHeight/2)-SLIDER_CHANNEL_HALFSIZE;
300  }
301  else
302  {
303  mnThumbPixRange = 0;
304  mnChannelPixRange = 0;
305  }
306 
307  if ( (nOldChannelPixRange != mnChannelPixRange) ||
308  (nOldChannelPixTop != mnChannelPixTop) ||
309  (nOldChannelPixBottom != mnChannelPixBottom) )
310  bInvalidateAll = true;
311 
312  mbCalcSize = false;
313  }
314 
315  if ( mnThumbPixRange )
317 
318  if ( bUpdate && bInvalidateAll )
319  {
320  Invalidate();
321  bUpdate = false;
322  }
323  ImplUpdateRects( bUpdate );
324 }
325 
327 {
328  // do missing calculations
329  if (mbCalcSize)
330  ImplCalc(false);
331 
333 
334  if (rRenderContext.IsNativeControlSupported(ControlType::Slider, nPart))
335  {
338 
339  SliderValue aSliderValue;
340  aSliderValue.mnMin = mnMinRange;
341  aSliderValue.mnMax = mnMaxRange;
342  aSliderValue.mnCur = mnThumbPos;
343  aSliderValue.maThumbRect = maThumbRect;
344 
345  if (IsMouseOver())
346  {
348  aSliderValue.mnThumbState |= ControlState::ROLLOVER;
349  }
350 
351  const tools::Rectangle aCtrlRegion(Point(0,0), GetOutputSizePixel());
352 
353  if (rRenderContext.DrawNativeControl(ControlType::Slider, nPart, aCtrlRegion, nState, aSliderValue, OUString()))
354  return;
355  }
356 
357  DecorationView aDecoView(&rRenderContext);
358  DrawButtonFlags nStyle;
359  const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
360  bool bEnabled = IsEnabled();
361 
362  if (!maChannel1Rect.IsEmpty())
363  {
364  long nRectSize;
366  rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
367  if (GetStyle() & WB_HORZ)
368  {
369  rRenderContext.DrawLine(aRect.TopLeft(), Point(aRect.Left(), aRect.Bottom() - 1));
370  rRenderContext.DrawLine(aRect.TopLeft(), aRect.TopRight());
371  }
372  else
373  {
374  rRenderContext.DrawLine(aRect.TopLeft(), Point(aRect.Right() - 1, aRect.Top()));
375  rRenderContext.DrawLine(aRect.TopLeft(), aRect.BottomLeft());
376  }
377  rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
378  if (GetStyle() & WB_HORZ)
379  {
380  rRenderContext.DrawLine(aRect.BottomLeft(), aRect.BottomRight());
381  nRectSize = aRect.GetWidth();
382  }
383  else
384  {
385  rRenderContext.DrawLine(aRect.TopRight(), aRect.BottomRight());
386  nRectSize = aRect.GetHeight();
387  }
388 
389  if (nRectSize > 1)
390  {
391  aRect.AdjustLeft( 1 );
392  aRect.AdjustTop( 1 );
393  if (GetStyle() & WB_HORZ)
394  aRect.AdjustBottom( -1 );
395  else
396  aRect.AdjustRight( -1 );
397  rRenderContext.SetLineColor();
399  rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
400  else
401  rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
402  rRenderContext.DrawRect(aRect);
403  }
404  }
405 
406  if (!maChannel2Rect.IsEmpty())
407  {
408  long nRectSize;
410  rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
411  if (GetStyle() & WB_HORZ)
412  {
413  rRenderContext.DrawLine(aRect.TopRight(), aRect.BottomRight());
414  rRenderContext.DrawLine(aRect.BottomLeft(), aRect.BottomRight());
415  nRectSize = aRect.GetWidth();
416  }
417  else
418  {
419  rRenderContext.DrawLine(aRect.BottomLeft(), aRect.BottomRight());
420  rRenderContext.DrawLine(aRect.TopRight(), aRect.BottomRight());
421  nRectSize = aRect.GetHeight();
422  }
423 
424  if (nRectSize > 1)
425  {
426  rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
427  if (GetStyle() & WB_HORZ)
428  rRenderContext.DrawLine(aRect.TopLeft(), Point(aRect.Right() - 1, aRect.Top()));
429  else
430  rRenderContext.DrawLine(aRect.TopLeft(), Point(aRect.Left(), aRect.Bottom() - 1));
431 
432  aRect.AdjustRight( -1 );
433  aRect.AdjustBottom( -1 );
434  if (GetStyle() & WB_HORZ)
435  aRect.AdjustTop( 1 );
436  else
437  aRect.AdjustLeft( 1 );
438  rRenderContext.SetLineColor();
440  rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
441  else
442  rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
443  rRenderContext.DrawRect(aRect);
444  }
445  }
446 
447  if (maThumbRect.IsEmpty())
448  return;
449 
450  if (bEnabled)
451  {
452  nStyle = DrawButtonFlags::NONE;
454  nStyle |= DrawButtonFlags::Pressed;
455  aDecoView.DrawButton(maThumbRect, nStyle);
456  }
457  else
458  {
459  rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
460  rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
461  rRenderContext.DrawRect(maThumbRect);
462  }
463 }
464 
465 bool Slider::ImplIsPageUp( const Point& rPos )
466 {
467  Size aSize = GetOutputSizePixel();
469  if ( GetStyle() & WB_HORZ )
470  {
471  aRect.SetTop( 0 );
472  aRect.SetBottom( aSize.Height()-1 );
473  }
474  else
475  {
476  aRect.SetLeft( 0 );
477  aRect.SetRight( aSize.Width()-1 );
478  }
479  return aRect.IsInside( rPos );
480 }
481 
482 bool Slider::ImplIsPageDown( const Point& rPos )
483 {
484  Size aSize = GetOutputSizePixel();
486  if ( GetStyle() & WB_HORZ )
487  {
488  aRect.SetTop( 0 );
489  aRect.SetBottom( aSize.Height()-1 );
490  }
491  else
492  {
493  aRect.SetLeft( 0 );
494  aRect.SetRight( aSize.Width()-1 );
495  }
496  return aRect.IsInside( rPos );
497 }
498 
499 long Slider::ImplSlide( long nNewPos )
500 {
501  long nOldPos = mnThumbPos;
502  SetThumbPos( nNewPos );
503  long nDelta = mnThumbPos-nOldPos;
504  if ( nDelta )
505  {
506  Slide();
507  }
508  return nDelta;
509 }
510 
512 {
513  long nDelta = 0;
514 
515  switch ( meScrollType )
516  {
517  case ScrollType::LineUp:
518  nDelta = ImplSlide( mnThumbPos-mnLineSize );
519  break;
520 
522  nDelta = ImplSlide( mnThumbPos+mnLineSize );
523  break;
524 
525  case ScrollType::PageUp:
526  nDelta = ImplSlide( mnThumbPos-mnPageSize );
527  break;
528 
530  nDelta = ImplSlide( mnThumbPos+mnPageSize );
531  break;
532 
533  default:
534  break;
535  }
536 
537  return nDelta;
538 }
539 
540 void Slider::ImplDoMouseAction( const Point& rMousePos, bool bCallAction )
541 {
542  sal_uInt16 nOldStateFlags = mnStateFlags;
543  bool bAction = false;
544 
545  switch ( meScrollType )
546  {
547  case ScrollType::PageUp:
548  if ( ImplIsPageUp( rMousePos ) )
549  {
550  bAction = bCallAction;
552  }
553  else
555  break;
556 
558  if ( ImplIsPageDown( rMousePos ) )
559  {
560  bAction = bCallAction;
562  }
563  else
565  break;
566  default:
567  break;
568  }
569 
570  if ( bAction )
571  {
572  if ( ImplDoAction() )
573  {
574  Invalidate();
575  }
576  }
577  else if ( nOldStateFlags != mnStateFlags )
578  {
579  Invalidate();
580  }
581 }
582 
583 void Slider::ImplDoSlide( long nNewPos )
584 {
586  return;
587 
589  ImplSlide( nNewPos );
591 }
592 
594 {
596  (eScrollType == ScrollType::DontKnow) ||
597  (eScrollType == ScrollType::Drag) )
598  return;
599 
600  meScrollType = eScrollType;
601  ImplDoAction();
603 }
604 
606 {
607  if ( !rMEvt.IsLeft() )
608  return;
609 
610  const Point& rMousePos = rMEvt.GetPosPixel();
612 
613  if ( maThumbRect.IsInside( rMousePos ) )
614  {
616 
617  // calculate additional values
618  Point aCenterPos = maThumbRect.Center();
619  if ( GetStyle() & WB_HORZ )
620  mnMouseOff = rMousePos.X()-aCenterPos.X();
621  else
622  mnMouseOff = rMousePos.Y()-aCenterPos.Y();
623  }
624  else if ( ImplIsPageUp( rMousePos ) )
625  {
626  nTrackFlags = StartTrackingFlags::ButtonRepeat;
628  }
629  else if ( ImplIsPageDown( rMousePos ) )
630  {
631  nTrackFlags = StartTrackingFlags::ButtonRepeat;
633  }
634 
635  // Shall we start Tracking?
637  {
638  // store Start position for cancel and EndScroll delta
640  ImplDoMouseAction( rMousePos, /*bCallAction*/true );
642 
643  StartTracking( nTrackFlags );
644  }
645 }
646 
648 {
649 }
650 
651 void Slider::Tracking( const TrackingEvent& rTEvt )
652 {
653  if ( rTEvt.IsTrackingEnded() )
654  {
655  // reset Button and PageRect state
656  sal_uInt16 nOldStateFlags = mnStateFlags;
659  if ( nOldStateFlags != mnStateFlags )
660  {
662  }
663 
664  // on cancel, reset the previous Thumb position
665  if ( rTEvt.IsTrackingCanceled() )
666  {
668  Slide();
669  }
670 
672  {
673  // after dragging, recalculate to a rounded Thumb position
674  ImplCalc();
676  }
677 
679  }
680  else
681  {
682  const Point rMousePos = rTEvt.GetMouseEvent().GetPosPixel();
683 
684  // special handling for dragging
686  {
687  long nMovePix;
688  Point aCenterPos = maThumbRect.Center();
689  if ( GetStyle() & WB_HORZ )
690  nMovePix = rMousePos.X()-(aCenterPos.X()+mnMouseOff);
691  else
692  nMovePix = rMousePos.Y()-(aCenterPos.Y()+mnMouseOff);
693  // only if the mouse moves in Scroll direction we have to act
694  if ( nMovePix )
695  {
696  mnThumbPixPos += nMovePix;
701  long nOldPos = mnThumbPos;
703  if ( nOldPos != mnThumbPos )
704  {
705  ImplUpdateRects();
707  if ( nOldPos != mnThumbPos )
708  {
709  Slide();
710  }
711  }
712  }
713  }
714  else
715  ImplDoMouseAction( rMousePos, rTEvt.IsTrackingRepeat() );
716 
717  // end tracking if ScrollBar values indicate we are done
718  if ( !IsVisible() )
719  EndTracking();
720  }
721 }
722 
723 void Slider::KeyInput( const KeyEvent& rKEvt )
724 {
725  if ( !rKEvt.GetKeyCode().GetModifier() )
726  {
727  switch ( rKEvt.GetKeyCode().GetCode() )
728  {
729  case KEY_HOME:
731  break;
732  case KEY_END:
734  break;
735 
736  case KEY_LEFT:
737  case KEY_UP:
739  break;
740 
741  case KEY_RIGHT:
742  case KEY_DOWN:
744  break;
745 
746  case KEY_PAGEUP:
748  break;
749 
750  case KEY_PAGEDOWN:
752  break;
753 
754  default:
755  Control::KeyInput( rKEvt );
756  break;
757  }
758  }
759  else
760  Control::KeyInput( rKEvt );
761 }
762 
763 void Slider::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
764 {
765  ImplDraw(rRenderContext);
766 }
767 
769 {
770  Control::Resize();
771  mbCalcSize = true;
772  if ( IsReallyVisible() )
773  ImplCalc( false );
775 }
776 
778 {
779  Control::StateChanged( nType );
780 
781  if ( nType == StateChangedType::InitShow )
782  ImplCalc( false );
783  else if ( nType == StateChangedType::Data )
784  {
785  if ( IsReallyVisible() && IsUpdateMode() )
786  ImplCalc();
787  }
788  else if ( nType == StateChangedType::UpdateMode )
789  {
790  if ( IsReallyVisible() && IsUpdateMode() )
791  {
792  ImplCalc( false );
793  Invalidate();
794  }
795  }
796  else if ( nType == StateChangedType::Enable )
797  {
798  if ( IsReallyVisible() && IsUpdateMode() )
799  {
800  Invalidate();
801  }
802  }
803  else if ( nType == StateChangedType::Style )
804  {
805  if ( IsReallyVisible() && IsUpdateMode() )
806  {
807  if ( (GetPrevStyle() & SLIDER_VIEW_STYLE) !=
809  {
810  mbCalcSize = true;
811  ImplCalc( false );
812  Invalidate();
813  }
814  }
815  }
816  else if ( nType == StateChangedType::ControlBackground )
817  {
819  Invalidate();
820  }
821 }
822 
824 {
825  Control::DataChanged( rDCEvt );
826 
827  if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
828  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
829  {
831  Invalidate();
832  }
833 }
834 
836 {
837  maSlideHdl.Call( this );
838 }
839 
840 void Slider::SetRangeMin(long nNewRange)
841 {
842  SetRange(Range(nNewRange, GetRangeMax()));
843 }
844 
845 void Slider::SetRangeMax(long nNewRange)
846 {
847  SetRange(Range(GetRangeMin(), nNewRange));
848 }
849 
850 void Slider::SetRange( const Range& rRange )
851 {
852  // adjust Range
853  Range aRange = rRange;
854  aRange.Justify();
855  long nNewMinRange = aRange.Min();
856  long nNewMaxRange = aRange.Max();
857 
858  // reset Range if different
859  if ( (mnMinRange != nNewMinRange) ||
860  (mnMaxRange != nNewMaxRange) )
861  {
862  mnMinRange = nNewMinRange;
863  mnMaxRange = nNewMaxRange;
864 
865  // adjust Thumb
866  if ( mnThumbPos > mnMaxRange )
868  if ( mnThumbPos < mnMinRange )
871  }
872 }
873 
874 void Slider::SetThumbPos( long nNewThumbPos )
875 {
876  if ( nNewThumbPos < mnMinRange )
877  nNewThumbPos = mnMinRange;
878  if ( nNewThumbPos > mnMaxRange )
879  nNewThumbPos = mnMaxRange;
880 
881  if ( mnThumbPos != nNewThumbPos )
882  {
883  mnThumbPos = nNewThumbPos;
885  }
886 }
887 
889 {
890  long nWidth = mnMaxRange - mnMinRange + mnThumbSize + 1;
891  long nHeight = SLIDER_HEIGHT;
892  Size aSize;
893  if ( GetStyle() & WB_HORZ )
894  {
895  aSize.setWidth( nWidth );
896  aSize.setHeight( nHeight );
897  }
898  else
899  {
900  aSize.setHeight( nWidth );
901  aSize.setWidth( nHeight );
902  }
903  return aSize;
904 }
905 
906 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long mnStartPos
Definition: slider.hxx:33
virtual Point GetPosPixel() const
Definition: window.cxx:2792
Point TopLeft() const
#define SLIDER_THUMB_SIZE
Definition: slider.cxx:31
long Width() const
const Color & GetShadowColor() const
bool IsControlBackground() const
Definition: window2.cxx:1087
long GetWidth() const
Point GetPointerPosPixel()
Definition: mouse.cxx:550
const Wallpaper & GetBackground() const
Definition: outdev.hxx:643
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: slider.cxx:723
long GetHeight() const
long mnLineSize
Definition: slider.hxx:45
The parent window is invalidated, too.
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)
long GetRangeMin() const
Definition: slider.hxx:85
long ImplMulDiv(long nNumber, long nNumerator, long nDenominator)
Definition: thumbpos.hxx:13
StartTrackingFlags
Definition: window.hxx:291
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: slider.cxx:605
long Height() const
Point BottomLeft() const
void Union(const tools::Rectangle &rRegion)
Definition: region.cxx:508
bool IsBackground() const
Definition: outdev.hxx:646
long AdjustLeft(long nHorzMoveDelta)
void ImplDraw(vcl::RenderContext &rRenderContext)
Definition: slider.cxx:326
const StyleSettings & GetStyleSettings() const
#define SLIDER_CHANNEL_SIZE
Definition: slider.cxx:32
Link< Slider *, void > maSlideHdl
Definition: slider.hxx:51
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:260
void SetRange(const Range &rRange)
Definition: slider.cxx:850
long mnThumbPixPos
Definition: slider.hxx:37
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1262
void CompatStateChanged(StateChangedType nStateChange)
Definition: window.cxx:3828
void ImplCalc(bool bUpdate=true)
Definition: slider.cxx:229
sal_uInt16 GetCode() const
Definition: keycod.hxx:51
void SetParentClipMode(ParentClipMode nMode=ParentClipMode::NONE)
long ImplCalcThumbPos(long nPixPos)
Definition: slider.cxx:205
WinBits GetPrevStyle() const
Definition: window2.cxx:958
DataChangedEventType GetType() const
Definition: event.hxx:357
long ImplSlide(long nNewPos)
Definition: slider.cxx:499
DrawButtonFlags
Definition: decoview.hxx:53
The invalidated area is updated immediately.
const Color & GetControlBackground() const
Definition: window2.cxx:1082
tools::Rectangle DrawButton(const tools::Rectangle &rRect, DrawButtonFlags nStyle)
Definition: decoview.cxx:931
virtual void StateChanged(StateChangedType nType) override
Definition: slider.cxx:777
void PaintImmediately()
Definition: paint.cxx:1286
void SetRangeMin(long nNewRange)
Definition: slider.cxx:840
void StartTracking(StartTrackingFlags nFlags=StartTrackingFlags::NONE)
Definition: window2.cxx:244
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
constexpr sal_uInt16 KEY_UP
Definition: keycodes.hxx:111
long mnMouseOff
Definition: slider.hxx:34
long AdjustBottom(long nVertMoveDelta)
virtual void Resize() override
Definition: slider.cxx:768
bool IsTrackingRepeat() const
Definition: event.hxx:261
The invalidated area is painted with the background color/pattern.
constexpr sal_uInt16 KEY_END
Definition: keycodes.hxx:115
bool IsEmpty() const
StateChangedType
Definition: window.hxx:317
sal_Int64 WinBits
void SetBackground()
long Right() const
void SetThumbPos(long nThumbPos)
Definition: slider.cxx:874
void ImplDoSlideAction(ScrollType eScrollType)
Definition: slider.cxx:593
void ImplInit(vcl::Window *pParent, WinBits nStyle)
Definition: slider.cxx:39
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
Definition: window2.cxx:272
AllSettingsFlags GetFlags() const
Definition: event.hxx:358
constexpr sal_uInt16 KEY_PAGEUP
Definition: keycodes.hxx:116
const Color & GetLightColor() const
sal_uInt16 GetModifier() const
Definition: keycod.hxx:54
long Top() const
void ImplDoMouseAction(const Point &rPos, bool bCallAction)
Definition: slider.cxx:540
void Move(long nHorzMove, long nVertMove)
Definition: region.cxx:414
void DrawLine(const Point &rStartPt, const Point &rEndPt)
Definition: line.cxx:88
ScrollType meScrollType
Definition: slider.hxx:48
bool IsChildTransparentModeEnabled() const
Definition: window2.cxx:1027
long mnPageSize
Definition: slider.hxx:46
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:51
long GetRangeMax() const
Definition: slider.hxx:87
constexpr sal_uInt16 KEY_DOWN
Definition: keycodes.hxx:110
void Justify()
Point BottomRight() const
void SetLineColor()
tools::Rectangle maChannel1Rect
Definition: slider.hxx:30
void SetTop(long v)
void Slide()
Definition: slider.cxx:835
constexpr sal_uInt16 KEY_HOME
Definition: keycodes.hxx:114
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: slider.cxx:823
Size CalcWindowSizePixel()
Definition: slider.cxx:888
long ImplDoAction()
Definition: slider.cxx:511
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1162
long mnMinRange
Definition: slider.hxx:42
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: slider.cxx:647
bool ImplIsPageUp(const Point &rPos)
Definition: slider.cxx:465
ScrollType
Definition: scrbar.hxx:28
void SetRight(long v)
bool IsUpdateMode() const
Definition: window2.cxx:1173
#define SLIDER_VIEW_STYLE
Definition: slider.cxx:37
void SetFillColor()
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:302
#define SLIDER_STATE_THUMB_DOWN
Definition: slider.cxx:29
long Bottom() const
long mnThumbPixOffset
Definition: slider.hxx:35
constexpr sal_uInt16 KEY_PAGEDOWN
Definition: keycodes.hxx:117
#define SLIDER_STATE_CHANNEL2_DOWN
Definition: slider.cxx:28
bool IsInside(const Point &rPOINT) const
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:418
void SetPaintTransparent(bool bTransparent)
Definition: paint.cxx:1024
Slider(vcl::Window *pParent, WinBits nStyle)
Definition: slider.cxx:64
Size GetOutputSizePixel() const
Definition: outdev.hxx:441
long mnChannelPixRange
Definition: slider.hxx:39
const Color & GetCheckedColor() const
vcl::Window * GetParent() const
Definition: window2.cxx:1097
long mnThumbPos
Definition: slider.hxx:44
tools::Rectangle maThumbRect
bool IsTrackingEnded() const
Definition: event.hxx:263
void ImplDoSlide(long nNewPos)
Definition: slider.cxx:583
constexpr sal_uInt16 KEY_RIGHT
Definition: keycodes.hxx:113
#define SLIDER_STATE_CHANNEL1_DOWN
Definition: slider.cxx:27
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1799
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
Definition: window.cxx:935
long Max() const
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:54
long mnThumbPixRange
Definition: slider.hxx:36
long ImplCalcThumbPosPix(long nPos)
Definition: slider.cxx:214
bool IsMouseOver() const
Definition: mouse.cxx:606
virtual void Resize() override
Definition: ctrl.cxx:74
long AdjustRight(long nHorzMoveDelta)
WindowType
Definition: ctrl.hxx:33
void ImplUpdateRects(bool bUpdate=true)
Definition: slider.cxx:98
ControlState mnThumbState
bool IsVisible() const
Definition: window2.cxx:1102
void EnableChildTransparentMode(bool bEnable=true)
Definition: window2.cxx:1022
bool IsLeft() const
Definition: event.hxx:146
void ImplInitSettings()
Definition: slider.cxx:75
void SetBottom(long v)
long mnThumbSize
Definition: slider.hxx:38
long AdjustTop(long nVertMoveDelta)
bool ImplIsPageDown(const Point &rPos)
Definition: slider.cxx:482
long mnChannelPixTop
Definition: slider.hxx:40
long mnMaxRange
Definition: slider.hxx:43
const Point & GetPosPixel() const
Definition: event.hxx:120
long Left() const
tools::Rectangle maThumbRect
Definition: slider.hxx:32
virtual void Tracking(const TrackingEvent &rTEvt) override
Definition: slider.cxx:651
#define SLIDER_HEIGHT
Definition: slider.cxx:35
bool IsEnabled() const
Definition: window2.cxx:1122
void SetLeft(long v)
bool IsTrackingCanceled() const
Definition: event.hxx:265
WinBits GetStyle() const
Definition: window2.cxx:953
constexpr sal_uInt16 KEY_LEFT
Definition: keycodes.hxx:112
long Min() const
const MouseEvent & GetMouseEvent() const
Definition: event.hxx:259
bool IsReallyVisible() const
Definition: window2.cxx:1107
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: slider.cxx:763
tools::Rectangle maChannel2Rect
Definition: slider.hxx:31
WinBits const WB_HORZ
bool HasFocus() const
Definition: window.cxx:2965
sal_uInt16 mnStateFlags
Definition: slider.hxx:47
void setWidth(long nWidth)
virtual ~Slider() override
Definition: slider.cxx:70
The child windows are not invalidated.
sal_Int32 nState
#define SLIDER_CHANNEL_HALFSIZE
Definition: slider.cxx:33
Point TopRight() const
Point Center() const
bool mbCalcSize
Definition: slider.hxx:49
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:35
long mnChannelPixBottom
Definition: slider.hxx:41
void SetRangeMax(long nNewRange)
Definition: slider.cxx:845
void setHeight(long nHeight)