2019-09-05 00:26:26 +08:00
|
|
|
#pragma once
|
|
|
|
#include "FancyZones.h"
|
2019-12-17 16:21:46 +08:00
|
|
|
#include "lib/ZoneSet.h"
|
2019-09-05 00:26:26 +08:00
|
|
|
|
2020-02-10 21:59:51 +08:00
|
|
|
namespace ZoneWindowUtils
|
|
|
|
{
|
|
|
|
std::wstring GenerateUniqueId(HMONITOR monitor, PCWSTR deviceId, PCWSTR virtualDesktopId);
|
2020-08-07 16:06:25 +08:00
|
|
|
std::wstring GenerateUniqueIdAllMonitorsArea(PCWSTR virtualDesktopId);
|
2020-02-10 21:59:51 +08:00
|
|
|
}
|
|
|
|
|
2020-03-10 02:22:53 +08:00
|
|
|
/**
|
|
|
|
* Class representing single work area, which is defined by monitor and virtual desktop.
|
|
|
|
*/
|
2019-09-05 00:26:26 +08:00
|
|
|
interface __declspec(uuid("{7F017528-8110-4FB3-BE41-F472969C2560}")) IZoneWindow : public IUnknown
|
|
|
|
{
|
2020-03-10 02:22:53 +08:00
|
|
|
/**
|
|
|
|
* A window is being moved or resized. Track down window position and give zone layout
|
|
|
|
* hints if dragging functionality is enabled.
|
|
|
|
*
|
|
|
|
* @param window Handle of window being moved or resized.
|
|
|
|
*/
|
2020-06-05 22:53:08 +08:00
|
|
|
IFACEMETHOD(MoveSizeEnter)(HWND window) = 0;
|
2020-07-23 00:00:03 +08:00
|
|
|
|
2020-03-10 02:22:53 +08:00
|
|
|
/**
|
|
|
|
* A window has changed location, shape, or size. Track down window position and give zone layout
|
|
|
|
* hints if dragging functionality is enabled.
|
|
|
|
*
|
2020-07-10 17:06:01 +08:00
|
|
|
* @param ptScreen Cursor coordinates.
|
|
|
|
* @param dragEnabled Boolean indicating is giving hints about active zone layout enabled.
|
|
|
|
* Hints are given while dragging window while holding SHIFT key.
|
|
|
|
* @param selectManyZones When this parameter is true, the set of highlighted zones is computed
|
|
|
|
by finding the minimum bounding rectangle of the zone(s) from which the
|
|
|
|
user started dragging and the zone(s) above which the user is hovering
|
|
|
|
at the moment this function is called. Otherwise, highlight only the zone(s)
|
|
|
|
above which the user is currently hovering.
|
2020-03-10 02:22:53 +08:00
|
|
|
*/
|
2020-07-10 17:06:01 +08:00
|
|
|
IFACEMETHOD(MoveSizeUpdate)(POINT const& ptScreen, bool dragEnabled, bool selectManyZones) = 0;
|
2020-03-10 02:22:53 +08:00
|
|
|
/**
|
|
|
|
* The movement or resizing of a window has finished. Assign window to the zone of it
|
|
|
|
* is dropped within zone borders.
|
|
|
|
*
|
|
|
|
* @param window Handle of window being moved or resized.
|
2020-05-26 22:56:25 +08:00
|
|
|
* @param ptScreen Cursor coordinates where window is dropped.
|
2020-03-10 02:22:53 +08:00
|
|
|
*/
|
2019-09-05 00:26:26 +08:00
|
|
|
IFACEMETHOD(MoveSizeEnd)(HWND window, POINT const& ptScreen) = 0;
|
2020-03-10 02:22:53 +08:00
|
|
|
/**
|
|
|
|
* Assign window to the zone based on zone index inside zone layout.
|
|
|
|
*
|
|
|
|
* @param window Handle of window which should be assigned to zone.
|
|
|
|
* @param index Zone index within zone layout.
|
|
|
|
*/
|
2019-09-05 00:26:26 +08:00
|
|
|
IFACEMETHOD_(void, MoveWindowIntoZoneByIndex)(HWND window, int index) = 0;
|
2020-04-10 22:09:08 +08:00
|
|
|
/**
|
|
|
|
* Assign window to the zones based on the set of zone indices inside zone layout.
|
|
|
|
*
|
|
|
|
* @param window Handle of window which should be assigned to zone.
|
|
|
|
* @param indexSet The set of zone indices within zone layout.
|
|
|
|
*/
|
|
|
|
IFACEMETHOD_(void, MoveWindowIntoZoneByIndexSet)(HWND window, const std::vector<int>& indexSet) = 0;
|
2020-03-10 02:22:53 +08:00
|
|
|
/**
|
|
|
|
* Assign window to the zone based on direction (using WIN + LEFT/RIGHT arrow).
|
|
|
|
*
|
|
|
|
* @param window Handle of window which should be assigned to zone.
|
|
|
|
* @param vkCode Pressed arrow key.
|
2020-03-25 01:50:26 +08:00
|
|
|
* @param cycle Whether we should move window to the first zone if we reached last zone in layout.
|
|
|
|
*
|
|
|
|
* @returns Boolean which is always true if cycle argument is set, otherwise indicating if there is more
|
|
|
|
* zones left in the zone layout in which window can move.
|
2020-03-10 02:22:53 +08:00
|
|
|
*/
|
2020-03-25 01:50:26 +08:00
|
|
|
IFACEMETHOD_(bool, MoveWindowIntoZoneByDirection)(HWND window, DWORD vkCode, bool cycle) = 0;
|
2020-03-10 02:22:53 +08:00
|
|
|
/**
|
|
|
|
* Cycle through active zone layouts (giving hints about each layout).
|
|
|
|
*
|
|
|
|
* @param vkCode Pressed key representing layout index.
|
|
|
|
*/
|
2019-09-05 00:26:26 +08:00
|
|
|
IFACEMETHOD_(void, CycleActiveZoneSet)(DWORD vkCode) = 0;
|
2020-07-23 00:00:03 +08:00
|
|
|
|
2020-03-10 02:22:53 +08:00
|
|
|
/**
|
|
|
|
* Save information about zone in which window was assigned, when closing the window.
|
|
|
|
* Used once we open same window again to assign it to its previous zone.
|
|
|
|
*
|
|
|
|
* @param window Window handle.
|
|
|
|
*/
|
2019-09-05 00:26:26 +08:00
|
|
|
IFACEMETHOD_(void, SaveWindowProcessToZoneIndex)(HWND window) = 0;
|
2020-03-10 02:22:53 +08:00
|
|
|
/**
|
|
|
|
* @returns Unique work area identifier. Format: <device-id>_<resolution>_<virtual-desktop-id>
|
|
|
|
*/
|
2019-09-05 00:26:26 +08:00
|
|
|
IFACEMETHOD_(std::wstring, UniqueId)() = 0;
|
2020-03-10 02:22:53 +08:00
|
|
|
/**
|
|
|
|
* @returns Active zone layout for this work area.
|
|
|
|
*/
|
2019-09-05 00:26:26 +08:00
|
|
|
IFACEMETHOD_(IZoneSet*, ActiveZoneSet)() = 0;
|
2020-03-13 22:56:23 +08:00
|
|
|
IFACEMETHOD_(void, ShowZoneWindow)() = 0;
|
|
|
|
IFACEMETHOD_(void, HideZoneWindow)() = 0;
|
2020-05-06 23:16:16 +08:00
|
|
|
/**
|
|
|
|
* Update currently active zone layout for this work area.
|
|
|
|
*/
|
|
|
|
IFACEMETHOD_(void, UpdateActiveZoneSet)() = 0;
|
2020-07-10 17:06:01 +08:00
|
|
|
/**
|
|
|
|
* Clear the selected zones when this ZoneWindow loses focus.
|
|
|
|
*/
|
|
|
|
IFACEMETHOD_(void, ClearSelectedZones)() = 0;
|
2019-09-05 00:26:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
winrt::com_ptr<IZoneWindow> MakeZoneWindow(IZoneWindowHost* host, HINSTANCE hinstance, HMONITOR monitor,
|
2020-05-31 18:36:45 +08:00
|
|
|
const std::wstring& uniqueId, const std::wstring& parentUniqueId, bool flashZones) noexcept;
|