Add hover state to Tree items display
This commit is contained in:
@ -450,6 +450,9 @@ private:
|
||||
Vector2 pressing_pos;
|
||||
Rect2 pressing_item_rect;
|
||||
|
||||
Vector2 hovered_pos;
|
||||
bool is_mouse_hovering = false;
|
||||
|
||||
float range_drag_base = 0.0;
|
||||
bool range_drag_enabled = false;
|
||||
Vector2 range_drag_capture_pos;
|
||||
@ -545,10 +548,13 @@ private:
|
||||
int font_size = 0;
|
||||
int tb_font_size = 0;
|
||||
|
||||
Ref<StyleBox> hovered;
|
||||
Ref<StyleBox> hovered_dimmed;
|
||||
Ref<StyleBox> selected;
|
||||
Ref<StyleBox> selected_focus;
|
||||
Ref<StyleBox> cursor;
|
||||
Ref<StyleBox> cursor_unfocus;
|
||||
Ref<StyleBox> button_hover;
|
||||
Ref<StyleBox> button_pressed;
|
||||
Ref<StyleBox> title_button;
|
||||
Ref<StyleBox> title_button_hover;
|
||||
@ -572,6 +578,8 @@ private:
|
||||
Ref<Texture2D> updown;
|
||||
|
||||
Color font_color;
|
||||
Color font_hovered_color;
|
||||
Color font_hovered_dimmed_color;
|
||||
Color font_selected_color;
|
||||
Color font_disabled_color;
|
||||
Color guide_color;
|
||||
@ -623,16 +631,17 @@ private:
|
||||
};
|
||||
|
||||
ClickType click_type = Cache::CLICK_NONE;
|
||||
ClickType hover_type = Cache::CLICK_NONE;
|
||||
int click_index = -1;
|
||||
int click_id = -1;
|
||||
TreeItem *click_item = nullptr;
|
||||
int click_column = 0;
|
||||
int hover_index = -1;
|
||||
int hover_header_column = -1;
|
||||
bool hover_header_row = false;
|
||||
Point2 click_pos;
|
||||
|
||||
TreeItem *hover_item = nullptr;
|
||||
int hover_cell = -1;
|
||||
int hover_column = -1;
|
||||
int hover_button_index_in_column = -1;
|
||||
|
||||
bool rtl = false;
|
||||
} cache;
|
||||
@ -660,6 +669,7 @@ private:
|
||||
TreeItem *_search_item_text(TreeItem *p_at, const String &p_find, int *r_col, bool p_selectable, bool p_backwards = false);
|
||||
|
||||
TreeItem *_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_column, int &h, int §ion) const;
|
||||
int _get_item_h_offset(TreeItem *p_item) const;
|
||||
|
||||
void _find_button_at_pos(const Point2 &p_pos, TreeItem *&r_item, int &r_column, int &r_index) const;
|
||||
|
||||
@ -689,6 +699,8 @@ private:
|
||||
|
||||
bool enable_recursive_folding = true;
|
||||
|
||||
void _determine_hovered_item();
|
||||
|
||||
int _count_selected_items(TreeItem *p_from) const;
|
||||
bool _is_branch_selected(TreeItem *p_from) const;
|
||||
bool _is_sibling_branch_selected(TreeItem *p_from) const;
|
||||
|
||||
Reference in New Issue
Block a user