2 * $Id: GHOST_WindowSDL.h 38349 2011-07-13 00:49:22Z gsrb3d $
3 * ***** BEGIN GPL LICENSE BLOCK *****
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * Contributor(s): Campbell Barton
21 * ***** END GPL LICENSE BLOCK *****
24 /** \file ghost/intern/GHOST_WindowSDL.h
26 * Declaration of GHOST_WindowSDL class.
29 #ifndef _GHOST_WINDOWSDL_H_
30 #define _GHOST_WINDOWSDL_H_
32 #include "GHOST_Window.h"
33 #include "GHOST_SystemSDL.h"
40 #if !SDL_VERSION_ATLEAST(1, 3, 0)
41 # error "SDL 1.3 or newer is needed to build with Ghost"
46 class GHOST_WindowSDL : public GHOST_Window
49 GHOST_SystemSDL * m_system;
50 bool m_invalid_window;
52 SDL_Window * m_sdl_win;
53 SDL_GLContext m_sdl_glcontext;
54 SDL_Cursor * m_sdl_custom_cursor;
58 const GHOST_TabletData* GetTabletData() { return NULL; }
60 GHOST_WindowSDL(GHOST_SystemSDL *system,
61 const STR_String& title,
62 GHOST_TInt32 left, GHOST_TInt32 top,
63 GHOST_TUns32 width, GHOST_TUns32 height,
64 GHOST_TWindowState state,
65 const GHOST_TEmbedderWindowID parentWindow,
66 GHOST_TDrawingContextType type,
67 const bool stereoVisual,
68 const GHOST_TUns16 numOfAASamples
81 GHOST_TSuccess invalidate(void);
84 * called by the X11 system implementation when expose events
85 * for the window have been pushed onto the GHOST queue
90 m_invalid_window = false;
95 return (m_sdl_win != NULL);
98 void getWindowBounds(GHOST_Rect& bounds) const;
99 void getClientBounds(GHOST_Rect& bounds) const;
102 GHOST_TSuccess installDrawingContext(GHOST_TDrawingContextType type);
103 GHOST_TSuccess removeDrawingContext();
106 setWindowCursorGrab(GHOST_TGrabCursorMode mode);
109 setWindowCursorShape(GHOST_TStandardCursor shape);
112 setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
113 GHOST_TUns8 mask[16][2],
117 setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
119 int sizex, int sizey,
121 int fg_color, int bg_color);
124 setWindowCursorVisibility(bool visible);
127 setTitle(const STR_String& title);
130 getTitle(STR_String& title) const;
133 setClientWidth(GHOST_TUns32 width);
136 setClientHeight(GHOST_TUns32 height);
139 setClientSize(GHOST_TUns32 width,
140 GHOST_TUns32 height);
143 screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY,
144 GHOST_TInt32& outX, GHOST_TInt32& outY) const;
147 clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY,
148 GHOST_TInt32& outX, GHOST_TInt32& outY) const;
154 activateDrawingContext();
157 setState(GHOST_TWindowState state);
162 GHOST_TSuccess setOrder(GHOST_TWindowOrder order) { return GHOST_kSuccess; } // TODO
167 #endif // _GHOST_WINDOWSDL_H_