|
@@ -1704,6 +1704,10 @@ void Tree::_update_theme_item_cache() {
|
|
|
theme_cache.drop_position_color = get_theme_color(SNAME("drop_position_color"));
|
|
|
theme_cache.h_separation = get_theme_constant(SNAME("h_separation"));
|
|
|
theme_cache.v_separation = get_theme_constant(SNAME("v_separation"));
|
|
|
+ theme_cache.inner_item_margin_bottom = get_theme_constant(SNAME("inner_item_margin_bottom"));
|
|
|
+ theme_cache.inner_item_margin_left = get_theme_constant(SNAME("inner_item_margin_left"));
|
|
|
+ theme_cache.inner_item_margin_right = get_theme_constant(SNAME("inner_item_margin_right"));
|
|
|
+ theme_cache.inner_item_margin_top = get_theme_constant(SNAME("inner_item_margin_top"));
|
|
|
theme_cache.item_margin = get_theme_constant(SNAME("item_margin"));
|
|
|
theme_cache.button_margin = get_theme_constant(SNAME("button_margin"));
|
|
|
theme_cache.icon_max_width = get_theme_constant(SNAME("icon_max_width"));
|
|
@@ -1841,13 +1845,14 @@ int Tree::get_item_height(TreeItem *p_item) const {
|
|
|
void Tree::draw_item_rect(TreeItem::Cell &p_cell, const Rect2i &p_rect, const Color &p_color, const Color &p_icon_color, int p_ol_size, const Color &p_ol_color) {
|
|
|
ERR_FAIL_COND(theme_cache.font.is_null());
|
|
|
|
|
|
- Rect2i rect = p_rect;
|
|
|
+ Rect2i rect = p_rect.grow_individual(-theme_cache.inner_item_margin_left, -theme_cache.inner_item_margin_top, -theme_cache.inner_item_margin_right, -theme_cache.inner_item_margin_bottom);
|
|
|
Size2 ts = p_cell.text_buf->get_size();
|
|
|
bool rtl = is_layout_rtl();
|
|
|
|
|
|
int w = 0;
|
|
|
+ Size2i bmsize;
|
|
|
if (!p_cell.icon.is_null()) {
|
|
|
- Size2i bmsize = _get_cell_icon_size(p_cell);
|
|
|
+ bmsize = _get_cell_icon_size(p_cell);
|
|
|
w += bmsize.width + theme_cache.h_separation;
|
|
|
if (rect.size.width > 0 && (w + ts.width) > rect.size.width) {
|
|
|
ts.width = rect.size.width - w;
|
|
@@ -1886,8 +1891,6 @@ void Tree::draw_item_rect(TreeItem::Cell &p_cell, const Rect2i &p_rect, const Co
|
|
|
}
|
|
|
|
|
|
if (!p_cell.icon.is_null()) {
|
|
|
- Size2i bmsize = _get_cell_icon_size(p_cell);
|
|
|
-
|
|
|
p_cell.draw_icon(ci, rect.position + Size2i(0, Math::floor((real_t)(rect.size.y - bmsize.y) / 2)), bmsize, p_icon_color);
|
|
|
rect.position.x += bmsize.x + theme_cache.h_separation;
|
|
|
rect.size.x -= bmsize.x + theme_cache.h_separation;
|