NRE_WindowStyle.hpp
Go to the documentation of this file.
1 
10  #pragma once
11 
12  #ifdef _WIN32 // Windows
13  #include <Windows.h>
14  #elif __linux__ // Linux
15  #include <X11/Xlib.h>
16  #else
17  #error "Not Supported Yet or Unknown compiler"
18  #endif
19 
20  #include <utility>
21 
26  namespace NRE {
31  namespace Graphics {
32 
37  class WindowStyle {
38  private : // Fields
39  unsigned int style;
40 
41  public : // Methods
42  //## Constructor ##//
47  inline WindowStyle(unsigned int s = BASIC) : style(s) {
48  }
49 
50  //## Copy Constructor ##//
55  WindowStyle(WindowStyle const& ws) = default;
56 
57  //## Move Constructor ##//
62  WindowStyle(WindowStyle && ws) = default;
63 
64  //## Deconstructor ##//
68  ~WindowStyle() = default;
69 
70  //## Methods ##//
71  #ifdef _WIN32 // Windows
72 
76  DWORD toNativeStyle() const;
77  #elif __linux__ // Linux
78  struct NativeWindowHints {
79  unsigned long flags;
80  unsigned long functions;
81  unsigned long decorations;
82  long inputMode;
83  unsigned long state;
84  };
85 
86  static constexpr unsigned long HINTS_FUNCTIONS = 1 << 0;
87  static constexpr unsigned long HINTS_DECORATIONS = 1 << 1;
88  static constexpr unsigned long DECOR_BORDER = 1 << 1;
89  static constexpr unsigned long DECOR_RESIZEH = 1 << 2;
90  static constexpr unsigned long DECOR_TITLE = 1 << 3;
91  static constexpr unsigned long DECOR_MENU = 1 << 4;
92  static constexpr unsigned long DECOR_MINIMIZE = 1 << 5;
93  static constexpr unsigned long DECOR_MAXIMIZE = 1 << 6;
94  static constexpr unsigned long FUNC_RESIZE = 1 << 1;
95  static constexpr unsigned long FUNC_MOVE = 1 << 2;
96  static constexpr unsigned long FUNC_MINIMIZE = 1 << 3;
97  static constexpr unsigned long FUNC_MAXIMIZE = 1 << 4;
98  static constexpr unsigned long FUNC_CLOSE = 1 << 5;
99 
104  NativeWindowHints toNativeStyle() const;
105  #endif
106 
107  //## Assignment Operator ##//
113  WindowStyle& operator =(WindowStyle const& ws) = default;
119  WindowStyle& operator =(WindowStyle && ws) = default;
120 
121  //## Shortcut Operator ##//
128 
129  //## Bitwise Operator ##//
135  WindowStyle operator |(WindowStyle const& ws) const;
141  unsigned int operator &(unsigned int ws) const;
142 
143  public : // Static
144  static constexpr unsigned int BASIC = 0b000;
145  static constexpr unsigned int CLOSEABLE = 0b001;
146  static constexpr unsigned int RESIZEABLE = 0b010;
147  static constexpr unsigned int FULLSCREEN = 0b100;
148  };
149  }
150  }
Manage a window style.
Definition: NRE_WindowStyle.hpp:37
unsigned int operator&(unsigned int ws) const
Definition: NRE_WindowStyle.cpp:24
WindowStyle operator|(WindowStyle const &ws) const
Definition: NRE_WindowStyle.cpp:20
static constexpr unsigned int CLOSEABLE
Definition: NRE_WindowStyle.hpp:145
WindowStyle & operator=(WindowStyle const &ws)=default
static constexpr unsigned int RESIZEABLE
Definition: NRE_WindowStyle.hpp:146
WindowStyle(unsigned int s=BASIC)
Definition: NRE_WindowStyle.hpp:47
WindowStyle & operator|=(WindowStyle const &ws)
Definition: NRE_WindowStyle.cpp:15
The NearlyRealEngine&#39;s global namespace.
Graphics&#39; API.
static constexpr unsigned int BASIC
Definition: NRE_WindowStyle.hpp:144
static constexpr unsigned int FULLSCREEN
Definition: NRE_WindowStyle.hpp:147