diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-09-27 08:16:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-27 08:16:36 +0200 |
commit | fd0ad201224b7e16d75975a8a3937de22d30e9d3 (patch) | |
tree | ade8c8b2a0ff7e0d5a9e7c9b1313865db3e474e8 /scene/gui | |
parent | d1ecc15c118e3c089cdce51ca2736c76ee0ff3a3 (diff) | |
parent | 5629a006d998dcae59fbd6d89a13703427351abd (diff) |
Merge pull request #32369 from ndarilek/get_button_tooltip
Implement `TreeItem.get_button_tooltip(column, idx)`.
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/tree.cpp | 6 | ||||
-rw-r--r-- | scene/gui/tree.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 57663bbe82..7102a3cfbf 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -547,6 +547,11 @@ Ref<Texture> TreeItem::get_button(int p_column, int p_idx) const { ERR_FAIL_INDEX_V(p_idx, cells[p_column].buttons.size(), Ref<Texture>()); return cells[p_column].buttons[p_idx].texture; } +String TreeItem::get_button_tooltip(int p_column, int p_idx) const { + ERR_FAIL_INDEX_V(p_column, cells.size(), String()); + ERR_FAIL_INDEX_V(p_idx, cells[p_column].buttons.size(), String()); + return cells[p_column].buttons[p_idx].tooltip; +} int TreeItem::get_button_id(int p_column, int p_idx) const { ERR_FAIL_INDEX_V(p_column, cells.size(), -1); ERR_FAIL_INDEX_V(p_idx, cells[p_column].buttons.size(), -1); @@ -795,6 +800,7 @@ void TreeItem::_bind_methods() { ClassDB::bind_method(D_METHOD("add_button", "column", "button", "button_idx", "disabled", "tooltip"), &TreeItem::add_button, DEFVAL(-1), DEFVAL(false), DEFVAL("")); ClassDB::bind_method(D_METHOD("get_button_count", "column"), &TreeItem::get_button_count); + ClassDB::bind_method(D_METHOD("get_button_tooltip", "column"), &TreeItem::get_button_tooltip); ClassDB::bind_method(D_METHOD("get_button", "column", "button_idx"), &TreeItem::get_button); ClassDB::bind_method(D_METHOD("set_button", "column", "button_idx", "button"), &TreeItem::set_button); ClassDB::bind_method(D_METHOD("erase_button", "column", "button_idx"), &TreeItem::erase_button); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index f12d8fc4d2..47befb0c15 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -201,6 +201,7 @@ public: void add_button(int p_column, const Ref<Texture> &p_button, int p_id = -1, bool p_disabled = false, const String &p_tooltip = ""); int get_button_count(int p_column) const; + String get_button_tooltip(int p_column, int p_idx) const; Ref<Texture> get_button(int p_column, int p_idx) const; int get_button_id(int p_column, int p_idx) const; void erase_button(int p_column, int p_idx); |