Commit Graph

125 Commits

Author SHA1 Message Date
bruvzg 41df3caad3 [Button] Use align_to_largest_stylebox for min. size calculation. 2024-07-04 09:40:55 +03:00
bruvzg 35b4b5f779 [Button] Do not include internal margins into base button minimum size. 2024-06-13 14:18:44 +03:00
bruvzg 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
bruvzg 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
bruvzg 45bde2b5b0 [Button] Fix theme elements size rounding errors not keeping sufficient space for the text. 2024-04-18 11:48:46 +03:00
Rémi Verschelde 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
bruvzg 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
Rindbee 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
Yuri Sizov 2924bfd4d3 Register theme properties with ThemeDB 2023-09-11 13:45:23 +02:00
A Thousand Ships 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
Haoyu Qiu 7f70ac56a0 Fix Button text when overrun is not trim nothing 2023-08-08 15:08:28 +08:00
kobewi de4a3fa151 Unify and streamline connecting to Resource changes 2023-07-17 19:35:57 +02:00
Haoyu Qiu 71430cdd48 Fix Button clipping when internal margins exist 2023-07-14 13:59:16 +08:00
Ninni Pipping d4ac3b6ded Make TextureButton and Button update on texture change 2023-05-29 16:40:56 +02:00
Rindbee 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
Florian Kothmeier 68b9fa71a0 Implement vertical icon alignment for buttons 2023-05-01 19:51:47 +02:00
Yuri Sizov 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
VolTer 7d14c44025 Add more sections to Button and BaseButton 2023-01-25 15:39:02 +01:00
Juan Linietsky 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
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
Markus Sauermann 3b14f0334c Remove redundant Variant-types initializations 2022-11-14 19:35:19 +01:00
Yuri Sizov 3b1aa240dc Add a lifecycle method for manual theme item caching to Control 2022-09-01 16:35:36 +03:00