|
Blender
V2.59
|
00001 /* 00002 * $Id: GHOST_WindowCocoa.h 37861 2011-06-27 13:57:27Z blendix $ 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 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00020 * All rights reserved. 00021 * 00022 * The Original Code is: all of this file. 00023 * 00024 * Contributor(s): none yet. 00025 * 00026 * ***** END GPL LICENSE BLOCK ***** 00027 */ 00028 00034 #ifndef _GHOST_WINDOW_COCOA_H_ 00035 #define _GHOST_WINDOW_COCOA_H_ 00036 00037 #ifndef __APPLE__ 00038 #error Apple OSX only! 00039 #endif // __APPLE__ 00040 00041 #include "GHOST_Window.h" 00042 #include "STR_String.h" 00043 00044 @class CocoaWindow; 00045 @class CocoaOpenGLView; 00046 00047 class GHOST_SystemCocoa; 00048 00060 class GHOST_WindowCocoa : public GHOST_Window { 00061 public: 00077 GHOST_WindowCocoa( 00078 GHOST_SystemCocoa *systemCocoa, 00079 const STR_String& title, 00080 GHOST_TInt32 left, 00081 GHOST_TInt32 bottom, 00082 GHOST_TUns32 width, 00083 GHOST_TUns32 height, 00084 GHOST_TWindowState state, 00085 GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone, 00086 const bool stereoVisual = false, 00087 const GHOST_TUns16 numOfAASamples = 0 00088 ); 00089 00094 virtual ~GHOST_WindowCocoa(); 00095 00100 virtual bool getValid() const; 00101 00106 virtual void* getOSWindow() const; 00107 00112 virtual void setTitle(const STR_String& title); 00113 00118 virtual void getTitle(STR_String& title) const; 00119 00125 virtual void getWindowBounds(GHOST_Rect& bounds) const; 00126 00132 virtual void getClientBounds(GHOST_Rect& bounds) const; 00133 00138 virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width); 00139 00144 virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height); 00145 00151 virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height); 00152 00157 virtual GHOST_TWindowState getState() const; 00158 00164 virtual GHOST_TSuccess setModifiedState(bool isUnsavedChanges); 00165 00173 virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const; 00174 00182 virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const; 00183 00192 void clientToScreenIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const; 00193 00202 void screenToClientIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const; 00203 00208 NSScreen* getScreen(); 00209 00215 virtual GHOST_TSuccess setState(GHOST_TWindowState state); 00216 00222 virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order); 00223 00228 virtual GHOST_TSuccess swapBuffers(); 00229 00235 GHOST_TSuccess updateDrawingContext(); 00236 00241 virtual GHOST_TSuccess activateDrawingContext(); 00242 00243 virtual void loadCursor(bool visible, GHOST_TStandardCursor cursor) const; 00244 00245 00246 const GHOST_TabletData* GetTabletData() 00247 { return &m_tablet; } 00248 00249 GHOST_TabletData& GetCocoaTabletData() 00250 { return m_tablet; } 00251 00256 virtual GHOST_TSuccess setProgressBar(float progress); 00257 00261 virtual GHOST_TSuccess endProgressBar(); 00262 protected: 00268 virtual GHOST_TSuccess installDrawingContext(GHOST_TDrawingContextType type); 00269 00274 virtual GHOST_TSuccess removeDrawingContext(); 00275 00280 virtual GHOST_TSuccess invalidate(); 00281 00286 virtual GHOST_TSuccess setWindowCursorVisibility(bool visible); 00287 00292 virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode); 00293 00298 virtual GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape); 00299 00304 virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, 00305 int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color); 00306 00307 virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY); 00308 00310 CocoaWindow *m_window; 00311 00313 CocoaOpenGLView *m_openGLView; 00314 00316 NSOpenGLContext *m_openGLContext; 00317 00319 GHOST_SystemCocoa *m_systemCocoa; 00320 00322 static NSOpenGLContext *s_firstOpenGLcontext; 00323 00324 NSCursor* m_customCursor; 00325 00326 GHOST_TabletData m_tablet; 00327 }; 00328 00329 #endif // _GHOST_WINDOW_COCOA_H_ 00330