2019-09-04 18:26:26 +02:00
|
|
|
#pragma once
|
|
|
|
|
#include <Windows.h>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2020-03-05 13:07:06 +03:00
|
|
|
struct ScreenSize
|
|
|
|
|
{
|
|
|
|
|
explicit ScreenSize(RECT rect) :
|
|
|
|
|
rect(rect) {}
|
|
|
|
|
RECT rect;
|
|
|
|
|
int left() const { return rect.left; }
|
|
|
|
|
int right() const { return rect.right; }
|
|
|
|
|
int top() const { return rect.top; }
|
|
|
|
|
int bottom() const { return rect.bottom; }
|
|
|
|
|
int height() const { return rect.bottom - rect.top; };
|
|
|
|
|
int width() const { return rect.right - rect.left; };
|
|
|
|
|
POINT top_left() const { return { rect.left, rect.top }; };
|
|
|
|
|
POINT top_middle() const { return { rect.left + width() / 2, rect.top }; };
|
|
|
|
|
POINT top_right() const { return { rect.right, rect.top }; };
|
|
|
|
|
POINT middle_left() const { return { rect.left, rect.top + height() / 2 }; };
|
|
|
|
|
POINT middle() const { return { rect.left + width() / 2, rect.top + height() / 2 }; };
|
|
|
|
|
POINT middle_right() const { return { rect.right, rect.top + height() / 2 }; };
|
|
|
|
|
POINT bottom_left() const { return { rect.left, rect.bottom }; };
|
2020-05-27 10:58:47 -04:00
|
|
|
POINT bottom_middle() const { return { rect.left + width() / 2, rect.bottom }; };
|
2020-03-05 13:07:06 +03:00
|
|
|
POINT bottom_right() const { return { rect.right, rect.bottom }; };
|
2019-09-04 18:26:26 +02:00
|
|
|
};
|
|
|
|
|
|
2020-03-05 13:07:06 +03:00
|
|
|
struct MonitorInfo : ScreenSize
|
|
|
|
|
{
|
|
|
|
|
explicit MonitorInfo(HMONITOR monitor, RECT rect) :
|
|
|
|
|
handle(monitor), ScreenSize(rect) {}
|
|
|
|
|
HMONITOR handle;
|
2019-09-04 18:26:26 +02:00
|
|
|
|
2020-03-05 13:07:06 +03:00
|
|
|
// Returns monitor rects ordered from left to right
|
2020-04-20 18:09:10 +02:00
|
|
|
static std::vector<MonitorInfo> GetMonitors(bool includeNonWorkingArea);
|
2020-03-05 13:07:06 +03:00
|
|
|
static MonitorInfo GetPrimaryMonitor();
|
2019-09-04 18:26:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool operator==(const ScreenSize& lhs, const ScreenSize& rhs);
|