libdisplaydevice master
C++ library to modify display devices.
win_display_device.h
Go to the documentation of this file.
1
5#pragma once
6
7// system includes
8#include <memory>
9
10// local includes
13
14namespace display_device {
19 public:
24 explicit WinDisplayDevice(std::shared_ptr<WinApiLayerInterface> w_api);
25
29 [[nodiscard]] bool isApiAccessAvailable() const override;
30
34 [[nodiscard]] EnumeratedDeviceList enumAvailableDevices() const override;
35
39 [[nodiscard]] std::string getDisplayName(const std::string &device_id) const override;
40
44 [[nodiscard]] ActiveTopology getCurrentTopology() const override;
45
49 [[nodiscard]] bool isTopologyValid(const ActiveTopology &topology) const override;
50
54 [[nodiscard]] bool isTopologyTheSame(const ActiveTopology &lhs, const ActiveTopology &rhs) const override;
55
59 [[nodiscard]] bool setTopology(const ActiveTopology &new_topology) override;
60
64 [[nodiscard]] DeviceDisplayModeMap getCurrentDisplayModes(const StringSet &device_ids) const override;
65
69 [[nodiscard]] bool setDisplayModes(const DeviceDisplayModeMap &modes) override;
70
74 [[nodiscard]] bool isPrimary(const std::string &device_id) const override;
75
79 [[nodiscard]] bool setAsPrimary(const std::string &device_id) override;
80
84 [[nodiscard]] HdrStateMap getCurrentHdrStates(const StringSet &device_ids) const override;
85
89 [[nodiscard]] bool setHdrStates(const HdrStateMap &states) override;
90
91 private:
92 std::shared_ptr<WinApiLayerInterface> m_w_api;
93 };
94} // namespace display_device
Higher level abstracted API for interacting Windows' display device(s).
Definition win_display_device_interface.h:17
Default implementation for the WinDisplayDeviceInterface.
Definition win_display_device.h:18
bool isTopologyTheSame(const ActiveTopology &lhs, const ActiveTopology &rhs) const override
Check if the topologies are close enough to be considered the same by the OS.
Definition win_display_device_topology.cpp:119
WinDisplayDevice(std::shared_ptr< WinApiLayerInterface > w_api)
Definition win_display_device_general.cpp:16
bool isPrimary(const std::string &device_id) const override
Check whether the specified device is primary.
Definition win_display_device_primary.cpp:13
bool isApiAccessAvailable() const override
Check if the API for changing display settings is accessible.
Definition win_display_device_general.cpp:23
bool setTopology(const ActiveTopology &new_topology) override
Set a new active topology for the OS.
Definition win_display_device_topology.cpp:138
ActiveTopology getCurrentTopology() const override
Get the active (current) topology.
Definition win_display_device_topology.cpp:54
bool setAsPrimary(const std::string &device_id) override
Set the device as a primary display.
Definition win_display_device_primary.cpp:40
HdrStateMap getCurrentHdrStates(const StringSet &device_ids) const override
Get HDR state for the devices.
Definition win_display_device_hdr.cpp:69
bool setDisplayModes(const DeviceDisplayModeMap &modes) override
Set new display modes for the devices.
Definition win_display_device_modes.cpp:147
EnumeratedDeviceList enumAvailableDevices() const override
Enumerate the available (active and inactive) devices.
Definition win_display_device_general.cpp:33
bool setHdrStates(const HdrStateMap &states) override
Set HDR states for the devices.
Definition win_display_device_hdr.cpp:95
DeviceDisplayModeMap getCurrentDisplayModes(const StringSet &device_ids) const override
Get current display modes for the devices.
Definition win_display_device_modes.cpp:105
std::string getDisplayName(const std::string &device_id) const override
Get display name associated with the device.
Definition win_display_device_general.cpp:81
bool isTopologyValid(const ActiveTopology &topology) const override
Verify if the active topology is valid.
Definition win_display_device_topology.cpp:92
std::vector< EnumeratedDevice > EnumeratedDeviceList
A list of EnumeratedDevice objects.
Definition types.h:208
std::set< std::string, std::less<> > StringSet
Ordered set keyed by strings with transparent comparisons.
Definition types.h:46
Declarations for the WinApiLayerInterface.
Declarations for the WinDisplayDeviceInterface.
StringMap< DisplayMode > DeviceDisplayModeMap
Ordered map of [DEVICE_ID -> DisplayMode].
Definition types.h:116
std::vector< std::vector< std::string > > ActiveTopology
A LIST[LIST[DEVICE_ID]] structure which represents an active topology.
Definition types.h:96
StringMap< std::optional< HdrState > > HdrStateMap
Ordered map of [DEVICE_ID -> std::optional<HdrState>].
Definition types.h:121