Refactor new editor boundaries and test ownership
This commit is contained in:
78
new_editor/app/Platform/Win32/EditorWindowInputController.h
Normal file
78
new_editor/app/Platform/Win32/EditorWindowInputController.h
Normal file
@@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include "Platform/Win32/EditorWindowPointerCapture.h"
|
||||
|
||||
#include <Platform/Win32/InputModifierTracker.h>
|
||||
|
||||
#include <XCEngine/UI/Types.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor::App::Internal {
|
||||
|
||||
class EditorWindowInputController final {
|
||||
public:
|
||||
EditorWindowInputController() = default;
|
||||
~EditorWindowInputController() = default;
|
||||
|
||||
EditorWindowInputController(const EditorWindowInputController&) = delete;
|
||||
EditorWindowInputController& operator=(const EditorWindowInputController&) = delete;
|
||||
EditorWindowInputController(EditorWindowInputController&&) = delete;
|
||||
EditorWindowInputController& operator=(EditorWindowInputController&&) = delete;
|
||||
|
||||
bool IsTrackingMouseLeave() const;
|
||||
void SetTrackingMouseLeave(bool trackingMouseLeave);
|
||||
|
||||
EditorWindowPointerCaptureOwner GetPointerCaptureOwner() const;
|
||||
bool OwnsPointerCapture(EditorWindowPointerCaptureOwner owner) const;
|
||||
bool HasPointerCaptureOwner() const;
|
||||
void AcquirePointerCapture(HWND hwnd, EditorWindowPointerCaptureOwner owner);
|
||||
void ReleasePointerCapture(HWND hwnd, EditorWindowPointerCaptureOwner owner);
|
||||
void ForceReleasePointerCapture(HWND hwnd);
|
||||
void ClearPointerCaptureOwner();
|
||||
|
||||
void QueuePointerEvent(
|
||||
::XCEngine::UI::UIInputEventType type,
|
||||
::XCEngine::UI::UIPointerButton button,
|
||||
const ::XCEngine::UI::UIPoint& position,
|
||||
WPARAM wParam);
|
||||
void QueueSyntheticPointerStateSyncEvent(
|
||||
const ::XCEngine::UI::UIPoint& position,
|
||||
const ::XCEngine::UI::UIInputModifiers& modifiers);
|
||||
void QueuePointerLeaveEvent(const ::XCEngine::UI::UIPoint& position);
|
||||
void QueuePointerWheelEvent(
|
||||
const ::XCEngine::UI::UIPoint& position,
|
||||
short wheelDelta,
|
||||
WPARAM wParam);
|
||||
void QueueKeyEvent(::XCEngine::UI::UIInputEventType type, WPARAM wParam, LPARAM lParam);
|
||||
void QueueCharacterEvent(WPARAM wParam);
|
||||
void QueueWindowFocusEvent(::XCEngine::UI::UIInputEventType type);
|
||||
|
||||
void SyncInputModifiersFromSystemState();
|
||||
void ResetInputModifiers();
|
||||
::XCEngine::UI::UIInputModifiers GetCurrentModifiers() const;
|
||||
|
||||
bool HasPendingPointerStateReconciliationEvent() const;
|
||||
std::vector<::XCEngine::UI::UIInputEvent> TakePendingEvents();
|
||||
void ClearPendingEvents();
|
||||
void ResetInteractionState();
|
||||
void ResetWindowState();
|
||||
|
||||
private:
|
||||
static std::int32_t MapVirtualKeyToUIKeyCode(WPARAM wParam);
|
||||
static bool IsRepeatKeyMessage(LPARAM lParam);
|
||||
|
||||
Host::InputModifierTracker m_modifierTracker = {};
|
||||
std::vector<::XCEngine::UI::UIInputEvent> m_pendingEvents = {};
|
||||
bool m_trackingMouseLeave = false;
|
||||
EditorWindowPointerCaptureOwner m_pointerCaptureOwner =
|
||||
EditorWindowPointerCaptureOwner::None;
|
||||
};
|
||||
|
||||
} // namespace XCEngine::UI::Editor::App::Internal
|
||||
Reference in New Issue
Block a user