Files
XCEngine/new_editor/src/XCUIBackend/XCUILayoutLabRuntime.h

91 lines
2.7 KiB
C++

#pragma once
#include <XCEngine/UI/DrawData.h>
#include <memory>
#include <string>
namespace XCEngine {
namespace UI {
struct UIRect;
struct UIPoint;
} // namespace UI
namespace Editor {
namespace XCUIBackend {
struct XCUILayoutLabInputState {
UI::UIRect canvasRect = {};
UI::UIPoint pointerPosition = {};
bool pointerInside = false;
bool pointerPressed = false;
bool navigatePrevious = false;
bool navigateNext = false;
bool navigateHome = false;
bool navigateEnd = false;
bool navigateCollapse = false;
bool navigateExpand = false;
};
struct XCUILayoutLabFrameStats {
bool documentsReady = false;
std::string statusMessage = {};
std::size_t drawListCount = 0;
std::size_t commandCount = 0;
std::size_t filledRectCommandCount = 0;
std::size_t rectOutlineCommandCount = 0;
std::size_t textCommandCount = 0;
std::size_t imageCommandCount = 0;
std::size_t clipPushCommandCount = 0;
std::size_t clipPopCommandCount = 0;
std::size_t nativeSupportedCommandCount = 0;
std::size_t nativeUnsupportedCommandCount = 0;
std::size_t nativeUnsupportedImageCommandCount = 0;
std::size_t nativeUnsupportedUnknownCommandCount = 0;
bool nativeOverlayReady = false;
std::string nativeOverlayStatusMessage = {};
std::size_t rowCount = 0;
std::size_t columnCount = 0;
std::size_t overlayCount = 0;
std::size_t scrollViewCount = 0;
std::size_t treeViewCount = 0;
std::size_t treeItemCount = 0;
std::size_t listViewCount = 0;
std::size_t listItemCount = 0;
std::size_t propertySectionCount = 0;
std::size_t fieldRowCount = 0;
std::size_t expandedTreeItemCount = 0;
std::size_t expandedPropertySectionCount = 0;
std::string hoveredElementId = {};
std::string selectedElementId = {};
};
struct XCUILayoutLabFrameResult {
UI::UIDrawData drawData = {};
XCUILayoutLabFrameStats stats = {};
};
class XCUILayoutLabRuntime {
public:
XCUILayoutLabRuntime();
~XCUILayoutLabRuntime();
XCUILayoutLabRuntime(XCUILayoutLabRuntime&& other) noexcept;
XCUILayoutLabRuntime& operator=(XCUILayoutLabRuntime&& other) noexcept;
XCUILayoutLabRuntime(const XCUILayoutLabRuntime&) = delete;
XCUILayoutLabRuntime& operator=(const XCUILayoutLabRuntime&) = delete;
bool ReloadDocuments();
const XCUILayoutLabFrameResult& Update(const XCUILayoutLabInputState& input);
const XCUILayoutLabFrameResult& GetFrameResult() const;
bool TryGetElementRect(const std::string& elementId, UI::UIRect& outRect) const;
private:
struct RuntimeState;
std::unique_ptr<RuntimeState> m_state;
};
} // namespace XCUIBackend
} // namespace Editor
} // namespace XCEngine