2026-04-15 08:24:06 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#ifndef NOMINMAX
|
|
|
|
|
#define NOMINMAX
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
2026-04-23 00:36:28 +08:00
|
|
|
#include <cstdint>
|
2026-04-15 08:24:06 +08:00
|
|
|
#include <string>
|
2026-04-23 00:36:28 +08:00
|
|
|
#include <string_view>
|
2026-04-15 08:24:06 +08:00
|
|
|
|
|
|
|
|
namespace XCEngine::UI::Editor::App {
|
|
|
|
|
|
2026-04-23 00:36:28 +08:00
|
|
|
enum class EditorWindowLifecycleState : std::uint8_t {
|
|
|
|
|
PendingNativeCreate = 0,
|
|
|
|
|
NativeAttached,
|
|
|
|
|
Initializing,
|
|
|
|
|
Running,
|
|
|
|
|
Closing,
|
|
|
|
|
Destroyed,
|
|
|
|
|
};
|
|
|
|
|
|
2026-04-25 17:51:37 +08:00
|
|
|
enum class EditorWindowCategory : std::uint8_t {
|
|
|
|
|
Workspace = 0,
|
|
|
|
|
Utility,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline std::string_view GetEditorWindowCategoryName(
|
|
|
|
|
EditorWindowCategory category) {
|
|
|
|
|
switch (category) {
|
|
|
|
|
case EditorWindowCategory::Workspace:
|
|
|
|
|
return "Workspace";
|
|
|
|
|
case EditorWindowCategory::Utility:
|
|
|
|
|
return "Utility";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "Unknown";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct EditorWindowChromePolicy {
|
|
|
|
|
bool allowDetachedTitleBarTabStrip = true;
|
|
|
|
|
bool showFrameStats = true;
|
2026-04-25 18:20:17 +08:00
|
|
|
bool showTopmostButton = false;
|
|
|
|
|
bool topmostByDefault = false;
|
2026-04-25 17:51:37 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct EditorWindowNativeStylePolicy {
|
|
|
|
|
DWORD extendedWindowStyle = WS_EX_APPWINDOW;
|
|
|
|
|
DWORD windowStyle = 0;
|
|
|
|
|
bool useHostWindowStyle = true;
|
|
|
|
|
};
|
|
|
|
|
|
2026-04-23 00:36:28 +08:00
|
|
|
inline std::string_view GetEditorWindowLifecycleStateName(
|
|
|
|
|
EditorWindowLifecycleState state) {
|
|
|
|
|
switch (state) {
|
|
|
|
|
case EditorWindowLifecycleState::PendingNativeCreate:
|
|
|
|
|
return "PendingNativeCreate";
|
|
|
|
|
case EditorWindowLifecycleState::NativeAttached:
|
|
|
|
|
return "NativeAttached";
|
|
|
|
|
case EditorWindowLifecycleState::Initializing:
|
|
|
|
|
return "Initializing";
|
|
|
|
|
case EditorWindowLifecycleState::Running:
|
|
|
|
|
return "Running";
|
|
|
|
|
case EditorWindowLifecycleState::Closing:
|
|
|
|
|
return "Closing";
|
|
|
|
|
case EditorWindowLifecycleState::Destroyed:
|
|
|
|
|
return "Destroyed";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "Unknown";
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-15 08:24:06 +08:00
|
|
|
struct EditorWindowWindowState {
|
|
|
|
|
HWND hwnd = nullptr;
|
|
|
|
|
std::string windowId = {};
|
|
|
|
|
std::wstring title = {};
|
|
|
|
|
std::string titleText = {};
|
2026-04-25 17:51:37 +08:00
|
|
|
EditorWindowCategory category = EditorWindowCategory::Workspace;
|
|
|
|
|
EditorWindowChromePolicy chromePolicy = {};
|
2026-04-15 08:24:06 +08:00
|
|
|
bool primary = false;
|
2026-04-23 00:36:28 +08:00
|
|
|
EditorWindowLifecycleState lifecycle = EditorWindowLifecycleState::PendingNativeCreate;
|
2026-04-15 08:24:06 +08:00
|
|
|
};
|
|
|
|
|
|
2026-04-19 02:48:41 +08:00
|
|
|
struct EditorWindowState {
|
|
|
|
|
EditorWindowWindowState window = {};
|
2026-04-15 08:24:06 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace XCEngine::UI::Editor::App
|