Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding in PopMenu left and right insert #1311

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions modules/juce_gui_basics/menus/juce_PopupMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
31 changes: 31 additions & 0 deletions modules/juce_gui_basics/menus/juce_PopupMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,37 @@ class JUCE_API PopupMenu

/** 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.

Expand Down
Loading