code optimization

- lifecycle functions for widgets
- persistence functions

Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
2025-06-20 20:53:13 +02:00
parent 1a912d31c4
commit a0fe4ba538
11 changed files with 218 additions and 153 deletions

View File

@@ -59,6 +59,7 @@ void setScreen(const std::shared_ptr<Widget> &screen)
m_widget = screen;
m_history.clear();
m_history.emplace_back(m_widget);
m_widget->enter();
}
}
@@ -66,7 +67,12 @@ void pushScreen(const std::shared_ptr<Widget> &screen)
{
if (screen != nullptr)
{
if (m_widget)
{
m_widget->pause();
}
m_widget = screen;
m_widget->enter();
m_history.emplace_back(m_widget);
}
}
@@ -76,7 +82,12 @@ void popScreen()
if (m_history.size() >= 2)
{
m_history.pop_back();
if (m_widget)
{
m_widget->exit();
}
m_widget = m_history.back();
m_widget->resume();
}
}