From 4ab9cdf33a0bcb5a6ea00a6a2511c4a76519b774 Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 4 Jun 2014 13:08:49 +0100 Subject: [PATCH] Added a MouseEvent parameter to ListBoxModel::backgroundClicked and TableListBoxModel::backgroundClicked --- modules/juce_gui_basics/widgets/juce_ListBox.cpp | 4 ++-- modules/juce_gui_basics/widgets/juce_ListBox.h | 12 +++++++++--- .../juce_gui_basics/widgets/juce_TableListBox.cpp | 6 +++--- .../juce_gui_basics/widgets/juce_TableListBox.h | 14 ++++++++++---- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/modules/juce_gui_basics/widgets/juce_ListBox.cpp b/modules/juce_gui_basics/widgets/juce_ListBox.cpp index 5c2dddb49a..9034f44909 100644 --- a/modules/juce_gui_basics/widgets/juce_ListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ListBox.cpp @@ -809,7 +809,7 @@ void ListBox::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& whee void ListBox::mouseUp (const MouseEvent& e) { if (e.mouseWasClicked() && model != nullptr) - model->backgroundClicked(); + model->backgroundClicked (e); } //============================================================================== @@ -947,7 +947,7 @@ Component* ListBoxModel::refreshComponentForRow (int, bool, Component* existingC void ListBoxModel::listBoxItemClicked (int, const MouseEvent&) {} void ListBoxModel::listBoxItemDoubleClicked (int, const MouseEvent&) {} -void ListBoxModel::backgroundClicked() {} +void ListBoxModel::backgroundClicked (const MouseEvent&) {} void ListBoxModel::selectedRowsChanged (int) {} void ListBoxModel::deleteKeyPressed (int) {} void ListBoxModel::returnKeyPressed (int) {} diff --git a/modules/juce_gui_basics/widgets/juce_ListBox.h b/modules/juce_gui_basics/widgets/juce_ListBox.h index 94e96016ea..b575d1520a 100644 --- a/modules/juce_gui_basics/widgets/juce_ListBox.h +++ b/modules/juce_gui_basics/widgets/juce_ListBox.h @@ -84,18 +84,18 @@ public: /** This can be overridden to react to the user clicking on a row. @see listBoxItemDoubleClicked */ - virtual void listBoxItemClicked (int row, const MouseEvent& e); + virtual void listBoxItemClicked (int row, const MouseEvent&); /** This can be overridden to react to the user double-clicking on a row. @see listBoxItemClicked */ - virtual void listBoxItemDoubleClicked (int row, const MouseEvent& e); + virtual void listBoxItemDoubleClicked (int row, const MouseEvent&); /** This can be overridden to react to the user clicking on a part of the list where there are no rows. @see listBoxItemClicked */ - virtual void backgroundClicked(); + virtual void backgroundClicked (const MouseEvent&); /** Override this to be informed when rows are selected or deselected. @@ -152,6 +152,12 @@ public: /** You can override this to return a custom mouse cursor for each row. */ virtual MouseCursor getMouseCursorForRow (int row); + +private: + #if JUCE_CATCH_DEPRECATED_CODE_MISUSE + // This method's signature has changed to take a MouseEvent parameter - please update your code! + JUCE_DEPRECATED_WITH_BODY (virtual int backgroundClicked(), { return 0; }) + #endif }; diff --git a/modules/juce_gui_basics/widgets/juce_TableListBox.cpp b/modules/juce_gui_basics/widgets/juce_TableListBox.cpp index 3e2df4d2ee..ce71febb4d 100644 --- a/modules/juce_gui_basics/widgets/juce_TableListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_TableListBox.cpp @@ -398,10 +398,10 @@ void TableListBox::returnKeyPressed (int row) model->returnKeyPressed (row); } -void TableListBox::backgroundClicked() +void TableListBox::backgroundClicked (const MouseEvent& e) { if (model != nullptr) - model->backgroundClicked(); + model->backgroundClicked (e); } void TableListBox::listWasScrolled() @@ -457,7 +457,7 @@ void TableListBox::updateColumnComponents() const //============================================================================== void TableListBoxModel::cellClicked (int, int, const MouseEvent&) {} void TableListBoxModel::cellDoubleClicked (int, int, const MouseEvent&) {} -void TableListBoxModel::backgroundClicked() {} +void TableListBoxModel::backgroundClicked (const MouseEvent&) {} void TableListBoxModel::sortOrderChanged (int, const bool) {} int TableListBoxModel::getColumnAutoSizeWidth (int) { return 0; } void TableListBoxModel::selectedRowsChanged (int) {} diff --git a/modules/juce_gui_basics/widgets/juce_TableListBox.h b/modules/juce_gui_basics/widgets/juce_TableListBox.h index 9f83e86c69..19096aefff 100644 --- a/modules/juce_gui_basics/widgets/juce_TableListBox.h +++ b/modules/juce_gui_basics/widgets/juce_TableListBox.h @@ -103,21 +103,21 @@ public: The mouse event's coordinates will be relative to the entire table row. @see cellDoubleClicked, backgroundClicked */ - virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e); + virtual void cellClicked (int rowNumber, int columnId, const MouseEvent&); /** This callback is made when the user clicks on one of the cells in the table. The mouse event's coordinates will be relative to the entire table row. @see cellClicked, backgroundClicked */ - virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e); + virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent&); /** This can be overridden to react to the user double-clicking on a part of the list where there are no rows. @see cellClicked */ - virtual void backgroundClicked(); + virtual void backgroundClicked (const MouseEvent&); //============================================================================== /** This callback is made when the table's sort order is changed. @@ -182,6 +182,12 @@ public: @see getDragSourceCustomData, DragAndDropContainer::startDragging */ virtual var getDragSourceDescription (const SparseSet& currentlySelectedRows); + +private: + #if JUCE_CATCH_DEPRECATED_CODE_MISUSE + // This method's signature has changed to take a MouseEvent parameter - please update your code! + JUCE_DEPRECATED_WITH_BODY (virtual int backgroundClicked(), { return 0; }) + #endif }; @@ -303,7 +309,7 @@ public: /** @internal */ void returnKeyPressed (int currentSelectedRow) override; /** @internal */ - void backgroundClicked() override; + void backgroundClicked (const MouseEvent&) override; /** @internal */ void listWasScrolled() override; /** @internal */