2015-06-20 15:54:29 +02:00
|
|
|
// BlitzUtility - Expanding the normal Blitz functionality.
|
2016-02-06 00:18:01 +01:00
|
|
|
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
|
2015-06-20 15:54:29 +02:00
|
|
|
//
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
#include "DisplayEnumerator.h"
|
|
|
|
|
|
|
|
|
|
BOOL CALLBACK BU_DisplayEnumerator_Callback(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
|
|
|
|
|
DisplayEnumerator* displayEnumerator = (DisplayEnumerator*)dwData;
|
|
|
|
|
|
|
|
|
|
displayEnumerator->displays.push_back(RECT(*lprcMonitor));
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-06 00:18:01 +01:00
|
|
|
DLL_FUNCTION(DisplayEnumerator*) BU_DisplayEnumerator_Create() {
|
2015-06-20 15:54:29 +02:00
|
|
|
DisplayEnumerator* displayEnumerator = new DisplayEnumerator();
|
|
|
|
|
return displayEnumerator;
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-06 00:18:01 +01:00
|
|
|
DLL_FUNCTION(void) BU_DisplayEnumerator_Destroy(DisplayEnumerator* displayEnumerator) {
|
2015-06-20 15:54:29 +02:00
|
|
|
delete displayEnumerator;
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-06 00:18:01 +01:00
|
|
|
DLL_FUNCTION(uint32_t) BU_DisplayEnumerator_Enumerate(DisplayEnumerator* displayEnumerator) {
|
2015-06-20 15:54:29 +02:00
|
|
|
EnumDisplayMonitors(NULL, NULL, BU_DisplayEnumerator_Callback, (LPARAM)displayEnumerator);
|
|
|
|
|
|
|
|
|
|
return displayEnumerator->displays.size();
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-06 00:18:01 +01:00
|
|
|
DLL_FUNCTION(uint32_t) BU_DisplayEnumerator_Count(DisplayEnumerator* displayEnumerator) {
|
2015-06-20 15:54:29 +02:00
|
|
|
return displayEnumerator->displays.size();
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-06 00:18:01 +01:00
|
|
|
DLL_FUNCTION(void) BU_DisplayEnumerator_Retrieve(DisplayEnumerator* displayEnumerator, uint32_t index, PRECT display) {
|
2015-06-20 15:54:29 +02:00
|
|
|
// Retrieve the requested index.
|
|
|
|
|
auto iterator = displayEnumerator->displays.begin();
|
|
|
|
|
std::advance(iterator, index);
|
|
|
|
|
|
|
|
|
|
// Copy data.
|
|
|
|
|
display->left = iterator->left;
|
|
|
|
|
display->top = iterator->top;
|
|
|
|
|
display->right = iterator->right;
|
|
|
|
|
display->bottom = iterator->bottom;
|
|
|
|
|
}
|