feat: add a new awesome feature

This commit is contained in:
2025-11-04 16:48:53 +08:00
parent 8dee285de8
commit 7b087e296a
22 changed files with 210 additions and 58 deletions

View File

@@ -203,7 +203,7 @@ bool TabControl::handleEvent(const ExMessage& msg)
break;
}
if (dirty)
requestRepaint();
requestRepaint(parent);
return consume;
}
@@ -347,4 +347,35 @@ int TabControl::indexOf(const std::string& tabText) const
return idx;
}
void TabControl::setDirty(bool dirty)
{
this->dirty = dirty;
for (auto& c : controls)
{
c.first->setDirty(dirty);
c.second->setDirty(dirty);
}
}
void TabControl::requestRepaint(Control* parent)
{
if (this == parent)
{
for (auto& control : controls)
{
if (control.first->isDirty() && control.first->IsVisible())
{
control.first->draw();
break;
}
else if (control.second->isDirty()&&control.second->IsVisible())
{
control.second->draw();
break;
}
}
}
else
onRequestRepaintAsRoot();
}