Add a lifecycle method for manual theme item caching to Control

This commit is contained in:
Yuri Sizov 2022-08-31 15:02:40 +03:00
parent 0c221f0284
commit 3b1aa240dc
52 changed files with 1592 additions and 910 deletions

View file

@ -482,12 +482,13 @@ private:
void propagate_set_columns(TreeItem *p_item);
struct Cache {
struct ThemeCache {
Ref<Font> font;
Ref<Font> tb_font;
int font_size = 0;
int tb_font_size = 0;
Ref<StyleBox> bg;
Ref<StyleBox> bg_focus;
Ref<StyleBox> selected;
Ref<StyleBox> selected_focus;
Ref<StyleBox> cursor;
@ -505,8 +506,9 @@ private:
Ref<Texture2D> checked;
Ref<Texture2D> unchecked;
Ref<Texture2D> indeterminate;
Ref<Texture2D> arrow_collapsed;
Ref<Texture2D> arrow;
Ref<Texture2D> arrow_collapsed;
Ref<Texture2D> arrow_collapsed_mirrored;
Ref<Texture2D> select_arrow;
Ref<Texture2D> updown;
@ -536,7 +538,9 @@ private:
int scroll_border = 0;
int scroll_speed = 0;
int font_outline_size = 0;
} theme_cache;
struct Cache {
enum ClickType {
CLICK_NONE,
CLICK_TITLE,
@ -559,7 +563,6 @@ private:
Point2i text_editor_position;
bool rtl = false;
} cache;
int _get_title_button_height() const;
@ -572,7 +575,6 @@ private:
bool v_scroll_enabled = true;
Size2 get_internal_min_size() const;
void update_cache();
void update_scrollbars();
Rect2 search_item_rect(TreeItem *p_from, TreeItem *p_item);
@ -620,6 +622,8 @@ private:
bool _scroll(bool p_horizontal, float p_pages);
protected:
virtual void _update_theme_item_cache() override;
static void _bind_methods();
public: