Browse Source

Added a MouseEvent parameter to ListBoxModel::backgroundClicked and TableListBoxModel::backgroundClicked

tags/2021-05-28
jules 11 years ago
parent
commit
4ab9cdf33a
4 changed files with 24 additions and 12 deletions
  1. +2
    -2
      modules/juce_gui_basics/widgets/juce_ListBox.cpp
  2. +9
    -3
      modules/juce_gui_basics/widgets/juce_ListBox.h
  3. +3
    -3
      modules/juce_gui_basics/widgets/juce_TableListBox.cpp
  4. +10
    -4
      modules/juce_gui_basics/widgets/juce_TableListBox.h

+ 2
- 2
modules/juce_gui_basics/widgets/juce_ListBox.cpp View File

@@ -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) {}


+ 9
- 3
modules/juce_gui_basics/widgets/juce_ListBox.h View File

@@ -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
};


+ 3
- 3
modules/juce_gui_basics/widgets/juce_TableListBox.cpp View File

@@ -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) {}


+ 10
- 4
modules/juce_gui_basics/widgets/juce_TableListBox.h View File

@@ -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<int>& 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 */


Loading…
Cancel
Save