diff options
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/panel_container.cpp | 7 | ||||
-rw-r--r-- | scene/gui/scroll_container.cpp | 38 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 7 | ||||
-rw-r--r-- | scene/gui/tree.h | 1 |
4 files changed, 51 insertions, 2 deletions
diff --git a/scene/gui/panel_container.cpp b/scene/gui/panel_container.cpp index bcf75b79f8..b5e3ef8c7b 100644 --- a/scene/gui/panel_container.cpp +++ b/scene/gui/panel_container.cpp @@ -31,7 +31,12 @@ Size2 PanelContainer::get_minimum_size() const { - Ref<StyleBox> style=get_stylebox("panel"); + Ref<StyleBox> style; + + if (has_stylebox("panel")) + style=get_stylebox("panel"); + else + style=get_stylebox("panel","PanelContainer"); Size2 ms; diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index a2fc038f9e..9bf93aff77 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -35,7 +35,37 @@ bool ScrollContainer::clips_input() const { Size2 ScrollContainer::get_minimum_size() const { - return Size2(1, 1); + + Size2 min_size; + + for(int i=0;i<get_child_count();i++) { + + Control *c = get_child(i)->cast_to<Control>(); + if (!c) + continue; + if (c->is_set_as_toplevel()) + continue; + if (c == h_scroll || c == v_scroll) + continue; + Size2 minsize = c->get_combined_minimum_size(); + + + if (!scroll_h) { + min_size.x = MAX(min_size.x, minsize.x); + } + if (!scroll_v) { + min_size.y = MAX(min_size.y, minsize.y); + + } + } + + if (h_scroll->is_visible()) { + min_size.y+=h_scroll->get_minimum_size().y; + } + if (v_scroll->is_visible()) { + min_size.x+=v_scroll->get_minimum_size().x; + } + return min_size; }; @@ -179,6 +209,12 @@ void ScrollContainer::_notification(int p_what) { child_max_size = Size2(0, 0); Size2 size = get_size(); + if (h_scroll->is_visible()) + size.y-=h_scroll->get_minimum_size().y; + + if (v_scroll->is_visible()) + size.x-=h_scroll->get_minimum_size().x; + for(int i=0;i<get_child_count();i++) { Control *c = get_child(i)->cast_to<Control>(); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index f793bbe3c6..483aa47f35 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -574,7 +574,14 @@ void TreeItem::set_custom_color(int p_column,const Color& p_color) { cells[p_column].color=p_color; _changed_notify(p_column); } +Color TreeItem::get_custom_color(int p_column) const { + ERR_FAIL_INDEX_V( p_column, cells.size(), Color() ); + if (!cells[p_column].custom_color) + return Color(); + return cells[p_column].color; + +} void TreeItem::clear_custom_color(int p_column) { ERR_FAIL_INDEX( p_column, cells.size() ); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 421cfc47bc..1ba1c6a494 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -221,6 +221,7 @@ public: bool is_editable(int p_column); void set_custom_color(int p_column,const Color& p_color); + Color get_custom_color(int p_column) const; void clear_custom_color(int p_column); void set_custom_bg_color(int p_column,const Color& p_color); |