1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Adding in PopMenu left and right insert

This commit is contained in:
GavinFAW 2023-12-06 12:52:06 +01:00
parent 69795dc8e5
commit bb9b531b20
2 changed files with 41 additions and 0 deletions

View file

@ -2357,6 +2357,16 @@ bool PopupMenu::MenuItemIterator::next()
return true;
}
PopupMenu::Options PopupMenu::Options::withSelectableAreaLeftInset (int xInsetAmount) const
{
return with (*this, &Options::selectableAreaLeftInset, xInsetAmount);
}
PopupMenu::Options PopupMenu::Options::withSelectableAreaRightInset (int xInsetAmount) const
{
return with (*this, &Options::selectableAreaRightInset, xInsetAmount);
}
PopupMenu::Item& PopupMenu::MenuItemIterator::getItem() const
{
jassert (currentItem != nullptr);

View file

@ -552,6 +552,37 @@ public:
/** Sets the direction of the popup menu relative to the target screen area. */
[[nodiscard]] Options withPreferredPopupDirection (PopupDirection direction) const;
/** Provide an X value from the left edge of any PopupMenu item such
that clicks to the left of the X value will NOT select the Popup
menu item, but clicks to the right will select the Popup men item.
This is useful for blocking off area for extra UI in a
PopupMenu::CustomComponent that you do not want to be used for
selecting a menu item.
@note Added by Tim for FAW SampleComboBox.h so that we could prevent
the sample audio preview buttons in the SamplePopMenuItem
from selecting the item.
*/
[[nodiscard]] Options withSelectableAreaLeftInset (int xInsetAmount) const;
/** Provide an X value from the right edge of any PopupMenu item such
that clicks to the right of the X value will NOT select the Popup
menu item, but clicks to the left will select the Popup men item.
This is useful for blocking off area for extra UI in a
PopupMenu::CustomComponent that you do not want to be used for
selecting a menu item.
@note Added by Tim for FAW SampleComboBox.h so that we could prevent
the favorite buttons in the SamplePopMenuItem from selecting
the item.
*/
[[nodiscard]] Options withSelectableAreaRightInset (int xInsetAmount) const;
/** Sets an item to select in the menu.
This is useful for controls such as combo boxes, where opening the combo box