diff --git a/data/gui/screens/track_info.stkgui b/data/gui/screens/track_info.stkgui index 1f3aab798..1f38fd176 100644 --- a/data/gui/screens/track_info.stkgui +++ b/data/gui/screens/track_info.stkgui @@ -76,7 +76,7 @@
-
+
diff --git a/src/guiengine/widget.cpp b/src/guiengine/widget.cpp index c2c009603..283ee3b54 100644 --- a/src/guiengine/widget.cpp +++ b/src/guiengine/widget.cpp @@ -176,6 +176,22 @@ bool Widget::deleteChild(const char* id) return false; } +bool Widget::collapse() +{ + //const int count = m_children.size(); + //for (int n = 0; n < count; n++) + //{ + // m_children.erase(n); + //} + //m_element = NULL; + + auto parent = m_element->getParent(); + + parent->removeChild(m_element); + + return true; +} + // ----------------------------------------------------------------------------- namespace GUIEngine { @@ -342,6 +358,18 @@ void Widget::setVisible(bool visible) } } +// ----------------------------------------------------------------------------- + +void Widget::setCollapsed(bool collapsed) +{ + if (m_element != NULL) + { + m_element->setEnabled(!collapsed); + } + //m_is_visible = collapsed; +} + + // ----------------------------------------------------------------------------- void Widget::moveIrrlichtElement() diff --git a/src/guiengine/widget.hpp b/src/guiengine/widget.hpp index 5247d3c34..757f91d06 100644 --- a/src/guiengine/widget.hpp +++ b/src/guiengine/widget.hpp @@ -344,6 +344,10 @@ namespace GUIEngine */ virtual void setVisible(bool visible); + virtual bool collapse(); + + virtual void setCollapsed(bool collapsed); + /** Returns if the element is visible. */ bool isVisible() const; diff --git a/src/states_screens/track_info_screen.cpp b/src/states_screens/track_info_screen.cpp index 280ba1766..1ed14ebe1 100644 --- a/src/states_screens/track_info_screen.cpp +++ b/src/states_screens/track_info_screen.cpp @@ -175,6 +175,11 @@ void TrackInfoScreen::init() m_target_value_spinner->setValue(UserConfigParams::m_num_goals); } } + //else + /* { + m_target_type_spinner->collapse(); + m_target_type_label->collapse(); + }*/ // Lap count m_lap_spinner // -----------------------