Commit Graph

102 Commits

Author SHA1 Message Date
Tomasz Chabora 3dd881b4e4 Add option to allow echo events in menu shortcuts 2023-08-16 16:59:17 +02:00
Markus Sauermann d41665eb5e Fix position and size of MenuButton popup
Use the same logic as in OptionButton::show_popup
2023-06-15 15:29:50 +02:00
Markus Sauermann 840e2b14f3 Remove unused variable `PopupMenu::parent_rect`
This private variable is not read anywhere.
Remove it and all places, where it is set.
2023-06-15 12:08:47 +02:00
Haoyu Qiu 150f89352b Auto translate popup menus of MenuButton and OptionButton
Currently, `auto_translate` property of a `MenuButton` or `OptionButton`
won't affect its popup menu. It's okay if you want to auto translate,
but requires extra setup if you don't.
2023-03-27 18:09:24 +08:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Eric M a3ed9e6f2c Move Shortcut Context to Control and ensure that `shortcut_input` adheres to contexts. Also ensure that controls with no context are only triggered AFTER nodes which do have a context. 2022-10-13 21:07:19 +10:00
bruvzg 0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
EricEzaM 272c297931 Improve MenuButton and OptionButton
* MenuButton + OptionButton: Add method `show_popup()` which performs required popup setup before showing (prefer use of this over `get_popup()->popup()`, otherwise GH #66308 occurs)
* MenuButton: Ensure that the menu can be opened with a shortcut, if one is set for the button. (GH #66403). Ensure that popupmenu item shortcuts are checked first before the MenuButton shortcut.
2022-10-03 20:07:39 +10:00
Michael Alexsander 9507e91c07 Rename `PopupMenu`'s `set/get_current_index()` to `set/get_focused_item()` 2022-09-06 10:51:14 -03:00
Michael Alexsander 221344b9e2 Fix some corner cases in the `Menu/OptionButton` item auto-highlight 2022-08-28 01:15:03 -03:00
Rémi Verschelde ac7b5111f5
Merge pull request #64768 from bruvzg/popups_hide_if_visible 2022-08-26 11:59:50 +02:00
Rémi Verschelde b7d2ba12c8
Merge pull request #64635 from YeldhamDev/menu_buttons_popup_fix
Make `Menu/OptionButton` item auto-highlight behave better
2022-08-24 19:07:25 +02:00
风青山 e561c68256 Add some codes, returnes directly if the value is not changed.
Avoid executing the following value-changed logics if the value does not really change.
2022-08-23 23:25:22 +08:00
bruvzg cd095ab64a
Hide MenuButton / OptionButton popup on click if it's already visible. 2022-08-23 10:38:51 +03:00
Michael Alexsander 1da50698fc Make `Menu/OptionButton` item auto-highlight behave better 2022-08-19 14:54:53 -03:00
bruvzg 8c56a7416b
Implement `MenuBar` control to wrap `PopupMenu`s or native menu, use native menu for editor. 2022-08-18 22:25:44 +03:00
Juan Linietsky d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00
FireForge 88a8038387 Capitalize/fix some property enum hints 2022-05-12 15:03:16 -05:00
bruvzg d1207a0504
[Input] Add extra `shortcut_input` input processing step to process Unicode character input with Alt / Ctrl modifiers, after processing of shortcuts. 2022-04-05 13:46:45 +03:00
Hugo Locurcio be5116c4a4
Fix typo in BaseButton shortcut context methods 2022-03-07 22:36:12 +01:00
Hugo Locurcio a06f82ca4d
Add optional constructor arguments to more Control nodes
This can be used to make editor code more compact.
However, as of writing, these constructor arguments cannot be used
from the scripting API.

This was already provided for Label and CheckBox, but it was missing
for other Control nodes where it made sense to provide a default value.
2022-03-04 09:48:41 +01:00
Rémi Verschelde 0f5455230c
Use `switch` consistently in `_notification` (`scene` folder) 2022-02-15 18:44:55 +01:00
Michael Alexsander 8bde86da10 Make popups from `MenuButton`, `OptionButton`, and submenus obey the layout direction 2022-02-06 23:07:08 -03:00
Michael Alexsander 73c225838f Make popup menus focus items automatically when not using the mouse 2022-01-25 13:51:56 -03:00
Rémi Verschelde cb7daddbeb
Merge pull request #54647 from rafallus/fix/popupmenu_ids
Fix `PopupMenu` items id range in inspector
2022-01-08 11:39:09 +01:00
rafallus 38d578e24e Fix `PopupMenu` items id range in inspector 2022-01-07 19:58:09 -06:00
Rémi Verschelde fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Aaron Franke 6eb7179f1c
Rename "items_count" property to "item_count" 2021-12-06 22:02:27 -06:00
Rémi Verschelde 3abb5a9035
Add missing argument names for bindings in GDExtension 2021-11-04 15:27:23 +01:00
rafallus 4554892223 Implement inspector property array for `PopupMenu` and `MenuButton` 2021-11-03 09:32:29 -06:00
bruvzg 99dc2ec9e1 Fix RTL layout Label text, VBox child, 3D node editor controls, and popup menu alignment. 2021-09-21 10:35:23 +03:00
Rémi Verschelde b334560f05
Merge pull request #49376 from menip/OptionButtonFix 2021-09-17 16:00:42 +02:00
menip 4f4c9a5f57 Make Color Picker, Menu Button, Option Button consider camera position scale for popup position. 2021-08-30 08:42:33 -07:00
kobewi a913ae8d56 Add support for internal nodes 2021-08-28 02:07:23 +02:00
reduz 5cecdfa8af Entirely removes BIND_VMETHOD in favor of GDVIRTUAL
* `_gui_input`, `_input`, `_unhandled_input` and `_unhandled_key_input` are now regular C++ virutal functions.
* Everything else converted to GDVIRTUAL
* BIND_VMETHOD is gone, always use the new syntax from now on.

Creating `_gui_input` method and using the binder to register events will no longer work, simply override the virtual function now.
2021-08-23 08:10:13 -03:00
Haoyu Qiu 6ca476b406 Fix MenuButton not emitting about_to_popup signal 2021-08-16 20:53:10 +08:00
Bhuvan Vemula a0a019a998 Added EditorCommandPalette 2021-08-09 17:41:50 +05:30
Michael Alexsander 478b6d6a13 Make `switch_on_hover` work on embedded windows 2021-07-26 14:45:26 -03:00
Michael Alexsander a690cd9251 Make `MenuButton`'s `switch_on_hover` work again 2021-07-22 14:27:30 -03:00
Rafał Mikrut 504bc5cc67 Fix crashes in *_input functions 2021-04-05 08:52:21 +02:00
Rafał Mikrut 7961a1dea3 Initialize class variables with default values in scene/ [2/2] 2021-02-09 18:24:36 +01:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Eric M 7941235e06 Add is_valid() check for InputEventKey in CanvasItemEditor. 2020-11-23 21:52:15 +10:00
Eric M efe5c250d5 Implement new shortcuts system.
unhandled_key_input changed to unhandled_button_input. Controls can set a 'shortcut_context' which they can then use to determine if their shortcuts should be triggered or not, based on if the viewport's focused GUI control is a child of their 'shortcut context'.
2020-11-23 21:14:26 +10:00
Yuri Roubinsky f2b98b4106 Remove printing of windowpos/screenpos in MenuButton 2020-10-21 09:58:37 +03:00
FIF15 0e7e25d488 Remove redundant property "enabled_focus_mode"
Fixes #41529.
2020-10-13 10:04:37 +02:00
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Juan Linietsky 197cb4e771 Fixes to X11, still pretty broken 2020-03-26 15:50:00 +01:00
Juan Linietsky b3080bc2f4 Popups have also been converted to windows
Controls using the old modal API have been replaced to use popups.
2020-03-26 15:49:44 +01:00