1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-11 23:54:18 +00:00
This commit is contained in:
Gavin Burke 2025-07-11 04:30:17 +02:00 committed by GitHub
commit 8a99bc1a71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 54 additions and 9 deletions

View file

@ -262,7 +262,7 @@ private:
// If you hit this assertion then either your normalisation function is not working
// correctly or your input is out of the expected bounds.
jassert (exactlyEqual (clampedValue, value));
//jassert (clampedValue == value);
return clampedValue;
}

View file

@ -183,7 +183,7 @@ Value& Value::operator= (const var& newValue)
return *this;
}
void Value::referTo (const Value& valueToReferTo)
void Value::referTo (const Value& valueToReferTo, bool notifyListeners)
{
if (valueToReferTo.value != value)
{
@ -194,7 +194,7 @@ void Value::referTo (const Value& valueToReferTo)
}
value = valueToReferTo.value;
callListeners();
if(notifyListeners) callListeners();
}
}

View file

@ -121,7 +121,7 @@ public:
Existing listeners will still be registered after you call this method, and
they'll continue to receive messages when the new value changes.
*/
void referTo (const Value& valueToReferTo);
void referTo (const Value& valueToReferTo, bool notifyListeners = true);
/** Returns true if this object and the other one use the same underlying
ValueSource object.

View file

@ -3064,10 +3064,10 @@ AccessibilityHandler* Component::getAccessibilityHandler()
// By assigning the accessibility handler before notifying the system that an element was
// created, the if() predicate above should evaluate to false on recursive calls,
// terminating the recursion.
if (accessibilityHandler != nullptr)
detail::AccessibilityHelpers::notifyAccessibilityEvent (*accessibilityHandler, detail::AccessibilityHelpers::Event::elementCreated);
else
jassertfalse; // createAccessibilityHandler must return non-null
// if (accessibilityHandler != nullptr)
// notifyAccessibilityEventInternal (*accessibilityHandler, InternalAccessibilityEvent::elementCreated);
// else
// jassertfalse; // createAccessibilityHandler must return non-null
}
return accessibilityHandler.get();

View file

@ -2032,6 +2032,17 @@ static PopupMenu::Options with (PopupMenu::Options options, Member&& member, Ite
return options;
}
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::Options PopupMenu::Options::withTargetComponent (Component* comp) const
{
auto o = with (with (*this, &Options::targetComponent, comp), &Options::topLevelTarget, comp);

View file

@ -578,6 +578,35 @@ public:
*/
[[nodiscard]] Options forSubmenu() 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;
//==============================================================================
/** Gets the parent component. This may be nullptr if the Component has been deleted.
@ -660,6 +689,8 @@ public:
int visibleItemID = 0, minWidth = 0, minColumns = 1, maxColumns = 0, standardHeight = 0, initiallySelectedItemId = 0;
bool isWatchingForDeletion = false;
PopupDirection preferredPopupDirection = PopupDirection::downwards;
int selectableAreaLeftInset = 0;
int selectableAreaRightInset = 0;
};
//==============================================================================

View file

@ -439,6 +439,9 @@ public:
[[deprecated]] void setSelectedItemIndex (int, bool);
[[deprecated]] void setText (const String&, bool);
#endif
//GB 31/1/24 Changed to public
PopupMenu::Item* getItemForId (int) const noexcept;
private:
//==============================================================================
@ -459,7 +462,7 @@ private:
String textWhenNothingSelected, noChoicesMessage;
EditableState labelEditableState = editableUnknown;
PopupMenu::Item* getItemForId (int) const noexcept;
// std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
PopupMenu::Item* getItemForIndex (int) const noexcept;
bool selectIfEnabled (int index);
bool nudgeSelectedItem (int delta);