Libpointing
An open-source cross-platform library to get raw events from pointing devices and master transfer functions.
DisplayDevice.h
1 /* -*- mode: c++ -*-
2  *
3  * pointing/output/DisplayDevice.h --
4  *
5  * Initial software
6  * Authors: Géry Casiez, Nicolas Roussel
7  * Copyright © Inria
8  *
9  * http://libpointing.org/
10  *
11  * This software may be used and distributed according to the terms of
12  * the GNU General Public License version 2 or any later version.
13  *
14  */
15 
16 #ifndef DisplayDevice_h
17 #define DisplayDevice_h
18 
19 #include <pointing/utils/URI.h>
20 
21 #include <iostream>
22 
23 namespace pointing {
24 
31  class DisplayDevice {
32 
33  protected:
34 
35  DisplayDevice(void) {}
36 
37  public:
38 
42  struct Point {
43  float x, y ;
44  Point(void) : x(0), y(0) {}
45  Point(float x, float y) : x(x), y(y) {}
46  } ;
47 
51  struct Size {
52  float width, height ;
53  Size(void) : width(0), height(0) {}
54  Size(float w, float h) : width(w), height(h) {}
55  } ;
56 
60  struct Bounds {
61  Point origin ;
62  Size size ;
63  Bounds(void) {}
64  Bounds(float x, float y, float w, float h) : origin(x,y), size(w,h) {}
65  } ;
66 
70  static DisplayDevice *create(const char *device_uri=0) ;
71  static DisplayDevice *create(std::string device_uri) ;
72 
76  virtual Bounds getBounds(Bounds *defval=0) = 0 ; // pixels
77 
81  virtual Size getSize(Size *defval=0) = 0 ; // mm
82 
93  virtual double getResolution(double *hppi, double *vppi, double *defval=0) ; // ppi
94  double getResolution(double *defval=0) {
95  return getResolution(0, 0, defval) ;
96  }
97 
101  virtual double getRefreshRate(double *defval=0) = 0 ; // Hz
102 
107  virtual URI getURI(bool expanded=false) const = 0 ;
108 
112  virtual void setDebugLevel(int /*level*/) {}
113  virtual void debug(std::ostream& /*out*/) const {}
114 
115  virtual ~DisplayDevice(void) {}
116 
117  } ;
118 
119 }
120 
121 #endif
Display size in mms.
Definition: DisplayDevice.h:51
Display bounds (origin and size) in pixels.
Definition: DisplayDevice.h:60
static DisplayDevice * create(const char *device_uri=0)
Static create method is used to instantiate an object of the class.
Definition: DisplayDevice.cpp:40
virtual URI getURI(bool expanded=false) const =0
virtual Bounds getBounds(Bounds *defval=0)=0
virtual Size getSize(Size *defval=0)=0
A structure to maintain coordinates of a pixel.
Definition: DisplayDevice.h:42
Definition: DummyPointingDevice.cpp:23
virtual double getRefreshRate(double *defval=0)=0
DisplayDevice class is used to represent the displays connected to the computer.
Definition: DisplayDevice.h:31
virtual double getResolution(double *hppi, double *vppi, double *defval=0)
Computes the pixel density (resolution) of the display device.
Definition: DisplayDevice.cpp:85
virtual void setDebugLevel(int)
Sets the level of information for debugging purposes (default = 0).
Definition: DisplayDevice.h:112