MiniEngine/SDLWrapper/Window.h

69 lines
1.7 KiB
C++
Raw Normal View History

2017-06-18 17:40:17 +08:00
#pragma once
2017-06-18 20:37:45 +08:00
#include "include.h"
#include "_WindowType.h"
#include "_MessageBoxType.h"
#include "ErrorViewer.h"
#include "MessageBox.h"
#include "Surface.h"
2017-07-01 17:11:06 +08:00
#include "__Plugin.h"
2017-06-18 17:40:17 +08:00
#include "begin_code.h"
class Window
{
public:
Window()=default;
Window(std::string Title, int Width, int Height,
std::initializer_list<WindowType> WindowFlags = {WindowType::Shown},
int WindowPositionX=SDL_WINDOWPOS_CENTERED, int WindowPositionY=SDL_WINDOWPOS_CENTERED) throw(ErrorViewer);
Rect getSize() const;
void setSize(const Rect& sizeRect);
void setSize(int w, int h);
Point getPosition() const;
void setPosition(int x, int y);
void setPosition(const Point& point);
void setTitle(const std::string& Title);
std::string getTitle() const;
void setGrab(bool isGrab);
bool getGrab() const;
#if _MINIENGINE_SDL_VERSION_ATLEAST(2,0,5)
/// SDL2.0.5 Required.
int setOpacity(float opacity);
float getOpacity() const;
#endif
/// FIXME: Not Implemented.
void setResizable(bool resizable);
/// Use UTF8 in Title and Message please.
int showSimpleMessageBox(MessageBoxType type,const std::string& Title,const std::string& Message) const;
int showMessageBox(const WindowMessageBox& box) const;
void show();
void hide();
void raise();
void minimize();
void maximize();
void restore();
_DECL_DEPRECATED Surface getSurface();
bool isScreenKeyboardShown();
void release();
private:
std::shared_ptr<SDL_Window> _wnd;
void _set(SDL_Window*);
void _clear();
SDL_Window* _get() const;
friend class Renderer;
2017-07-01 17:11:06 +08:00
friend class _internal::Plugin;
2017-06-18 17:40:17 +08:00
};
#include "end_code.h"