xtd 0.2.0
screen.h
Go to the documentation of this file.
1 #pragma once
5 #include "control.h"
6 #include <xtd/drawing/rectangle>
7 #include <xtd/object>
8 #include <cstdint>
9 #include <vector>
10 
12 namespace xtd {
14  namespace forms {
30  class forms_export_ screen : public object {
31  public:
33  screen(const screen&) = default;
34  screen& operator =(const screen&) = default;
36 
38 
42  static std::vector<screen> all_screens();
43 
47  int32 bits_per_pixel() const noexcept;
48 
51  const drawing::rectangle& bounds() const noexcept;
52 
56  const xtd::ustring& device_name() const;
57 
60  bool high_resolution() const noexcept;
61 
65  int32 pixels_per_inch() const noexcept;
66 
69  bool primary() const noexcept;
70 
76  double scale_factor() const noexcept;
77 
81  static screen primary_screen();
82 
87  const drawing::rectangle& working_area() const noexcept;
89 
91 
96  static drawing::graphics create_graphics();
97 
101  static screen from_control(const control& control);
102 
106  static screen from_handle(intptr handle);
107 
111  static screen from_point(const drawing::point& point);
112 
116  static screen from_rectangle(const drawing::rectangle& rect);
117 
121  static drawing::rectangle get_bounds(const control& control);
122 
126  static drawing::rectangle get_bounds(intptr handle);
127 
131  static drawing::rectangle get_bounds(const drawing::point& point);
132 
136  static drawing::rectangle get_bounds(const drawing::rectangle& rect);
137 
147  static int32 get_standard_pixels_per_inch();
148 
152  static drawing::rectangle get_working_area(const control& control);
153 
157  static drawing::rectangle get_working_area(intptr handle);
158 
162  static drawing::rectangle get_working_area(const drawing::point& point);
163 
167  static drawing::rectangle get_working_area(const drawing::rectangle& rect);
169 
170  private:
171  screen() = default;
172  screen(int32 bits_per_pixel, const drawing::rectangle& bounds, const xtd::ustring& device_name, int32 pixels_per_inch, bool primary, double scale_factor, const drawing::rectangle& working_area);
173 
174  int32 bits_per_pixel_ = 0;
175  drawing::rectangle bounds_;
176  xtd::ustring device_name_;
177  int32 pixels_per_inch_ = 96;
178  bool primary_ = false;
179  double scale_factor_ = 1.;
180  drawing::rectangle working_area_;
181  };
182  }
183 }
Represents a display device or multiple display devices on a single system.
Definition: screen.h:30
intmax_t intptr
Represent a pointer or a handle.
Definition: types.h:151
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition: point.h:54
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
Stores a set of four integers that represent the location and size of a rectangle.
Definition: rectangle.h:44
Defines the base class for controls, which are components with visual representation.
Definition: control.h:78
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:32
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129
Contains xtd::forms::control control.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition: graphics.h:70