载入中...
搜索中...
未找到
DatabasePanel.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Export.h"
4#include "common/Runtime.h"
5#include "ui/ObjectRegistry.h"
6#include "ui/Widget.h"
7
8#include <simplesquirrel/simplesquirrel.hpp>
9
10#include <cstdint>
11#include <string>
12#include <vector>
13
14namespace eve::ui {
15
16class UIHost;
17
30public:
32 DatabasePanel() = default;
35 DatabasePanel(const DatabasePanel&) = delete;
37
39 void open();
41 void close();
43 bool isOpen() const;
45 [[nodiscard]] UIHostHandle host() const noexcept { return host_; }
46
48 void refresh();
50 bool selectClass(const std::string& name);
52 const std::string& selectedClass() const { return selectedClass_; }
57 [[nodiscard]] eve::Result<ObjectHandle> createInstance();
62 [[nodiscard]] eve::Result<ObjectHandle> registerObject(const ssq::Object& object, const std::string& label = {});
68 [[nodiscard]] eve::Result<void> unregister(ObjectHandle handle);
69
71 void sync();
73 WidgetDesc build();
74
75private:
76 void rebuildHost();
77 void rebuildCache();
78 WidgetDesc cellWidget(const ObjectEntry& entry, const ReflectedMember& member,
79 const ReflectedValue& value);
80
81 UIHostHandle host_{};
82 std::vector<std::string> classNames_;
83 std::string selectedClass_;
84 std::vector<ObjectEntry> entries_;
85 std::vector<ReflectedMember> members_;
86 // Row-major cell cache: [row][col] -> last value pushed to the view.
87 std::vector<std::vector<ReflectedValue>> cached_;
88};
89
90} // namespace eve::ui
double value
std::string label
#define EVENGINE_API_WORLD
Definition Export.h:109
std::string name
PrimitiveHandle handle
float(ui::Theme::* member)[4]
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Reflection-driven database panel (DevTools, MVVM).
const std::string & selectedClass() const
Name of the currently selected class ("" when none).
DatabasePanel(const DatabasePanel &)=delete
DatabasePanel & operator=(const DatabasePanel &)=delete
DatabasePanel()=default
Database panel.
UIHostHandle host() const noexcept
Returns the mounted database host handle, or an empty handle until open().
ecs::EntityHandle UIHostHandle
Definition UIHost.h:16
EVENGINE_API_FOUNDATION public API.
Definition Runtime.h:152
Typed snapshot of one live instance property.
Definition Runtime.h:132