Blender  V2.59
GHOST_Window.h
Go to the documentation of this file.
00001 /*
00002  * $Id: GHOST_Window.h 37765 2011-06-23 19:55:47Z 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_H_
00035 #define _GHOST_WINDOW_H_
00036 
00037 #include "GHOST_IWindow.h"
00038 
00039 class STR_String;
00040 
00050 class GHOST_Window : public GHOST_IWindow
00051 {
00052 public:
00086         GHOST_Window(
00087                 GHOST_TUns32 width,
00088                 GHOST_TUns32 height,
00089                 GHOST_TWindowState state,
00090                 GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
00091                 const bool stereoVisual = false,
00092                 const GHOST_TUns16 numOfAASamples = 0);
00093 
00119         virtual ~GHOST_Window();
00120 
00125         virtual void* getOSWindow() const;
00126         
00131         inline virtual GHOST_TStandardCursor getCursorShape() const;
00132 
00138         virtual GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursorShape);
00139 
00148         virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2], 
00149                                                                                                 GHOST_TUns8 mask[16][2], 
00150                                                                                                 int hotX, 
00151                                                                                                 int hotY);
00152                                                                                                 
00153         virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap, 
00154                                                                                                 GHOST_TUns8 *mask, 
00155                                                                                                 int sizex, int sizey,
00156                                                                                                 int hotX,  int hotY,
00157                                                                                                 int fg_color, int bg_color);
00158         
00163         inline virtual bool getCursorVisibility() const;
00164         inline virtual GHOST_TGrabCursorMode getCursorGrabMode() const;
00165         inline virtual void getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
00166         inline virtual void getCursorGrabAccum(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
00167         inline virtual void setCursorGrabAccum(GHOST_TInt32 x, GHOST_TInt32 y);
00168 
00174         virtual GHOST_TSuccess setCursorVisibility(bool visible);
00175 
00181         virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rect *bounds);
00182 
00187         virtual GHOST_TSuccess getCursorGrabBounds(GHOST_Rect& bounds);
00188 
00193         virtual GHOST_TSuccess setProgressBar(float progress) {return GHOST_kFailure;};
00194         
00198         virtual GHOST_TSuccess endProgressBar() {return GHOST_kFailure;};
00199         
00203         virtual void setAcceptDragOperation(bool canAccept);
00204         
00209         virtual bool canAcceptDragOperation() const;
00210         
00216         virtual GHOST_TSuccess setModifiedState(bool isUnsavedChanges);
00217         
00222         virtual bool getModifiedState();
00223         
00228         inline virtual GHOST_TDrawingContextType getDrawingContextType();
00229 
00237         virtual GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type);
00238 
00243         inline virtual GHOST_TUserDataPtr getUserData() const
00244         {
00245                 return m_userData;
00246         }
00247         
00252         virtual void setUserData(const GHOST_TUserDataPtr userData)
00253         {
00254                 m_userData = userData;
00255         }
00256 
00257 protected:
00263         virtual GHOST_TSuccess installDrawingContext(GHOST_TDrawingContextType type) = 0;
00264 
00269         virtual GHOST_TSuccess removeDrawingContext() = 0;
00270 
00275         virtual GHOST_TSuccess setWindowCursorVisibility(bool visible) = 0;
00276 
00281         virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) { return GHOST_kSuccess; };
00282         
00287         virtual GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape) = 0;
00288 
00293         virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2],
00294                                                          int hotX, int hotY) = 0;
00295         
00296         virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, 
00297                                                 int szx, int szy, int hotX, int hotY, int fg, int bg) = 0;
00299         GHOST_TDrawingContextType m_drawingContextType;
00300         
00302         GHOST_TUserDataPtr m_userData;
00303 
00305         bool m_cursorVisible;
00306 
00308         GHOST_TGrabCursorMode m_cursorGrab;
00309 
00311         GHOST_TInt32 m_cursorGrabInitPos[2];
00312 
00314         GHOST_TInt32 m_cursorGrabAccumPos[2];
00315 
00317         GHOST_Rect m_cursorGrabBounds;
00318 
00320         GHOST_TStandardCursor m_cursorShape;
00321     
00323         bool m_progressBarVisible;
00324         
00326         bool m_canAcceptDragOperation;
00327         
00329         bool m_isUnsavedChanges;
00330         
00332         bool m_fullScreen;
00333 
00338         bool m_stereoVisual;
00339         
00341         GHOST_TUns16 m_numOfAASamples;
00342     
00344     GHOST_TUns32 m_fullScreenWidth;
00346     GHOST_TUns32 m_fullScreenHeight;
00347 };
00348 
00349 
00350 inline GHOST_TDrawingContextType GHOST_Window::getDrawingContextType()
00351 {
00352         return m_drawingContextType;
00353 }
00354 
00355 inline bool GHOST_Window::getCursorVisibility() const
00356 {
00357         return m_cursorVisible;
00358 }
00359 
00360 inline GHOST_TGrabCursorMode GHOST_Window::getCursorGrabMode() const
00361 {
00362         return m_cursorGrab;
00363 }
00364 
00365 inline void GHOST_Window::getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y) const
00366 {
00367         x = m_cursorGrabInitPos[0];
00368         y = m_cursorGrabInitPos[1];
00369 }
00370 
00371 inline void GHOST_Window::getCursorGrabAccum(GHOST_TInt32 &x, GHOST_TInt32 &y) const
00372 {
00373         x= m_cursorGrabAccumPos[0];
00374         y= m_cursorGrabAccumPos[1];
00375 }
00376 
00377 inline void GHOST_Window::setCursorGrabAccum(GHOST_TInt32 x, GHOST_TInt32 y)
00378 {
00379         m_cursorGrabAccumPos[0]= x;
00380         m_cursorGrabAccumPos[1]= y;
00381 }
00382 
00383 inline GHOST_TStandardCursor GHOST_Window::getCursorShape() const
00384 {
00385         return m_cursorShape;
00386 }
00387 
00388 #endif // _GHOST_WINDOW_H
00389