Commit Graph

145 Commits

Author SHA1 Message Date
9e96c7d9b8 Merge pull request #110378 from timothyqiu/rtl-preview
Make text-related nodes translation domain aware
2025-10-16 12:48:05 -05:00
2d94ad1f3a Merge pull request #93389 from KoBeWi/MASSIVE_copy_paste
Remove code duplication in Button
2025-09-22 13:28:47 -05:00
172c80df67 Make text-related nodes translation domain aware
- Makes `is_layout_rtl()` translation domain aware
- Makes various text-drawing controls translation domain aware
- Makes translation preview use the project's fallback locale when disabled
2025-09-22 09:39:14 +08:00
e3ce74dc7e Remove code duplication in Button 2025-09-19 20:34:41 +02:00
aeb3a45c97 Hide Control focus when given via mouse input 2025-09-19 13:43:29 -03:00
a272376f89 Cleanup accessibility names. 2025-06-23 11:08:36 +03:00
b106dfd4f9 Base accessibility API. 2025-04-08 20:14:28 +03:00
b7eda9dbc1 Merge pull request #104230 from bruvzg/start_clip
Add properties to configure space trimming on line break.
2025-03-18 14:42:44 -05:00
2bbf0f2317 Add properties to configure space trimming on line break. 2025-03-16 16:15:37 +02:00
82a0290871 Add auto translate mode for items in PopupMenu and OptionButton 2025-03-09 23:50:11 +08:00
912b52a6a5 Expose OVERRUN_ENFORCE_ELLIPSIS flag to the controls. 2025-02-10 08:41:31 +02:00
8f79640dc3 Merge pull request #95511 from bruvzg/btn_oversampling_reshape
Reshape and update button on oversampling change.
2024-12-02 17:19:47 +01:00
d58b2e879f Get rid of easily removable uses of const_cast 2024-12-01 17:50:13 -08:00
6bbc1cb6a9 Merge pull request #98036 from bruvzg/para_btn_spacing
[TextParagraph/Button] Add support for line spacing.
2024-11-10 12:13:03 -06:00
562c666e3d Rename internal Button icon to button_icon to match exposed methods 2024-10-29 16:23:03 -07:00
cb618e46f8 Merge pull request #97335 from SlienCode/master
Fix `font_hover_pressed_color` and `icon_hover_pressed_color` not working for no stylebox use on `Button`
2024-10-24 20:38:33 -07:00
309712551c [TextParagraph/Button] Add support for line spacing. 2024-10-10 12:49:24 +03:00
41a1a7f94b Reshape and update button on oversampling change. 2024-10-06 22:53:34 +03:00
0f98b32448 Fix button text autowrap overflow when inside a container 2024-09-24 09:55:48 +08:00
6d4d5f9272 Fix font_hover_pressed_color and icon_hover_pressed_color not working for no stylebox use on Button
You now don't need to have a `hover_pressed` stylebox to make use of `font_hover_pressed_color` and `icon_hover_pressed_color`.
2024-09-22 20:07:46 +02:00
41df3caad3 [Button] Use align_to_largest_stylebox for min. size calculation. 2024-07-04 09:40:55 +03:00
35b4b5f779 [Button] Do not include internal margins into base button minimum size. 2024-06-13 14:18:44 +03:00
721a663aa3 [Button] Adds theme option to align button text and icon to either largest or current stylebox. 2024-06-10 18:40:52 +03:00
ea379e3b3a Improve button min. size calculation. 2024-05-16 22:37:12 +03:00
82fef614ce Round the icon's drawing rect when drawing the button
Each component of the icon's drawing rect needs to be snapped to an
integer.
2024-05-11 00:15:36 +08:00
45bde2b5b0 [Button] Fix theme elements size rounding errors not keeping sufficient space for the text. 2024-04-18 11:48:46 +03:00
7e567c4777 Merge pull request #88615 from Rindbee/add-h_separation-between-icons-in-CheckButton-and-CheckBox
Add a `h_separation` between icons in `CheckButton`/`CheckBox`
2024-02-26 10:48:54 +01:00
00480fc818 [Button] Add autowrap feature. 2024-02-22 12:11:58 +02:00
5de496d3b0 Add a h_separation between icons in CheckButton/CheckBox
Previously, the `h_separation` between internal elements and custom elements
was added when `text` was not empty. That is, this `h_separation` does not
exist when there is a valid custom `icon` but `text` is empty.

