display_window_description.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2015 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** Harry Storbacka
28 ** Kenneth Gangstoe
29 */
30
31
32 #pragma once
33
34 #include <memory>
35
36 namespace clan
37 {
40
41 enum class WindowType
42 {
43 // \brief Normal application window decorated by the windowing system
44 normal,
45 // \brief Popup window (not decorated)
46 popup,
47 // \brief Popup window registered as a tool window (not decorated)
48 tool,
49 // \brief Custom drawn application window
50 custom
51 };
52
53 class Sizef;
54 class Rectf;
55 class DisplayWindow;
56 class DisplayWindowDescription_Impl;
57 struct DisplayWindowHandle;
58
62 class DisplayWindowDescription
63 {
66 public:
68 DisplayWindowDescription();
69
71 DisplayWindowDescription(const std::string &title);
72
74 DisplayWindowDescription(const std::string &title, const Rectf &position, bool client_area);
75
77 DisplayWindowDescription(const std::string &title, const Sizef &size, bool client_area);
78
80 DisplayWindowDescription(const Rectf &position, bool client_area);
81
84 DisplayWindowDescription(const DisplayWindowDescription &copy);
85
86 // \brief Copy the entire description (not just the implementation)
87 DisplayWindowDescription clone() const;
88
89 virtual ~DisplayWindowDescription();
90
94 public:
95
97 const std::string &get_title() const;
98
100 Sizef get_size() const;
101
103 Rectf get_position() const;
104
106 bool get_position_client_area() const;
107
109 bool is_fullscreen() const;
110
112 int get_flipping_buffers() const;
113
115 int get_swap_interval() const;
116
118 bool get_allow_resize() const;
119
121 int get_bpp() const;
122
126 int get_refresh_rate() const;
127
129 bool is_layered() const;
130
133 DisplayWindowHandle get_handle() const;
134
136 bool has_caption() const;
137
139 bool has_sysmenu() const;
140
142 bool has_minimize_button() const;
143
145 bool has_maximize_button() const;
146
148 bool is_visible() const;
149
151 bool is_topmost() const;
152
154 bool has_no_activate() const;
155
157
158 bool get_using_gui_window_cache() const;
159
161 bool has_drop_shadow() const;
162
164 DisplayWindow get_owner() const;
165
167 bool get_tablet_context() const;
168
170 int get_depth_size() const;
171
173 int get_stencil_size() const;
174
176 int get_fullscreen_monitor() const;
177
179 bool get_allow_screensaver() const;
180
182 bool is_update_supported() const;
183
185 int get_multisampling() const;
186
187 float get_extend_frame_left() const;
188 float get_extend_frame_top() const;
189 float get_extend_frame_right() const;
190 float get_extend_frame_bottom() const;
191
192 WindowType get_type() const;
193
197 public:
199 DisplayWindowDescription &operator =(const DisplayWindowDescription &copy);
200
202 void show_caption(bool value = true);
203
205 void show_sysmenu(bool value = true);
206
208 void show_minimize_button(bool value = true);
209
211 void show_maximize_button(bool value = true);
212
214 void set_visible(bool value = true);
215
217 void set_topmost(bool value = true);
218
220 void set_no_activate(bool value = true);
221
223 void set_drop_shadow(bool value = true);
224
226 void set_owner_window(const DisplayWindow &owner);
227
229 void set_title(const std::string &title);
230
234 void set_size(const Sizef &size, bool client_area);
235
242 void set_position(const Rectf &position, bool client_area);
243
245 void set_fullscreen(bool fullscreen = true, int monitor = 0);
246
248 void set_flipping_buffers(int num_buffers = 2);
249
251 void set_swap_interval(int interval = -1);
252
254 void set_allow_resize(bool allow_resize = true);
255
257 void set_bpp(int bpp);
258
262 void set_refresh_rate(int refresh_rate);
263
265 void set_tablet_context(bool create);
266
272 void set_using_gui_window_cache(bool value);
273
275 void set_layered(bool layered);
276
280 void set_allow_screensaver(bool allow_screensaver = true);
281
284 void set_handle(DisplayWindowHandle handle);
285
287
289 void set_depth_size(int value);
290
292
294 void set_stencil_size(int value);
295
300 void set_update_supported(bool value) const;
301
303 void set_multisampling(int value);
304
305 void set_extend_frame(float left, float top, float right, float bottom);
306
307 void set_type(WindowType type);
308
309
313 private:
314 std::shared_ptr<DisplayWindowDescription_Impl> impl;
316 };
317
318 }
319
clan
Definition: clanapp.h:35
clan::DisplayWindowDescription::get_type
WindowType get_type() const
clan::DisplayWindowDescription::get_extend_frame_left
float get_extend_frame_left() const
clan::DisplayWindowDescription::get_extend_frame_right
float get_extend_frame_right() const
clan::DisplayWindowDescription::set_flipping_buffers
void set_flipping_buffers(int num_buffers=2)
Sets the amount of flipping buffers to be used.
clan::DisplayWindowDescription::set_swap_interval
void set_swap_interval(int interval=-1)
Sets the swap interval to be used for the window.
clan::DisplayWindowDescription::~DisplayWindowDescription
virtual ~DisplayWindowDescription()
clan::DisplayWindowDescription::get_stencil_size
int get_stencil_size() const
Returns the minimum required stencil buffer.
clan::DisplayWindowDescription::is_fullscreen
bool is_fullscreen() const
Returns if window should be initially fullscreen.
clan::DisplayWindowDescription::set_drop_shadow
void set_drop_shadow(bool value=true)
Enables a drop shadow effect on the window.
clan::DisplayWindowDescription::is_update_supported
bool is_update_supported() const
Returns true if DisplayWindow::update should be supported.
clan::DisplayWindowDescription::set_no_activate
void set_no_activate(bool value=true)
Prevents window from being automatically activated.
clan::DisplayWindowDescription::is_topmost
bool is_topmost() const
Returns true if the window should be placed above all non-topmost windows.
clan::DisplayWindowHandle
Definition: display_window.h:87
clan::DisplayWindowDescription::DisplayWindowDescription
DisplayWindowDescription()
Constructs a window description with default values.
clan::DisplayWindowDescription::show_sysmenu
void show_sysmenu(bool value=true)
Sets if the window has a window menu on its title bar.
clan::DisplayWindowDescription::get_bpp
int get_bpp() const
Returns the numbers of bytes per pixel in the window.
clan::DisplayWindowDescription::set_bpp
void set_bpp(int bpp)
Sets the number of bytes per pixel.
clan::DisplayWindowDescription::get_allow_resize
bool get_allow_resize() const
Returns true if window should be resizeable.
clan::DisplayWindowDescription::set_title
void set_title(const std::string &title)
Sets the title of the window.
clan::DisplayWindowDescription::set_topmost
void set_topmost(bool value=true)
Sets if the window should be placed above all non-topmost windows.
clan::DisplayWindowDescription::get_using_gui_window_cache
bool get_using_gui_window_cache() const
Returns true if window from the window cache should be used. (GUI Only)
clan::DisplayWindowDescription::get_handle
DisplayWindowHandle get_handle() const
clan::WindowType::tool
clan::DisplayWindowDescription::is_layered
bool is_layered() const
Returns true if window is layered (black is transparent)
clan::DisplayWindowDescription::is_visible
bool is_visible() const
Returns true if the window is initially visible.
clan::DisplayWindowDescription::set_layered
void set_layered(bool layered)
Creates a layered window (complex shaped window)
clan::DisplayWindowDescription::set_update_supported
void set_update_supported(bool value) const
Controls if DisplayWindow::update is supported.
clan::DisplayWindowDescription::operator=
DisplayWindowDescription & operator=(const DisplayWindowDescription &copy)
Copy assignment operator.
clan::DisplayWindowDescription::set_tablet_context
void set_tablet_context(bool create)
Sets to true if a tablet input context should be created for this window.
clan::DisplayWindowDescription::set_allow_screensaver
void set_allow_screensaver(bool allow_screensaver=true)
Allow the screensaver to appear.
clan::DisplayWindowDescription::get_owner
DisplayWindow get_owner() const
Returns the window owning this one.
clan::StyleTokenType::string
@ keyword
clan::DisplayWindowDescription::get_allow_screensaver
bool get_allow_screensaver() const
Returns true if the screensaver is allowed.
clan::DisplayWindowDescription::get_fullscreen_monitor
int get_fullscreen_monitor() const
Returns the index of the monitor to go fullscreen on. See ScreenInfo.
clan::DisplayWindowDescription::has_no_activate
bool has_no_activate() const
Indicates if window is automatically activated or not.
clan::DisplayWindowDescription::has_drop_shadow
bool has_drop_shadow() const
Returns true if the window is drawn with a drop shadow effect.
clan::DisplayWindowDescription::set_handle
void set_handle(DisplayWindowHandle handle)
clan::DisplayWindowDescription::show_maximize_button
void show_maximize_button(bool value=true)
Sets if the window has a maximize button.
clan::DisplayWindowDescription::set_using_gui_window_cache
void set_using_gui_window_cache(bool value)
clan::DisplayWindowDescription::get_refresh_rate
int get_refresh_rate() const
clan::DisplayWindowDescription::get_multisampling
int get_multisampling() const
Returns the number of samples per pixel.
clan::DisplayWindowDescription::set_visible
void set_visible(bool value=true)
Toggles whether the window is created as initially visible.
clan::Rectf
2D (left,top,right,bottom) rectangle structure - Float
Definition: rect.h:484
clan::DisplayWindowDescription::has_maximize_button
bool has_maximize_button() const
Returns true if the window has a maximize button.
clan::DisplayWindowDescription::set_allow_resize
void set_allow_resize(bool allow_resize=true)
Sets if windows should be resizable.
clan::WindowType
WindowType
Definition: display_window_description.h:41
clan::WindowType::popup
clan::WindowType::custom
clan::DisplayWindowDescription::get_position_client_area
bool get_position_client_area() const
Returns if the client area is used for the initial position of the window.
clan::DisplayWindowDescription::show_minimize_button
void show_minimize_button(bool value=true)
Sets if the window has a minimize button.
clan::DisplayWindowDescription::set_stencil_size
void set_stencil_size(int value)
Sets the minimum required stencil buffer.
clan::DisplayWindowDescription::set_fullscreen
void set_fullscreen(bool fullscreen=true, int monitor=0)
Makes the window initially fullscreen.
clan::DisplayWindowDescription::get_swap_interval
int get_swap_interval() const
Returns the swap interval to be used for the window.
clan::DisplayWindowDescription::has_caption
bool has_caption() const
Returns true if a title bar is shown.
clan::DisplayWindowDescription::set_depth_size
void set_depth_size(int value)
Sets the minimum required depth buffer.
clan::DisplayWindowDescription::has_minimize_button
bool has_minimize_button() const
Returns true if the window has a minimize button.
clan::Key::left
clan::DisplayWindowDescription::get_tablet_context
bool get_tablet_context() const
Returns true if a tablet context is to be created for the window.
clan::DisplayWindowDescription::set_size
void set_size(const Sizef &size, bool client_area)
Sets the size of the window (including window frame).
clan::DisplayWindowDescription::get_depth_size
int get_depth_size() const
Returns the minimum required depth buffer.
clan::DisplayWindowDescription
Display window description class.
Definition: display_window_description.h:62
clan::Key::right
clan::DisplayWindowDescription::set_position
void set_position(const Rectf &position, bool client_area)
Sets the position of the window (including window frame).
clan::DisplayWindowDescription::get_position
Rectf get_position() const
Returns the initial position of the window.
clan::DisplayWindowDescription::get_size
Sizef get_size() const
Returns the size of the window stored in description.
clan::DisplayWindowDescription::get_extend_frame_top
float get_extend_frame_top() const
clan::DisplayWindowDescription::get_title
const std::string & get_title() const
Returns the window title stored in the description.
clan::DisplayWindowDescription::get_flipping_buffers
int get_flipping_buffers() const
Returns the amount of flipping buffers to be created.
clan::DisplayWindowDescription::set_owner_window
void set_owner_window(const DisplayWindow &owner)
Specifies another window which owns this one.
clan::DisplayWindowDescription::set_extend_frame
void set_extend_frame(float left, float top, float right, float bottom)
clan::DisplayWindowDescription::get_extend_frame_bottom
float get_extend_frame_bottom() const
clan::DisplayWindowDescription::set_multisampling
void set_multisampling(int value)
Sets the number of samples per pixel.
clan::DisplayWindow
Top-level window class.
Definition: display_window.h:101
clan::DisplayWindowDescription::set_refresh_rate
void set_refresh_rate(int refresh_rate)
clan::DisplayWindowDescription::show_caption
void show_caption(bool value=true)
Controls if a title bar (including frame) is shown or not.
clan::DisplayWindowDescription::has_sysmenu
bool has_sysmenu() const
Returns true if the window has a window menu on its title bar.
clan::DisplayWindowDescription::clone
DisplayWindowDescription clone() const
clan::Sizef
2D (width,height) size structure - Float
Definition: size.h:169
clan::WindowType::normal
clan::DisplayWindowDescription::set_type
void set_type(WindowType type)