- Added methods for file watching, including `watch`, `unwatch`, `unwatchAll`, `getWatchCount`, `pollWatch`, `getLastWatchPath`, and `getLastWatchRealPath`. - Enhanced the `Filesystem` class to support monitoring file changes, allowing for real-time updates. - Updated the `physfs` implementation to handle file watch targets and events. - Improved documentation and added unit tests to validate the new file watching features. Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
699 B
C++
34 lines
699 B
C++
#include "ui/Component.h"
|
|
|
|
#include "ui/UISystem.h"
|
|
|
|
namespace eve::ui {
|
|
|
|
void Component::attach(UIHost *host) {
|
|
host_ = host;
|
|
dirty_ = true;
|
|
}
|
|
|
|
void Component::mountAs(const std::string &hostName) {
|
|
UIHost *h = UISystem::findHost(hostName);
|
|
if (!h) h = UIHost::createHost(hostName);
|
|
attach(h);
|
|
rebuild(true);
|
|
}
|
|
|
|
void Component::rebuild(bool forceFull) {
|
|
if (!host_) return;
|
|
WidgetDesc tree = build();
|
|
if (forceFull) host_->setTree(std::move(tree));
|
|
else host_->setTreeReconcile(std::move(tree));
|
|
dirty_ = false;
|
|
}
|
|
|
|
bool Component::updateIfDirty() {
|
|
if (!dirty_ || !host_) return false;
|
|
rebuild(false);
|
|
return true;
|
|
}
|
|
|
|
} // namespace eve::ui
|