Now, the `h_separation` between the internal element and the custom element
is added when the internal element and any custom element exist (both width
are greater than `0`).
2024-02-21 17:53:07 +08:00
567e76f935 Fix forgetting h_separation when internal elements exist 2024-01-22 22:20:01 +08:00
f29a7d302e Make the drawing logic clearer in Button
The drawing logic follows the calculation logic in `Button::get_minimum_size`.

According to the order of `stylebox`, `icon`, and `text`, and follow properties
such as alignment mode, to fill the display space of the button.

Add a `Button::_set_h_separation_is_valid_when_no_text` for Button derived
classes (like `OptionButton`) that expects a `h_separation` between `icon`
and theme icon even if the `text` is empty.
2024-01-18 22:57:22 +08:00
2924bfd4d3 Register theme properties with ThemeDB 2023-09-11 13:45:23 +02:00
380db4d03e Remove unnecessary validity checks from Button and TextureRect
The one in `TextureRect` appears to be a leftover from earlier code, and
the one in `Button` was copied from there.
2023-09-06 16:39:06 +02:00
7f70ac56a0 Fix Button text when overrun is not trim nothing 2023-08-08 15:08:28 +08:00
de4a3fa151 Unify and streamline connecting to Resource changes 2023-07-17 19:35:57 +02:00
71430cdd48 Fix Button clipping when internal margins exist 2023-07-14 13:59:16 +08:00
d4ac3b6ded Make TextureButton and Button update on texture change 2023-05-29 16:40:56 +02:00
9bd1d3b5c8 Update size or size cache when toggling expand_icon in Button
When the `expand_icon` is switched, the size cache can be updated to
solve the issue that the cache cannot be updated when the `OptionButton`
is enabled with `fit_to_longest_item`.
2023-05-17 06:06:25 +08:00
68b9fa71a0 Implement vertical icon alignment for buttons 2023-05-01 19:51:47 +02:00
1522762dc9 Make icons of scripted and custom classes fit the editor UI
Also:
- Add an option to limit the icon size in PopupMenu.
This is similar to how this works in Tree and TreeItem.
- Add the same option to TabBar.
- Add a theme constant for Tree, PopupMenu, Button, and
TabBar to apply this limit on the control level.

Co-authored-by: Daylily-Zeleen <daylily-zeleen@foxmail.com>
2023-03-31 21:39:02 +02:00
7d14c44025 Add more sections to Button and BaseButton 2023-01-25 15:39:02 +01:00
0e0a6bb39b Removed unused property hints and Object::get_translatable_strings()
* Remove unused `EditorPropertyMember` and related hints, previouly used by
  VisualScript. Such logic should be implemented in the VS module itself.
* As the above broke compatibility with the VS module, clean up the other
  hacks that were still in core in support of VisualScript.
* `PROPERTY_USAGE_INTERNATIONALIZED` was only used in Object's
  `get_translatable_strings()`, which is a legacy function not used anywhere.
  So both are removed.
* Reordered some usage flags after the above removal to minimize the diff.
* General clean up.

Fixes #30203.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-01-09 16:56:01 +01:00
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
3b14f0334c Remove redundant Variant-types initializations 2022-11-14 19:35:19 +01:00
3b1aa240dc Add a lifecycle method for manual theme item caching to Control 2022-09-01 16:35:36 +03:00
7aad14a4b6 [TextServer] Add support for trimming edge spaces on line break. 2022-09-01 08:11:55 +03:00
e31bb5ffeb Rename CanvasItem.update() to queue_redraw()
Affects a lot of classes. Very thoroughly checked signal connections and deferred calls to this method, add_do_method/add_undo_method calls, and so on.

Also renames the internal `_update_callback()` to `_redraw_callback()` for consistency.

Just a few comments have also been changed to say "redraw".

In CPUParticles2D, there was a private variable with the same name. It has been renamed to `do_redraw`.
2022-08-29 14:59:47 +02:00
4a3a15c304 Fix case where h_separation might not work in Button
This patch mainly solves two things:
1. The typo of `h_separation`;
2. Negative values of `h_separation` will be treated as `0` when used, to prevent the button's minimum `width` from being reduced by `h_separation`.
2022-08-12 19:57:08 +08:00
62d14ca22d Round icon position and size in buttons to make them look sharper 2022-08-05 15:48:45 +03:00
24d02dfb47 Add fit_to_longest_item to OptionButton 2022-08-02 23:37:43 +02:00