Utility/Enums: Change WindowStyleFlags to the new flags format

This commit is contained in:
Lynix
2016-11-27 02:28:39 +01:00
parent 0070e691b0
commit 1db3d60cea
8 changed files with 35 additions and 24 deletions

View File

@@ -7,6 +7,8 @@
#ifndef NAZARA_ENUMS_UTILITY_HPP
#define NAZARA_ENUMS_UTILITY_HPP
#include <Nazara/Core/Flags.hpp>
namespace Nz
{
enum AnimationType
@@ -430,20 +432,29 @@ namespace Nz
WindowEventType_Max = WindowEventType_TextEntered
};
enum WindowStyleFlags
enum WindowStyle
{
WindowStyle_None = 0x0, ///< Window has no border nor titlebar.
WindowStyle_Fullscreen = 0x1, ///< At the window creation, the OS tries to set it in fullscreen.
WindowStyle_None, ///< Window has no border nor titlebar.
WindowStyle_Fullscreen, ///< At the window creation, the OS tries to set it in fullscreen.
WindowStyle_Closable = 0x2, ///< Allows the window to be closed by a button in the titlebar, generating a Quit event.
WindowStyle_Resizable = 0x4, ///< Allows the window to be resized by dragging its corners or by a button of the titlebar.
WindowStyle_Titlebar = 0x8, ///< Adds a titlebar to the window, this option is automatically enabled if buttons of the titlebar are enabled.
WindowStyle_Closable, ///< Allows the window to be closed by a button in the titlebar, generating a Quit event.
WindowStyle_Resizable, ///< Allows the window to be resized by dragging its corners or by a button of the titlebar.
WindowStyle_Titlebar, ///< Adds a titlebar to the window, this option is automatically enabled if buttons of the titlebar are enabled.
WindowStyle_Threaded = 0x10, ///< Runs the window into a thread, allowing the application to keep updating while resizing/dragging the window.
WindowStyle_Threaded, ///< Runs the window into a thread, allowing the application to keep updating while resizing/dragging the window.
WindowStyle_Default = WindowStyle_Closable | WindowStyle_Resizable | WindowStyle_Titlebar,
WindowStyle_Max = WindowStyle_Threaded*2-1
WindowStyle_Max = WindowStyle_Threaded
};
template<>
struct EnableFlagsOperators<WindowStyle>
{
static constexpr bool value = true;
};
using WindowStyleFlags = Flags<WindowStyle>;
constexpr WindowStyleFlags WindowStyle_Default = WindowStyle_Closable | WindowStyle_Resizable | WindowStyle_Titlebar;
}
#endif // NAZARA_ENUMS_UTILITY_HPP

View File

@@ -36,7 +36,7 @@ namespace Nz
public:
inline Window();
inline Window(VideoMode mode, const String& title, UInt32 style = WindowStyle_Default);
inline Window(VideoMode mode, const String& title, WindowStyleFlags style = WindowStyle_Default);
inline Window(WindowHandle handle);
Window(const Window&) = delete;
inline Window(Window&& window) noexcept;
@@ -44,7 +44,7 @@ namespace Nz
inline void Close();
bool Create(VideoMode mode, const String& title, UInt32 style = WindowStyle_Default);
bool Create(VideoMode mode, const String& title, WindowStyleFlags style = WindowStyle_Default);
bool Create(WindowHandle handle);
void Destroy();
@@ -62,7 +62,7 @@ namespace Nz
unsigned int GetHeight() const;
Vector2i GetPosition() const;
Vector2ui GetSize() const;
UInt32 GetStyle() const;
WindowStyleFlags GetStyle() const;
String GetTitle() const;
unsigned int GetWidth() const;

View File

@@ -21,7 +21,7 @@ namespace Nz
{
}
inline Window::Window(VideoMode mode, const String& title, UInt32 style) :
inline Window::Window(VideoMode mode, const String& title, WindowStyleFlags style) :
Window()
{
ErrorFlags flags(ErrorFlag_ThrowException, true);