Blender V2.61 - r43446

GHOST_Window.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_H_
00034 #define _GHOST_WINDOW_H_
00035 
00036 #include "GHOST_IWindow.h"
00037 
00038 class STR_String;
00039 
00049 class GHOST_Window : public GHOST_IWindow
00050 {
00051 public:
00085     GHOST_Window(
00086         GHOST_TUns32 width,
00087         GHOST_TUns32 height,
00088         GHOST_TWindowState state,
00089         GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
00090         const bool stereoVisual = false,
00091         const GHOST_TUns16 numOfAASamples = 0);
00092 
00118     virtual ~GHOST_Window();
00119 
00124     virtual void* getOSWindow() const;
00125     
00130     inline virtual GHOST_TStandardCursor getCursorShape() const;
00131 
00137     virtual GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursorShape);
00138 
00147     virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2], 
00148                                                 GHOST_TUns8 mask[16][2], 
00149                                                 int hotX, 
00150                                                 int hotY);
00151                                                 
00152     virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap, 
00153                                                 GHOST_TUns8 *mask, 
00154                                                 int sizex, int sizey,
00155                                                 int hotX,  int hotY,
00156                                                 int fg_color, int bg_color);
00157     
00162     inline virtual bool getCursorVisibility() const;
00163     inline virtual GHOST_TGrabCursorMode getCursorGrabMode() const;
00164     inline virtual void getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
00165     inline virtual void getCursorGrabAccum(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
00166     inline virtual void setCursorGrabAccum(GHOST_TInt32 x, GHOST_TInt32 y);
00167 
00173     virtual GHOST_TSuccess setCursorVisibility(bool visible);
00174 
00180     virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rect *bounds);
00181 
00186     virtual GHOST_TSuccess getCursorGrabBounds(GHOST_Rect& bounds);
00187 
00192     virtual GHOST_TSuccess setProgressBar(float progress) {return GHOST_kFailure;};
00193     
00197     virtual GHOST_TSuccess endProgressBar() {return GHOST_kFailure;};
00198     
00202     virtual void setAcceptDragOperation(bool canAccept);
00203     
00208     virtual bool canAcceptDragOperation() const;
00209     
00215     virtual GHOST_TSuccess setModifiedState(bool isUnsavedChanges);
00216     
00221     virtual bool getModifiedState();
00222     
00227     inline virtual GHOST_TDrawingContextType getDrawingContextType();
00228 
00236     virtual GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type);
00237 
00242     inline virtual GHOST_TUserDataPtr getUserData() const
00243     {
00244         return m_userData;
00245     }
00246     
00251     virtual void setUserData(const GHOST_TUserDataPtr userData)
00252     {
00253         m_userData = userData;
00254     }
00255 
00256 protected:
00262     virtual GHOST_TSuccess installDrawingContext(GHOST_TDrawingContextType type) = 0;
00263 
00268     virtual GHOST_TSuccess removeDrawingContext() = 0;
00269 
00274     virtual GHOST_TSuccess setWindowCursorVisibility(bool visible) = 0;
00275 
00280     virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) { return GHOST_kSuccess; };
00281     
00286     virtual GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape) = 0;
00287 
00292     virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
00293                                                       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