cgv
Loading...
Searching...
No Matches
cgv::os::display Class Referenceabstract

the display class gives access to the display modes of all available displays. More...

#include <display.h>

Public Member Functions

access to available display modes
virtual void enumerate_display_modes (std::vector< display_mode > &display_modes, bool compatible_with_attached_monitor=true)=0
 enumerate all available display modes. If the display is active only the display modes supported by the attached monitor are enumerated
 
virtual void show_display_modes (bool compatible_with_attached_monitor=true)=0
 print out all available display modes
 
read only information about the display
virtual std::string get_name () const =0
 return the name of the display
 
virtual std::string get_description () const =0
 return the description string of the display
 
virtual std::string get_ID () const =0
 return the unique ID string of the display
 
virtual bool is_mirror () const =0
 return whether display is a mirrored display
 
virtual bool is_removable () const =0
 return whether display is removable
 
global configuration
virtual bool is_active () const =0
 return whether display is active
 
virtual bool activate ()=0
 activate the display based on the registered settings or change the current display settings to the registered settings if the display is already active. Return whether activation or change of settings was successful.
 
virtual bool check_activate () const =0
 check if activation of the registered settings will work
 
virtual bool deactivate ()=0
 deactivate the display, return whether deactivation was successful
 
virtual bool is_primary () const =0
 return whether display is the primary display
 
virtual bool make_primary ()=0
 make this display the primary display
 
virtual bool can_be_primary () const =0
 check if this display can be made primary
 
access to current display configuration if display is active
virtual display_configuration get_configuration () const =0
 return the current display configuration
 
virtual display_mode get_mode () const =0
 return the currently set display mode
 
virtual unsigned int get_width () const =0
 return the current width (only defined if display is active)
 
virtual unsigned int get_height () const =0
 return the current height (only defined if display is active)
 
virtual unsigned int get_bit_depth () const =0
 return the current bit depth of the display pixels (only defined if display is active)
 
virtual unsigned int get_refresh_rate () const =0
 return the current refresh rate in Hz (only defined if display is active)
 
virtual display_position get_position () const =0
 return the current display position
 
virtual int get_x () const =0
 return the current current x coordinate within the virtual screen spanned by the desktop (only defined if display is active)
 
virtual int get_y () const =0
 return the current current y coordinate within the virtual screen spanned by the desktop (only defined if display is active)
 
virtual bool set_configuration (const display_configuration &dc)=0
 set the display configuration immediately, return whether this was successful.
 
virtual bool set_mode (const display_mode &dm)=0
 set the given display mode immediately, return whether this was successful. Only valid display modes can be set.
 
virtual bool set_resolution (unsigned int w, unsigned int h)=0
 set new resolution of the display immediately, return whether this was successful. Only resolutions that correspond to valid display modes can be set.
 
virtual bool set_bit_depth (unsigned int bits)=0
 set new bit depth of the display immediately, return whether this was successful. Only bit depths that correspond to valid display modes can be set.
 
virtual bool set_refresh_rate (unsigned int hz)=0
 set new refresh rate of the display immediately, return whether this was successful. Only refresh rates that correspond to valid display modes can be set.
 
virtual bool set_position (const display_position &dp)=0
 set the display position immediately, return whether this was successful. Only positions that result in a tight non overlapping packing of displays can be set.
 
virtual bool set_position (unsigned int x, unsigned int y)=0
 set new position of the display within the virtual screen immediately, return whether this was successful. Only positions that result in a tight non overlapping packing of displays can be set.
 
registration of new configuration and test of configuration
virtual display_mode get_registered_mode () const =0
 return the display mode registered in the registry
 
virtual unsigned int get_registered_width () const =0
 return the registered width (this is changed by prepare_resolution)
 
virtual unsigned int get_registered_height () const =0
 return the registered height (this is changed by prepare_resolution)
 
virtual unsigned int get_registered_bit_depth () const =0
 return the registered bit depth of a display pixel (this is changed by prepare_bit_depth)
 
virtual unsigned int get_registered_refresh_rate () const =0
 return the registered refresh rate in Hz (this is changed by prepare_refresh_rate)
 
virtual bool register_configuration (const display_configuration &dc)=0
 register new display configuration, which is activated in the next activate() or activate_all() call
 
