refactor(new_editor/app): reorganize host structure and add smoke test
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
#include "WindowMessageDispatchHandlers.h"
|
||||
|
||||
#include "Platform/Win32/EditorWindow.h"
|
||||
#include "WindowMessageHost.h"
|
||||
|
||||
namespace XCEngine::UI::Editor::Host {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr UINT kMessageNcUaDrawCaption = 0x00AEu;
|
||||
constexpr UINT kMessageNcUaDrawFrame = 0x00AFu;
|
||||
|
||||
} // namespace
|
||||
|
||||
bool TryDispatchWindowChromeMessage(
|
||||
const WindowMessageDispatchContext& context,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam,
|
||||
LRESULT& outResult) {
|
||||
switch (message) {
|
||||
case WM_GETMINMAXINFO:
|
||||
if (context.window.IsBorderlessWindowEnabled() &&
|
||||
context.window.HandleBorderlessWindowGetMinMaxInfo(lParam)) {
|
||||
outResult = 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case WM_NCCALCSIZE:
|
||||
if (context.window.IsBorderlessWindowEnabled()) {
|
||||
outResult = context.window.HandleBorderlessWindowNcCalcSize(wParam, lParam);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case WM_NCACTIVATE:
|
||||
if (context.window.IsBorderlessWindowEnabled()) {
|
||||
outResult = TRUE;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case WM_NCHITTEST:
|
||||
if (context.window.IsBorderlessWindowEnabled()) {
|
||||
outResult = HTCLIENT;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case WM_NCPAINT:
|
||||
case kMessageNcUaDrawCaption:
|
||||
case kMessageNcUaDrawFrame:
|
||||
if (context.window.IsBorderlessWindowEnabled()) {
|
||||
outResult = 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case WM_SYSCOMMAND:
|
||||
if (context.window.HandleBorderlessWindowSystemCommand(
|
||||
context.windowHost.GetEditorContext(),
|
||||
context.windowHost.IsGlobalTabDragActive(),
|
||||
wParam)) {
|
||||
outResult = 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case WM_SETCURSOR:
|
||||
if (LOWORD(lParam) == HTCLIENT && context.window.ApplyCurrentCursor()) {
|
||||
outResult = TRUE;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Host
|
||||
Reference in New Issue
Block a user