Blender V2.61 - r43446
|
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_WINDOWSDL_H_ 00029 #define _GHOST_WINDOWSDL_H_ 00030 00031 #include "GHOST_Window.h" 00032 #include "GHOST_SystemSDL.h" 00033 #include <map> 00034 00035 extern "C" { 00036 #include "SDL.h" 00037 } 00038 00039 #if !SDL_VERSION_ATLEAST(1, 3, 0) 00040 # error "SDL 1.3 or newer is needed to build with Ghost" 00041 #endif 00042 00043 class STR_String; 00044 00045 class GHOST_WindowSDL : public GHOST_Window 00046 { 00047 private : 00048 GHOST_SystemSDL * m_system; 00049 bool m_invalid_window; 00050 00051 SDL_Window * m_sdl_win; 00052 SDL_GLContext m_sdl_glcontext; 00053 SDL_Cursor * m_sdl_custom_cursor; 00054 00055 public: 00056 00057 const GHOST_TabletData* GetTabletData() { return NULL; } 00058 00059 GHOST_WindowSDL(GHOST_SystemSDL *system, 00060 const STR_String& title, 00061 GHOST_TInt32 left, GHOST_TInt32 top, 00062 GHOST_TUns32 width, GHOST_TUns32 height, 00063 GHOST_TWindowState state, 00064 const GHOST_TEmbedderWindowID parentWindow, 00065 GHOST_TDrawingContextType type, 00066 const bool stereoVisual, 00067 const GHOST_TUns16 numOfAASamples 00068 ); 00069 00070 ~GHOST_WindowSDL(); 00071 00072 /* SDL specific */ 00073 SDL_Window * 00074 getSDLWindow() 00075 { 00076 return m_sdl_win; 00077 } 00078 00079 00080 GHOST_TSuccess invalidate(void); 00081 00087 void validate() 00088 { 00089 m_invalid_window = false; 00090 } 00091 00092 bool getValid() const 00093 { 00094 return (m_sdl_win != NULL); 00095 } 00096 00097 void getWindowBounds(GHOST_Rect& bounds) const; 00098 void getClientBounds(GHOST_Rect& bounds) const; 00099 00100 protected: 00101 GHOST_TSuccess installDrawingContext(GHOST_TDrawingContextType type); 00102 GHOST_TSuccess removeDrawingContext(); 00103 00104 GHOST_TSuccess 00105 setWindowCursorGrab(GHOST_TGrabCursorMode mode); 00106 00107 GHOST_TSuccess 00108 setWindowCursorShape(GHOST_TStandardCursor shape); 00109 00110 GHOST_TSuccess 00111 setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], 00112 GHOST_TUns8 mask[16][2], 00113 int hotX, int hotY); 00114 00115 GHOST_TSuccess 00116 setWindowCustomCursorShape(GHOST_TUns8 *bitmap, 00117 GHOST_TUns8 *mask, 00118 int sizex, int sizey, 00119 int hotX, int hotY, 00120 int fg_color, int bg_color); 00121 00122 GHOST_TSuccess 00123 setWindowCursorVisibility(bool visible); 00124 00125 void 00126 setTitle(const STR_String& title); 00127 00128 void 00129 getTitle(STR_String& title) const; 00130 00131 GHOST_TSuccess 00132 setClientWidth(GHOST_TUns32 width); 00133 00134 GHOST_TSuccess 00135 setClientHeight(GHOST_TUns32 height); 00136 00137 GHOST_TSuccess 00138 setClientSize(GHOST_TUns32 width, 00139 GHOST_TUns32 height); 00140 00141 void 00142 screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, 00143 GHOST_TInt32& outX, GHOST_TInt32& outY) const; 00144 00145 void 00146 clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, 00147 GHOST_TInt32& outX, GHOST_TInt32& outY) const; 00148 00149 GHOST_TSuccess 00150 swapBuffers(); 00151 00152 GHOST_TSuccess 00153 activateDrawingContext(); 00154 00155 GHOST_TSuccess 00156 setState(GHOST_TWindowState state); 00157 00158 GHOST_TWindowState 00159 getState() const; 00160 00161 GHOST_TSuccess setOrder(GHOST_TWindowOrder order) { return GHOST_kSuccess; } // TODO 00162 00163 }; 00164 00165 00166 #endif // _GHOST_WINDOWSDL_H_