|
Blender
V2.59
|
00001 /* 00002 * $Id: GHOST_WindowCarbon.h 35152 2011-02-25 11:28:33Z jesterking $ 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_CARBON_H_ 00035 #define _GHOST_WINDOW_CARBON_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 #define __CARBONSOUND__ 00045 #include <Carbon/Carbon.h> 00046 00047 #include <AGL/agl.h> 00048 00049 00061 class GHOST_WindowCarbon : public GHOST_Window { 00062 public: 00076 GHOST_WindowCarbon( 00077 const STR_String& title, 00078 GHOST_TInt32 left, 00079 GHOST_TInt32 top, 00080 GHOST_TUns32 width, 00081 GHOST_TUns32 height, 00082 GHOST_TWindowState state, 00083 GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone, 00084 const bool stereoVisual = false, 00085 const GHOST_TUns16 numOfAASamples = 0 00086 ); 00087 00092 virtual ~GHOST_WindowCarbon(); 00093 00098 virtual bool getValid() const; 00099 00104 virtual void setTitle(const STR_String& title); 00105 00110 virtual void getTitle(STR_String& title) const; 00111 00117 virtual void getWindowBounds(GHOST_Rect& bounds) const; 00118 00124 virtual void getClientBounds(GHOST_Rect& bounds) const; 00125 00130 virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width); 00131 00136 virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height); 00137 00143 virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height); 00144 00149 virtual GHOST_TWindowState getState() const; 00150 00158 virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const; 00159 00167 virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const; 00168 00174 virtual GHOST_TSuccess setState(GHOST_TWindowState state); 00175 00181 virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order); 00182 00187 virtual GHOST_TSuccess swapBuffers(); 00188 00194 GHOST_TSuccess updateDrawingContext(); 00195 00200 virtual GHOST_TSuccess activateDrawingContext(); 00201 00202 virtual void loadCursor(bool visible, GHOST_TStandardCursor cursor) const; 00203 00208 virtual bool getFullScreenDirty(); 00209 00210 /* accessor for fullscreen window */ 00211 virtual void setMac_windowState(short value); 00212 virtual short getMac_windowState(); 00213 00214 00215 const GHOST_TabletData* GetTabletData() 00216 { return &m_tablet; } 00217 00218 GHOST_TabletData& GetCarbonTabletData() 00219 { return m_tablet; } 00220 protected: 00226 virtual GHOST_TSuccess installDrawingContext(GHOST_TDrawingContextType type); 00227 00232 virtual GHOST_TSuccess removeDrawingContext(); 00233 00238 virtual GHOST_TSuccess invalidate(); 00239 00244 virtual GHOST_TSuccess setWindowCursorVisibility(bool visible); 00245 00250 virtual GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape); 00251 00256 virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, 00257 int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color); 00258 00259 virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY); 00260 00266 virtual void gen2mac(const STR_String& in, Str255 out) const; 00267 00273 virtual void mac2gen(const Str255 in, STR_String& out) const; 00274 00275 WindowRef m_windowRef; 00276 CGrafPtr m_grafPtr; 00277 AGLContext m_aglCtx; 00278 00280 static AGLContext s_firstaglCtx; 00281 00282 Cursor* m_customCursor; 00283 00284 GHOST_TabletData m_tablet; 00285 00287 bool m_fullScreenDirty; 00288 00300 short mac_windowState; 00301 00302 00307 #ifdef GHOST_DRAW_CARBON_GUTTER 00308 static const GHOST_TInt32 s_sizeRectSize; 00309 #endif // GHOST_DRAW_CARBON_GUTTER 00310 }; 00311 00312 #endif // _GHOST_WINDOW_CARBON_H_ 00313