|
Blender
V2.59
|
00001 /* 00002 * $Id: GHOST_SystemSDL.h 38349 2011-07-13 00:49:22Z gsrb3d $ 00003 * ***** BEGIN GPL LICENSE BLOCK ***** 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software Foundation, 00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 * 00019 * Contributor(s): Campbell Barton 00020 * 00021 * ***** END GPL LICENSE BLOCK ***** 00022 */ 00023 00029 #ifndef _GHOST_SYSTEM_SDL_H_ 00030 #define _GHOST_SYSTEM_SDL_H_ 00031 00032 #include "GHOST_System.h" 00033 #include "../GHOST_Types.h" 00034 #include "GHOST_DisplayManagerSDL.h" 00035 #include "GHOST_TimerManager.h" 00036 #include "GHOST_WindowSDL.h" 00037 #include "GHOST_Event.h" 00038 00039 extern "C" { 00040 #include "SDL.h" 00041 } 00042 00043 #if !SDL_VERSION_ATLEAST(1, 3, 0) 00044 # error "SDL 1.3 or newer is needed to build with Ghost" 00045 #endif 00046 00047 00048 class GHOST_WindowSDL; 00049 00050 00051 class GHOST_SystemSDL : public GHOST_System { 00052 public: 00053 00054 void addDirtyWindow(GHOST_WindowSDL *bad_wind); 00055 00056 GHOST_SystemSDL(); 00057 ~GHOST_SystemSDL(); 00058 00059 bool 00060 processEvents(bool waitForEvent); 00061 00062 int 00063 toggleConsole(int action) { return 0; } 00064 00065 GHOST_TSuccess 00066 getModifierKeys(GHOST_ModifierKeys& keys) const; 00067 00068 GHOST_TSuccess 00069 getButtons(GHOST_Buttons& buttons) const; 00070 00071 GHOST_TUns8 * 00072 getClipboard(bool selection) const; 00073 00074 void 00075 putClipboard(GHOST_TInt8 *buffer, bool selection) const; 00076 00077 GHOST_TUns64 00078 getMilliSeconds(); 00079 00080 GHOST_TUns8 00081 getNumDisplays() const; 00082 00083 GHOST_TSuccess 00084 getCursorPosition(GHOST_TInt32& x, 00085 GHOST_TInt32& y) const; 00086 00087 GHOST_TSuccess 00088 setCursorPosition(GHOST_TInt32 x, 00089 GHOST_TInt32 y); 00090 00091 void 00092 getMainDisplayDimensions(GHOST_TUns32& width, 00093 GHOST_TUns32& height) const; 00094 00095 private: 00096 00097 GHOST_TSuccess 00098 init(); 00099 00100 GHOST_IWindow * 00101 createWindow(const STR_String& title, 00102 GHOST_TInt32 left, 00103 GHOST_TInt32 top, 00104 GHOST_TUns32 width, 00105 GHOST_TUns32 height, 00106 GHOST_TWindowState state, 00107 GHOST_TDrawingContextType type, 00108 bool stereoVisual, 00109 const GHOST_TUns16 numOfAASamples, 00110 const GHOST_TEmbedderWindowID parentWindow 00111 ); 00112 00113 /* SDL spesific */ 00114 GHOST_WindowSDL * findGhostWindow(SDL_Window *sdl_win); 00115 00116 bool 00117 generateWindowExposeEvents(); 00118 00119 void 00120 processEvent(SDL_Event *sdl_event); 00121 00123 std::vector<GHOST_WindowSDL *> m_dirty_windows; 00124 }; 00125 00126 #endif