Utility/Enums: Change WindowStyleFlags to the new flags format
This commit is contained in:
parent
0070e691b0
commit
1db3d60cea
|
|
@ -30,7 +30,7 @@ namespace Nz
|
|||
{
|
||||
public:
|
||||
RenderWindow() = default;
|
||||
RenderWindow(VideoMode mode, const String& title, UInt32 style = WindowStyle_Default, const ContextParameters& parameters = ContextParameters());
|
||||
RenderWindow(VideoMode mode, const String& title, WindowStyleFlags style = WindowStyle_Default, const ContextParameters& parameters = ContextParameters());
|
||||
RenderWindow(WindowHandle handle, const ContextParameters& parameters = ContextParameters());
|
||||
RenderWindow(const RenderWindow&) = delete;
|
||||
RenderWindow(RenderWindow&&) = delete; ///TODO
|
||||
|
|
@ -39,7 +39,7 @@ namespace Nz
|
|||
bool CopyToImage(AbstractImage* image, const Vector3ui& dstPos = Vector3ui(0U)) const;
|
||||
bool CopyToImage(AbstractImage* image, const Rectui& rect, const Vector3ui& dstPos = Vector3ui(0U)) const;
|
||||
|
||||
bool Create(VideoMode mode, const String& title, UInt32 style = WindowStyle_Default, const ContextParameters& parameters = ContextParameters());
|
||||
bool Create(VideoMode mode, const String& title, WindowStyleFlags style = WindowStyle_Default, const ContextParameters& parameters = ContextParameters());
|
||||
bool Create(WindowHandle handle, const ContextParameters& parameters = ContextParameters());
|
||||
|
||||
void Display();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace Nz
|
||||
{
|
||||
RenderWindow::RenderWindow(VideoMode mode, const String& title, UInt32 style, const ContextParameters& parameters) :
|
||||
RenderWindow::RenderWindow(VideoMode mode, const String& title, WindowStyleFlags style, const ContextParameters& parameters) :
|
||||
RenderTarget(), Window()
|
||||
{
|
||||
ErrorFlags flags(ErrorFlag_ThrowException, true);
|
||||
|
|
@ -121,7 +121,7 @@ namespace Nz
|
|||
return true;
|
||||
}
|
||||
|
||||
bool RenderWindow::Create(VideoMode mode, const String& title, UInt32 style, const ContextParameters& parameters)
|
||||
bool RenderWindow::Create(VideoMode mode, const String& title, WindowStyleFlags style, const ContextParameters& parameters)
|
||||
{
|
||||
m_parameters = parameters;
|
||||
return Window::Create(mode, title, style);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace Nz
|
|||
{
|
||||
}
|
||||
|
||||
bool WindowImpl::Create(const VideoMode& mode, const String& title, UInt32 style)
|
||||
bool WindowImpl::Create(const VideoMode& mode, const String& title, WindowStyleFlags style)
|
||||
{
|
||||
bool async = (style & WindowStyle_Threaded) != 0;
|
||||
bool fullscreen = (style & WindowStyle_Fullscreen) != 0;
|
||||
|
|
@ -259,7 +259,7 @@ namespace Nz
|
|||
return m_size;
|
||||
}
|
||||
|
||||
UInt32 WindowImpl::GetStyle() const
|
||||
WindowStyleFlags WindowImpl::GetStyle() const
|
||||
{
|
||||
return m_style;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace Nz
|
|||
WindowImpl(WindowImpl&&) = delete; ///TODO?
|
||||
~WindowImpl() = default;
|
||||
|
||||
bool Create(const VideoMode& mode, const String& title, UInt32 style);
|
||||
bool Create(const VideoMode& mode, const String& title, WindowStyleFlags style);
|
||||
bool Create(WindowHandle handle);
|
||||
|
||||
void Destroy();
|
||||
|
|
@ -49,7 +49,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;
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ namespace Nz
|
|||
HCURSOR m_cursor;
|
||||
HWND m_handle;
|
||||
LONG_PTR m_callback;
|
||||
UInt32 m_style;
|
||||
WindowStyleFlags m_style;
|
||||
Vector2i m_maxSize;
|
||||
Vector2i m_minSize;
|
||||
Vector2i m_mousePos;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Nz
|
|||
Destroy();
|
||||
}
|
||||
|
||||
bool Window::Create(VideoMode mode, const String& title, UInt32 style)
|
||||
bool Window::Create(VideoMode mode, const String& title, WindowStyleFlags style)
|
||||
{
|
||||
// Si la fenêtre est déjà ouverte, nous conservons sa position
|
||||
bool opened = IsOpen();
|
||||
|
|
@ -228,7 +228,7 @@ namespace Nz
|
|||
return m_impl->GetSize();
|
||||
}
|
||||
|
||||
UInt32 Window::GetStyle() const
|
||||
WindowStyleFlags Window::GetStyle() const
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!m_impl)
|
||||
|
|
|
|||
Loading…
Reference in New Issue