Interface Kit: Add support for shortcuts w/o Command
Introduce B_NO_COMMAND_KEY modifier that is used when a shortcut has no Command modifier, otherwise B_COMMAND_KEY modifier is added. This is conceptually different from B_NO_MODIFIERS in that it allows other modifiers such as B_CONTROL_KEY, B_SHIFT_KEY and B_OPTION_KEY to be added to a shortcut, but not B_COMMAND_KEY. This option is required to remove B_COMMAND_KEY because the Command modifier is assumed to be present on all shortcuts. This allows us to break this assumption without breaking apps written before this change and assume B_COMMAND_KEY to be present even if it has not been explictly added. Document B_NO_COMMAND_KEY in BMenuItem and BWindow docs. Fixes #7078 Co-authored-by: X512 <[email protected]> Co-authored-by: Ryan Leavengood <[email protected]> Change-Id: If0e20cd848112898f4425ede8c17231dc50deb8a Reviewed-on: https://review.haiku-os.org/c/haiku/+/7293 Tested-by: Commit checker robot <[email protected]> Reviewed-by: nephele nephele <[email protected]>
This commit is contained in:
co-authored by
X512
Ryan Leavengood
parent
a5f92820b7
commit
1e2091ced5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 Haiku, Inc. All rights reserved.
|
||||
* Copyright 2014-2025 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -79,8 +79,9 @@
|
||||
\param label The text \a label that is displayed.
|
||||
\param message The BMessage that is sent when the item is selected.
|
||||
\param shortcut The \a shortcut characters to activate the menu item.
|
||||
\param modifiers The modifier keys to active the menu item,
|
||||
\c B_COMMAND_KEY is assumed.
|
||||
\param modifiers The modifier keys to activate the menu item.
|
||||
\c B_COMMAND_KEY is assumed, to remove \c B_COMMAND_KEY you
|
||||
must specify \c B_NO_COMMAND_KEY.
|
||||
|
||||
\since BeOS R3
|
||||
*/
|
||||
@@ -228,7 +229,8 @@
|
||||
|
||||
\param shortcut The ASCII shortcut character to set.
|
||||
\param modifiers A bitmap mask of modifier keys used to activate
|
||||
the shortcut.
|
||||
the shortcut. \c B_COMMAND_KEY is assumed, to remove
|
||||
\c B_COMMAND_KEY you must specify \c B_NO_COMMAND_KEY.
|
||||
|
||||
\since BeOS R3
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2015 Haiku, Inc. All rights reserved.
|
||||
* Copyright 2011-2025 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -1307,6 +1307,7 @@
|
||||
- \c B_OPTION_KEY
|
||||
- \c B_CONTROL_KEY
|
||||
- \c B_MENU_KEY
|
||||
To remove \c B_COMMAND_KEY specify \c B_NO_COMMAND_KEY.
|
||||
\param item The menu \a item to activate.
|
||||
|
||||
\since Haiku R1
|
||||
@@ -1327,6 +1328,7 @@
|
||||
- \c B_OPTION_KEY
|
||||
- \c B_CONTROL_KEY
|
||||
- \c B_MENU_KEY
|
||||
To remove \c B_COMMAND_KEY specify \c B_NO_COMMAND_KEY.
|
||||
\param message The \a message to send when the shortcut is activated. The
|
||||
BWindow takes ownership of the \a message.
|
||||
|
||||
@@ -1350,6 +1352,7 @@
|
||||
- \c B_OPTION_KEY
|
||||
- \c B_CONTROL_KEY
|
||||
- \c B_MENU_KEY
|
||||
To remove \c B_COMMAND_KEY specify \c B_NO_COMMAND_KEY.
|
||||
\param message The \a message to send when the shortcut is activated. The
|
||||
BWindow takes ownership of the \a message.
|
||||
\param target The handler to send the message to.
|
||||
@@ -1369,6 +1372,7 @@
|
||||
- \c B_OPTION_KEY
|
||||
- \c B_CONTROL_KEY
|
||||
- \c B_MENU_KEY
|
||||
To remove \c B_COMMAND_KEY specify \c B_NO_COMMAND_KEY.
|
||||
|
||||
\returns \c true if the window has the specified shortcut, \c false
|
||||
otherwise.
|
||||
@@ -1390,6 +1394,7 @@
|
||||
- \c B_OPTION_KEY
|
||||
- \c B_CONTROL_KEY
|
||||
- \c B_MENU_KEY
|
||||
To remove \c B_COMMAND_KEY specify \c B_NO_COMMAND_KEY.
|
||||
|
||||
\since BeOS R3
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user