Add get_button_color(column, id)

Docs should point to Color constuctor instead of just the class, but I unfortunately cannot.
This commit is contained in:
radzo73 2024-01-28 14:55:48 -05:00
parent 17e7f85c06
commit de5b0d7103
3 changed files with 16 additions and 0 deletions

View file

@ -1222,6 +1222,12 @@ int TreeItem::get_button_by_id(int p_column, int p_id) const {
return -1;
}
Color TreeItem::get_button_color(int p_column, int p_index) const {
ERR_FAIL_INDEX_V(p_column, cells.size(), Color());
ERR_FAIL_INDEX_V(p_index, cells[p_column].buttons.size(), Color());
return cells[p_column].buttons[p_index].color;
}
void TreeItem::set_button_tooltip_text(int p_column, int p_index, const String &p_tooltip) {
ERR_FAIL_INDEX(p_column, cells.size());
ERR_FAIL_INDEX(p_index, cells[p_column].buttons.size());
@ -1662,6 +1668,7 @@ void TreeItem::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_button_tooltip_text", "column", "button_index"), &TreeItem::get_button_tooltip_text);
ClassDB::bind_method(D_METHOD("get_button_id", "column", "button_index"), &TreeItem::get_button_id);
ClassDB::bind_method(D_METHOD("get_button_by_id", "column", "id"), &TreeItem::get_button_by_id);
ClassDB::bind_method(D_METHOD("get_button_color", "column", "id"), &TreeItem::get_button_color);
ClassDB::bind_method(D_METHOD("get_button", "column", "button_index"), &TreeItem::get_button);
ClassDB::bind_method(D_METHOD("set_button_tooltip_text", "column", "button_index", "tooltip"), &TreeItem::set_button_tooltip_text);
ClassDB::bind_method(D_METHOD("set_button", "column", "button_index", "button"), &TreeItem::set_button);