diff options
Diffstat (limited to 'scene/gui/tree.cpp')
-rw-r--r-- | scene/gui/tree.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index de17416d8e..4975b66744 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -333,6 +333,15 @@ bool TreeItem::is_collapsed() { return collapsed; } +void TreeItem::set_custom_minimum_height(int p_height) { + custom_min_height = p_height; + _changed_notify(); +} + +int TreeItem::get_custom_minimum_height() const { + return custom_min_height; +} + TreeItem *TreeItem::get_next() { return next; @@ -703,6 +712,9 @@ void TreeItem::_bind_methods() { ClassDB::bind_method(D_METHOD("set_collapsed", "enable"), &TreeItem::set_collapsed); ClassDB::bind_method(D_METHOD("is_collapsed"), &TreeItem::is_collapsed); + ClassDB::bind_method(D_METHOD("set_custom_minimum_height", "height"), &TreeItem::set_custom_minimum_height); + ClassDB::bind_method(D_METHOD("get_custom_minimum_height"), &TreeItem::get_custom_minimum_height); + ClassDB::bind_method(D_METHOD("get_next"), &TreeItem::get_next); ClassDB::bind_method(D_METHOD("get_prev"), &TreeItem::get_prev); ClassDB::bind_method(D_METHOD("get_parent"), &TreeItem::get_parent); @@ -780,6 +792,7 @@ TreeItem::TreeItem(Tree *p_tree) { tree = p_tree; collapsed = false; disable_folding = false; + custom_min_height = 0; parent = 0; // parent item next = 0; // next in list @@ -921,6 +934,9 @@ int Tree::compute_item_height(TreeItem *p_item) const { default: {} } } + int item_min_height = p_item->get_custom_minimum_height(); + if (height < item_min_height) + height = item_min_height; height += cache.vseparation; @@ -2304,7 +2320,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { int col, h, section; TreeItem *it = _find_item_at_pos(root, mpos, col, h, section); - if (drop_mode_flags && it != drop_mode_over || section != drop_mode_section) { + if ((drop_mode_flags && it != drop_mode_over) || section != drop_mode_section) { drop_mode_over = it; drop_mode_section = section; update(); @@ -2478,7 +2494,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { pressing_for_editor = false; blocked++; - bool handled = propagate_mouse_event(pos + cache.offset, 0, 0, b->is_doubleclick(), root, b->get_button_index(), b); + propagate_mouse_event(pos + cache.offset, 0, 0, b->is_doubleclick(), root, b->get_button_index(), b); blocked--; if (pressing_for_editor) { @@ -3593,6 +3609,7 @@ void Tree::_bind_methods() { ClassDB::bind_method(D_METHOD("get_item_area_rect", "item", "column"), &Tree::_get_item_rect, DEFVAL(-1)); ClassDB::bind_method(D_METHOD("get_item_at_pos", "pos"), &Tree::get_item_at_pos); ClassDB::bind_method(D_METHOD("get_column_at_pos", "pos"), &Tree::get_column_at_pos); + ClassDB::bind_method(D_METHOD("get_drop_section_at_pos", "pos"), &Tree::get_drop_section_at_pos); ClassDB::bind_method(D_METHOD("ensure_cursor_is_visible"), &Tree::ensure_cursor_is_visible); |