Blender V2.61 - r43446

GHOST_WindowCarbon.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  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00033 #ifndef _GHOST_WINDOW_CARBON_H_
00034 #define _GHOST_WINDOW_CARBON_H_
00035 
00036 #ifndef __APPLE__
00037 #error Apple OSX only!
00038 #endif // __APPLE__
00039 
00040 #include "GHOST_Window.h"
00041 #include "STR_String.h"
00042 
00043 #define __CARBONSOUND__
00044 #include <Carbon/Carbon.h>
00045 
00046 #include <AGL/agl.h>
00047 
00048 
00060 class GHOST_WindowCarbon : public GHOST_Window {
00061 public:
00075     GHOST_WindowCarbon(
00076         const STR_String& title,
00077         GHOST_TInt32 left,
00078         GHOST_TInt32 top,
00079         GHOST_TUns32 width,
00080         GHOST_TUns32 height,
00081         GHOST_TWindowState state,
00082         GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
00083         const bool stereoVisual = false,
00084         const GHOST_TUns16 numOfAASamples = 0
00085     );
00086 
00091     virtual ~GHOST_WindowCarbon();
00092 
00097     virtual bool getValid() const;
00098 
00103     virtual void setTitle(const STR_String& title);
00104 
00109     virtual void getTitle(STR_String& title) const;
00110 
00116     virtual void getWindowBounds(GHOST_Rect& bounds) const;
00117     
00123     virtual void getClientBounds(GHOST_Rect& bounds) const;
00124 
00129     virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width);
00130 
00135     virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height);
00136 
00142     virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height);
00143 
00148     virtual GHOST_TWindowState getState() const;
00149 
00157     virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
00158 
00166     virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
00167 
00173     virtual GHOST_TSuccess setState(GHOST_TWindowState state);
00174 
00180     virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order);
00181 
00186     virtual GHOST_TSuccess swapBuffers();
00187 
00193     GHOST_TSuccess updateDrawingContext();
00194 
00199     virtual GHOST_TSuccess activateDrawingContext();
00200 
00201     virtual void loadCursor(bool visible, GHOST_TStandardCursor cursor) const;
00202 
00207     virtual bool getFullScreenDirty();
00208 
00209         /* accessor for fullscreen window */
00210     virtual void setMac_windowState(short value);
00211     virtual short getMac_windowState();
00212 
00213 
00214     const GHOST_TabletData* GetTabletData()
00215     { return &m_tablet; }
00216 
00217     GHOST_TabletData& GetCarbonTabletData()
00218     { return m_tablet; }
00219 protected:
00225     virtual GHOST_TSuccess installDrawingContext(GHOST_TDrawingContextType type);
00226 
00231     virtual GHOST_TSuccess removeDrawingContext();
00232     
00237     virtual GHOST_TSuccess invalidate();
00238 
00243     virtual GHOST_TSuccess setWindowCursorVisibility(bool visible);
00244     
00249     virtual GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape);
00250 
00255     virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
00256                     int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color);
00257                     
00258     virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY);
00259 
00265     virtual void gen2mac(const STR_String& in, Str255 out) const;
00266 
00272     virtual void mac2gen(const Str255 in, STR_String& out) const;
00273     
00274     WindowRef m_windowRef;
00275     CGrafPtr m_grafPtr;
00276     AGLContext m_aglCtx;
00277 
00279     static AGLContext s_firstaglCtx;
00280         
00281     Cursor* m_customCursor;
00282 
00283     GHOST_TabletData m_tablet;
00284 
00286     bool m_fullScreenDirty;
00287     
00299     short mac_windowState;
00300     
00301 
00306 #ifdef GHOST_DRAW_CARBON_GUTTER
00307     static const GHOST_TInt32 s_sizeRectSize;
00308 #endif // GHOST_DRAW_CARBON_GUTTER
00309 };
00310 
00311 #endif // _GHOST_WINDOW_CARBON_H_
00312