Nui
screen.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <nui/core.hpp>
4 
5 #include <cstdint>
6 #include <vector>
7 #include <string>
8 #include <functional>
9 
10 namespace Nui
11 {
12  class Display
13  {
14  public:
15  Display(const Display&) = default;
16  Display(Display&&) = default;
17  Display& operator=(const Display&) = default;
18  Display& operator=(Display&&) = default;
19  ~Display() = default;
20 
21  int32_t x() const
22  {
23  return x_;
24  }
25  int32_t y() const
26  {
27  return y_;
28  }
29  int32_t width() const
30  {
31  return width_;
32  }
33  int32_t height() const
34  {
35  return height_;
36  }
37  bool isPrimary() const
38  {
39  return isPrimary_;
40  }
41  std::string deviceName() const
42  {
43  return deviceName_;
44  }
45 
46  Display(int32_t x, int32_t y, int32_t width, int32_t height, bool isPrimary, std::string deviceName)
47  : x_(x)
48  , y_(y)
49  , width_(width)
50  , height_(height)
51  , isPrimary_(isPrimary)
52  , deviceName_(std::move(deviceName))
53  {}
54 
55  private:
56  int32_t x_;
57  int32_t y_;
58  int32_t width_;
59  int32_t height_;
60  bool isPrimary_;
61  std::string deviceName_;
62  };
63 
64 #ifdef NUI_BACKEND
65  class Screen
66  {
67  public:
68  static std::vector<Display> getDisplays();
69  static Display getPrimaryDisplay();
70  };
71 #else
72  class Screen
73  {
74  public:
75  static void getDisplays(std::function<void(std::vector<Display>&&)> callback);
76  static void getPrimaryDisplay(std::function<void(Display&&)> callback);
77  };
78 #endif
79 }
Definition: screen.hpp:13
Display & operator=(Display &&)=default
bool isPrimary() const
Definition: screen.hpp:37
Display & operator=(const Display &)=default
Display(int32_t x, int32_t y, int32_t width, int32_t height, bool isPrimary, std::string deviceName)
Definition: screen.hpp:46
int32_t x() const
Definition: screen.hpp:21
Display(Display &&)=default
int32_t width() const
Definition: screen.hpp:29
Display(const Display &)=default
int32_t y() const
Definition: screen.hpp:25
~Display()=default
std::string deviceName() const
Definition: screen.hpp:41
int32_t height() const
Definition: screen.hpp:33
Definition: screen.hpp:73
static void getDisplays(std::function< void(std::vector< Display > &&)> callback)
Definition: screen_mac.cpp:81
static void getPrimaryDisplay(std::function< void(Display &&)> callback)
Definition: screen_mac.cpp:101
Definition: file_dialog.hpp:6