xtd 0.2.0
screen.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "control.hpp"
6#include <xtd/drawing/rectangle>
7#include <xtd/object>
8#include <cstdint>
9#include <vector>
10
12namespace xtd {
14 namespace forms {
32 class forms_export_ screen : public object, public iequatable<screen> {
33 public:
35 screen() = default;
36 screen(const screen&) = default;
37 screen& operator =(const screen&) = default;
39
41
46 int32 bits_per_pixel() const noexcept;
47
50 const drawing::rectangle& bounds() const noexcept;
51
55 const xtd::string& device_name() const;
56
59 bool high_resolution() const noexcept;
60
64 int32 pixels_per_inch() const noexcept;
65
68 bool primary() const noexcept;
69
75 double scale_factor() const noexcept;
76
81 const drawing::rectangle& working_area() const noexcept;
83
85
89 static xtd::array<screen> all_screens();
90
94 static screen primary_screen();
96
98
103 bool equals(const xtd::object& obj) const noexcept override;
107 bool equals(const screen& other) const noexcept override;
108
111 xtd::size get_hash_code() const noexcept override;
113
115
119 static drawing::graphics create_graphics();
120
124 static screen from_control(const control& control);
125
129 static screen from_handle(intptr handle);
130
134 static screen from_point(const drawing::point& point);
135
139 static screen from_rectangle(const drawing::rectangle& rect);
140
144 static drawing::rectangle get_bounds(const control& control);
145
149 static drawing::rectangle get_bounds(intptr handle);
150
154 static drawing::rectangle get_bounds(const drawing::point& point);
155
159 static drawing::rectangle get_bounds(const drawing::rectangle& rect);
160
171
175 static drawing::rectangle get_working_area(const control& control);
176
180 static drawing::rectangle get_working_area(intptr handle);
181
185 static drawing::rectangle get_working_area(const drawing::point& point);
186
190 static drawing::rectangle get_working_area(const drawing::rectangle& rect);
192
193 private:
194 screen(int32 bits_per_pixel, const drawing::rectangle& bounds, const xtd::string& device_name, int32 pixels_per_inch, bool primary, double scale_factor, const drawing::rectangle& working_area);
195
196 int32 bits_per_pixel_ = 0;
197 drawing::rectangle bounds_;
198 xtd::string device_name_;
199 int32 pixels_per_inch_ = 96;
200 bool primary_ = false;
201 double scale_factor_ = 1.;
202 drawing::rectangle working_area_;
203 };
204 }
205}
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:61
Defines the base class for controls, which are components with visual representation.
Definition control.hpp:81
static screen from_point(const drawing::point &point)
Retrieves a screen for the display that contains the specified point.
static screen from_handle(intptr handle)
Retrieves a screen for the display that contains the largest portion of the object referred to by the...
bool high_resolution() const noexcept
Gets a value indicating whether a particular display is high resolution.
double scale_factor() const noexcept
Gets the scale factor of the display.
const drawing::rectangle & bounds() const noexcept
Gets the bounds of the display.
int32 bits_per_pixel() const noexcept
Gets the number of bits of memory, associated with one pixel of data.
int32 pixels_per_inch() const noexcept
Gets the number of pixels per inch of the display.
static int32 get_standard_pixels_per_inch()
Gets the the standard number of pixels per inch of the display.
const drawing::rectangle & working_area() const noexcept
Gets the working area of the display. The working area is the desktop area of the display,...
static drawing::rectangle get_working_area(const control &control)
Retrieves the working area for the display that contains the largest region of the specified control....
static drawing::graphics create_graphics()
Creates the xtd::drawing::graphics for the screen.
static drawing::rectangle get_bounds(const control &control)
Retrieves the bounds of the display that contains the largest portion of the specified control.
bool primary() const noexcept
Gets a value indicating whether a particular display is the primary device.
static screen from_rectangle(const drawing::rectangle &rect)
Retrieves a screen for the display that contains the largest portion of the rectangle.
static screen primary_screen()
Gets the primary display.
static screen from_control(const control &control)
Retrieves a screen for the display that contains the largest portion of the specified control.
bool equals(const xtd::object &obj) const noexcept override
Determines whether the specified object is equal to the current object.
static xtd::array< screen > all_screens()
Gets an array of all displays on the system.
xtd::size get_hash_code() const noexcept override
Serves as a hash function for a particular type.
const xtd::string & device_name() const
Gets the device name associated with a display.
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:22
object()=default
Create a new instance of the ultimate base class object.
Contains xtd::forms::control control.
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.hpp:23
@ other
The operating system is other.
Definition platform_id.hpp:58
@ size
Specifies that both the width and height property values of the control are defined.
Definition bounds_specified.hpp:36
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8