Blender V2.61 - r43446

GHOST_SystemSDL.h

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