LMMS
Loading...
Searching...
No Matches
juce_Viewport.cpp
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29static bool viewportWouldScrollOnEvent (const Viewport* vp, const MouseInputSource& src) noexcept
30{
31 if (vp != nullptr)
32 {
33 switch (vp->getScrollOnDragMode())
34 {
35 case Viewport::ScrollOnDragMode::all: return true;
36 case Viewport::ScrollOnDragMode::nonHover: return ! src.canHover();
37 case Viewport::ScrollOnDragMode::never: return false;
38 }
39 }
40
41 return false;
42}
43
45
47 private ViewportDragPosition::Listener
48{
50 {
51 viewport.contentHolder.addMouseListener (this, true);
52 offsetX.addListener (this);
53 offsetY.addListener (this);
54 offsetX.behaviour.setMinimumVelocity (60);
55 offsetY.behaviour.setMinimumVelocity (60);
56 }
57
59 {
60 viewport.contentHolder.removeMouseListener (this);
61 Desktop::getInstance().removeGlobalMouseListener (this);
62 }
63
65 {
66 offsetX.setPosition (offsetX.getPosition());
67 offsetY.setPosition (offsetY.getPosition());
68 }
69
70 void positionChanged (ViewportDragPosition&, double) override
71 {
72 viewport.setViewPosition (originalViewPos - Point<int> ((int) offsetX.getPosition(),
73 (int) offsetY.getPosition()));
74 }
75
76 void mouseDown (const MouseEvent& e) override
77 {
79 {
80 offsetX.setPosition (offsetX.getPosition());
81 offsetY.setPosition (offsetY.getPosition());
82
83 // switch to a global mouse listener so we still receive mouseUp events
84 // if the original event component is deleted
85 viewport.contentHolder.removeMouseListener (this);
86 Desktop::getInstance().addGlobalMouseListener (this);
87
89
90 scrollSource = e.source;
91 }
92 }
93
94 void mouseDrag (const MouseEvent& e) override
95 {
96 if (e.source == scrollSource
97 && ! doesMouseEventComponentBlockViewportDrag (e.eventComponent))
98 {
99 auto totalOffset = e.getEventRelativeTo (&viewport).getOffsetFromDragStart().toFloat();
100
101 if (! isDragging && totalOffset.getDistanceFromOrigin() > 8.0f && viewportWouldScrollOnEvent (&viewport, e.source))
102 {
103 isDragging = true;
104
105 originalViewPos = viewport.getViewPosition();
106 offsetX.setPosition (0.0);
107 offsetX.beginDrag();
108 offsetY.setPosition (0.0);
109 offsetY.beginDrag();
110 }
111
112 if (isDragging)
113 {
114 offsetX.drag (totalOffset.x);
115 offsetY.drag (totalOffset.y);
116 }
117 }
118 }
119
120 void mouseUp (const MouseEvent& e) override
121 {
122 if (isGlobalMouseListener && e.source == scrollSource)
124 }
125
127 {
128 if (std::exchange (isDragging, false) == true)
129 {
130 offsetX.endDrag();
131 offsetY.endDrag();
132 }
133
134 viewport.contentHolder.addMouseListener (this, true);
135 Desktop::getInstance().removeGlobalMouseListener (this);
136
137 isGlobalMouseListener = false;
138 }
139
141 {
142 for (auto c = eventComp; c != nullptr && c != &viewport; c = c->getParentComponent())
143 if (c->getViewportIgnoreDragFlag())
144 return true;
145
146 return false;
147 }
148
153 bool isDragging = false;
155
157};
158
159//==============================================================================
161 : Component (name),
162 dragToScrollListener (std::make_unique<DragToScrollListener> (*this))
163{
164 // content holder is used to clip the contents so they don't overlap the scrollbars
166 contentHolder.setInterceptsMouseClicks (false, true);
167
168 scrollBarThickness = getLookAndFeel().getDefaultScrollbarWidth();
169
170 setInterceptsMouseClicks (false, true);
172
174}
175
180
181//==============================================================================
184
185//==============================================================================
187{
188 if (contentComp != nullptr)
189 {
190 contentComp->removeComponentListener (this);
191
192 if (deleteContent)
193 {
194 // This sets the content comp to a null pointer before deleting the old one, in case
195 // anything tries to use the old one while it's in mid-deletion..
196 std::unique_ptr<Component> oldCompDeleter (contentComp.get());
197 contentComp = nullptr;
198 }
199 else
200 {
201 contentHolder.removeChildComponent (contentComp);
202 contentComp = nullptr;
203 }
204 }
205}
206
207void Viewport::setViewedComponent (Component* const newViewedComponent, const bool deleteComponentWhenNoLongerNeeded)
208{
209 if (contentComp.get() != newViewedComponent)
210 {
212 contentComp = newViewedComponent;
213 deleteContent = deleteComponentWhenNoLongerNeeded;
214
215 if (contentComp != nullptr)
216 {
217 contentHolder.addAndMakeVisible (contentComp);
219 contentComp->addComponentListener (this);
220 }
221
224 }
225}
226
228{
229 verticalScrollBar.reset();
230 horizontalScrollBar.reset();
231
234
237
238 getVerticalScrollBar().addListener (this);
239 getHorizontalScrollBar().addListener (this);
240 getVerticalScrollBar().addMouseListener (this, true);
241 getHorizontalScrollBar().addMouseListener (this, true);
242
243 resized();
244}
245
246int Viewport::getMaximumVisibleWidth() const { return contentHolder.getWidth(); }
247int Viewport::getMaximumVisibleHeight() const { return contentHolder.getHeight(); }
248
249bool Viewport::canScrollVertically() const noexcept { return contentComp->getY() < 0 || contentComp->getBottom() > getHeight(); }
250bool Viewport::canScrollHorizontally() const noexcept { return contentComp->getX() < 0 || contentComp->getRight() > getWidth(); }
251
253{
254 jassert (contentComp != nullptr);
255
256 auto contentBounds = contentHolder.getLocalArea (contentComp.get(), contentComp->getLocalBounds());
257
258 Point<int> p (jmax (jmin (0, contentHolder.getWidth() - contentBounds.getWidth()), jmin (0, -(pos.x))),
259 jmax (jmin (0, contentHolder.getHeight() - contentBounds.getHeight()), jmin (0, -(pos.y))));
260
261 return p.transformedBy (contentComp->getTransform().inverted());
262}
263
264void Viewport::setViewPosition (const int xPixelsOffset, const int yPixelsOffset)
265{
266 setViewPosition ({ xPixelsOffset, yPixelsOffset });
267}
268
270{
271 if (contentComp != nullptr)
272 contentComp->setTopLeftPosition (viewportPosToCompPos (newPosition));
273}
274
275void Viewport::setViewPositionProportionately (const double x, const double y)
276{
277 if (contentComp != nullptr)
278 setViewPosition (jmax (0, roundToInt (x * (contentComp->getWidth() - getWidth()))),
279 jmax (0, roundToInt (y * (contentComp->getHeight() - getHeight()))));
280}
281
282bool Viewport::autoScroll (const int mouseX, const int mouseY, const int activeBorderThickness, const int maximumSpeed)
283{
284 if (contentComp != nullptr)
285 {
286 int dx = 0, dy = 0;
287
289 {
290 if (mouseX < activeBorderThickness)
291 dx = activeBorderThickness - mouseX;
292 else if (mouseX >= contentHolder.getWidth() - activeBorderThickness)
293 dx = (contentHolder.getWidth() - activeBorderThickness) - mouseX;
294
295 if (dx < 0)
296 dx = jmax (dx, -maximumSpeed, contentHolder.getWidth() - contentComp->getRight());
297 else
298 dx = jmin (dx, maximumSpeed, -contentComp->getX());
299 }
300
302 {
303 if (mouseY < activeBorderThickness)
304 dy = activeBorderThickness - mouseY;
305 else if (mouseY >= contentHolder.getHeight() - activeBorderThickness)
306 dy = (contentHolder.getHeight() - activeBorderThickness) - mouseY;
307
308 if (dy < 0)
309 dy = jmax (dy, -maximumSpeed, contentHolder.getHeight() - contentComp->getBottom());
310 else
311 dy = jmin (dy, maximumSpeed, -contentComp->getY());
312 }
313
314 if (dx != 0 || dy != 0)
315 {
316 contentComp->setTopLeftPosition (contentComp->getX() + dx,
317 contentComp->getY() + dy);
318
319 return true;
320 }
321 }
322
323 return false;
324}
325
330
331//==============================================================================
336
341
342//==============================================================================
344{
346 {
347 scrollBarThickness = getLookAndFeel().getDefaultScrollbarWidth();
348 resized();
349 }
350}
351
353{
355}
356
357//==============================================================================
359{
360 auto scrollbarWidth = getScrollBarThickness();
361 const bool canShowAnyBars = getWidth() > scrollbarWidth && getHeight() > scrollbarWidth;
362 const bool canShowHBar = showHScrollbar && canShowAnyBars;
363 const bool canShowVBar = showVScrollbar && canShowAnyBars;
364
365 bool hBarVisible = false, vBarVisible = false;
366 Rectangle<int> contentArea;
367
368 for (int i = 3; --i >= 0;)
369 {
370 hBarVisible = canShowHBar && ! getHorizontalScrollBar().autoHides();
371 vBarVisible = canShowVBar && ! getVerticalScrollBar().autoHides();
372 contentArea = getLocalBounds();
373
374 if (contentComp != nullptr && ! contentArea.contains (contentComp->getBounds()))
375 {
376 hBarVisible = canShowHBar && (hBarVisible || contentComp->getX() < 0 || contentComp->getRight() > contentArea.getWidth());
377 vBarVisible = canShowVBar && (vBarVisible || contentComp->getY() < 0 || contentComp->getBottom() > contentArea.getHeight());
378
379 if (vBarVisible)
380 contentArea.setWidth (getWidth() - scrollbarWidth);
381
382 if (hBarVisible)
383 contentArea.setHeight (getHeight() - scrollbarWidth);
384
385 if (! contentArea.contains (contentComp->getBounds()))
386 {
387 hBarVisible = canShowHBar && (hBarVisible || contentComp->getRight() > contentArea.getWidth());
388 vBarVisible = canShowVBar && (vBarVisible || contentComp->getBottom() > contentArea.getHeight());
389 }
390 }
391
392 if (vBarVisible) contentArea.setWidth (getWidth() - scrollbarWidth);
393 if (hBarVisible) contentArea.setHeight (getHeight() - scrollbarWidth);
394
395 if (! vScrollbarRight && vBarVisible)
396 contentArea.setX (scrollbarWidth);
397
398 if (! hScrollbarBottom && hBarVisible)
399 contentArea.setY (scrollbarWidth);
400
401 if (contentComp == nullptr)
402 {
403 contentHolder.setBounds (contentArea);
404 break;
405 }
406
407 auto oldContentBounds = contentComp->getBounds();
408 contentHolder.setBounds (contentArea);
409
410 // If the content has changed its size, that might affect our scrollbars, so go round again and re-calculate..
411 if (oldContentBounds == contentComp->getBounds())
412 break;
413 }
414
415 Rectangle<int> contentBounds;
416
417 if (auto cc = contentComp.get())
418 contentBounds = contentHolder.getLocalArea (cc, cc->getLocalBounds());
419
420 auto visibleOrigin = -contentBounds.getPosition();
421
422 auto& hbar = getHorizontalScrollBar();
423 auto& vbar = getVerticalScrollBar();
424
425 hbar.setBounds (contentArea.getX(), hScrollbarBottom ? contentArea.getHeight() : 0, contentArea.getWidth(), scrollbarWidth);
426 hbar.setRangeLimits (0.0, contentBounds.getWidth());
427 hbar.setCurrentRange (visibleOrigin.x, contentArea.getWidth());
428 hbar.setSingleStepSize (singleStepX);
429
430 if (canShowHBar && ! hBarVisible)
431 visibleOrigin.setX (0);
432
433 vbar.setBounds (vScrollbarRight ? contentArea.getWidth() : 0, contentArea.getY(), scrollbarWidth, contentArea.getHeight());
434 vbar.setRangeLimits (0.0, contentBounds.getHeight());
435 vbar.setCurrentRange (visibleOrigin.y, contentArea.getHeight());
436 vbar.setSingleStepSize (singleStepY);
437
438 if (canShowVBar && ! vBarVisible)
439 visibleOrigin.setY (0);
440
441 // Force the visibility *after* setting the ranges to avoid flicker caused by edge conditions in the numbers.
442 hbar.setVisible (hBarVisible);
443 vbar.setVisible (vBarVisible);
444
445 if (contentComp != nullptr)
446 {
447 auto newContentCompPos = viewportPosToCompPos (visibleOrigin);
448
449 if (contentComp->getBounds().getPosition() != newContentCompPos)
450 {
451 contentComp->setTopLeftPosition (newContentCompPos); // (this will re-entrantly call updateVisibleArea again)
452 return;
453 }
454 }
455
456 const Rectangle<int> visibleArea (visibleOrigin.x, visibleOrigin.y,
457 jmin (contentBounds.getWidth() - visibleOrigin.x, contentArea.getWidth()),
458 jmin (contentBounds.getHeight() - visibleOrigin.y, contentArea.getHeight()));
459
460 if (lastVisibleArea != visibleArea)
461 {
462 lastVisibleArea = visibleArea;
463 visibleAreaChanged (visibleArea);
464 }
465
466 hbar.handleUpdateNowIfNeeded();
467 vbar.handleUpdateNowIfNeeded();
468}
469
470//==============================================================================
471void Viewport::setSingleStepSizes (const int stepX, const int stepY)
472{
473 if (singleStepX != stepX || singleStepY != stepY)
474 {
475 singleStepX = stepX;
476 singleStepY = stepY;
478 }
479}
480
481void Viewport::setScrollBarsShown (const bool showVerticalScrollbarIfNeeded,
482 const bool showHorizontalScrollbarIfNeeded,
483 const bool allowVerticalScrollingWithoutScrollbar,
484 const bool allowHorizontalScrollingWithoutScrollbar)
485{
486 allowScrollingWithoutScrollbarV = allowVerticalScrollingWithoutScrollbar;
487 allowScrollingWithoutScrollbarH = allowHorizontalScrollingWithoutScrollbar;
488
489 if (showVScrollbar != showVerticalScrollbarIfNeeded
490 || showHScrollbar != showHorizontalScrollbarIfNeeded)
491 {
492 showVScrollbar = showVerticalScrollbarIfNeeded;
493 showHScrollbar = showHorizontalScrollbarIfNeeded;
495 }
496}
497
498void Viewport::setScrollBarThickness (const int thickness)
499{
500 int newThickness;
501
502 // To stay compatible with the previous code: use the
503 // default thickness if thickness parameter is zero
504 // or negative
505 if (thickness <= 0)
506 {
508 newThickness = getLookAndFeel().getDefaultScrollbarWidth();
509 }
510 else
511 {
513 newThickness = thickness;
514 }
515
516 if (scrollBarThickness != newThickness)
517 {
518 scrollBarThickness = newThickness;
520 }
521}
522
524{
525 return scrollBarThickness;
526}
527
528void Viewport::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, double newRangeStart)
529{
530 auto newRangeStartInt = roundToInt (newRangeStart);
531
532 if (scrollBarThatHasMoved == horizontalScrollBar.get())
533 {
534 setViewPosition (newRangeStartInt, getViewPositionY());
535 }
536 else if (scrollBarThatHasMoved == verticalScrollBar.get())
537 {
538 setViewPosition (getViewPositionX(), newRangeStartInt);
539 }
540}
541
543{
544 if (e.eventComponent == this)
545 if (! useMouseWheelMoveIfNeeded (e, wheel))
547}
548
550{
551 if (e.eventComponent == horizontalScrollBar.get() || e.eventComponent == verticalScrollBar.get())
552 dragToScrollListener->stopOngoingAnimation();
553}
554
555static int rescaleMouseWheelDistance (float distance, int singleStepSize) noexcept
556{
557 if (distance == 0.0f)
558 return 0;
559
560 distance *= 14.0f * (float) singleStepSize;
561
562 return roundToInt (distance < 0 ? jmin (distance, -1.0f)
563 : jmax (distance, 1.0f));
564}
565
567{
568 if (! (e.mods.isAltDown() || e.mods.isCtrlDown() || e.mods.isCommandDown()))
569 {
570 const bool canScrollVert = (allowScrollingWithoutScrollbarV || getVerticalScrollBar().isVisible());
571 const bool canScrollHorz = (allowScrollingWithoutScrollbarH || getHorizontalScrollBar().isVisible());
572
573 if (canScrollHorz || canScrollVert)
574 {
575 auto deltaX = rescaleMouseWheelDistance (wheel.deltaX, singleStepX);
576 auto deltaY = rescaleMouseWheelDistance (wheel.deltaY, singleStepY);
577
578 auto pos = getViewPosition();
579
580 if (deltaX != 0 && deltaY != 0 && canScrollHorz && canScrollVert)
581 {
582 pos.x -= deltaX;
583 pos.y -= deltaY;
584 }
585 else if (canScrollHorz && (deltaX != 0 || e.mods.isShiftDown() || ! canScrollVert))
586 {
587 pos.x -= deltaX != 0 ? deltaX : deltaY;
588 }
589 else if (canScrollVert && deltaY != 0)
590 {
591 pos.y -= deltaY;
592 }
593
594 if (pos != getViewPosition())
595 {
596 setViewPosition (pos);
597 return true;
598 }
599 }
600 }
601
602 return false;
603}
604
605static bool isUpDownKeyPress (const KeyPress& key)
606{
607 return key == KeyPress::upKey
612 || key == KeyPress::endKey;
613}
614
615static bool isLeftRightKeyPress (const KeyPress& key)
616{
617 return key == KeyPress::leftKey
619}
620
622{
623 const bool isUpDownKey = isUpDownKeyPress (key);
624
625 if (getVerticalScrollBar().isVisible() && isUpDownKey)
626 return getVerticalScrollBar().keyPressed (key);
627
628 const bool isLeftRightKey = isLeftRightKeyPress (key);
629
630 if (getHorizontalScrollBar().isVisible() && (isUpDownKey || isLeftRightKey))
631 return getHorizontalScrollBar().keyPressed (key);
632
633 return false;
634}
635
640
642{
643 return new ScrollBar (isVertical);
644}
645
646void Viewport::setScrollBarPosition (bool verticalScrollbarOnRight,
647 bool horizontalScrollbarAtBottom)
648{
649 vScrollbarRight = verticalScrollbarOnRight;
650 hScrollbarBottom = horizontalScrollbarAtBottom;
651
652 resized();
653}
654
655} // namespace juce
Type jmin(const Type a, const Type b)
Definition MathsFunctions.h:60
Type jmax(const Type a, const Type b)
Definition MathsFunctions.h:48
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_AnimatedPosition.h:54
void setInterceptsMouseClicks(bool allowClicksOnThisComponent, bool allowClicksOnChildComponents) noexcept
Definition juce_Component.cpp:1420
bool isVisible() const noexcept
Definition juce_Component.h:122
int getHeight() const noexcept
Definition juce_Component.h:274
void addAndMakeVisible(Component *child, int zOrder=-1)
Definition juce_Component.cpp:1554
Component() noexcept
Definition juce_Component.cpp:517
void setWantsKeyboardFocus(bool wantsFocus) noexcept
Definition juce_Component.cpp:2842
int getWidth() const noexcept
Definition juce_Component.h:271
void mouseWheelMove(const MouseEvent &event, const MouseWheelDetails &wheel) override
Definition juce_Component.cpp:2303
LookAndFeel & getLookAndFeel() const noexcept
Definition juce_Component.cpp:2173
Rectangle< int > getLocalBounds() const noexcept
Definition juce_Component.cpp:2283
void addChildComponent(Component *child, int zOrder=-1)
Definition juce_Component.cpp:1548
static Desktop &JUCE_CALLTYPE getInstance()
Definition juce_Desktop.cpp:50
Definition juce_KeyPress.h:40
static const int homeKey
Definition juce_KeyPress.h:204
static const int upKey
Definition juce_KeyPress.h:198
static const int endKey
Definition juce_KeyPress.h:205
static const int rightKey
Definition juce_KeyPress.h:201
static const int downKey
Definition juce_KeyPress.h:199
static const int leftKey
Definition juce_KeyPress.h:200
static const int pageUpKey
Definition juce_KeyPress.h:202
static const int pageDownKey
Definition juce_KeyPress.h:203
Definition juce_MouseEvent.h:39
Definition juce_MouseInputSource.h:52
Definition juce_MouseListener.h:39
Definition juce_Point.h:42
ValueType y
Definition juce_Point.h:247
ValueType x
Definition juce_Point.h:246
Definition juce_Rectangle.h:67
void setHeight(ValueType newHeight) noexcept
Definition juce_Rectangle.h:204
bool contains(ValueType xCoord, ValueType yCoord) const noexcept
Definition juce_Rectangle.h:622
Point< ValueType > getPosition() const noexcept
Definition juce_Rectangle.h:161
ValueType getHeight() const noexcept
Definition juce_Rectangle.h:136
void setWidth(ValueType newWidth) noexcept
Definition juce_Rectangle.h:201
ValueType getX() const noexcept
Definition juce_Rectangle.h:127
ValueType getWidth() const noexcept
Definition juce_Rectangle.h:133
void setX(ValueType newX) noexcept
Definition juce_Rectangle.h:195
void setY(ValueType newY) noexcept
Definition juce_Rectangle.h:198
ValueType getY() const noexcept
Definition juce_Rectangle.h:130
Definition juce_ScrollBar.h:54
Definition juce_String.h:53
Definition juce_Viewport.h:47
void mouseDown(const MouseEvent &e) override
Definition juce_Viewport.cpp:549
void setViewPositionProportionately(double proportionX, double proportionY)
Definition juce_Viewport.cpp:275
int singleStepY
Definition juce_Viewport.h:355
std::unique_ptr< ScrollBar > horizontalScrollBar
Definition juce_Viewport.h:350
bool showHScrollbar
Definition juce_Viewport.h:357
void setScrollBarPosition(bool verticalScrollbarOnRight, bool horizontalScrollbarAtBottom)
Definition juce_Viewport.cpp:646
AccessibilityIgnoredComponent contentHolder
Definition juce_Viewport.h:351
virtual void viewedComponentChanged(Component *newComponent)
Definition juce_Viewport.cpp:183
bool allowScrollingWithoutScrollbarV
Definition juce_Viewport.h:359
bool isCurrentlyScrollingOnDrag() const noexcept
Definition juce_Viewport.cpp:337
int getViewPositionX() const noexcept
Definition juce_Viewport.h:145
int getScrollBarThickness() const
Definition juce_Viewport.cpp:523
ScrollBar & getVerticalScrollBar() noexcept
Definition juce_Viewport.h:254
ScrollOnDragMode
Definition juce_Viewport.h:291
@ nonHover
Definition juce_Viewport.h:293
@ all
Definition juce_Viewport.h:294
@ never
Definition juce_Viewport.h:292
void setScrollOnDragMode(ScrollOnDragMode scrollOnDragMode)
Definition juce_Viewport.cpp:332
bool canScrollVertically() const noexcept
Definition juce_Viewport.cpp:249
bool allowScrollingWithoutScrollbarH
Definition juce_Viewport.h:359
int getMaximumVisibleHeight() const
Definition juce_Viewport.cpp:247
std::unique_ptr< ScrollBar > verticalScrollBar
Definition juce_Viewport.h:350
void componentMovedOrResized(Component &, bool wasMoved, bool wasResized) override
Definition juce_Viewport.cpp:326
bool showVScrollbar
Definition juce_Viewport.h:357
Point< int > getViewPosition() const noexcept
Definition juce_Viewport.h:137
bool hScrollbarBottom
Definition juce_Viewport.h:360
int scrollBarThickness
Definition juce_Viewport.h:354
ScrollOnDragMode scrollOnDragMode
Definition juce_Viewport.h:356
bool useMouseWheelMoveIfNeeded(const MouseEvent &, const MouseWheelDetails &)
Definition juce_Viewport.cpp:566
ScrollBar & getHorizontalScrollBar() noexcept
Definition juce_Viewport.h:259
Point< int > viewportPosToCompPos(Point< int >) const
Definition juce_Viewport.cpp:252
virtual void visibleAreaChanged(const Rectangle< int > &newVisibleArea)
Definition juce_Viewport.cpp:182
bool autoScroll(int mouseX, int mouseY, int distanceFromEdge, int maximumSpeed)
Definition juce_Viewport.cpp:282
bool canScrollHorizontally() const noexcept
Definition juce_Viewport.cpp:250
void deleteOrRemoveContentComp()
Definition juce_Viewport.cpp:186
~Viewport() override
Definition juce_Viewport.cpp:176
void scrollBarMoved(ScrollBar *, double newRangeStart) override
Definition juce_Viewport.cpp:528
bool keyPressed(const KeyPress &) override
Definition juce_Viewport.cpp:621
void resized() override
Definition juce_Viewport.cpp:352
int singleStepX
Definition juce_Viewport.h:355
void setViewPosition(int xPixelsOffset, int yPixelsOffset)
Definition juce_Viewport.cpp:264
void setScrollBarsShown(bool showVerticalScrollbarIfNeeded, bool showHorizontalScrollbarIfNeeded, bool allowVerticalScrollingWithoutScrollbar=false, bool allowHorizontalScrollingWithoutScrollbar=false)
Definition juce_Viewport.cpp:481
bool vScrollbarRight
Definition juce_Viewport.h:360
int getViewPositionY() const noexcept
Definition juce_Viewport.h:150
bool deleteContent
Definition juce_Viewport.h:357
void lookAndFeelChanged() override
Definition juce_Viewport.cpp:343
void recreateScrollbars()
Definition juce_Viewport.cpp:227
int getMaximumVisibleWidth() const
Definition juce_Viewport.cpp:246
void updateVisibleArea()
Definition juce_Viewport.cpp:358
virtual ScrollBar * createScrollBarComponent(bool isVertical)
Definition juce_Viewport.cpp:641
Rectangle< int > lastVisibleArea
Definition juce_Viewport.h:353
std::unique_ptr< DragToScrollListener > dragToScrollListener
Definition juce_Viewport.h:363
Viewport(const String &componentName=String())
Definition juce_Viewport.cpp:160
void setViewedComponent(Component *newViewedComponent, bool deleteComponentWhenNoLongerNeeded=true)
Definition juce_Viewport.cpp:207
bool customScrollBarThickness
Definition juce_Viewport.h:358
static bool respondsToKey(const KeyPress &)
Definition juce_Viewport.cpp:636
WeakReference< Component > contentComp
Definition juce_Viewport.h:352
void setSingleStepSizes(int stepX, int stepY)
Definition juce_Viewport.cpp:471
void mouseWheelMove(const MouseEvent &, const MouseWheelDetails &) override
Definition juce_Viewport.cpp:542
void setScrollBarThickness(int thickness)
Definition juce_Viewport.cpp:498
* e
Definition inflate.c:1404
int y
Definition inflate.c:1588
unsigned v[N_MAX]
Definition inflate.c:1584
register unsigned i
Definition inflate.c:1575
unsigned x[BMAX+1]
Definition inflate.c:1586
static const char * name
Definition pugl.h:1582
#define jassert(expression)
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition carla_juce.cpp:31
static int rescaleMouseWheelDistance(float distance, int singleStepSize) noexcept
Definition juce_Viewport.cpp:555
constexpr Type jmin(Type a, Type b)
Definition juce_MathsFunctions.h:106
constexpr Type jmax(Type a, Type b)
Definition juce_MathsFunctions.h:94
static bool viewportWouldScrollOnEvent(const Viewport *vp, const MouseInputSource &src) noexcept
Definition juce_Viewport.cpp:29
static bool isLeftRightKeyPress(const KeyPress &key)
Definition juce_Viewport.cpp:615
AnimatedPosition< AnimatedPositionBehaviours::ContinuousWithMomentum > ViewportDragPosition
Definition juce_Viewport.cpp:44
int roundToInt(const FloatType value) noexcept
Definition juce_MathsFunctions.h:465
static bool isUpDownKeyPress(const KeyPress &key)
Definition juce_Viewport.cpp:605
Definition juce_Uuid.h:141
png_structrp int mode
Definition png.h:1139
Definition juce_MouseEvent.h:392
float deltaY
Definition juce_MouseEvent.h:410
float deltaX
Definition juce_MouseEvent.h:401
Definition juce_Viewport.cpp:48
void mouseUp(const MouseEvent &e) override
Definition juce_Viewport.cpp:120
ViewportDragPosition offsetY
Definition juce_Viewport.cpp:150
~DragToScrollListener() override
Definition juce_Viewport.cpp:58
Point< int > originalViewPos
Definition juce_Viewport.cpp:151
DragToScrollListener(Viewport &v)
Definition juce_Viewport.cpp:49
void stopOngoingAnimation()
Definition juce_Viewport.cpp:64
ViewportDragPosition offsetX
Definition juce_Viewport.cpp:150
void mouseDrag(const MouseEvent &e) override
Definition juce_Viewport.cpp:94
MouseInputSource scrollSource
Definition juce_Viewport.cpp:152
Viewport & viewport
Definition juce_Viewport.cpp:149
bool doesMouseEventComponentBlockViewportDrag(const Component *eventComp)
Definition juce_Viewport.cpp:140
bool isGlobalMouseListener
Definition juce_Viewport.cpp:154
void positionChanged(ViewportDragPosition &, double) override
Definition juce_Viewport.cpp:70
void endDragAndClearGlobalMouseListener()
Definition juce_Viewport.cpp:126
void mouseDown(const MouseEvent &e) override
Definition juce_Viewport.cpp:76
bool isDragging
Definition juce_Viewport.cpp:153
uch * p
Definition crypt.c:594
return c
Definition crypt.c:175
ZCONST char * key
Definition crypt.c:587
dy
Definition zipinfo.c:2288
#define const
Definition zconf.h:137