mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 11:46:30 +02:00
[FancyZones] Improve code quality (part 3: window dragging) (#23040)
This commit is contained in:
30
src/modules/fancyzones/FancyZonesLib/DraggingState.h
Normal file
30
src/modules/fancyzones/FancyZonesLib/DraggingState.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <FancyZonesLib/KeyState.h>
|
||||
#include <FancyZonesLib/SecondaryMouseButtonsHook.h>
|
||||
|
||||
class DraggingState
|
||||
{
|
||||
public:
|
||||
DraggingState(const std::function<void()>& keyUpdateCallback);
|
||||
~DraggingState() = default;
|
||||
|
||||
void Enable();
|
||||
void Disable();
|
||||
void UpdateDraggingState() noexcept;
|
||||
|
||||
bool IsDragging() const noexcept;
|
||||
bool IsSelectManyZonesState() const noexcept;
|
||||
|
||||
private:
|
||||
void OnMouseDown();
|
||||
|
||||
std::atomic<bool> m_mouseState;
|
||||
SecondaryMouseButtonsHook m_mouseHook;
|
||||
KeyState<VK_LSHIFT> m_leftShiftKeyState;
|
||||
KeyState<VK_RSHIFT> m_rightShiftKeyState;
|
||||
KeyState<VK_LCONTROL, VK_RCONTROL> m_ctrlKeyState;
|
||||
std::function<void()> m_keyUpdateCallback;
|
||||
|
||||
bool m_dragging{}; // True if we should be showing zone hints while dragging
|
||||
};
|
||||
Reference in New Issue
Block a user