56 int width,
int height,
57 bool rowIsSelected) = 0;
86 virtual Component* refreshComponentForRow (
int rowNumber,
bool isRowSelected,
93 virtual String getNameForRow (
int rowNumber);
98 virtual void listBoxItemClicked (
int row,
const MouseEvent&);
103 virtual void listBoxItemDoubleClicked (
int row,
const MouseEvent&);
109 virtual void backgroundClicked (
const MouseEvent&);
119 virtual void selectedRowsChanged (
int lastRowSelected);
129 virtual void deleteKeyPressed (
int lastRowSelected);
139 virtual void returnKeyPressed (
int lastRowSelected);
146 virtual void listWasScrolled();
167 virtual String getTooltipForRow (
int row);
170 virtual MouseCursor getMouseCursorForRow (
int row);
173 #if ! JUCE_DISABLE_ASSERTIONS
226 #if ! JUCE_DISABLE_ASSERTIONS
227 checkModelPtrIsValid();
241 void updateContent();
253 void setMultipleSelectionEnabled (
bool shouldBeEnabled)
noexcept;
262 void setClickingTogglesRowSelection (
bool flipRowSelection)
noexcept;
267 void setRowSelectedOnMouseDown (
bool isSelectedOnMouseDown)
noexcept;
279 void setMouseMoveSelectsRows (
bool shouldSelect);
295 void selectRow (
int rowNumber,
296 bool dontScrollToShowThisRow =
false,
297 bool deselectOthersFirst =
true);
310 void selectRangeOfRows (
int firstRow,
312 bool dontScrollToShowThisRange =
false);
318 void deselectRow (
int rowNumber);
323 void deselectAllRows();
328 void flipRowSelection (
int rowNumber);
342 void setSelectedRows (
const SparseSet<int>& setOfRowsToBeSelected,
347 bool isRowSelected (
int rowNumber)
const;
352 int getNumSelectedRows()
const;
364 int getSelectedRow (
int index = 0)
const;
373 int getLastRowSelected()
const;
388 void selectRowsBasedOnModifierKeys (
int rowThatWasClickedOn,
390 bool isMouseUpEvent);
403 void setVerticalPosition (
double newProportion);
412 double getVerticalPosition()
const;
415 void scrollToEnsureRowIsOnscreen (
int row);
418 ScrollBar& getVerticalScrollBar() const noexcept;
421 ScrollBar& getHorizontalScrollBar() const noexcept;
428 int getRowContainingPosition (
int x,
int y) const noexcept;
443 int getInsertionIndexForPosition (
int x,
int y) const noexcept;
451 Rectangle<
int> getRowPosition (
int rowNumber,
452 bool relativeToComponentTopLeft) const noexcept;
463 Component* getComponentForRowNumber (
int rowNumber) const noexcept;
468 int getRowNumberOfComponent (const
Component* rowComponent) const noexcept;
473 int getVisibleRowWidth() const noexcept;
480 void setRowHeight (
int newHeight);
485 int getRowHeight() const noexcept {
return rowHeight; }
492 int getNumRowsOnScreen() const noexcept;
504 backgroundColourId = 0x1002800,
506 outlineColourId = 0x1002810,
508 textColourId = 0x1002820
516 void setOutlineThickness (
int outlineThickness);
547 void setMinimumContentWidth (
int newMinimumWidth);
552 int getVisibleContentWidth() const noexcept;
559 void repaintRow (
int rowNumber) noexcept;
580 Viewport* getViewport() const noexcept;
584 bool keyPressed (const
KeyPress&) override;
586 bool keyStateChanged (
bool isKeyDown) override;
590 void paintOverChildren (
Graphics&) override;
592 void resized() override;
594 void visibilityChanged() override;
600 void colourChanged() override;
602 void parentHierarchyChanged() override;
605 const
var& dragDescription,
bool allowDraggingToOtherWindows);
611 [[deprecated (
"This method's bool parameter has changed: see the new method signature.")]]
615 [[deprecated (
"The name of this function is ambiguous if derived classes supply their own models, use getListBoxModel instead")]]
616 ListBoxModel* getModel() const noexcept {
return getListBoxModel(); }
620 JUCE_PUBLIC_IN_DLL_BUILD (
class ListViewport)
621 JUCE_PUBLIC_IN_DLL_BUILD (
class RowComponent)
622 friend class ListViewport;
623 friend class TableListBox;
624 ListBoxModel* model =
nullptr;
628 SparseSet<int> selected;
629 int totalItems = 0, rowHeight = 22, minimumRowWidth = 0;
630 int outlineThickness = 0;
631 int lastRowSelected = -1;
632 bool multipleSelection =
false, alwaysFlipSelection =
false, hasDoneInitialUpdate =
false, selectOnMouseDown =
true;
634 #if ! JUCE_DISABLE_ASSERTIONS
638 void assignModelPtr (ListBoxModel*);
639 void checkModelPtrIsValid()
const;
640 bool hasAccessibleHeaderComponent()
const;
641 void selectRowInternal (
int rowNumber,
bool dontScrollToShowThisRow,
642 bool deselectOthersFirst,
bool isMouseClick);
Base class for accessible Components.
The base class for all JUCE user-interface objects.
A graphics context, used for drawing a component or image.
Represents a key press, including any modifier keys that are needed.
A subclass of this is used to drive a ListBox.
virtual void paintListBoxItem(int rowNumber, Graphics &g, int width, int height, bool rowIsSelected)=0
This method must be implemented to draw a row of the list.
virtual int getNumRows()=0
This has to return the number of items in the list.
virtual bool mayDragToExternalWindows() const
Called when starting a drag operation on a list row to determine whether the item may be dragged to o...
virtual ~ListBoxModel()=default
Destructor.
A list of items that can be scrolled vertically.
ColourIds
A set of colour IDs to use to change the colour of various aspects of the label.
int getOutlineThickness() const noexcept
Returns the thickness of outline that will be drawn around the listbox.
bool getRowSelectedOnMouseDown() const
Gets whether a row should be selected when the mouse is pressed or released.
ListBoxModel * getListBoxModel() const noexcept
Returns the current list model.
Component * getHeaderComponent() const noexcept
Returns whatever header component was set with setHeaderComponent().
Represents the state of the mouse buttons and modifier keys.
Represents a mouse cursor image.
Contains position and status information about a mouse event.
Manages a rectangle and allows geometric operations to be performed on it.
An image that will be resampled before it is drawn.
Holds a set of primitive values, storing them as a set of ranges.
A Viewport is used to contain a larger child component, and allows the child to be automatically scro...
A variant class, that can be used to hold a range of primitive values.
NotificationType
These enums are used in various classes to indicate whether a notification event should be sent out.
Contains status information about a mouse wheel event.