| @@ -107,7 +107,7 @@ public: | |||
| void mouseDrag (const MouseEvent& e) override | |||
| { | |||
| if (auto* m = getOwner().getModel()) | |||
| if (auto* m = getModel (getOwner())) | |||
| { | |||
| if (asBase().isEnabled() && e.mouseWasDraggedSinceMouseDown() && ! isDragging) | |||
| { | |||
| @@ -143,6 +143,9 @@ private: | |||
| const Base& asBase() const { return *static_cast<const Base*> (this); } | |||
| Base& asBase() { return *static_cast< Base*> (this); } | |||
| static TableListBoxModel* getModel (TableListBox& x) { return x.getTableListBoxModel(); } | |||
| static ListBoxModel* getModel (ListBox& x) { return x.getListBoxModel(); } | |||
| int row = -1; | |||
| bool selected = false, isDragging = false, isDraggingToScroll = false, selectRowOnMouseUp = false; | |||
| }; | |||
| @@ -156,7 +159,7 @@ public: | |||
| void paint (Graphics& g) override | |||
| { | |||
| if (auto* m = owner.getModel()) | |||
| if (auto* m = owner.getListBoxModel()) | |||
| m->paintListBoxItem (getRow(), g, getWidth(), getHeight(), isSelected()); | |||
| } | |||
| @@ -164,7 +167,7 @@ public: | |||
| { | |||
| updateRowAndSelection (newRow, nowSelected); | |||
| if (auto* m = owner.getModel()) | |||
| if (auto* m = owner.getListBoxModel()) | |||
| { | |||
| setMouseCursor (m->getMouseCursorForRow (getRow())); | |||
| @@ -188,14 +191,14 @@ public: | |||
| { | |||
| owner.selectRowsBasedOnModifierKeys (getRow(), e.mods, isMouseUp); | |||
| if (auto* m = owner.getModel()) | |||
| if (auto* m = owner.getListBoxModel()) | |||
| m->listBoxItemClicked (getRow(), e); | |||
| } | |||
| void mouseDoubleClick (const MouseEvent& e) override | |||
| { | |||
| if (isEnabled()) | |||
| if (auto* m = owner.getModel()) | |||
| if (auto* m = owner.getListBoxModel()) | |||
| m->listBoxItemDoubleClicked (getRow(), e); | |||
| } | |||
| @@ -207,7 +210,7 @@ public: | |||
| String getTooltip() override | |||
| { | |||
| if (auto* m = owner.getModel()) | |||
| if (auto* m = owner.getListBoxModel()) | |||
| return m->getTooltipForRow (getRow()); | |||
| return {}; | |||
| @@ -238,7 +241,7 @@ private: | |||
| String getTitle() const override | |||
| { | |||
| if (auto* m = rowComponent.owner.getModel()) | |||
| if (auto* m = rowComponent.owner.getListBoxModel()) | |||
| return m->getNameForRow (rowComponent.getRow()); | |||
| return {}; | |||
| @@ -248,7 +251,7 @@ private: | |||
| AccessibleState getCurrentState() const override | |||
| { | |||
| if (auto* m = rowComponent.owner.getModel()) | |||
| if (auto* m = rowComponent.owner.getListBoxModel()) | |||
| if (rowComponent.getRow() >= m->getNumRows()) | |||
| return AccessibleState().withIgnored(); | |||
| @@ -345,7 +348,7 @@ public: | |||
| { | |||
| updateVisibleArea (true); | |||
| if (auto* m = owner.getModel()) | |||
| if (auto* m = owner.getListBoxModel()) | |||
| m->listWasScrolled(); | |||
| startTimer (50); | |||
| @@ -221,7 +221,7 @@ public: | |||
| void setModel (ListBoxModel* newModel); | |||
| /** Returns the current list model. */ | |||
| ListBoxModel* getModel() const noexcept | |||
| ListBoxModel* getListBoxModel() const noexcept | |||
| { | |||
| #if ! JUCE_DISABLE_ASSERTIONS | |||
| checkModelPtrIsValid(); | |||
| @@ -612,6 +612,9 @@ public: | |||
| void setSelectedRows (const SparseSet<int>&, bool); | |||
| #endif | |||
| [[deprecated ("The name of this function is ambiguous if derived classes supply their own models, use getListBoxModel instead")]] | |||
| ListBoxModel* getModel() const noexcept { return getListBoxModel(); } | |||
| private: | |||
| //============================================================================== | |||
| JUCE_PUBLIC_IN_DLL_BUILD (class ListViewport) | |||
| @@ -41,7 +41,7 @@ public: | |||
| void paint (Graphics& g) override | |||
| { | |||
| if (auto* tableModel = owner.getModel()) | |||
| if (auto* tableModel = owner.getTableListBoxModel()) | |||
| { | |||
| tableModel->paintRowBackground (g, getRow(), getWidth(), getHeight(), isSelected()); | |||
| @@ -80,7 +80,7 @@ public: | |||
| updateRowAndSelection (newRow, isNowSelected); | |||
| auto* tableModel = owner.getModel(); | |||
| auto* tableModel = owner.getTableListBoxModel(); | |||
| if (tableModel != nullptr && getRow() < owner.getNumRows()) | |||
| { | |||
| @@ -171,7 +171,7 @@ public: | |||
| auto columnId = owner.getHeader().getColumnIdAtX (e.x); | |||
| if (columnId != 0) | |||
| if (auto* m = owner.getModel()) | |||
| if (auto* m = owner.getTableListBoxModel()) | |||
| m->cellClicked (getRow(), columnId, e); | |||
| } | |||
| @@ -183,7 +183,7 @@ public: | |||
| const auto columnId = owner.getHeader().getColumnIdAtX (e.x); | |||
| if (columnId != 0) | |||
| if (auto* m = owner.getModel()) | |||
| if (auto* m = owner.getTableListBoxModel()) | |||
| m->cellDoubleClicked (getRow(), columnId, e); | |||
| } | |||
| @@ -192,7 +192,7 @@ public: | |||
| auto columnId = owner.getHeader().getColumnIdAtX (getMouseXYRelative().getX()); | |||
| if (columnId != 0) | |||
| if (auto* m = owner.getModel()) | |||
| if (auto* m = owner.getTableListBoxModel()) | |||
| return m->getCellTooltip (getRow(), columnId); | |||
| return {}; | |||
| @@ -219,7 +219,7 @@ public: | |||
| return std::make_unique<RowAccessibilityHandler> (*this); | |||
| } | |||
| ListBox& getOwner() const { return owner; } | |||
| TableListBox& getOwner() const { return owner; } | |||
| private: | |||
| //============================================================================== | |||
| @@ -247,7 +247,7 @@ private: | |||
| AccessibleState getCurrentState() const override | |||
| { | |||
| if (auto* m = rowComponent.owner.getModel()) | |||
| if (auto* m = rowComponent.owner.getTableListBoxModel()) | |||
| if (rowComponent.getRow() >= m->getNumRows()) | |||
| return AccessibleState().withIgnored(); | |||
| @@ -578,7 +578,7 @@ std::unique_ptr<AccessibilityHandler> TableListBox::createAccessibilityHandler() | |||
| int getNumRows() const override | |||
| { | |||
| if (auto* tableModel = tableListBox.getModel()) | |||
| if (auto* tableModel = tableListBox.getTableListBoxModel()) | |||
| return tableModel->getNumRows(); | |||
| return 0; | |||
| @@ -233,7 +233,7 @@ public: | |||
| void setModel (TableListBoxModel* newModel); | |||
| /** Returns the model currently in use. */ | |||
| TableListBoxModel* getModel() const noexcept { return model; } | |||
| TableListBoxModel* getTableListBoxModel() const noexcept { return model; } | |||
| //============================================================================== | |||
| /** Returns the header component being used in this table. */ | |||
| @@ -334,6 +334,10 @@ public: | |||
| /** @internal */ | |||
| std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override; | |||
| /** Returns the model currently in use. */ | |||
| [[deprecated ("This function hides the non-virtual ListBox::getModel, use getTableListBoxModel instead")]] | |||
| TableListBoxModel* getModel() const noexcept { return getTableListBoxModel(); } | |||
| private: | |||
| //============================================================================== | |||
| class Header; | |||