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 
206 {
207  // calculate position
208  tools::Long nCalcThumbPos;
209  nCalcThumbPos = ImplMulDiv( nPixPos-mnThumbPixOffset, mnMaxRange-mnMinRange, mnThumbPixRange-1 );
210  nCalcThumbPos += mnMinRange;
211  return nCalcThumbPos;
212 }
213 
215 {
216  // calculate position
217  tools::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  tools::Long nOldChannelPixRange = mnChannelPixRange;
267  tools::Long nOldChannelPixTop = mnChannelPixTop;
268  tools::Long nOldChannelPixBottom = mnChannelPixBottom;
269  tools::Long nCalcWidth;
270  tools::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  const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
359  bool bEnabled = IsEnabled();
360 
361  if (!maChannel1Rect.IsEmpty())
362  {
363  tools::Long nRectSize;
365  rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
366  if (GetStyle() & WB_HORZ)
367  {
368  rRenderContext.DrawLine(aRect.TopLeft(), Point(aRect.Left(), aRect.Bottom() - 1));
369  rRenderContext.DrawLine(aRect.TopLeft(), aRect.TopRight());
370  }
371  else
372  {
373  rRenderContext.DrawLine(aRect.TopLeft(), Point(aRect.Right() - 1, aRect.Top()));
374  rRenderContext.DrawLine(aRect.TopLeft(), aRect.BottomLeft());
375  }
376  rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
377  if (GetStyle() & WB_HORZ)
378  {
379  rRenderContext.DrawLine(aRect.BottomLeft(), aRect.BottomRight());
380  nRectSize = aRect.GetWidth();
381  }
382  else
383  {
384  rRenderContext.DrawLine(aRect.TopRight(), aRect.BottomRight());
385  nRectSize = aRect.GetHeight();
386  }
387 
388  if (nRectSize > 1)
389  {
390  aRect.AdjustLeft( 1 );
391  aRect.AdjustTop( 1 );
392  if (GetStyle() & WB_HORZ)
393  aRect.AdjustBottom( -1 );
394  else
395  aRect.AdjustRight( -1 );
396  rRenderContext.SetLineColor();
398  rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
399  else
400  rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
401  rRenderContext.DrawRect(aRect);
402  }
403  }
404 
405  if (!maChannel2Rect.IsEmpty())
406  {
407  tools::Long nRectSize;
409  rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
410  if (GetStyle() & WB_HORZ)
411  {
412  rRenderContext.DrawLine(aRect.TopRight(), aRect.BottomRight());
413  rRenderContext.DrawLine(aRect.BottomLeft(), aRect.BottomRight());
414  nRectSize = aRect.GetWidth();
415  }
416  else
417  {
418  rRenderContext.DrawLine(aRect.BottomLeft(), aRect.BottomRight());
419  rRenderContext.DrawLine(aRect.TopRight(), aRect.BottomRight());
420  nRectSize = aRect.GetHeight();
421  }
422 
423  if (nRectSize > 1)
424  {
425  rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
426  if (GetStyle() & WB_HORZ)
427  rRenderContext.DrawLine(aRect.TopLeft(), Point(aRect.Right() - 1, aRect.Top()));
428  else
429  rRenderContext.DrawLine(aRect.TopLeft(), Point(aRect.Left(), aRect.Bottom() - 1));
430 
431  aRect.AdjustRight( -1 );
432  aRect.AdjustBottom( -1 );
433  if (GetStyle() & WB_HORZ)
434  aRect.AdjustTop( 1 );
435  else
436  aRect.AdjustLeft( 1 );
437  rRenderContext.SetLineColor();
439  rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
440  else
441  rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
442  rRenderContext.DrawRect(aRect);
443  }
444  }
445 
446  if (maThumbRect.IsEmpty())
447  return;
448 
449  if (bEnabled)
450  {
453  nStyle |= DrawButtonFlags::Pressed;
454  aDecoView.DrawButton(maThumbRect, nStyle);
455  }
456  else
457  {
458  rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
459  rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
460  rRenderContext.DrawRect(maThumbRect);
461  }
462 }
463 
464 bool Slider::ImplIsPageUp( const Point& rPos )
465 {
466  Size aSize = GetOutputSizePixel();
468  if ( GetStyle() & WB_HORZ )
469  {
470  aRect.SetTop( 0 );
471  aRect.SetBottom( aSize.Height()-1 );
472  }
473  else
474  {
475  aRect.SetLeft( 0 );
476  aRect.SetRight( aSize.Width()-1 );
477  }
478  return aRect.IsInside( rPos );
479 }
480 
481 bool Slider::ImplIsPageDown( const Point& rPos )
482 {
483  Size aSize = GetOutputSizePixel();
485  if ( GetStyle() & WB_HORZ )
486  {
487  aRect.SetTop( 0 );
488  aRect.SetBottom( aSize.Height()-1 );
489  }
490  else
491  {
492  aRect.SetLeft( 0 );
493  aRect.SetRight( aSize.Width()-1 );
494  }
495  return aRect.IsInside( rPos );
496 }
497 
499 {
500  tools::Long nOldPos = mnThumbPos;
501  SetThumbPos( nNewPos );
502  tools::Long nDelta = mnThumbPos-nOldPos;
503  if ( nDelta )
504  {
505  Slide();
506  }
507  return nDelta;
508 }
509 
511 {
512  tools::Long nDelta = 0;
513 
514  switch ( meScrollType )
515  {
516  case ScrollType::LineUp:
517  nDelta = ImplSlide( mnThumbPos-mnLineSize );
518  break;
519 
521  nDelta = ImplSlide( mnThumbPos+mnLineSize );
522  break;
523 
524  case ScrollType::PageUp:
525  nDelta = ImplSlide( mnThumbPos-mnPageSize );
526  break;
527 
529  nDelta = ImplSlide( mnThumbPos+mnPageSize );
530  break;
531 
532  default:
533  break;
534  }
535 
536  return nDelta;
537 }
538 
539 void Slider::ImplDoMouseAction( const Point& rMousePos, bool bCallAction )
540 {
541  sal_uInt16 nOldStateFlags = mnStateFlags;
542  bool bAction = false;
543 
544  switch ( meScrollType )
545  {
546  case ScrollType::PageUp:
547  if ( ImplIsPageUp( rMousePos ) )
548  {
549  bAction = bCallAction;
551  }
552  else
554  break;
555 
557  if ( ImplIsPageDown( rMousePos ) )
558  {
559  bAction = bCallAction;
561  }
562  else
564  break;
565  default:
566  break;
567  }
568 
569  if ( bAction )
570  {
571  if ( ImplDoAction() )
572  {
573  Invalidate();
574  }
575  }
576  else if ( nOldStateFlags != mnStateFlags )
577  {
578  Invalidate();
579  }
580 }
581 
583 {
585  return;
586 
588  ImplSlide( nNewPos );
590 }
591 
593 {
595  (eScrollType == ScrollType::DontKnow) ||
596  (eScrollType == ScrollType::Drag) )
597  return;
598 
599  meScrollType = eScrollType;
600  ImplDoAction();
602 }
603 
605 {
606  if ( !rMEvt.IsLeft() )
607  return;
608 
609  const Point& rMousePos = rMEvt.GetPosPixel();
611 
612  if ( maThumbRect.IsInside( rMousePos ) )
613  {
615 
616  // calculate additional values
617  Point aCenterPos = maThumbRect.Center();
618  if ( GetStyle() & WB_HORZ )
619  mnMouseOff = rMousePos.X()-aCenterPos.X();
620  else
621  mnMouseOff = rMousePos.Y()-aCenterPos.Y();
622  }
623  else if ( ImplIsPageUp( rMousePos ) )
624  {
625  nTrackFlags = StartTrackingFlags::ButtonRepeat;
627  }
628  else if ( ImplIsPageDown( rMousePos ) )
629  {
630  nTrackFlags = StartTrackingFlags::ButtonRepeat;
632  }
633 
634  // Shall we start Tracking?
636  {
637  // store Start position for cancel and EndScroll delta
639  ImplDoMouseAction( rMousePos, /*bCallAction*/true );
641 
642  StartTracking( nTrackFlags );
643  }
644 }
645 
647 {
648 }
649 
650 void Slider::Tracking( const TrackingEvent& rTEvt )
651 {
652  if ( rTEvt.IsTrackingEnded() )
653  {
654  // reset Button and PageRect state
655  sal_uInt16 nOldStateFlags = mnStateFlags;
658  if ( nOldStateFlags != mnStateFlags )
659  {
661  }
662 
663  // on cancel, reset the previous Thumb position
664  if ( rTEvt.IsTrackingCanceled() )
665  {
667  Slide();
668  }
669 
671  {
672  // after dragging, recalculate to a rounded Thumb position
673  ImplCalc();
675  }
676 
678  }
679  else
680  {
681  const Point rMousePos = rTEvt.GetMouseEvent().GetPosPixel();
682 
683  // special handling for dragging
685  {
686  tools::Long nMovePix;
687  Point aCenterPos = maThumbRect.Center();
688  if ( GetStyle() & WB_HORZ )
689  nMovePix = rMousePos.X()-(aCenterPos.X()+mnMouseOff);
690  else
691  nMovePix = rMousePos.Y()-(aCenterPos.Y()+mnMouseOff);
692  // only if the mouse moves in Scroll direction we have to act
693  if ( nMovePix )
694  {
695  mnThumbPixPos += nMovePix;
700  tools::Long nOldPos = mnThumbPos;
702  if ( nOldPos != mnThumbPos )
703  {
704  ImplUpdateRects();
706  if ( nOldPos != mnThumbPos )
707  {
708  Slide();
709  }
710  }
711  }
712  }
713  else
714  ImplDoMouseAction( rMousePos, rTEvt.IsTrackingRepeat() );
715 
716  // end tracking if ScrollBar values indicate we are done
717  if ( !IsVisible() )
718  EndTracking();
719  }
720 }
721 
722 void Slider::KeyInput( const KeyEvent& rKEvt )
723 {
724  if ( !rKEvt.GetKeyCode().GetModifier() )
725  {
726  switch ( rKEvt.GetKeyCode().GetCode() )
727  {
728  case KEY_HOME:
730  break;
731  case KEY_END:
733  break;
734 
735  case KEY_LEFT:
736  case KEY_UP:
738  break;
739 
740  case KEY_RIGHT:
741  case KEY_DOWN:
743  break;
744 
745  case KEY_PAGEUP:
747  break;
748 
749  case KEY_PAGEDOWN:
751  break;
752 
753  default:
754  Control::KeyInput( rKEvt );
755  break;
756  }
757  }
758  else
759  Control::KeyInput( rKEvt );
760 }
761 
762 void Slider::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
763 {
764  ImplDraw(rRenderContext);
765 }
766 
768 {
769  Control::Resize();
770  mbCalcSize = true;
771  if ( IsReallyVisible() )
772  ImplCalc( false );
774 }
775 
777 {
778  Control::StateChanged( nType );
779 
780  if ( nType == StateChangedType::InitShow )
781  ImplCalc( false );
782  else if ( nType == StateChangedType::Data )
783  {
784  if ( IsReallyVisible() && IsUpdateMode() )
785  ImplCalc();
786  }
787  else if ( nType == StateChangedType::UpdateMode )
788  {
789  if ( IsReallyVisible() && IsUpdateMode() )
790  {
791  ImplCalc( false );
792  Invalidate();
793  }
794  }
795  else if ( nType == StateChangedType::Enable )
796  {
797  if ( IsReallyVisible() && IsUpdateMode() )
798  {
799  Invalidate();
800  }
801  }
802  else if ( nType == StateChangedType::Style )
803  {
804  if ( IsReallyVisible() && IsUpdateMode() )
805  {
806  if ( (GetPrevStyle() & SLIDER_VIEW_STYLE) !=
808  {
809  mbCalcSize = true;
810  ImplCalc( false );
811  Invalidate();
812  }
813  }
814  }
815  else if ( nType == StateChangedType::ControlBackground )
816  {
818  Invalidate();
819  }
820 }
821 
823 {
824  Control::DataChanged( rDCEvt );
825 
826  if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
827  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
828  {
830  Invalidate();
831  }
832 }
833 
835 {
836  maSlideHdl.Call( this );
837 }
838 
840 {
841  SetRange(Range(nNewRange, GetRangeMax()));
842 }
843 
845 {
846  SetRange(Range(GetRangeMin(), nNewRange));
847 }
848 
849 void Slider::SetRange( const Range& rRange )
850 {
851  // adjust Range
852  Range aRange = rRange;
853  aRange.Justify();
854  tools::Long nNewMinRange = aRange.Min();
855  tools::Long nNewMaxRange = aRange.Max();
856 
857  // reset Range if different
858  if ( (mnMinRange != nNewMinRange) ||
859  (mnMaxRange != nNewMaxRange) )
860  {
861  mnMinRange = nNewMinRange;
862  mnMaxRange = nNewMaxRange;
863 
864  // adjust Thumb
865  if ( mnThumbPos > mnMaxRange )
867  if ( mnThumbPos < mnMinRange )
870  }
871 }
872 
873 void Slider::SetThumbPos( tools::Long nNewThumbPos )
874 {
875  if ( nNewThumbPos < mnMinRange )
876  nNewThumbPos = mnMinRange;
877  if ( nNewThumbPos > mnMaxRange )
878  nNewThumbPos = mnMaxRange;
879 
880  if ( mnThumbPos != nNewThumbPos )
881  {
882  mnThumbPos = nNewThumbPos;
884  }
885 }
886 
888 {
889  tools::Long nWidth = mnMaxRange - mnMinRange + mnThumbSize + 1;
890  tools::Long nHeight = SLIDER_HEIGHT;
891  Size aSize;
892  if ( GetStyle() & WB_HORZ )
893  {
894  aSize.setWidth( nWidth );
895  aSize.setHeight( nHeight );
896  }
897  else
898  {
899  aSize.setHeight( nWidth );
900  aSize.setWidth( nHeight );
901  }
902  return aSize;
903 }
904 
905 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual Point GetPosPixel() const
Definition: window.cxx:2789
Point TopLeft() const
#define SLIDER_THUMB_SIZE
Definition: slider.cxx:31
const Color & GetShadowColor() const
bool IsControlBackground() const
Definition: window2.cxx:1087
tools::Long mnLineSize
Definition: slider.hxx:45
tools::Long mnMaxRange
Definition: slider.hxx:43
Point GetPointerPosPixel()
Definition: mouse.cxx:550
const Wallpaper & GetBackground() const
Definition: outdev.hxx:642
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: slider.cxx:722
void SetRangeMax(tools::Long nNewRange)
Definition: slider.cxx:844
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
void setWidth(tools::Long nWidth)
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)
void Move(tools::Long nHorzMove, tools::Long nVertMove)
Definition: region.cxx:414
StartTrackingFlags
Definition: window.hxx:291
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: slider.cxx:604
tools::Long mnMax
tools::Long mnMinRange
Definition: slider.hxx:42
Point BottomLeft() const
void Union(const tools::Rectangle &rRegion)
Definition: region.cxx:508
bool IsBackground() const
Definition: outdev.hxx:645
tools::Long mnThumbPixRange
Definition: slider.hxx:36
tools::Long ImplMulDiv(tools::Long nNumber, tools::Long nNumerator, tools::Long nDenominator)
Definition: thumbpos.hxx:13
long Long
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
tools::Long mnThumbPixOffset
Definition: slider.hxx:35
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:260
tools::Long GetRangeMax() const
Definition: slider.hxx:87
void SetRange(const Range &rRange)
Definition: slider.cxx:849
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1262
void CompatStateChanged(StateChangedType nStateChange)
Definition: window.cxx:3882
void ImplCalc(bool bUpdate=true)
Definition: slider.cxx:229
sal_uInt16 GetCode() const
Definition: keycod.hxx:51
void SetParentClipMode(ParentClipMode nMode=ParentClipMode::NONE)
tools::Long GetWidth() const
WinBits GetPrevStyle() const
Definition: window2.cxx:958
DataChangedEventType GetType() const
Definition: event.hxx:356
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
tools::Long mnChannelPixRange
Definition: slider.hxx:39
tools::Long mnMin
virtual void StateChanged(StateChangedType nType) override
Definition: slider.cxx:776
void PaintImmediately()
Definition: paint.cxx:1288
void StartTracking(StartTrackingFlags nFlags=StartTrackingFlags::NONE)
Definition: window2.cxx:244
tools::Long mnPageSize
Definition: slider.hxx:46
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
void SetRight(tools::Long v)
constexpr sal_uInt16 KEY_UP
Definition: keycodes.hxx:111
virtual void Resize() override
Definition: slider.cxx:767
tools::Long mnThumbPixPos
Definition: slider.hxx:37
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()
tools::Long Left() const
void ImplDoSlideAction(ScrollType eScrollType)
Definition: slider.cxx:592
tools::Long mnChannelPixTop
Definition: slider.hxx:40
void SetLeft(tools::Long v)
tools::Long mnChannelPixBottom
Definition: slider.hxx:41
void ImplInit(vcl::Window *pParent, WinBits nStyle)
Definition: slider.cxx:39
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
Definition: window2.cxx:272
void SetThumbPos(tools::Long nThumbPos)
Definition: slider.cxx:873
AllSettingsFlags GetFlags() const
Definition: event.hxx:357
constexpr sal_uInt16 KEY_PAGEUP
Definition: keycodes.hxx:116
tools::Long Bottom() const
const Color & GetLightColor() const
sal_uInt16 GetModifier() const
Definition: keycod.hxx:54
void ImplDoMouseAction(const Point &rPos, bool bCallAction)
Definition: slider.cxx:539
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
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
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:51
constexpr sal_uInt16 KEY_DOWN
Definition: keycodes.hxx:110
void Justify()
Point BottomRight() const
void SetLineColor()
tools::Rectangle maChannel1Rect
Definition: slider.hxx:30
void Slide()
Definition: slider.cxx:834
constexpr sal_uInt16 KEY_HOME
Definition: keycodes.hxx:114
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: slider.cxx:822
Size CalcWindowSizePixel()
Definition: slider.cxx:887
tools::Long ImplDoAction()
Definition: slider.cxx:510
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1164
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: slider.cxx:646
bool ImplIsPageUp(const Point &rPos)
Definition: slider.cxx:464
ScrollType
Definition: scrbar.hxx:28
tools::Long mnThumbPos
Definition: slider.hxx:44
tools::Long ImplSlide(tools::Long nNewPos)
Definition: slider.cxx:498
bool IsUpdateMode() const
Definition: window2.cxx:1173
#define SLIDER_VIEW_STYLE
Definition: slider.cxx:37
void SetFillColor()
tools::Long Width() const
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
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.
void SetTop(tools::Long v)
tools::Long ImplCalcThumbPosPix(tools::Long nPos)
Definition: slider.cxx:214
void SetBottom(tools::Long v)
const AllSettings & GetSettings() const
Definition: outdev.hxx:417
void SetPaintTransparent(bool bTransparent)
Definition: paint.cxx:1026
Slider(vcl::Window *pParent, WinBits nStyle)
Definition: slider.cxx:64
Size GetOutputSizePixel() const
Definition: outdev.hxx:440
tools::Long Top() const
const Color & GetCheckedColor() const
tools::Long mnThumbSize
Definition: slider.hxx:38
vcl::Window * GetParent() const
Definition: window2.cxx:1097
tools::Rectangle maThumbRect
bool IsTrackingEnded() const
Definition: event.hxx:263
tools::Long AdjustTop(tools::Long nVertMoveDelta)
constexpr sal_uInt16 KEY_RIGHT
Definition: keycodes.hxx:113
tools::Long Min() const
#define SLIDER_STATE_CHANNEL1_DOWN
Definition: slider.cxx:27
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1804
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
Definition: window.cxx:937
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:54
bool IsMouseOver() const
Definition: mouse.cxx:606
virtual void Resize() override
Definition: ctrl.cxx:74
WindowType
tools::Long mnMouseOff
Definition: slider.hxx:34
Definition: ctrl.hxx:33
void ImplUpdateRects(bool bUpdate=true)
Definition: slider.cxx:98
void SetRangeMin(tools::Long nNewRange)
Definition: slider.cxx:839
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
tools::Long Height() const
bool ImplIsPageDown(const Point &rPos)
Definition: slider.cxx:481
const Point & GetPosPixel() const
Definition: event.hxx:120
tools::Long GetRangeMin() const
Definition: slider.hxx:85
tools::Rectangle maThumbRect
Definition: slider.hxx:32
virtual void Tracking(const TrackingEvent &rTEvt) override
Definition: slider.cxx:650
void setHeight(tools::Long nHeight)
tools::Long GetHeight() const
#define SLIDER_HEIGHT
Definition: slider.cxx:35
bool IsEnabled() const
Definition: window2.cxx:1122
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
bool IsTrackingCanceled() const
Definition: event.hxx:265
WinBits GetStyle() const
Definition: window2.cxx:953
constexpr sal_uInt16 KEY_LEFT
Definition: keycodes.hxx:112
tools::Long ImplCalcThumbPos(tools::Long nPixPos)
Definition: slider.cxx:205
tools::Long mnCur
void ImplDoSlide(tools::Long nNewPos)
Definition: slider.cxx:582
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:762
tools::Long Max() const
tools::Rectangle maChannel2Rect
Definition: slider.hxx:31
WinBits const WB_HORZ
bool HasFocus() const
Definition: window.cxx:2962
sal_uInt16 mnStateFlags
Definition: slider.hxx:47
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
tools::Long Right() const
Point Center() const
bool mbCalcSize
Definition: slider.hxx:49
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:35
tools::Long mnStartPos
Definition: slider.hxx:33