diff options
author | Yuri Sizov <yuris@humnom.net> | 2023-03-31 21:17:59 +0200 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-03-31 21:39:02 +0200 |
commit | 1522762dc986c130ad63cbf854514d730788a4cf (patch) | |
tree | 81cbbbb7028bc95f828d78644b570e506736ece9 /scene/gui/tab_bar.h | |
parent | 9fae65404a223a86816685b0b4036a57b8f976b7 (diff) | |
download | redot-engine-1522762dc986c130ad63cbf854514d730788a4cf.tar.gz |
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>
Diffstat (limited to 'scene/gui/tab_bar.h')
-rw-r--r-- | scene/gui/tab_bar.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/scene/gui/tab_bar.h b/scene/gui/tab_bar.h index dc70a84689..a232061b69 100644 --- a/scene/gui/tab_bar.h +++ b/scene/gui/tab_bar.h @@ -62,6 +62,8 @@ private: Ref<TextLine> text_buf; Ref<Texture2D> icon; + int icon_max_width = 0; + bool disabled = false; bool hidden = false; int ofs_cache = 0; @@ -106,6 +108,7 @@ private: struct ThemeCache { int h_separation = 0; + int icon_max_width = 0; Ref<StyleBox> tab_unselected_style; Ref<StyleBox> tab_selected_style; @@ -133,6 +136,7 @@ private: } theme_cache; int get_tab_width(int p_idx) const; + Size2 _get_tab_icon_size(int p_idx) const; void _ensure_no_over_offset(); void _update_hover(); @@ -171,6 +175,9 @@ public: void set_tab_icon(int p_tab, const Ref<Texture2D> &p_icon); Ref<Texture2D> get_tab_icon(int p_tab) const; + void set_tab_icon_max_width(int p_tab, int p_width); + int get_tab_icon_max_width(int p_tab) const; + void set_tab_disabled(int p_tab, bool p_disabled); bool is_tab_disabled(int p_tab) const; |