1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-13 00:04:19 +00:00
Commit graph

169 commits

Author SHA1 Message Date
reuk
8ccea668e4
PopupMenu: Adjust mouse interactions so that menu is only dismissed on mouseUp if the mouse has moved
Previously, MouseSourceState::checkButtonState would trigger a menu item
if the MouseSourceState had observed the mouse button transition from
pressed to released while over an item, after more than 250ms had
elapsed since creating the menu window. In situations where the main
thread was very busy, this timeout could sometimes be reached inside the
same mouse click/release gesture. If the menu was created inside a
mouse-down, then simply tapping the mouse could sometimes trigger an
item from the menu as soon as the menu window appeared.

To help avoid accidentally triggering menu items, the menu window now
prevents any item from being triggered by the mouse until either the
mouse has been released once, or the mouse has moved. Put another way,
if the mouse is initially pressed when the menu is shown, it cannot
trigger a menu item unless the mouse is moved before it is released.
2024-10-20 22:59:40 +01:00
reuk
db4a2c0b9f
PopupMenu: Make dismissOnMouseUp private 2024-10-20 22:59:40 +01:00
reuk
570b86ff0c
PopupMenu: Refactor mouseOver detection
The mouseWasOver member will now be updated on each mouse event, rather
than on a timer.
2024-10-20 22:59:40 +01:00
Tom Poole
94d98a2b10 Update licensing information 2024-04-16 11:39:35 +01:00
reuk
903c77b977
PopupMenu: Add accessor for top-level target component to Options class
This allows the LookAndFeel of submenus to query the target component
used for the top-level menu. getTargetComponent() isn't suitable for
this because the target component is set to null for submenus, and this
behaviour can't be changed without potentially breaking code that relies
on the current behaviour.
2023-11-29 13:50:39 +00:00
reuk
7626f86607
PopupMenu: Only display inside safe user area 2023-10-23 16:33:18 +01:00
Tom Poole
6bf9bb9a2e Add final specifiers in implementation files 2023-10-10 16:12:38 +01:00
reuk
081b1ff216
PopupMenu: Avoid dismissing menu in response to mouse events over the menu
In cases where no JUCE component had keyboard focus, clicking a menu
item would cause the menu to be dismissed instead of triggering the
item's action.
2023-04-04 19:55:11 +01:00
Anthony Nicholls
cff722a4af GUI Basics: Refactor juce_gui_basics file structure
- Created a new detail namespace
- Moved shared module implementation details into the detail namespace
- Split dependencies so source files only rely on details in the detail namespace
- Removed all code from the juce_gui_basics.cpp file
2023-03-16 08:53:12 +00:00
attila
a662e5584b PopupMenu: Add explicit focus order to menu items
Without this VoiceOver will iterate over menu items left to right first,
and iteration order will be affected by whether the PopupMenu gets
broken up into multiple columns due to not enough screen space.
2023-02-03 16:11:11 +01:00
reuk
cf297c75c6
PopupMenu: Fix issue where PopupMenu would sometimes use the default rather than the parent look and feel
Previously, for the following snippet, the menu's LnF was incorrectly
being forced to the default LnF. The correct behaviour is to display the
menu using LnF v4. The menu doesn't have an explicit LnF set, so it
should use the LnF of its parent component.

    LookAndFeel::setDefaultLookAndFeel (&lookAndFeel_V1);
    setLookAndFeel (&lookAndFeel_V4);
    PopupMenu().showMenuAsync (PopupMenu::Options{}.withParentComponent (this));
2023-01-25 17:07:23 +00:00
reuk
e5fc50908e
PopupMenu: Use correct LookAndFeel when computing parent component 2022-12-01 11:41:52 +00:00
reuk
28f2157912
Convert ignoreUnused to [[maybe_unused]] 2022-12-01 11:41:50 +00:00
reuk
2b1745272e
Android: Fix a couple of accessibility-related crashes
These crashes could be seen in the DemoRunner when selecting items in
nested PopupMenu windows.
2022-06-13 15:29:56 +01:00
Tom Poole
2ec861d99e Update licensing banners to JUCE 7 2022-05-16 17:55:48 +01:00
reuk
319da1608d PopupMenu: Avoid potential crash when accessing exitingModalState member 2022-05-05 21:35:49 +01:00
reuk
4bfcb78809
PopupMenu: Use DPI awareness of target component when creating new windows
Also updates the drop shadower so that the DPI-awareness of the shadows
matches the DPI-awareness of the shadowed component.
2022-04-22 14:18:50 +01:00
Tom Poole
dea3fe60e4 Update copyright banners 2022-04-04 12:36:32 +01:00
reuk
c51b331318
PopupMenu Accessibility: Report menu-item ticked state on Windows 2022-03-07 11:03:55 +00:00
attila
a1a8e1339f PopupMenu: Fix click-through from submenu
Previously it was possible to inadvertently activate a menu item by
clicking on a submenu item that was drawn on top of the parent menu.

The root cause was that hide() initiates an asynchronous mechanism
through exitModalState() that eventually destroys the MenuWindow, but
the MouseSourceState timer callbacks and event handlers sometimes still
had a chance to do a state update. Since the submenus have just been
destroyed the update could mistakenly conclude to activate one of the
items of the now lone parent.
2022-02-08 17:38:32 +01:00
reuk
77c24ae49f
PopupMenu: Expose item ticked state to screen readers 2022-01-10 22:15:20 +00:00
reuk
3084a23547
PopupMenu: Improve accessibility of custom components in menus
The 'wrapper' accessibility handler is now ignored if a menu item has a
custom component, and has no submenu, and cannot be triggered
automatically. This avoids the case where a custom menu item may end up
with a wrapper accessibility handler that has no useful actions.