virtual bool register_mode (const display_mode &dm)=0
 register new display mode, which is activated in the next activate() or activate_all() call
 
virtual bool register_resolution (unsigned int w, unsigned int h)=0
 register new resolution of the display, which is activated in the next activate() or activate_all() call
 
virtual bool register_bit_depth (unsigned int bits)=0
 register new bit depth of the display, which is activated in the next activate() or activate_all() call
 
virtual bool register_refresh_rate (unsigned int hz)=0
 register new refresh rate of the display, which is activated in the next activate() or activate_all() call
 
virtual bool register_position (const display_position &dp)=0
 register new position immediately, which is activated in the next activate() or activate_all() call
 
virtual bool register_position (unsigned int x, unsigned int y)=0
 register new position of the display, which is activated in the next activate() or activate_all() call
 
virtual bool check_configuration (const display_configuration &dc) const =0
 check given display configuration
 
virtual bool check_mode (const display_mode &dm) const =0
 check given display mode
 
virtual bool check_resolution (unsigned int w, unsigned int h) const =0
 check given resolution
 
virtual bool check_bit_depth (unsigned int bits) const =0
 check given bit depth
 
virtual bool check_refresh_rate (unsigned int hz) const =0
 check given refresh rate
 
virtual bool check_position (const display_position &dp) const =0
 check given position
 
virtual bool check_position (unsigned int x, unsigned int y) const =0
 check given position
 

static methods dealing with all displays

static std::string last_error
 if one of the methods return false, this static member gives textual information about the reason
 
static void scan_displays (DisplayScanMode mode=DSM_ALL)
 scan all available displays and ignore the mirrored displays that do not correspond to physical devices if only_physical_displays is set to true
 
static const std::vector< display * > & get_displays ()
 return the list of previously scanned display devices
 
static void clear_displays ()
 clear the list of previously scanned devices and free all allocated memory
 
static bool activate_all ()
 activate all displays according to the registered settings
 
static bool check_activate_all ()
 check if all displays can be activated according to the registered settings
 
static void show_all_displays (DisplayScanMode scan_mode=DSM_ALL)
 show all available displays
 
virtual ~display ()
 virtual destructor frees all platform specifically allocated memory
 

Detailed Description

the display class gives access to the display modes of all available displays.

An example application can be found in <apps/display>. It provides a command line interface to the implementation.

Definition at line 73 of file display.h.

Constructor & Destructor Documentation

◆ ~display()

virtual cgv::os::display::~display ( )
inlinevirtual

virtual destructor frees all platform specifically allocated memory

Definition at line 95 of file display.h.

Member Function Documentation

◆ activate_all()

bool cgv::os::display::activate_all ( )
static

activate all displays according to the registered settings

Definition at line 559 of file display.cxx.

◆ check_activate_all()

bool cgv::os::display::check_activate_all ( )
static

check if all displays can be activated according to the registered settings

activate all displays according to the registered settings

Definition at line 574 of file display.cxx.

◆ clear_displays()

void cgv::os::display::clear_displays ( )
static

clear the list of previously scanned devices and free all allocated memory

Definition at line 523 of file display.cxx.

Referenced by scan_displays().

◆ get_displays()

const std::vector< display * > & cgv::os::display::get_displays ( )
static

return the list of previously scanned display devices

Definition at line 517 of file display.cxx.

Referenced by show_all_displays().

◆ scan_displays()

void cgv::os::display::scan_displays ( DisplayScanMode  mode = DSM_ALL)
static

scan all available displays and ignore the mirrored displays that do not correspond to physical devices if only_physical_displays is set to true

enumerate the current displays and ignore the mirrored displays that do not correpond to physical devices

Definition at line 530 of file display.cxx.

References clear_displays().

Referenced by show_all_displays().

◆ show_all_displays()

void cgv::os::display::show_all_displays ( DisplayScanMode  scan_mode = DSM_ALL)
static

show all available displays

Definition at line 585 of file display.cxx.

References get_displays(), and scan_displays().

Member Data Documentation

◆ last_error

std::string cgv::os::display::last_error
static

if one of the methods return false, this static member gives textual information about the reason

Definition at line 79 of file display.h.


The documentation for this class was generated from the following files: