From d722537154cd87dca134e7055aa2bfdc187eb1b0 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 2 Jan 2015 22:34:22 -0300 Subject: [PATCH] -proper minimum size computation for TabContainer --- drivers/gles2/rasterizer_gles2.cpp | 7 +++++-- scene/gui/tab_container.cpp | 33 ++++++++++++++++++++++++++++++ scene/gui/tab_container.h | 2 ++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 0072ca9c865..ccbba2f51c8 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -8188,14 +8188,17 @@ void RasterizerGLES2::canvas_draw_polygon(int p_vertex_count, const int* p_indic } if (p_indices) { - - static const int _max_draw_poly_indices = 8*1024; // change this size if needed!!! +#ifdef GLEW_ENABLED + glDrawElements(GL_TRIANGLES, p_vertex_count, GL_UNSIGNED_INT, p_indices ); +#else + static const int _max_draw_poly_indices = 16*1024; // change this size if needed!!! ERR_FAIL_COND(p_vertex_count > _max_draw_poly_indices); static uint16_t _draw_poly_indices[_max_draw_poly_indices]; for (int i=0; i *p_strings) const { } +Size2 TabContainer::get_minimum_size() const { + + Size2 ms; + + for(int i=0;icast_to(); + if (!c) + continue; + if (c->is_set_as_toplevel()) + continue; + + if (!c->has_meta("_tab_name")) + continue; + + if (!c->is_visible()) + continue; + + Size2 cms = c->get_minimum_size(); + ms.x=MAX(ms.x,cms.x); + ms.y=MAX(ms.y,cms.y); + } + + Ref tab_bg = get_stylebox("tab_bg"); + Ref tab_fg = get_stylebox("tab_fg"); + Ref font = get_font("font"); + + ms.y+=MAX(tab_bg->get_minimum_size().y,tab_fg->get_minimum_size().y); + ms.y+=font->get_height(); + + return ms; +} + void TabContainer::_bind_methods() { ObjectTypeDB::bind_method(_MD("_input_event"),&TabContainer::_input_event); diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h index d5b6a2b503c..df7b03e040a 100644 --- a/scene/gui/tab_container.h +++ b/scene/gui/tab_container.h @@ -85,6 +85,8 @@ public: void set_current_tab(int p_current); int get_current_tab() const; + virtual Size2 get_minimum_size() const; + virtual void get_translatable_strings(List *p_strings) const; TabContainer();