This patch also adds a 'label' argument to the addCustomItem functions,
which allows text for the screen reader to be supplied in the case where
a custom component is in use, but the menu item has accessibility
actions.
2022-01-10 22:15:20 +00:00
reuk
c2f661171a
PopupMenu: Avoid giving focus back to previous component on dismiss
This change is designed to fix issues with views stealing focus and
being brought to the front when popup menus are dismissed.

To test this behaviour:
- Open two instances "a" and "b" of a plugin editor containing a
  ComboBox
- Click the ComboBox in editor "a", opening its PopupMenu
- Drag the titlebar of editor "b" to move it
- The PopupMenu should be dismissed, but editor "a" should *not* steal
  keyboard focus or be brought to the front
2021-10-26 16:52:14 +01:00
reuk
3141c32a64
PopupMenu: Avoid const_cast in implementation 2021-09-28 11:31:48 +01:00
reuk
ab966fb499
PopupMenu: Add withMousePosition helper function to Options 2021-09-28 11:31:48 +01:00
reuk
84c5627b42
PopupMenu: Ensure that menu appears at the correct position on Windows with a hi res display in standalone apps 2021-09-28 11:31:48 +01:00
reuk
ea757cf1ea
PopupMenu: Only show menus within safe areas of the screen
This change stops menus from displaying under notches/cutouts on mobile
platforms.
2021-09-28 11:31:47 +01:00
ed
d6fd33b38d Accessibility: Disable accessibility for PopupMenu windows on the desktop when their parent window or target component have accessibility disabled 2021-09-15 14:04:23 +01:00
ed
90eb878d16 Accessibility: Make createAccessibilityHandler() private in Component subclasses 2021-09-07 11:23:17 +01:00
reuk
1ee106d730
PopupMenu: Avoid dismissing PopupMenus in bridged plugin editors
When bridging 32-bit/64-bit plugins on Windows, the plugin is hosted in
an auxilliary process, and the plugin's editor is embedded into an HWND
owned by a different process (the plugin host).

Previously, the `isForegroundProcess` check would fail for bridged
plugins, because the foreground window may belong to the DAW, rather
than to the auxilliary hosting process.

This patch adds an additional check, to find whether the same process
owns both the foreground window, and the window which embeds the
PopupMenu's target component. In this case, we avoid immediately
dismissing the PopupMenu.
2021-06-08 14:57:42 +01:00
reuk
0a4a67d439 PopupMenu: Use correct alignment for submenus with large borders 2021-05-24 19:40:47 +01:00
reuk
bcd7ae1fb5
PopupMenu: Avoid cropping menu items at the bottom of long menus with large borders 2021-05-24 18:48:39 +01:00
ed
b6bb2f4882 Accessibility: Improved PopupMenu focus handling when opening and added support for submenus 2021-05-20 18:24:57 +01:00
ed
ec990202b1 Accessibility: Added VoiceOver (macOS) and Narrator (Windows) accessibility screen reader support to juce_gui_basics 2021-05-10 10:53:14 +01:00
reuk
d62d3aaa4f
PopupMenu: Add option to specify initially-selected menu item 2021-03-10 16:14:42 +00:00
reuk
326d8deb16
PopupMenu: Tidy up Options implementation 2021-03-10 16:14:00 +00:00
ed
1b2f17f2e8 PopupMenu: Check currently focused component before passing keyboard focus on menu completion 2021-01-29 11:43:04 +00:00
reuk
99e2cd0e3f
PopupMenu: Dismiss popups when minimising parent window
This behaviour was already present on windows, so this patch updates
Linux and macOS window-handling to match.
2021-01-15 12:18:31 +00:00
ed
b7e28541ca Replaced deprecated Displays methods 2020-10-27 12:38:59 +00:00
reuk
f61447fd01 PopupMenu: Allow manual column breaking 2020-10-26 17:04:49 +00:00
reuk
d4450ad8ae PopupMenu: Add LookAndFeelMethods for drawing column separators 2020-10-26 17:04:49 +00:00
reuk
f04e11c4bb PopupMenu: Allow theming of popup menu background based on Options
Adds a new `drawPopupMenuBackgroundForOption` member function to
`PopupMenu::LookAndFeelMethods`. By default this will pass through
to `drawPopupMenuBackground`, but it can be overridden in cases
where the background appearance depends on the current `Options`.
2020-10-26 17:04:49 +00:00
ed
94d853b00d Fixed some issues when navigating PopupMenus with the keyboard 2020-07-10 19:05:26 +01:00
reuk
394c4fd475 Clang: Fix warnings when building with clang 10 2020-07-01 10:00:43 +01:00
ed
009d685179 Updated all license headers 2020-06-29 08:30:22 +01:00
ed
d510b73cdf Normalised all whitespace before args in std::function 2020-06-05 09:37:49 +01:00
Tom Poole
894e7d2bd2 Updated all license headers 2020-04-23 17:30:39 +01:00
reuk
327f817b9b Copyrights: Update commercial/gpl headers to be gpl-only 2020-04-09 15:22:56 +01:00
ed
441c88f3b9 macOS: Removed all dynamic_cast type_info warning workarounds which have been fixed in 0dd3b02 2020-03-30 12:57:28 +01:00
Tom Poole
f2e75a8f52 Fixed a popup submenu item selection bug on a right key press 2020-03-25 15:23:09 +00:00