29template <
typename RowComponentType>
30static AccessibilityActions getListRowAccessibilityActions (
RowComponentType& rowComponent)
32 auto onFocus = [&rowComponent]
34 rowComponent.getOwner().scrollToEnsureRowIsOnscreen (rowComponent.getRow());
35 rowComponent.getOwner().selectRow (rowComponent.getRow());
38 auto onPress = [&rowComponent, onFocus]
46 rowComponent.getOwner().flipRowSelection (rowComponent.getRow());
54void ListBox::checkModelPtrIsValid()
const
56 #if ! JUCE_DISABLE_ASSERTIONS
63 jassert ((model ==
nullptr) == (weakModelPtr.
lock() ==
nullptr));
69template <
typename Base>
72 auto& getOwner()
const {
return asBase().getOwner(); }
87 isDraggingToScroll =
false;
88 selectRowOnMouseUp =
false;
93 const auto select = getOwner().getRowSelectedOnMouseDown()
95 && ! detail::ViewportHelpers::wouldScrollOnEvent (getOwner().getViewport(), e.
source) ;
97 asBase().performSelection (e,
false);
99 selectRowOnMouseUp =
true;
104 if (asBase().
isEnabled() && selectRowOnMouseUp && ! (isDragging || isDraggingToScroll))
105 asBase().performSelection (e,
true);
110 if (
auto* m = getModel (getOwner()))
116 if (getOwner().getRowSelectedOnMouseDown() || getOwner().isRowSelected (row))
134 if (! isDraggingToScroll)
135 if (
auto*
vp = getOwner().getViewport())
136 isDraggingToScroll =
vp->isCurrentlyScrollingOnDrag();
139 int getRow()
const {
return row; }
140 bool isSelected()
const {
return selected; }
143 const Base& asBase()
const {
return *
static_cast<const Base*
> (
this); }
144 Base& asBase() {
return *
static_cast< Base*
> (
this); }
146 static TableListBoxModel* getModel (TableListBox& x) {
return x.getTableListBoxModel(); }
147 static ListBoxModel* getModel (ListBox& x) {
return x.getListBoxModel(); }
150 bool selected =
false, isDragging =
false, isDraggingToScroll =
false, selectRowOnMouseUp =
false;
174 customComponent.reset (m->refreshComponentForRow (
newRow,
nowSelected, customComponent.release()));
176 if (customComponent !=
nullptr)
190 void performSelection (
const MouseEvent& e,
bool isMouseUp)
195 m->listBoxItemClicked (getRow(), e);
202 m->listBoxItemDoubleClicked (getRow(), e);
207 if (customComponent !=
nullptr)
214 return m->getTooltipForRow (getRow());
221 return std::make_unique<RowAccessibilityHandler> (*
this);
224 ListBox& getOwner()
const {
return owner; }
226 Component* getCustomComponent()
const {
return customComponent.get(); }
230 class RowAccessibilityHandler
final :
public AccessibilityHandler
237 { std::make_unique<RowCellInterface> (*
this) }),
242 String getTitle()
const override
244 if (
auto* m = rowComponent.owner.getListBoxModel())
245 return m->getNameForRow (rowComponent.getRow());
250 String getHelp()
const override {
return rowComponent.getTooltip(); }
252 AccessibleState getCurrentState()
const override
254 if (
auto* m = rowComponent.owner.getListBoxModel())
255 if (rowComponent.getRow() >= m->getNumRows())
256 return AccessibleState().withIgnored();
260 if (rowComponent.owner.multipleSelection)
265 if (rowComponent.isSelected())
272 class RowCellInterface
final :
public AccessibilityCellInterface
275 explicit RowCellInterface (RowAccessibilityHandler& h) : handler (h) {}
277 int getDisclosureLevel()
const override {
return 0; }
279 const AccessibilityHandler* getTableHandler()
const override
281 return handler.rowComponent.owner.getAccessibilityHandler();
285 RowAccessibilityHandler& handler;
288 RowComponent& rowComponent;
312 return createIgnoredAccessibilityHandler (*
this);
316 auto content = std::make_unique<IgnoredComponent>();
317 content->setWantsKeyboardFocus (
false);
322 int getIndexOfFirstVisibleRow()
const {
return jmax (0, firstIndex - 1); }
324 RowComponent* getComponentForRowIfOnscreen (
int row)
const noexcept
326 const auto startIndex = getIndexOfFirstVisibleRow();
328 return (startIndex <= row && row < startIndex + (
int) rows.size())
329 ? rows[(
size_t) (row %
jmax (1, (
int) rows.size()))].get()
333 int getRowNumberOfComponent (
const Component*
const rowComponent)
const noexcept
335 const auto iter =
std::find_if (rows.begin(), rows.end(), [=] (
auto& ptr) { return ptr.get() == rowComponent; });
337 if (iter == rows.end())
341 const auto mod =
jmax (1, (
int) rows.size());
342 const auto startIndex = getIndexOfFirstVisibleRow();
344 return index +
mod * ((startIndex /
mod) + (index < (startIndex %
mod) ? 1 : 0));
349 updateVisibleArea (
true);
352 m->listWasScrolled();
362 auto newX = content.getX();
363 auto newY = content.getY();
376 void updateContents()
385 auto w = content.getWidth();
392 rows.emplace_back (
new RowComponent (owner));
393 content.addAndMakeVisible (*rows.back());
396 firstIndex = y /
rowH;
397 firstWholeIndex = (y +
rowH - 1) /
rowH;
400 const auto startIndex = getIndexOfFirstVisibleRow();
401 const auto lastIndex = startIndex + (
int) rows.size();
403 for (
auto row = startIndex; row < lastIndex; ++row)
405 if (
auto*
rowComp = getComponentForRowIfOnscreen (row))
417 if (owner.headerComponent !=
nullptr)
418 owner.headerComponent->setBounds (owner.outlineThickness + content.getX(),
419 owner.outlineThickness,
422 owner.headerComponent->getHeight());
425 void selectRow (
const int row,
const int rowH,
const bool dontScroll,
434 else if (row >= lastWholeIndex && !
dontScroll)
436 const int rowsOnScreen = lastWholeIndex - firstWholeIndex;
456 void scrollToEnsureRowIsOnscreen (
const int row,
const int rowH)
458 if (row < firstWholeIndex)
462 else if (row >= lastWholeIndex)
477 if (Viewport::respondsToKey (key))
498 void timerCallback()
override
508 int firstIndex = 0, firstWholeIndex = 0, lastWholeIndex = 0;
509 bool hasUpdated =
false;
559 headerComponent.reset();
567 #if ! JUCE_DISABLE_ASSERTIONS
568 weakModelPtr = model !=
nullptr ? model->sharedState :
nullptr;
590 if (mouseMoveSelector ==
nullptr)
595 mouseMoveSelector.reset();
602 if (! hasDoneInitialUpdate)
610 if (outlineThickness > 0)
619 viewport->setBoundsInset (
BorderSize<int> (outlineThickness + (headerComponent !=
nullptr ? headerComponent->getHeight() : 0),
620 outlineThickness, outlineThickness, outlineThickness));
624 viewport->updateVisibleArea (
false);
629 viewport->updateVisibleArea (
true);
634 return viewport.get();
640 checkModelPtrIsValid();
641 hasDoneInitialUpdate =
true;
642 totalItems = (model !=
nullptr) ? model->
getNumRows() : 0;
644 bool selectionChanged =
false;
646 if (selected.
size() > 0 && selected [selected.
size() - 1] >= totalItems)
650 selectionChanged =
true;
653 viewport->updateVisibleArea (
isVisible());
656 if (selectionChanged)
658 if (model !=
nullptr)
672void ListBox::selectRowInternal (
const int row,
677 checkModelPtrIsValid();
679 if (! multipleSelection)
690 selected.
addRange ({ row, row + 1 });
698 lastRowSelected = row;
714 checkModelPtrIsValid();
720 if (row == lastRowSelected)
723 viewport->updateContents();
734 checkModelPtrIsValid();
742 viewport->updateContents();
760 const int numRows = totalItems - 1;
778 selectRowInternal (row,
false,
false,
true);
783 checkModelPtrIsValid();
788 lastRowSelected = -1;
790 viewport->updateContents();
792 if (model !=
nullptr)
804 if (multipleSelection && (mods.
isCommandDown() || alwaysFlipSelection))
808 else if (multipleSelection && mods.
isShiftDown() && lastRowSelected >= 0)
820 return selected.
size();
826 ? selected [index] : -1;
836 return isRowSelected (lastRowSelected) ? lastRowSelected : -1;
844 const int row = (viewport->getViewPositionY() + y - viewport->getY()) / rowHeight;
856 return jlimit (0, totalItems, (viewport->getViewPositionY() + y + rowHeight / 2 - viewport->getY()) / rowHeight);
863 if (
auto*
listRowComp = viewport->getComponentForRowIfOnscreen (row))
871 return viewport->getRowNumberOfComponent (rowComponent);
879 y -= viewport->getViewPositionY();
881 return { viewport->getX(), y,
882 viewport->getViewedComponent()->getWidth(), rowHeight };
887 auto offscreen = viewport->getViewedComponent()->getHeight() - viewport->getHeight();
889 viewport->setViewPosition (viewport->getViewPositionX(),
895 auto offscreen = viewport->getViewedComponent()->getHeight() - viewport->getHeight();
903 return viewport->getViewWidth();
908 viewport->scrollToEnsureRowIsOnscreen (row,
getRowHeight());
914 checkModelPtrIsValid();
918 const bool multiple = multipleSelection
919 && lastRowSelected >= 0
966 if (model !=
nullptr)
972 if (model !=
nullptr)
1021 checkModelPtrIsValid();
1031 viewport->setSingleStepSizes (20, rowHeight);
1037 return viewport->getMaximumVisibleHeight() / rowHeight;
1077bool ListBox::hasAccessibleHeaderComponent()
const
1079 return headerComponent !=
nullptr
1080 && headerComponent->getAccessibilityHandler() !=
nullptr;
1085 repaint (getRowPosition (
rowNumber,
true));
1097 if (
auto*
rowComp = viewport->getComponentForRowIfOnscreen (
firstRow + i))
1121 if (
auto*
rowComp = viewport->getComponentForRowIfOnscreen (
firstRow + i))
1132 rowComp->paintEntireComponent (g,
false);
1165 explicit TableInterface (
ListBox& listBoxToWrap)
1166 : listBox (listBoxToWrap)
1170 int getNumRows()
const override
1172 listBox.checkModelPtrIsValid();
1174 return listBox.model !=
nullptr ? listBox.model->getNumRows()
1178 int getNumColumns()
const override
1185 if (listBox.hasAccessibleHeaderComponent())
1186 return listBox.headerComponent->getAccessibilityHandler();
1193 if (
auto* rowComponent = listBox.viewport->getComponentForRowIfOnscreen (row))
1206 const auto rowNumber = listBox.getRowNumberOfComponent (&handler.
getComponent());
1208 return rowNumber != -1 ? makeOptional (
Span { rowNumber, 1 })
1214 return Span { 0, 1 };
1219 if (
const auto row = getRowSpan (h))
1220 listBox.scrollToEnsureRowIsOnscreen (row->begin);
1229 return std::make_unique<AccessibilityHandler> (*
this,
1230 AccessibilityRole::list,
A simple wrapper for building a collection of supported accessibility actions and corresponding callb...
Base class for accessible Components.
virtual AccessibleState getCurrentState() const
Returns the current state of the UI element.
const Component & getComponent() const noexcept
Returns the Component that this handler represents.
An abstract interface which represents a UI element that supports a table interface.
AccessibleState withAccessibleOffscreen() const noexcept
Sets the accessible offscreen flag and returns the new state.
AccessibleState withSelectable() const noexcept
Sets the selectable flag and returns the new state.
AccessibleState withSelected() const noexcept
Sets the selected flag and returns the new state.
AccessibleState withMultiSelectable() const noexcept
Sets the multiSelectable flag and returns the new state.
Specifies a set of gaps to be left around the sides of a rectangle.
void mouseDrag(const MouseEvent &e) override
Called when the mouse is moved while a button is held down.
void mouseUp(const MouseEvent &e) override
Called when a mouse button is released.
void mouseDown(const MouseEvent &e) override
Called when a mouse button is pressed.
The base class for all JUCE user-interface objects.
bool isVisible() const noexcept
Tests whether the component is visible or not.
bool isOpaque() const noexcept
Returns true if no parts of this component are transparent.
void setFocusContainerType(FocusContainerType containerType) noexcept
Sets whether this component is a container for components that can have their focus traversed,...
int getHeight() const noexcept
Returns the component's height in pixels.
Point< int > getLocalPoint(const Component *sourceComponent, Point< int > pointRelativeToSourceComponent) const
Converts a point to be relative to this component's coordinate space.
static float JUCE_CALLTYPE getApproximateScaleFactorForComponent(const Component *targetComponent)
Returns the approximate scale factor for a given component by traversing its parent hierarchy and app...
void addAndMakeVisible(Component *child, int zOrder=-1)
Adds a child component to this one, and also makes the child visible if it isn't already.
void addMouseListener(MouseListener *newListener, bool wantsEventsForAllNestedChildComponents)
Registers a listener to be told when mouse events occur in this component.
AccessibilityHandler * getAccessibilityHandler()
Returns the accessibility handler for this component, or nullptr if this component is not accessible.
void setOpaque(bool shouldBeOpaque)
Indicates whether any parts of the component might be transparent.
void setMouseCursor(const MouseCursor &cursorType)
Changes the mouse cursor shape to use when the mouse is over this component.
void repaint()
Marks the whole component as needing to be redrawn.
@ none
The component will not act as a focus container.
@ focusContainer
The component will act as a top-level component within which focus is passed around.
void removeMouseListener(MouseListener *listenerToRemove)
Deregisters a mouse listener.
void setWantsKeyboardFocus(bool wantsFocus) noexcept
Sets a flag to indicate whether this component wants keyboard focus or not.
Colour findColour(int colourID, bool inheritFromParent=false) const
Looks for a colour that has been registered with the given colour ID number.
int getWidth() const noexcept
Returns the component's width in pixels.
void mouseWheelMove(const MouseEvent &event, const MouseWheelDetails &wheel) override
Called when the mouse-wheel is moved.
bool isEnabled() const noexcept
Returns true if the component (and all its parents) are enabled.
Rectangle< int > getLocalBounds() const noexcept
Returns the component's bounds, relative to its own origin.
void invalidateAccessibilityHandler()
Invalidates the AccessibilityHandler that is currently being used for this component.
static DragAndDropContainer * findParentDragContainerFor(Component *childComponent)
Utility to find the DragAndDropContainer for a given Component.
A graphics context, used for drawing a component or image.
void drawRect(int x, int y, int width, int height, int lineThickness=1) const
Draws a rectangular outline, using the current colour or brush.
void endTransparencyLayer()
Completes a drawing operation to a temporary semi-transparent buffer.
void addTransform(const AffineTransform &transform)
Adds a transformation which will be performed on all the graphics operations that the context subsequ...
void beginTransparencyLayer(float layerOpacity)
Begins rendering to an off-screen bitmap which will later be flattened onto the current context with ...
bool reduceClipRegion(int x, int y, int width, int height)
Intersects the current clipping region with another region.
void setColour(Colour newColour)
Changes the current drawing colour.
void fillAll() const
Fills the context's entire clip region with the current colour or brush.
void setOrigin(Point< int > newOrigin)
Moves the position of the context's origin.
Holds a fixed-size bitmap.
@ ARGB
< each pixel is a 4-byte ARGB premultiplied colour value.
Represents a key press, including any modifier keys that are needed.
static const int homeKey
key-code for the home key
static const int upKey
key-code for the cursor-up key
static bool isKeyCurrentlyDown(int keyCode)
Checks whether a particular key is held down, irrespective of modifiers.
static const int endKey
key-code for the end key
bool isKeyCode(int keyCodeToCompare) const noexcept
Checks whether the KeyPress's key is the same as the one provided, without checking the modifiers.
static const int deleteKey
key-code for the delete key (not backspace)
ModifierKeys getModifiers() const noexcept
Returns the key modifiers.
static const int downKey
key-code for the cursor-down key
static const int returnKey
key-code for the return key
static const int pageUpKey
key-code for the page-up key
static const int pageDownKey
key-code for the page-down key
static const int backspaceKey
key-code for the backspace key
A subclass of this is used to drive a ListBox.
virtual void deleteKeyPressed(int lastRowSelected)
Override this to be informed when the delete key is pressed.
virtual void returnKeyPressed(int lastRowSelected)
Override this to be informed when the return key is pressed.
virtual Component * refreshComponentForRow(int rowNumber, bool isRowSelected, Component *existingComponentToUpdate)
This is used to create or update a custom component to go in a row of the list.
virtual void listBoxItemDoubleClicked(int row, const MouseEvent &)
This can be overridden to react to the user double-clicking on a row.
virtual String getTooltipForRow(int row)
You can override this to provide tool tips for specific rows.
virtual var getDragSourceDescription(const SparseSet< int > &rowsToDescribe)
To allow rows from your list to be dragged-and-dropped, implement this method.
virtual int getNumRows()=0
This has to return the number of items in the list.
virtual void listBoxItemClicked(int row, const MouseEvent &)
This can be overridden to react to the user clicking on a row.
virtual void listWasScrolled()
Override this to be informed when the list is scrolled.
virtual String getNameForRow(int rowNumber)
This can be overridden to return a name for the specified row.
virtual void backgroundClicked(const MouseEvent &)
This can be overridden to react to the user clicking on a part of the list where there are no rows.
virtual MouseCursor getMouseCursorForRow(int row)
You can override this to return a custom mouse cursor for each row.
virtual void selectedRowsChanged(int lastRowSelected)
Override this to be informed when rows are selected or deselected.
void paint(Graphics &g) override
Components can override this method to draw their content.
bool keyPressed(const KeyPress &key) override
Called when a key is pressed.
void visibleAreaChanged(const Rectangle< int > &) override
Callback method that is called when the visible area changes.
void resized() override
Called when this component's size has been changed.
void paint(Graphics &g) override
Components can override this method to draw their content.
void mouseDoubleClick(const MouseEvent &e) override
Called when a mouse button has been double-clicked on a component.
String getTooltip() override
Returns the string that this object wants to show as its tooltip.
std::unique_ptr< AccessibilityHandler > createAccessibilityHandler() override
Override this method to return a custom AccessibilityHandler for this component.
A list of items that can be scrolled vertically.
void setMultipleSelectionEnabled(bool shouldBeEnabled) noexcept
Turns on multiple-selection of rows.
void deselectRow(int rowNumber)
Deselects a row.
int getRowContainingPosition(int x, int y) const noexcept
Finds the row index that contains a given x,y position.
ListBox(const String &componentName=String(), ListBoxModel *model=nullptr)
Creates a ListBox.
bool keyStateChanged(bool isKeyDown) override
Called when a key is pressed or released.
int getVisibleRowWidth() const noexcept
Returns the width of a row (which may be less than the width of this component if there's a scrollbar...
int getRowNumberOfComponent(const Component *rowComponent) const noexcept
Returns the row number that the given component represents.
void parentHierarchyChanged() override
Called to indicate that the component's parents have changed.
void deselectAllRows()
Deselects any currently selected rows.
void setRowHeight(int newHeight)
Sets the height of each row in the list.
int getSelectedRow(int index=0) const
Returns the row number of a selected row.
virtual ScaledImage createSnapshotOfRows(const SparseSet< int > &rows, int &x, int &y)
This fairly obscure method creates an image that shows the row components specified in rows (for exam...
void scrollToEnsureRowIsOnscreen(int row)
Scrolls if necessary to make sure that a particular row is visible.
bool isRowSelected(int rowNumber) const
Checks whether a row is selected.
void paint(Graphics &) override
Components can override this method to draw their content.
void setMouseMoveSelectsRows(bool shouldSelect)
Makes the list react to mouse moves by selecting the row that the mouse if over.
int getLastRowSelected() const
Returns the last row that the user selected.
void mouseUp(const MouseEvent &) override
Called when a mouse button is released.
~ListBox() override
Destructor.
ScrollBar & getVerticalScrollBar() const noexcept
Returns a reference to the vertical scrollbar.
Viewport * getViewport() const noexcept
Returns the viewport that this ListBox uses.
void setMinimumContentWidth(int newMinimumWidth)
Changes the width of the rows in the list.
void setOutlineThickness(int outlineThickness)
Sets the thickness of a border that will be drawn around the box.
void colourChanged() override
This method is called when a colour is changed by the setColour() method, or when the look-and-feel i...
void selectRangeOfRows(int firstRow, int lastRow, bool dontScrollToShowThisRange=false)
Selects a set of rows.
void visibilityChanged() override
Called when this component's visibility changes.
int getInsertionIndexForPosition(int x, int y) const noexcept
Finds a row index that would be the most suitable place to insert a new item for a given position.
void repaintRow(int rowNumber) noexcept
Repaints one of the rows.
void setSelectedRows(const SparseSet< int > &setOfRowsToBeSelected, NotificationType sendNotificationEventToModel=sendNotification)
Sets the rows that should be selected, based on an explicit set of ranges.
void setModel(ListBoxModel *newModel)
Changes the current data model to display.
Component * getComponentForRowNumber(int rowNumber) const noexcept
Finds the row component for a given row in the list.
void setClickingTogglesRowSelection(bool flipRowSelection) noexcept
If enabled, this makes the listbox flip the selection status of each row that the user clicks,...
@ backgroundColourId
The background colour to fill the list with.
@ outlineColourId
An optional colour to use to draw a border around the list.
void setRowSelectedOnMouseDown(bool isSelectedOnMouseDown) noexcept
Sets whether a row should be selected when the mouse is pressed or released.
void paintOverChildren(Graphics &) override
Components can override this method to draw over the top of their children.
int getVisibleContentWidth() const noexcept
Returns the space currently available for the row items, taking into account borders,...
ScrollBar & getHorizontalScrollBar() const noexcept
Returns a reference to the horizontal scrollbar.
void flipRowSelection(int rowNumber)
Selects or deselects a row.
Rectangle< int > getRowPosition(int rowNumber, bool relativeToComponentTopLeft) const noexcept
Returns the position of one of the rows, relative to the top-left of the listbox.
double getVerticalPosition() const
Returns the current vertical position as a proportion of the total.
bool keyPressed(const KeyPress &) override
Called when a key is pressed.
int getNumRowsOnScreen() const noexcept
Returns the number of rows actually visible.
void updateContent()
Causes the list to refresh its content.
ListBoxModel * getListBoxModel() const noexcept
Returns the current list model.
int getNumSelectedRows() const
Returns the number of rows that are currently selected.
int getRowHeight() const noexcept
Returns the height of a row in the list.
void mouseWheelMove(const MouseEvent &, const MouseWheelDetails &) override
Called when the mouse-wheel is moved.
void setHeaderComponent(std::unique_ptr< Component > newHeaderComponent)
Sets a component that the list should use as a header.
SparseSet< int > getSelectedRows() const
Returns a sparse set indicating the rows that are currently selected.
void selectRow(int rowNumber, bool dontScrollToShowThisRow=false, bool deselectOthersFirst=true)
Selects a row.
void setVerticalPosition(double newProportion)
Scrolls the list to a particular position.
void resized() override
Called when this component's size has been changed.
void selectRowsBasedOnModifierKeys(int rowThatWasClickedOn, ModifierKeys modifiers, bool isMouseUpEvent)
Multiply-selects rows based on the modifier keys.
std::unique_ptr< AccessibilityHandler > createAccessibilityHandler() override
Override this method to return a custom AccessibilityHandler for this component.
Represents the state of the mouse buttons and modifier keys.
bool isCommandDown() const noexcept
Checks whether the 'command' key flag is set (or 'ctrl' on Windows/Linux).
int getRawFlags() const noexcept
Returns the raw flags for direct testing.
bool isPopupMenu() const noexcept
Checks whether the user is trying to launch a pop-up menu.
bool isShiftDown() const noexcept
Checks whether the shift key's flag is set.
@ commandModifier
Command key flag - on windows this is the same as the CTRL key flag.
@ shiftModifier
Shift key flag.
Represents a mouse cursor image.
@ NormalCursor
The standard arrow cursor.
Contains position and status information about a mouse event.
MouseInputSource source
The source device that generated this event.
MouseEvent getEventRelativeTo(Component *newComponent) const noexcept
Creates a version of this event that is relative to a different component.
const Point< float > position
The position of the mouse when the event occurred.
bool mouseWasDraggedSinceMouseDown() const noexcept
Returns true if the user seems to be performing a drag gesture.
bool mouseWasClicked() const noexcept
Returns true if the mouse event is part of a click gesture rather than a drag.
A MouseListener can be registered with a component to receive callbacks about mouse events that happe...
A pair of (x, y) coordinates.
constexpr Point< int > toInt() const noexcept
Casts this point to a Point<int> object.
A general-purpose range object, that simply represents any linear range with a start and end point.
Manages a rectangle and allows geometric operations to be performed on it.
ValueType getY() const noexcept
Returns the y coordinate of the rectangle's top edge.
An image that will be resampled before it is drawn.
A non-owning view over contiguous objects stored in an Array or vector or other similar container.
Holds a set of primitive values, storing them as a set of ranges.
void clear()
Clears the set.
Type size() const noexcept
Returns the number of values in the set.
void addRange(Range< Type > range)
Adds a range of contiguous values to the set.
bool isEmpty() const noexcept
Checks whether the set is empty.
bool contains(Type valueToLookFor) const noexcept
Checks whether a particular value is in the set.
void removeRange(Range< Type > rangeToRemove)
Removes a range of values from the set.
Makes repeated callbacks to a virtual method at a specified time interval.
void stopTimer() noexcept
Stops the timer.
void startTimer(int intervalInMilliseconds) noexcept
Starts the timer and sets the length of interval required.
A Viewport is used to contain a larger child component, and allows the child to be automatically scro...
Component * getViewedComponent() const noexcept
Returns the component that's currently being used inside the Viewport.
int getViewPositionX() const noexcept
Returns the position within the child component of the top-left of its visible area.
int getMaximumVisibleHeight() const
Returns the height available within this component for the contents.
bool keyPressed(const KeyPress &) override
Called when a key is pressed.
void setViewPosition(int xPixelsOffset, int yPixelsOffset)
Changes the position of the viewed component.
int getViewPositionY() const noexcept
Returns the position within the child component of the top-left of its visible area.
int getMaximumVisibleWidth() const
Returns the width available within this component for the contents.
void setViewedComponent(Component *newViewedComponent, bool deleteComponentWhenNoLongerNeeded=true)
Sets the component that this viewport will contain and scroll around.
A variant class, that can be used to hold a range of primitive values.
constexpr bool approximatelyEqual(Type a, Type b, Tolerance< Type > tolerance=Tolerance< Type >{} .withAbsolute(std::numeric_limits< Type >::min()) .withRelative(std::numeric_limits< Type >::epsilon()))
Returns true if the two floating-point numbers are approximately equal.
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Constrains a value to keep it within a given range.
@ rowSelectionChanged
Indicates that the selection of rows in a list or table has changed.
@ structureChanged
Indicates that the structure of the UI elements has changed in a significant way.
NotificationType
These enums are used in various classes to indicate whether a notification event should be sent out.
@ sendNotification
Requests a notification message, either synchronous or not.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
@ focus
Indicates that the UI element has received focus.
@ toggle
Represents a "toggle" action.
@ press
Represents a "press" action.
bool isPositiveAndBelow(Type1 valueToTest, Type2 upperLimit) noexcept
Returns true if a value is at least zero, and also below a specified upper limit.
int roundToInt(const FloatType value) noexcept
Fast floating-point-to-integer conversion.
AccessibilityRole
The list of available roles for an AccessibilityHandler object.
Contains status information about a mouse wheel event.
Utility struct which holds one or more accessibility interfaces.
void mouseExit(const MouseEvent &e) override
Called when the mouse moves out of a component.
void mouseMove(const MouseEvent &e) override
Called when the mouse moves inside a component.