LMMS
Loading...
Searching...
No Matches
juce_ListBox.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
29template <typename RowComponentType>
30static AccessibilityActions getListRowAccessibilityActions (RowComponentType& rowComponent)
31{
32 auto onFocus = [&rowComponent]
33 {
34 rowComponent.owner.scrollToEnsureRowIsOnscreen (rowComponent.row);
35 rowComponent.owner.selectRow (rowComponent.row);
36 };
37
38 auto onPress = [&rowComponent, onFocus]
39 {
40 onFocus();
41 rowComponent.owner.keyPressed (KeyPress (KeyPress::returnKey));
42 };
43
44 auto onToggle = [&rowComponent]
45 {
46 rowComponent.owner.flipRowSelection (rowComponent.row);
47 };
48
50 .addAction (AccessibilityActionType::press, std::move (onPress))
51 .addAction (AccessibilityActionType::toggle, std::move (onToggle));
52}
53
55{
56 #if ! JUCE_DISABLE_ASSERTIONS
57 // If this is hit, the model was destroyed while the ListBox was still using it.
58 // You should ensure that the model remains alive for as long as the ListBox holds a pointer to it.
59 // If this assertion is hit in the destructor of a ListBox instance, do one of the following:
60 // - Adjust the order in which your destructors run, so that the ListBox destructor runs
61 // before the destructor of your ListBoxModel, or
62 // - Call ListBox::setModel (nullptr) before destroying your ListBoxModel.
63 jassert ((model == nullptr) == (weakModelPtr.lock() == nullptr));
64 #endif
65}
66
68 public TooltipClient
69{
70public:
71 RowComponent (ListBox& lb) : owner (lb) {}
72
73 void paint (Graphics& g) override
74 {
75 if (auto* m = owner.getModel())
76 m->paintListBoxItem (row, g, getWidth(), getHeight(), isSelected);
77 }
78
79 void update (const int newRow, const bool nowSelected)
80 {
81 const auto rowHasChanged = (row != newRow);
82 const auto selectionHasChanged = (isSelected != nowSelected);
83
84 if (rowHasChanged || selectionHasChanged)
85 {
86 repaint();
87
88 if (rowHasChanged)
89 row = newRow;
90
91 if (selectionHasChanged)
92 isSelected = nowSelected;
93 }
94
95 if (auto* m = owner.getModel())
96 {
97 setMouseCursor (m->getMouseCursorForRow (row));
98
99 customComponent.reset (m->refreshComponentForRow (newRow, nowSelected, customComponent.release()));
100
101 if (customComponent != nullptr)
102 {
104 customComponent->setBounds (getLocalBounds());
105
107 }
108 else
109 {
111 }
112 }
113 }
114
115 void performSelection (const MouseEvent& e, bool isMouseUp)
116 {
117 owner.selectRowsBasedOnModifierKeys (row, e.mods, isMouseUp);
118
119 if (auto* m = owner.getModel())
120 m->listBoxItemClicked (row, e);
121 }
122
123 void mouseDown (const MouseEvent& e) override
124 {
125 isDragging = false;
126 isDraggingToScroll = false;
127 selectRowOnMouseUp = false;
128
129 if (isEnabled())
130 {
131 if (owner.selectOnMouseDown && ! isSelected && ! viewportWouldScrollOnEvent (owner.getViewport(), e.source))
132 performSelection (e, false);
133 else
134 selectRowOnMouseUp = true;
135 }
136 }
137
138 void mouseUp (const MouseEvent& e) override
139 {
141 performSelection (e, true);
142 }
143
144 void mouseDoubleClick (const MouseEvent& e) override
145 {
146 if (isEnabled())
147 if (auto* m = owner.getModel())
148 m->listBoxItemDoubleClicked (row, e);
149 }
150
151 void mouseDrag (const MouseEvent& e) override
152 {
153 if (auto* m = owner.getModel())
154 {
155 if (isEnabled() && e.mouseWasDraggedSinceMouseDown() && ! isDragging)
156 {
157 SparseSet<int> rowsToDrag;
158
159 if (owner.selectOnMouseDown || owner.isRowSelected (row))
160 rowsToDrag = owner.getSelectedRows();
161 else
163
164 if (rowsToDrag.size() > 0)
165 {
166 auto dragDescription = m->getDragSourceDescription (rowsToDrag);
167
168 if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty())))
169 {
170 isDragging = true;
171 owner.startDragAndDrop (e, rowsToDrag, dragDescription, true);
172 }
173 }
174 }
175 }
176
177 if (! isDraggingToScroll)
178 if (auto* vp = owner.getViewport())
179 isDraggingToScroll = vp->isCurrentlyScrollingOnDrag();
180 }
181
182 void resized() override
183 {
184 if (customComponent != nullptr)
185 customComponent->setBounds (getLocalBounds());
186 }
187
189 {
190 if (auto* m = owner.getModel())
191 return m->getTooltipForRow (row);
192
193 return {};
194 }
195
196 //==============================================================================
198 {
199 public:
200 explicit RowAccessibilityHandler (RowComponent& rowComponentToWrap)
201 : AccessibilityHandler (rowComponentToWrap,
203 getListRowAccessibilityActions (rowComponentToWrap),
204 { std::make_unique<RowCellInterface> (*this) }),
205 rowComponent (rowComponentToWrap)
206 {
207 }
208
209 String getTitle() const override
210 {
211 if (auto* m = rowComponent.owner.getModel())
212 return m->getNameForRow (rowComponent.row);
213
214 return {};
215 }
216
217 String getHelp() const override { return rowComponent.getTooltip(); }
218
220 {
221 if (auto* m = rowComponent.owner.getModel())
222 if (rowComponent.row >= m->getNumRows())
223 return AccessibleState().withIgnored();
224
225 auto state = AccessibilityHandler::getCurrentState().withAccessibleOffscreen();
226
227 if (rowComponent.owner.multipleSelection)
228 state = state.withMultiSelectable();
229 else
230 state = state.withSelectable();
231
232 if (rowComponent.isSelected)
233 state = state.withSelected();
234
235 return state;
236 }
237
238 private:
240 {
241 public:
243
244 int getColumnIndex() const override { return 0; }
245 int getColumnSpan() const override { return 1; }
246
247 int getRowIndex() const override
248 {
249 const auto index = handler.rowComponent.row;
250
251 if (handler.rowComponent.owner.hasAccessibleHeaderComponent())
252 return index + 1;
253
254 return index;
255 }
256
257 int getRowSpan() const override { return 1; }
258
259 int getDisclosureLevel() const override { return 0; }
260
261 const AccessibilityHandler* getTableHandler() const override
262 {
263 return handler.rowComponent.owner.getAccessibilityHandler();
264 }
265
266 private:
268 };
269
271 };
272
273 std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override
274 {
275 return std::make_unique<RowAccessibilityHandler> (*this);
276 }
277
278 //==============================================================================
280 std::unique_ptr<Component> customComponent;
281 int row = -1;
282 bool isSelected = false, isDragging = false, isDraggingToScroll = false, selectRowOnMouseUp = false;
283
285};
286
287
288//==============================================================================
290 private Timer
291{
292public:
294 {
295 setWantsKeyboardFocus (false);
296
297 auto content = std::make_unique<Component>();
298 content->setWantsKeyboardFocus (false);
299
300 setViewedComponent (content.release());
301 }
302
303 RowComponent* getComponentForRow (int row) const noexcept
304 {
305 if (isPositiveAndBelow (row, rows.size()))
306 return rows[row];
307
308 return nullptr;
309 }
310
311 RowComponent* getComponentForRowWrapped (int row) const noexcept
312 {
313 return rows[row % jmax (1, rows.size())];
314 }
315
317 {
318 return (row >= firstIndex && row < firstIndex + rows.size())
319 ? getComponentForRowWrapped (row) : nullptr;
320 }
321
322 int getRowNumberOfComponent (Component* const rowComponent) const noexcept
323 {
324 const int index = getViewedComponent()->getIndexOfChildComponent (rowComponent);
325 const int num = rows.size();
326
327 for (int i = num; --i >= 0;)
328 if (((firstIndex + i) % jmax (1, num)) == index)
329 return firstIndex + i;
330
331 return -1;
332 }
333
334 void visibleAreaChanged (const Rectangle<int>&) override
335 {
336 updateVisibleArea (true);
337
338 if (auto* m = owner.getModel())
339 m->listWasScrolled();
340
341 startTimer (50);
342 }
343
344 void updateVisibleArea (const bool makeSureItUpdatesContent)
345 {
346 hasUpdated = false;
347
348 auto& content = *getViewedComponent();
349 auto newX = content.getX();
350 auto newY = content.getY();
351 auto newW = jmax (owner.minimumRowWidth, getMaximumVisibleWidth());
352 auto newH = owner.totalItems * owner.getRowHeight();
353
354 if (newY + newH < getMaximumVisibleHeight() && newH > getMaximumVisibleHeight())
355 newY = getMaximumVisibleHeight() - newH;
356
357 content.setBounds (newX, newY, newW, newH);
358
359 if (makeSureItUpdatesContent && ! hasUpdated)
361 }
362
364 {
365 hasUpdated = true;
366 auto rowH = owner.getRowHeight();
367 auto& content = *getViewedComponent();
368
369 if (rowH > 0)
370 {
371 auto y = getViewPositionY();
372 auto w = content.getWidth();
373
374 const int numNeeded = 4 + getMaximumVisibleHeight() / rowH;
375 rows.removeRange (numNeeded, rows.size());
376
377 while (numNeeded > rows.size())
378 {
379 auto* newRow = rows.add (new RowComponent (owner));
380 content.addAndMakeVisible (newRow);
381 }
382
383 firstIndex = y / rowH;
384 firstWholeIndex = (y + rowH - 1) / rowH;
385 lastWholeIndex = (y + getMaximumVisibleHeight() - 1) / rowH;
386
387 auto startIndex = jmax (0, firstIndex - 1);
388
389 for (int i = 0; i < numNeeded; ++i)
390 {
391 const int row = i + startIndex;
392
393 if (auto* rowComp = getComponentForRowWrapped (row))
394 {
395 rowComp->setBounds (0, row * rowH, w, rowH);
396 rowComp->update (row, owner.isRowSelected (row));
397 }
398 }
399 }
400
401 if (owner.headerComponent != nullptr)
402 owner.headerComponent->setBounds (owner.outlineThickness + content.getX(),
403 owner.outlineThickness,
404 jmax (owner.getWidth() - owner.outlineThickness * 2,
405 content.getWidth()),
406 owner.headerComponent->getHeight());
407 }
408
409 void selectRow (const int row, const int rowH, const bool dontScroll,
410 const int lastSelectedRow, const int totalRows, const bool isMouseClick)
411 {
412 hasUpdated = false;
413
414 if (row < firstWholeIndex && ! dontScroll)
415 {
417 }
418 else if (row >= lastWholeIndex && ! dontScroll)
419 {
420 const int rowsOnScreen = lastWholeIndex - firstWholeIndex;
421
422 if (row >= lastSelectedRow + rowsOnScreen
423 && rowsOnScreen < totalRows - 1
424 && ! isMouseClick)
425 {
427 jlimit (0, jmax (0, totalRows - rowsOnScreen), row) * rowH);
428 }
429 else
430 {
432 jmax (0, (row + 1) * rowH - getMaximumVisibleHeight()));
433 }
434 }
435
436 if (! hasUpdated)
438 }
439
440 void scrollToEnsureRowIsOnscreen (const int row, const int rowH)
441 {
442 if (row < firstWholeIndex)
443 {
445 }
446 else if (row >= lastWholeIndex)
447 {
449 jmax (0, (row + 1) * rowH - getMaximumVisibleHeight()));
450 }
451 }
452
453 void paint (Graphics& g) override
454 {
455 if (isOpaque())
456 g.fillAll (owner.findColour (ListBox::backgroundColourId));
457 }
458
459 bool keyPressed (const KeyPress& key) override
460 {
462 {
463 const int allowableMods = owner.multipleSelection ? ModifierKeys::shiftModifier : 0;
464
465 if ((key.getModifiers().getRawFlags() & ~allowableMods) == 0)
466 {
467 // we want to avoid these keypresses going to the viewport, and instead allow
468 // them to pass up to our listbox..
469 return false;
470 }
471 }
472
473 return Viewport::keyPressed (key);
474 }
475
476private:
477 std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override
478 {
480 }
481
482 void timerCallback() override
483 {
484 stopTimer();
485
486 if (auto* handler = owner.getAccessibilityHandler())
487 handler->notifyAccessibilityEvent (AccessibilityEvent::structureChanged);
488 }
489
493 bool hasUpdated = false;
494
496};
497
498//==============================================================================
500{
502 {
503 owner.addMouseListener (this, true);
504 }
505
507 {
508 owner.removeMouseListener (this);
509 }
510
511 void mouseMove (const MouseEvent& e) override
512 {
513 auto pos = e.getEventRelativeTo (&owner).position.toInt();
514 owner.selectRow (owner.getRowContainingPosition (pos.x, pos.y), true);
515 }
516
517 void mouseExit (const MouseEvent& e) override
518 {
519 mouseMove (e);
520 }
521
524};
525
526
527//==============================================================================
540
542{
543 headerComponent.reset();
544 viewport.reset();
545}
546
548{
549 model = newModel;
550
551 #if ! JUCE_DISABLE_ASSERTIONS
552 weakModelPtr = model != nullptr ? model->sharedState : nullptr;
553 #endif
554}
555
556void ListBox::setModel (ListBoxModel* const newModel)
557{
558 if (model != newModel)
559 {
560 assignModelPtr (newModel);
561 repaint();
563 }
564}
565
569
571{
572 if (b)
573 {
574 if (mouseMoveSelector == nullptr)
576 }
577 else
578 {
579 mouseMoveSelector.reset();
580 }
581}
582
583//==============================================================================
585{
588
589 g.fillAll (findColour (backgroundColourId));
590}
591
593{
594 if (outlineThickness > 0)
595 {
596 g.setColour (findColour (outlineColourId));
597 g.drawRect (getLocalBounds(), outlineThickness);
598 }
599}
600
602{
603 viewport->setBoundsInset (BorderSize<int> (outlineThickness + (headerComponent != nullptr ? headerComponent->getHeight() : 0),
605
606 viewport->setSingleStepSizes (20, getRowHeight());
607
608 viewport->updateVisibleArea (false);
609}
610
612{
613 viewport->updateVisibleArea (true);
614}
615
617{
618 return viewport.get();
619}
620
621//==============================================================================
623{
626 totalItems = (model != nullptr) ? model->getNumRows() : 0;
627
628 bool selectionChanged = false;
629
630 if (selected.size() > 0 && selected [selected.size() - 1] >= totalItems)
631 {
632 selected.removeRange ({ totalItems, std::numeric_limits<int>::max() });
634 selectionChanged = true;
635 }
636
637 viewport->updateVisibleArea (isVisible());
638 viewport->resized();
639
640 if (selectionChanged)
641 {
642 if (model != nullptr)
643 model->selectedRowsChanged (lastRowSelected);
644
645 if (auto* handler = getAccessibilityHandler())
646 handler->notifyAccessibilityEvent (AccessibilityEvent::rowSelectionChanged);
647 }
648}
649
650//==============================================================================
651void ListBox::selectRow (int row, bool dontScroll, bool deselectOthersFirst)
652{
653 selectRowInternal (row, dontScroll, deselectOthersFirst, false);
654}
655
656void ListBox::selectRowInternal (const int row,
657 bool dontScroll,
658 bool deselectOthersFirst,
659 bool isMouseClick)
660{
662
663 if (! multipleSelection)
664 deselectOthersFirst = true;
665
666 if ((! isRowSelected (row))
667 || (deselectOthersFirst && getNumSelectedRows() > 1))
668 {
670 {
671 if (deselectOthersFirst)
672 selected.clear();
673
674 selected.addRange ({ row, row + 1 });
675
676 if (getHeight() == 0 || getWidth() == 0)
677 dontScroll = true;
678
679 viewport->selectRow (row, getRowHeight(), dontScroll,
680 lastRowSelected, totalItems, isMouseClick);
681
683 model->selectedRowsChanged (row);
684
685 if (auto* handler = getAccessibilityHandler())
686 handler->notifyAccessibilityEvent (AccessibilityEvent::rowSelectionChanged);
687 }
688 else
689 {
690 if (deselectOthersFirst)
692 }
693 }
694}
695
696void ListBox::deselectRow (const int row)
697{
699
700 if (selected.contains (row))
701 {
702 selected.removeRange ({ row, row + 1 });
703
704 if (row == lastRowSelected)
706
707 viewport->updateContents();
708 model->selectedRowsChanged (lastRowSelected);
709
710 if (auto* handler = getAccessibilityHandler())
711 handler->notifyAccessibilityEvent (AccessibilityEvent::rowSelectionChanged);
712 }
713}
714
715void ListBox::setSelectedRows (const SparseSet<int>& setOfRowsToBeSelected,
716 const NotificationType sendNotificationEventToModel)
717{
719
720 selected = setOfRowsToBeSelected;
721 selected.removeRange ({ totalItems, std::numeric_limits<int>::max() });
722
725
726 viewport->updateContents();
727
728 if (model != nullptr && sendNotificationEventToModel == sendNotification)
729 model->selectedRowsChanged (lastRowSelected);
730
731 if (auto* handler = getAccessibilityHandler())
732 handler->notifyAccessibilityEvent (AccessibilityEvent::rowSelectionChanged);
733}
734
739
740void ListBox::selectRangeOfRows (int firstRow, int lastRow, bool dontScrollToShowThisRange)
741{
742 if (multipleSelection && (firstRow != lastRow))
743 {
744 const int numRows = totalItems - 1;
745 firstRow = jlimit (0, jmax (0, numRows), firstRow);
746 lastRow = jlimit (0, jmax (0, numRows), lastRow);
747
748 selected.addRange ({ jmin (firstRow, lastRow),
749 jmax (firstRow, lastRow) + 1 });
750
751 selected.removeRange ({ lastRow, lastRow + 1 });
752 }
753
754 selectRowInternal (lastRow, dontScrollToShowThisRange, false, true);
755}
756
757void ListBox::flipRowSelection (const int row)
758{
759 if (isRowSelected (row))
761 else
762 selectRowInternal (row, false, false, true);
763}
764
766{
768
769 if (! selected.isEmpty())
770 {
771 selected.clear();
772 lastRowSelected = -1;
773
774 viewport->updateContents();
775
776 if (model != nullptr)
777 model->selectedRowsChanged (lastRowSelected);
778
779 if (auto* handler = getAccessibilityHandler())
780 handler->notifyAccessibilityEvent (AccessibilityEvent::rowSelectionChanged);
781 }
782}
783
785 ModifierKeys mods,
786 const bool isMouseUpEvent)
787{
789 {
791 }
792 else if (multipleSelection && mods.isShiftDown() && lastRowSelected >= 0)
793 {
795 }
796 else if ((! mods.isPopupMenu()) || ! isRowSelected (row))
797 {
798 selectRowInternal (row, false, ! (multipleSelection && (! isMouseUpEvent) && isRowSelected (row)), true);
799 }
800}
801
803{
804 return selected.size();
805}
806
807int ListBox::getSelectedRow (const int index) const
808{
809 return (isPositiveAndBelow (index, selected.size()))
810 ? selected [index] : -1;
811}
812
813bool ListBox::isRowSelected (const int row) const
814{
815 return selected.contains (row);
816}
817
822
823//==============================================================================
824int ListBox::getRowContainingPosition (const int x, const int y) const noexcept
825{
827 {
828 const int row = (viewport->getViewPositionY() + y - viewport->getY()) / rowHeight;
829
831 return row;
832 }
833
834 return -1;
835}
836
837int ListBox::getInsertionIndexForPosition (const int x, const int y) const noexcept
838{
840 return jlimit (0, totalItems, (viewport->getViewPositionY() + y + rowHeight / 2 - viewport->getY()) / rowHeight);
841
842 return -1;
843}
844
845Component* ListBox::getComponentForRowNumber (const int row) const noexcept
846{
847 if (auto* listRowComp = viewport->getComponentForRowIfOnscreen (row))
848 return listRowComp->customComponent.get();
849
850 return nullptr;
851}
852
853int ListBox::getRowNumberOfComponent (Component* const rowComponent) const noexcept
854{
855 return viewport->getRowNumberOfComponent (rowComponent);
856}
857
858Rectangle<int> ListBox::getRowPosition (int rowNumber, bool relativeToComponentTopLeft) const noexcept
859{
860 auto y = viewport->getY() + rowHeight * rowNumber;
861
862 if (relativeToComponentTopLeft)
863 y -= viewport->getViewPositionY();
864
865 return { viewport->getX(), y,
866 viewport->getViewedComponent()->getWidth(), rowHeight };
867}
868
869void ListBox::setVerticalPosition (const double proportion)
870{
871 auto offscreen = viewport->getViewedComponent()->getHeight() - viewport->getHeight();
872
873 viewport->setViewPosition (viewport->getViewPositionX(),
874 jmax (0, roundToInt (proportion * offscreen)));
875}
876
878{
879 auto offscreen = viewport->getViewedComponent()->getHeight() - viewport->getHeight();
880
881 return offscreen > 0 ? viewport->getViewPositionY() / (double) offscreen
882 : 0;
883}
884
886{
887 return viewport->getViewWidth();
888}
889
891{
892 viewport->scrollToEnsureRowIsOnscreen (row, getRowHeight());
893}
894
895//==============================================================================
897{
899
900 const int numVisibleRows = viewport->getHeight() / getRowHeight();
901
902 const bool multiple = multipleSelection
903 && lastRowSelected >= 0
904 && key.getModifiers().isShiftDown();
905
906 if (key.isKeyCode (KeyPress::upKey))
907 {
908 if (multiple)
910 else
911 selectRow (jmax (0, lastRowSelected - 1));
912 }
913 else if (key.isKeyCode (KeyPress::downKey))
914 {
915 if (multiple)
917 else
918 selectRow (jmin (totalItems - 1, jmax (0, lastRowSelected + 1)));
919 }
920 else if (key.isKeyCode (KeyPress::pageUpKey))
921 {
922 if (multiple)
924 else
925 selectRow (jmax (0, jmax (0, lastRowSelected) - numVisibleRows));
926 }
927 else if (key.isKeyCode (KeyPress::pageDownKey))
928 {
929 if (multiple)
931 else
932 selectRow (jmin (totalItems - 1, jmax (0, lastRowSelected) + numVisibleRows));
933 }
934 else if (key.isKeyCode (KeyPress::homeKey))
935 {
936 if (multiple)
938 else
939 selectRow (0);
940 }
941 else if (key.isKeyCode (KeyPress::endKey))
942 {
943 if (multiple)
945 else
946 selectRow (totalItems - 1);
947 }
948 else if (key.isKeyCode (KeyPress::returnKey) && isRowSelected (lastRowSelected))
949 {
950 if (model != nullptr)
951 model->returnKeyPressed (lastRowSelected);
952 }
953 else if ((key.isKeyCode (KeyPress::deleteKey) || key.isKeyCode (KeyPress::backspaceKey))
955 {
956 if (model != nullptr)
957 model->deleteKeyPressed (lastRowSelected);
958 }
960 {
961 selectRangeOfRows (0, std::numeric_limits<int>::max());
962 }
963 else
964 {
965 return false;
966 }
967
968 return true;
969}
970
982
984{
985 bool eventWasUsed = false;
986
987 if (wheel.deltaX != 0.0f && getHorizontalScrollBar().isVisible())
988 {
989 eventWasUsed = true;
990 getHorizontalScrollBar().mouseWheelMove (e, wheel);
991 }
992
993 if (wheel.deltaY != 0.0f && getVerticalScrollBar().isVisible())
994 {
995 eventWasUsed = true;
996 getVerticalScrollBar().mouseWheelMove (e, wheel);
997 }
998
999 if (! eventWasUsed)
1001}
1002
1004{
1006
1007 if (e.mouseWasClicked() && model != nullptr)
1008 model->backgroundClicked (e);
1009}
1010
1011//==============================================================================
1012void ListBox::setRowHeight (const int newHeight)
1013{
1014 rowHeight = jmax (1, newHeight);
1015 viewport->setSingleStepSizes (20, rowHeight);
1016 updateContent();
1017}
1018
1020{
1021 return viewport->getMaximumVisibleHeight() / rowHeight;
1022}
1023
1024void ListBox::setMinimumContentWidth (const int newMinimumWidth)
1025{
1026 minimumRowWidth = newMinimumWidth;
1027 updateContent();
1028}
1029
1030int ListBox::getVisibleContentWidth() const noexcept { return viewport->getMaximumVisibleWidth(); }
1031
1032ScrollBar& ListBox::getVerticalScrollBar() const noexcept { return viewport->getVerticalScrollBar(); }
1033ScrollBar& ListBox::getHorizontalScrollBar() const noexcept { return viewport->getHorizontalScrollBar(); }
1034
1036{
1038 viewport->setOpaque (isOpaque());
1039 repaint();
1040}
1041
1046
1047void ListBox::setOutlineThickness (int newThickness)
1048{
1049 outlineThickness = newThickness;
1050 resized();
1051}
1052
1053void ListBox::setHeaderComponent (std::unique_ptr<Component> newHeaderComponent)
1054{
1055 headerComponent = std::move (newHeaderComponent);
1059}
1060
1062{
1063 return headerComponent != nullptr
1064 && headerComponent->getAccessibilityHandler() != nullptr;
1065}
1066
1067void ListBox::repaintRow (const int rowNumber) noexcept
1068{
1069 repaint (getRowPosition (rowNumber, true));
1070}
1071
1072ScaledImage ListBox::createSnapshotOfRows (const SparseSet<int>& rows, int& imageX, int& imageY)
1073{
1074 Rectangle<int> imageArea;
1075 auto firstRow = getRowContainingPosition (0, viewport->getY());
1076
1077 for (int i = getNumRowsOnScreen() + 2; --i >= 0;)
1078 {
1079 if (rows.contains (firstRow + i))
1080 {
1081 if (auto* rowComp = viewport->getComponentForRowIfOnscreen (firstRow + i))
1082 {
1083 auto pos = getLocalPoint (rowComp, Point<int>());
1084
1085 imageArea = imageArea.getUnion ({ pos.x, pos.y, rowComp->getWidth(), rowComp->getHeight() });
1086 }
1087 }
1088 }
1089
1090 imageArea = imageArea.getIntersection (getLocalBounds());
1091 imageX = imageArea.getX();
1092 imageY = imageArea.getY();
1093
1094 const auto additionalScale = 2.0f;
1095 const auto listScale = Component::getApproximateScaleFactorForComponent (this) * additionalScale;
1096 Image snapshot (Image::ARGB,
1097 roundToInt ((float) imageArea.getWidth() * listScale),
1098 roundToInt ((float) imageArea.getHeight() * listScale),
1099 true);
1100
1101 for (int i = getNumRowsOnScreen() + 2; --i >= 0;)
1102 {
1103 if (rows.contains (firstRow + i))
1104 {
1105 if (auto* rowComp = viewport->getComponentForRowIfOnscreen (firstRow + i))
1106 {
1107 Graphics g (snapshot);
1108 g.setOrigin ((getLocalPoint (rowComp, Point<int>()) - imageArea.getPosition()) * additionalScale);
1109
1110 const auto rowScale = Component::getApproximateScaleFactorForComponent (rowComp) * additionalScale;
1111
1112 if (g.reduceClipRegion (rowComp->getLocalBounds() * rowScale))
1113 {
1114 g.beginTransparencyLayer (0.6f);
1115 g.addTransform (AffineTransform::scale (rowScale));
1116 rowComp->paintEntireComponent (g, false);
1117 g.endTransparencyLayer();
1118 }
1119 }
1120 }
1121 }
1122
1123 return { snapshot, additionalScale };
1124}
1125
1126void ListBox::startDragAndDrop (const MouseEvent& e, const SparseSet<int>& rowsToDrag, const var& dragDescription, bool allowDraggingToOtherWindows)
1127{
1128 if (auto* dragContainer = DragAndDropContainer::findParentDragContainerFor (this))
1129 {
1130 int x, y;
1131 auto dragImage = createSnapshotOfRows (rowsToDrag, x, y);
1132
1133 auto p = Point<int> (x, y) - e.getEventRelativeTo (this).position.toInt();
1134 dragContainer->startDragging (dragDescription, this, dragImage, allowDraggingToOtherWindows, &p, &e.source);
1135 }
1136 else
1137 {
1138 // to be able to do a drag-and-drop operation, the listbox needs to
1139 // be inside a component which is also a DragAndDropContainer.
1141 }
1142}
1143
1144std::unique_ptr<AccessibilityHandler> ListBox::createAccessibilityHandler()
1145{
1146 class TableInterface : public AccessibilityTableInterface
1147 {
1148 public:
1149 explicit TableInterface (ListBox& listBoxToWrap)
1150 : listBox (listBoxToWrap)
1151 {
1152 }
1153
1154 int getNumRows() const override
1155 {
1156 listBox.checkModelPtrIsValid();
1157
1158 if (listBox.model == nullptr)
1159 return 0;
1160
1161 const auto numRows = listBox.model->getNumRows();
1162
1163 if (listBox.hasAccessibleHeaderComponent())
1164 return numRows + 1;
1165
1166 return numRows;
1167 }
1168
1169 int getNumColumns() const override
1170 {
1171 return 1;
1172 }
1173
1174 const AccessibilityHandler* getCellHandler (int row, int) const override
1175 {
1176 if (auto* headerHandler = getHeaderHandler())
1177 {
1178 if (row == 0)
1179 return headerHandler;
1180
1181 --row;
1182 }
1183
1184 if (auto* rowComponent = listBox.viewport->getComponentForRow (row))
1185 return rowComponent->getAccessibilityHandler();
1186
1187 return nullptr;
1188 }
1189
1190 private:
1191 const AccessibilityHandler* getHeaderHandler() const
1192 {
1193 if (listBox.hasAccessibleHeaderComponent())
1194 return listBox.headerComponent->getAccessibilityHandler();
1195
1196 return nullptr;
1197 }
1198
1199 ListBox& listBox;
1200
1202 };
1203
1204 return std::make_unique<AccessibilityHandler> (*this,
1207 AccessibilityHandler::Interfaces { std::make_unique<TableInterface> (*this) });
1208}
1209
1210//==============================================================================
1211Component* ListBoxModel::refreshComponentForRow (int, bool, Component* existingComponentToUpdate)
1212{
1213 ignoreUnused (existingComponentToUpdate);
1214 jassert (existingComponentToUpdate == nullptr); // indicates a failure in the code that recycles the components
1215 return nullptr;
1216}
1217
1218String ListBoxModel::getNameForRow (int rowNumber) { return "Row " + String (rowNumber + 1); }
1229
1230} // 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_AccessibilityActions.h:73
AccessibilityActions & addAction(AccessibilityActionType type, std::function< void()> actionCallback)
Definition juce_AccessibilityActions.h:88
Definition juce_AccessibilityCellInterface.h:37
Definition juce_AccessibilityHandler.h:41
virtual AccessibleState getCurrentState() const
Definition juce_AccessibilityHandler.cpp:75
AccessibilityHandler(Component &componentToWrap, AccessibilityRole accessibilityRole, AccessibilityActions actions={}, Interfaces interfaces={})
Definition juce_AccessibilityHandler.cpp:55
Definition juce_AccessibilityTableInterface.h:37
Definition juce_AccessibilityState.h:39
JUCE_NODISCARD AccessibleState withIgnored() const noexcept
Definition juce_AccessibilityState.h:95
static AffineTransform scale(float factorX, float factorY) noexcept
Definition juce_AffineTransform.cpp:141
Definition juce_BorderSize.h:42
Definition juce_Component.h:36
bool isVisible() const noexcept
Definition juce_Component.h:122
bool isOpaque() const noexcept
Definition juce_Component.cpp:843
void setFocusContainerType(FocusContainerType containerType) noexcept
Definition juce_Component.cpp:2862
int getHeight() const noexcept
Definition juce_Component.h:274
Point< int > getLocalPoint(const Component *sourceComponent, Point< int > pointRelativeToSourceComponent) const
Definition juce_Component.cpp:1136
static float JUCE_CALLTYPE getApproximateScaleFactorForComponent(const Component *targetComponent)
Definition juce_Component.cpp:1383
void addAndMakeVisible(Component *child, int zOrder=-1)
Definition juce_Component.cpp:1554
AccessibilityHandler * getAccessibilityHandler()
Definition juce_Component.cpp:3302
void setOpaque(bool shouldBeOpaque)
Definition juce_Component.cpp:829
void setMouseCursor(const MouseCursor &cursorType)
Definition juce_Component.cpp:1859
void repaint()
Definition juce_Component.cpp:1917
Component() noexcept
Definition juce_Component.cpp:517
@ none
Definition juce_Component.h:1283
@ focusContainer
Definition juce_Component.h:1295
void setWantsKeyboardFocus(bool wantsFocus) noexcept
Definition juce_Component.cpp:2842
Colour findColour(int colourID, bool inheritFromParent=false) const
Definition juce_Component.cpp:2219
static std::unique_ptr< AccessibilityHandler > createIgnoredAccessibilityHandler(Component &)
Definition juce_Component.cpp:3292
int getWidth() const noexcept
Definition juce_Component.h:271
void mouseWheelMove(const MouseEvent &event, const MouseWheelDetails &wheel) override
Definition juce_Component.cpp:2303
bool isEnabled() const noexcept
Definition juce_Component.cpp:3104
Rectangle< int > getLocalBounds() const noexcept
Definition juce_Component.cpp:2283
void invalidateAccessibilityHandler()
Definition juce_Component.cpp:3297
static DragAndDropContainer * findParentDragContainerFor(Component *childComponent)
Definition juce_DragAndDropContainer.cpp:547
Definition juce_GraphicsContext.h:45
Definition juce_Image.h:58
@ ARGB
Definition juce_Image.h:67
Definition juce_KeyPress.h:40
static const int homeKey
Definition juce_KeyPress.h:204
static const int upKey
Definition juce_KeyPress.h:198
static bool isKeyCurrentlyDown(int keyCode)
Definition juce_linux_Windowing.cpp:804
static const int endKey
Definition juce_KeyPress.h:205
static const int deleteKey
Definition juce_KeyPress.h:194
static const int downKey
Definition juce_KeyPress.h:199
static const int returnKey
Definition juce_KeyPress.h:191
static const int pageUpKey
Definition juce_KeyPress.h:202
static const int pageDownKey
Definition juce_KeyPress.h:203
static const int backspaceKey
Definition juce_KeyPress.h:195
Definition juce_ListBox.cpp:291
void updateContents()
Definition juce_ListBox.cpp:363
bool hasUpdated
Definition juce_ListBox.cpp:493
void paint(Graphics &g) override
Definition juce_ListBox.cpp:453
int firstWholeIndex
Definition juce_ListBox.cpp:492
void scrollToEnsureRowIsOnscreen(const int row, const int rowH)
Definition juce_ListBox.cpp:440
std::unique_ptr< AccessibilityHandler > createAccessibilityHandler() override
Definition juce_ListBox.cpp:477
int lastWholeIndex
Definition juce_ListBox.cpp:492
ListViewport(ListBox &lb)
Definition juce_ListBox.cpp:293
void updateVisibleArea(const bool makeSureItUpdatesContent)
Definition juce_ListBox.cpp:344
void selectRow(const int row, const int rowH, const bool dontScroll, const int lastSelectedRow, const int totalRows, const bool isMouseClick)
Definition juce_ListBox.cpp:409
int firstIndex
Definition juce_ListBox.cpp:492
void timerCallback() override
Definition juce_ListBox.cpp:482
bool keyPressed(const KeyPress &key) override
Definition juce_ListBox.cpp:459
RowComponent * getComponentForRowWrapped(int row) const noexcept
Definition juce_ListBox.cpp:311
RowComponent * getComponentForRowIfOnscreen(int row) const noexcept
Definition juce_ListBox.cpp:316
OwnedArray< RowComponent > rows
Definition juce_ListBox.cpp:491
void visibleAreaChanged(const Rectangle< int > &) override
Definition juce_ListBox.cpp:334
int getRowNumberOfComponent(Component *const rowComponent) const noexcept
Definition juce_ListBox.cpp:322
ListBox & owner
Definition juce_ListBox.cpp:490
RowComponent * getComponentForRow(int row) const noexcept
Definition juce_ListBox.cpp:303
int getColumnIndex() const override
Definition juce_ListBox.cpp:244
RowCellInterface(RowAccessibilityHandler &h)
Definition juce_ListBox.cpp:242
int getRowSpan() const override
Definition juce_ListBox.cpp:257
const AccessibilityHandler * getTableHandler() const override
Definition juce_ListBox.cpp:261
int getColumnSpan() const override
Definition juce_ListBox.cpp:245
int getDisclosureLevel() const override
Definition juce_ListBox.cpp:259
RowAccessibilityHandler & handler
Definition juce_ListBox.cpp:267
int getRowIndex() const override
Definition juce_ListBox.cpp:247
String getTitle() const override
Definition juce_ListBox.cpp:209
RowAccessibilityHandler(RowComponent &rowComponentToWrap)
Definition juce_ListBox.cpp:200
String getHelp() const override
Definition juce_ListBox.cpp:217
AccessibleState getCurrentState() const override
Definition juce_ListBox.cpp:219
RowComponent & rowComponent
Definition juce_ListBox.cpp:270
Definition juce_ListBox.cpp:69
void update(const int newRow, const bool nowSelected)
Definition juce_ListBox.cpp:79
void performSelection(const MouseEvent &e, bool isMouseUp)
Definition juce_ListBox.cpp:115
void resized() override
Definition juce_ListBox.cpp:182
void paint(Graphics &g) override
Definition juce_ListBox.cpp:73
void mouseDoubleClick(const MouseEvent &e) override
Definition juce_ListBox.cpp:144
std::unique_ptr< Component > customComponent
Definition juce_ListBox.cpp:280
void mouseDown(const MouseEvent &e) override
Definition juce_ListBox.cpp:123
String getTooltip() override
Definition juce_ListBox.cpp:188
bool isDragging
Definition juce_ListBox.cpp:282
int row
Definition juce_ListBox.cpp:281
bool selectRowOnMouseUp
Definition juce_ListBox.cpp:282
bool isSelected
Definition juce_ListBox.cpp:282
void mouseUp(const MouseEvent &e) override
Definition juce_ListBox.cpp:138
void mouseDrag(const MouseEvent &e) override
Definition juce_ListBox.cpp:151
std::unique_ptr< AccessibilityHandler > createAccessibilityHandler() override
Definition juce_ListBox.cpp:273
bool isDraggingToScroll
Definition juce_ListBox.cpp:282
ListBox & owner
Definition juce_ListBox.cpp:279
RowComponent(ListBox &lb)
Definition juce_ListBox.cpp:71
Definition juce_ListBox.h:189
bool multipleSelection
Definition juce_ListBox.h:617
void setMultipleSelectionEnabled(bool shouldBeEnabled) noexcept
Definition juce_ListBox.cpp:566
void deselectRow(int rowNumber)
Definition juce_ListBox.cpp:696
int getRowContainingPosition(int x, int y) const noexcept
Definition juce_ListBox.cpp:824
int getRowNumberOfComponent(Component *rowComponent) const noexcept
Definition juce_ListBox.cpp:853
ListBox(const String &componentName=String(), ListBoxModel *model=nullptr)
Definition juce_ListBox.cpp:528
bool keyStateChanged(bool isKeyDown) override
Definition juce_ListBox.cpp:971
int getVisibleRowWidth() const noexcept
Definition juce_ListBox.cpp:885
int rowHeight
Definition juce_ListBox.h:614
void parentHierarchyChanged() override
Definition juce_ListBox.cpp:1042
void deselectAllRows()
Definition juce_ListBox.cpp:765
void startDragAndDrop(const MouseEvent &, const SparseSet< int > &rowsToDrag, const var &dragDescription, bool allowDraggingToOtherWindows)
Definition juce_ListBox.cpp:1126
void setRowHeight(int newHeight)
Definition juce_ListBox.cpp:1012
int getSelectedRow(int index=0) const
Definition juce_ListBox.cpp:807
virtual ScaledImage createSnapshotOfRows(const SparseSet< int > &rows, int &x, int &y)
Definition juce_ListBox.cpp:1072
void scrollToEnsureRowIsOnscreen(int row)
Definition juce_ListBox.cpp:890
bool isRowSelected(int rowNumber) const
Definition juce_ListBox.cpp:813
void paint(Graphics &) override
Definition juce_ListBox.cpp:584
std::unique_ptr< Component > headerComponent
Definition juce_ListBox.h:611
void setMouseMoveSelectsRows(bool shouldSelect)
Definition juce_ListBox.cpp:570
SparseSet< int > selected
Definition juce_ListBox.h:613
int getLastRowSelected() const
Definition juce_ListBox.cpp:818
bool alwaysFlipSelection
Definition juce_ListBox.h:617
void mouseUp(const MouseEvent &) override
Definition juce_ListBox.cpp:1003
~ListBox() override
Definition juce_ListBox.cpp:541
ScrollBar & getVerticalScrollBar() const noexcept
Definition juce_ListBox.cpp:1032
std::unique_ptr< MouseListener > mouseMoveSelector
Definition juce_ListBox.h:612
Viewport * getViewport() const noexcept
Definition juce_ListBox.cpp:616
void setMinimumContentWidth(int newMinimumWidth)
Definition juce_ListBox.cpp:1024
void setOutlineThickness(int outlineThickness)
Definition juce_ListBox.cpp:1047
void selectRowInternal(int rowNumber, bool dontScrollToShowThisRow, bool deselectOthersFirst, bool isMouseClick)
Definition juce_ListBox.cpp:656
bool hasDoneInitialUpdate
Definition juce_ListBox.h:617
void colourChanged() override
Definition juce_ListBox.cpp:1035
void selectRangeOfRows(int firstRow, int lastRow, bool dontScrollToShowThisRange=false)
Definition juce_ListBox.cpp:740
ListBoxModel * model
Definition juce_ListBox.h:609
void checkModelPtrIsValid() const
Definition juce_ListBox.cpp:54
void visibilityChanged() override
Definition juce_ListBox.cpp:611
int getInsertionIndexForPosition(int x, int y) const noexcept
Definition juce_ListBox.cpp:837
void repaintRow(int rowNumber) noexcept
Definition juce_ListBox.cpp:1067
void setSelectedRows(const SparseSet< int > &setOfRowsToBeSelected, NotificationType sendNotificationEventToModel=sendNotification)
Definition juce_ListBox.cpp:715
void setModel(ListBoxModel *newModel)
Definition juce_ListBox.cpp:556
Component * getComponentForRowNumber(int rowNumber) const noexcept
Definition juce_ListBox.cpp:845
bool selectOnMouseDown
Definition juce_ListBox.h:617
void setClickingTogglesRowSelection(bool flipRowSelection) noexcept
Definition juce_ListBox.cpp:567
@ backgroundColourId
Definition juce_ListBox.h:494
@ outlineColourId
Definition juce_ListBox.h:496
int lastRowSelected
Definition juce_ListBox.h:616
void setRowSelectedOnMouseDown(bool isSelectedOnMouseDown) noexcept
Definition juce_ListBox.cpp:568
void paintOverChildren(Graphics &) override
Definition juce_ListBox.cpp:592
int getVisibleContentWidth() const noexcept
Definition juce_ListBox.cpp:1030
int minimumRowWidth
Definition juce_ListBox.h:614
ScrollBar & getHorizontalScrollBar() const noexcept
Definition juce_ListBox.cpp:1033
bool hasAccessibleHeaderComponent() const
Definition juce_ListBox.cpp:1061
void flipRowSelection(int rowNumber)
Definition juce_ListBox.cpp:757
int outlineThickness
Definition juce_ListBox.h:615
Rectangle< int > getRowPosition(int rowNumber, bool relativeToComponentTopLeft) const noexcept
Definition juce_ListBox.cpp:858
std::unique_ptr< ListViewport > viewport
Definition juce_ListBox.h:610
double getVerticalPosition() const
Definition juce_ListBox.cpp:877
bool keyPressed(const KeyPress &) override
Definition juce_ListBox.cpp:896
int getNumRowsOnScreen() const noexcept
Definition juce_ListBox.cpp:1019
void updateContent()
Definition juce_ListBox.cpp:622
int getNumSelectedRows() const
Definition juce_ListBox.cpp:802
int getRowHeight() const noexcept
Definition juce_ListBox.h:475
void mouseWheelMove(const MouseEvent &, const MouseWheelDetails &) override
Definition juce_ListBox.cpp:983
void setHeaderComponent(std::unique_ptr< Component > newHeaderComponent)
Definition juce_ListBox.cpp:1053
SparseSet< int > getSelectedRows() const
Definition juce_ListBox.cpp:735
void selectRow(int rowNumber, bool dontScrollToShowThisRow=false, bool deselectOthersFirst=true)
Definition juce_ListBox.cpp:651
void setVerticalPosition(double newProportion)
Definition juce_ListBox.cpp:869
int totalItems
Definition juce_ListBox.h:614
void assignModelPtr(ListBoxModel *)
Definition juce_ListBox.cpp:547
void resized() override
Definition juce_ListBox.cpp:601
std::weak_ptr< ListBoxModel::Empty > weakModelPtr
Definition juce_ListBox.h:620
void selectRowsBasedOnModifierKeys(int rowThatWasClickedOn, ModifierKeys modifiers, bool isMouseUpEvent)
Definition juce_ListBox.cpp:784
std::unique_ptr< AccessibilityHandler > createAccessibilityHandler() override
Definition juce_ListBox.cpp:1144
Definition juce_ListBox.h:38
virtual void deleteKeyPressed(int lastRowSelected)
Definition juce_ListBox.cpp:1223
virtual void returnKeyPressed(int lastRowSelected)
Definition juce_ListBox.cpp:1224
virtual Component * refreshComponentForRow(int rowNumber, bool isRowSelected, Component *existingComponentToUpdate)
Definition juce_ListBox.cpp:1211
virtual void listBoxItemDoubleClicked(int row, const MouseEvent &)
Definition juce_ListBox.cpp:1220
virtual String getTooltipForRow(int row)
Definition juce_ListBox.cpp:1227
virtual var getDragSourceDescription(const SparseSet< int > &rowsToDescribe)
Definition juce_ListBox.cpp:1226
virtual void listBoxItemClicked(int row, const MouseEvent &)
Definition juce_ListBox.cpp:1219
virtual void listWasScrolled()
Definition juce_ListBox.cpp:1225
virtual String getNameForRow(int rowNumber)
Definition juce_ListBox.cpp:1218
virtual void backgroundClicked(const MouseEvent &)
Definition juce_ListBox.cpp:1221
virtual MouseCursor getMouseCursorForRow(int row)
Definition juce_ListBox.cpp:1228
virtual void selectedRowsChanged(int lastRowSelected)
Definition juce_ListBox.cpp:1222
Definition juce_ModifierKeys.h:41
bool isCommandDown() const noexcept
Definition juce_ModifierKeys.h:68
bool isPopupMenu() const noexcept
Definition juce_ModifierKeys.h:78
bool isShiftDown() const noexcept
Definition juce_ModifierKeys.h:99
@ commandModifier
Definition juce_ModifierKeys.h:147
@ shiftModifier
Definition juce_ModifierKeys.h:121
Definition juce_MouseCursor.h:39
@ NormalCursor
Definition juce_MouseCursor.h:48
Definition juce_MouseEvent.h:39
Definition juce_MouseListener.h:39
Definition juce_OwnedArray.h:51
Definition juce_Point.h:42
static JUCE_NODISCARD Range withStartAndLength(const ValueType startValue, const ValueType length) noexcept
Definition juce_Range.h:66
Definition juce_Rectangle.h:67
Point< ValueType > getPosition() const noexcept
Definition juce_Rectangle.h:161
Rectangle getIntersection(Rectangle other) const noexcept
Definition juce_Rectangle.h:664
ValueType getHeight() const noexcept
Definition juce_Rectangle.h:136
ValueType getX() const noexcept
Definition juce_Rectangle.h:127
Rectangle getUnion(Rectangle other) const noexcept
Definition juce_Rectangle.h:719
ValueType getWidth() const noexcept
Definition juce_Rectangle.h:133
ValueType getY() const noexcept
Definition juce_Rectangle.h:130
Definition juce_ScaledImage.h:45
Definition juce_ScrollBar.h:54
Definition juce_SparseSet.h:41
Type size() const noexcept
Definition juce_SparseSet.h:67
void addRange(Range< Type > range)
Definition juce_SparseSet.h:143
bool contains(Type valueToLookFor) const noexcept
Definition juce_SparseSet.h:100
Definition juce_String.h:53
void stopTimer() noexcept
Definition juce_Timer.cpp:357
Timer() noexcept
Definition juce_Timer.cpp:316
void startTimer(int intervalInMilliseconds) noexcept
Definition juce_Timer.cpp:332
Definition juce_TooltipClient.h:42
Definition juce_Viewport.h:47
Component * getViewedComponent() const noexcept
Definition juce_Viewport.h:83
int getViewPositionX() const noexcept
Definition juce_Viewport.h:145
int getMaximumVisibleHeight() const
Definition juce_Viewport.cpp:247
bool keyPressed(const KeyPress &) override
Definition juce_Viewport.cpp:621
void setViewPosition(int xPixelsOffset, int yPixelsOffset)
Definition juce_Viewport.cpp:264
int getViewPositionY() const noexcept
Definition juce_Viewport.h:150
int getMaximumVisibleWidth() const
Definition juce_Viewport.cpp:246
Viewport(const String &componentName=String())
Definition juce_Viewport.cpp:160
void setViewedComponent(Component *newViewedComponent, bool deleteComponentWhenNoLongerNeeded=true)
Definition juce_Viewport.cpp:207
static bool respondsToKey(const KeyPress &)
Definition juce_Viewport.cpp:636
Definition juce_Variant.h:42
* e
Definition inflate.c:1404
UINT_D64 w
Definition inflate.c:942
unsigned * m
Definition inflate.c:1559
int y
Definition inflate.c:1588
int g
Definition inflate.c:1573
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)
#define jassertfalse
Definition carla_juce.cpp:31
constexpr Type jmin(Type a, Type b)
Definition juce_MathsFunctions.h:106
constexpr Type jmax(Type a, Type b)
Definition juce_MathsFunctions.h:94
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Definition juce_MathsFunctions.h:262
static bool viewportWouldScrollOnEvent(const Viewport *vp, const MouseInputSource &src) noexcept
Definition juce_Viewport.cpp:29
@ rowSelectionChanged
Definition juce_AccessibilityEvent.h:78
@ structureChanged
Definition juce_AccessibilityEvent.h:57
NotificationType
Definition juce_NotificationType.h:32
@ sendNotification
Definition juce_NotificationType.h:34
void ignoreUnused(Types &&...) noexcept
Definition juce_MathsFunctions.h:333
static AccessibilityActions getListRowAccessibilityActions(RowComponentType &rowComponent)
Definition juce_ListBox.cpp:30
@ focus
Definition juce_AccessibilityActions.h:54
@ toggle
Definition juce_AccessibilityActions.h:47
@ press
Definition juce_AccessibilityActions.h:40
bool isPositiveAndBelow(Type1 valueToTest, Type2 upperLimit) noexcept
Definition juce_MathsFunctions.h:279
int roundToInt(const FloatType value) noexcept
Definition juce_MathsFunctions.h:465
AccessibilityRole
Definition juce_AccessibilityRole.h:37
@ list
Definition juce_AccessibilityRole.h:56
@ listItem
Definition juce_AccessibilityRole.h:57
@ row
Definition juce_AccessibilityRole.h:53
Definition juce_AccessibilityHandler.h:49
Definition juce_ListBox.cpp:500
ListBoxMouseMoveSelector(ListBox &lb)
Definition juce_ListBox.cpp:501
void mouseExit(const MouseEvent &e) override
Definition juce_ListBox.cpp:517
ListBox & owner
Definition juce_ListBox.cpp:522
~ListBoxMouseMoveSelector() override
Definition juce_ListBox.cpp:506
void mouseMove(const MouseEvent &e) override
Definition juce_ListBox.cpp:511
Definition juce_MouseEvent.h:392
float deltaY
Definition juce_MouseEvent.h:410
float deltaX
Definition juce_MouseEvent.h:401
uch * p
Definition crypt.c:594
ZCONST char * key
Definition crypt.c:587
uch h[RAND_HEAD_LEN]
Definition crypt.c:459
b
Definition crypt.c:628
void handler(int signal)
Definition fileio.c:1632
#define const
Definition zconf.h:137