Cleanup: remove contributors for CMake files
[blender.git] / intern / ghost / intern / GHOST_SystemSDL.h
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16
17 /** \file ghost/intern/GHOST_SystemSDL.h
18  *  \ingroup GHOST
19  * Declaration of GHOST_SystemSDL class.
20  */
21
22 #ifndef __GHOST_SYSTEMSDL_H__
23 #define __GHOST_SYSTEMSDL_H__
24
25 #include "GHOST_System.h"
26 #include "../GHOST_Types.h"
27 #include "GHOST_DisplayManagerSDL.h"
28 #include "GHOST_TimerManager.h"
29 #include "GHOST_WindowSDL.h"
30 #include "GHOST_Event.h"
31
32 extern "C" {
33         #include "SDL.h"
34 }
35
36 #if !SDL_VERSION_ATLEAST(2, 0, 0)
37 #  error "SDL 2.0 or newer is needed to build with Ghost"
38 #endif
39
40
41 class GHOST_WindowSDL;
42
43
44 class GHOST_SystemSDL : public GHOST_System {
45 public:
46
47         void addDirtyWindow(GHOST_WindowSDL *bad_wind);
48
49         GHOST_SystemSDL();
50         ~GHOST_SystemSDL();
51
52         bool
53         processEvents(bool waitForEvent);
54
55         int
56         toggleConsole(int action) { return 0; }
57
58         GHOST_TSuccess
59         getModifierKeys(GHOST_ModifierKeys& keys) const;
60
61         GHOST_TSuccess
62         getButtons(GHOST_Buttons& buttons) const;
63
64         GHOST_TUns8 *
65         getClipboard(bool selection) const;
66
67         void
68         putClipboard(GHOST_TInt8 *buffer, bool selection) const;
69
70         GHOST_TUns64
71         getMilliSeconds();
72
73         GHOST_TUns8
74         getNumDisplays() const;
75
76         GHOST_TSuccess
77         getCursorPosition(GHOST_TInt32& x,
78                           GHOST_TInt32& y) const;
79
80         GHOST_TSuccess
81         setCursorPosition(GHOST_TInt32 x,
82                           GHOST_TInt32 y);
83
84         void
85         getAllDisplayDimensions(GHOST_TUns32& width,
86                                 GHOST_TUns32& height) const;
87
88         void
89         getMainDisplayDimensions(GHOST_TUns32& width,
90                                  GHOST_TUns32& height) const;
91
92         GHOST_IContext *
93         createOffscreenContext();
94
95         GHOST_TSuccess
96         disposeContext(GHOST_IContext *context);
97
98         /**
99          * Informs if the system provides native dialogs (eg. confirm quit)
100          */
101         virtual bool supportsNativeDialogs(void);
102 private:
103
104         GHOST_TSuccess
105         init();
106
107         GHOST_IWindow *
108         createWindow(const STR_String& title,
109                      GHOST_TInt32 left,
110                      GHOST_TInt32 top,
111                      GHOST_TUns32 width,
112                      GHOST_TUns32 height,
113                      GHOST_TWindowState state,
114                      GHOST_TDrawingContextType type,
115                      GHOST_GLSettings glSettings,
116                      const bool exclusive = false,
117                      const GHOST_TEmbedderWindowID parentWindow = 0
118                      );
119
120         /* SDL specific */
121         GHOST_WindowSDL *findGhostWindow(SDL_Window *sdl_win);
122
123         bool
124         generateWindowExposeEvents();
125
126         void
127         processEvent(SDL_Event *sdl_event);
128
129         /// The vector of windows that need to be updated.
130         std::vector<GHOST_WindowSDL *> m_dirty_windows;
131 };
132
133 #endif