mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
PopupMenu: Add missing target components for menus created by built-in widgets
This commit is contained in:
parent
336a475921
commit
b20df8d713
6 changed files with 14 additions and 9 deletions
|
|
@ -829,7 +829,7 @@ private:
|
||||||
setContentOwned (content, resizeAutomatically);
|
setContentOwned (content, resizeAutomatically);
|
||||||
}
|
}
|
||||||
|
|
||||||
void buttonClicked (Button*) override
|
void buttonClicked (Button* button) override
|
||||||
{
|
{
|
||||||
PopupMenu m;
|
PopupMenu m;
|
||||||
m.addItem (1, TRANS ("Audio/MIDI Settings..."));
|
m.addItem (1, TRANS ("Audio/MIDI Settings..."));
|
||||||
|
|
@ -839,7 +839,7 @@ private:
|
||||||
m.addSeparator();
|
m.addSeparator();
|
||||||
m.addItem (4, TRANS ("Reset to default state"));
|
m.addItem (4, TRANS ("Reset to default state"));
|
||||||
|
|
||||||
m.showMenuAsync (PopupMenu::Options(),
|
m.showMenuAsync (PopupMenu::Options().withTargetComponent (button),
|
||||||
ModalCallbackFunction::forComponent (menuCallback, this));
|
ModalCallbackFunction::forComponent (menuCallback, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,12 +102,17 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cellClicked (int rowNumber, int columnId, const juce::MouseEvent& e) override
|
void cellClicked (int rowNumber, int columnId, const MouseEvent& e) override
|
||||||
{
|
{
|
||||||
TableListBoxModel::cellClicked (rowNumber, columnId, e);
|
TableListBoxModel::cellClicked (rowNumber, columnId, e);
|
||||||
|
|
||||||
if (rowNumber >= 0 && rowNumber < getNumRows() && e.mods.isPopupMenu())
|
if (rowNumber >= 0 && rowNumber < getNumRows() && e.mods.isPopupMenu())
|
||||||
owner.createMenuForRow (rowNumber).showMenuAsync (PopupMenu::Options().withDeletionCheck (owner));
|
{
|
||||||
|
owner.createMenuForRow (rowNumber)
|
||||||
|
.showMenuAsync (PopupMenu::Options().withTargetComponent (e.originalComponent)
|
||||||
|
.withMousePosition()
|
||||||
|
.withDeletionCheck (owner));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteKeyPressed (int) override
|
void deleteKeyPressed (int) override
|
||||||
|
|
|
||||||
|
|
@ -672,7 +672,7 @@ public:
|
||||||
m.addSubMenu (TRANS ("Rotary mode"), rotaryMenu);
|
m.addSubMenu (TRANS ("Rotary mode"), rotaryMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
m.showMenuAsync (PopupMenu::Options(),
|
m.showMenuAsync (PopupMenu::Options().withTargetComponent (owner).withMousePosition(),
|
||||||
ModalCallbackFunction::forComponent (sliderMenuCallback, &owner));
|
ModalCallbackFunction::forComponent (sliderMenuCallback, &owner));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -912,7 +912,7 @@ void TableHeaderComponent::showColumnChooserMenu (const int columnIdClicked)
|
||||||
{
|
{
|
||||||
m.setLookAndFeel (&getLookAndFeel());
|
m.setLookAndFeel (&getLookAndFeel());
|
||||||
|
|
||||||
m.showMenuAsync (PopupMenu::Options(),
|
m.showMenuAsync (PopupMenu::Options().withTargetComponent (this).withMousePosition(),
|
||||||
ModalCallbackFunction::forComponent (tableHeaderMenuCallback, this, columnIdClicked));
|
ModalCallbackFunction::forComponent (tableHeaderMenuCallback, this, columnIdClicked));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1581,8 +1581,8 @@ void TextEditor::mouseDown (const MouseEvent& e)
|
||||||
|
|
||||||
menuActive = true;
|
menuActive = true;
|
||||||
|
|
||||||
m.showMenuAsync (PopupMenu::Options(),
|
m.showMenuAsync (PopupMenu::Options().withTargetComponent (this).withMousePosition(),
|
||||||
[safeThis = SafePointer<TextEditor> { this }] (int menuResult)
|
[safeThis = SafePointer { this }] (int menuResult)
|
||||||
{
|
{
|
||||||
if (auto* editor = safeThis.getComponent())
|
if (auto* editor = safeThis.getComponent())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1563,7 +1563,7 @@ void CodeEditorComponent::mouseDown (const MouseEvent& e)
|
||||||
m.setLookAndFeel (&getLookAndFeel());
|
m.setLookAndFeel (&getLookAndFeel());
|
||||||
addPopupMenuItems (m, &e);
|
addPopupMenuItems (m, &e);
|
||||||
|
|
||||||
m.showMenuAsync (PopupMenu::Options(),
|
m.showMenuAsync (PopupMenu::Options().withTargetComponent (this).withMousePosition(),
|
||||||
ModalCallbackFunction::forComponent (codeEditorMenuCallback, this));
|
ModalCallbackFunction::forComponent (codeEditorMenuCallback, this));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue