Monitor Manager - Horizon-NTH/HorizonGUI GitHub Wiki

MonitorManager

Overview

The MonitorManager class, located in the hgui namespace, is a utility class designed to provide access to information about Monitors in your graphical application. Monitors are essential for handling display and screen-related operations. This class allows you to retrieve monitor information, such as monitor names, primary monitor, and more. The class can be found in the header file MonitorManager.h.

Member Functions

  • const std::shared_ptr<kernel::Monitor>& get(const std::string& monitorName): Retrieves a monitor with the specified name.

  • std::vector<std::string> get_monitors_names(): Retrieves a list of monitor names available in the system.

  • const std::shared_ptr<kernel::Monitor>& get_primary_monitor(): Retrieves the primary monitor.

Example Usage

#include <hgui/MonitorManager.h>

// Example Usage of MonitorManager class

// Retrieve a specific monitor by name
std::string monitorName = "Monitor 1";
const std::shared_ptr<hgui::kernel::Monitor>& monitor = hgui::MonitorManager::get(monitorName);

// Get a list of all available monitor names
std::vector<std::string> monitorNames = hgui::MonitorManager::get_monitors_names();

// Retrieve the primary monitor
const std::shared_ptr<hgui::kernel::Monitor>& primaryMonitor = hgui::MonitorManager::get_primary_monitor();

// Use monitor information as needed
// (e.g., set display configurations, work with monitor properties)

Note: In the "Example Usage" section, we demonstrate how to use the MonitorManager class to retrieve a specific monitor by name, get a list of all available monitor names, and obtain the primary monitor. You can use monitor information for various display-related operations and configurations within your graphical application. This class is a valuable tool for managing monitors and display properties.