Blender V2.61 - r43446

GHOST_System.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_SYSTEM_H_
00034 #define _GHOST_SYSTEM_H_
00035 
00036 #include "GHOST_ISystem.h"
00037 
00038 #include "GHOST_Debug.h"
00039 #include "GHOST_Buttons.h"
00040 #include "GHOST_ModifierKeys.h"
00041 #include "GHOST_EventManager.h"
00042 #ifdef GHOST_DEBUG
00043 #include "GHOST_EventPrinter.h"
00044 #endif // GHOST_DEBUG
00045 
00046 class GHOST_DisplayManager;
00047 class GHOST_Event;
00048 class GHOST_TimerManager;
00049 class GHOST_Window;
00050 class GHOST_WindowManager;
00051 class GHOST_NDOFManager;
00052 
00062 class GHOST_System : public GHOST_ISystem
00063 {
00064 protected:
00069     GHOST_System();
00070 
00075     virtual ~GHOST_System();
00076 
00077 public:
00078     /***************************************************************************************
00079      ** Time(r) functionality
00080      ***************************************************************************************/
00081 
00088     virtual GHOST_TUns64 getMilliSeconds() const;
00089 
00100     virtual GHOST_ITimerTask* installTimer(GHOST_TUns64 delay,
00101                                            GHOST_TUns64 interval,
00102                                            GHOST_TimerProcPtr timerProc,
00103                                            GHOST_TUserDataPtr userData = 0);
00104 
00110     virtual GHOST_TSuccess removeTimer(GHOST_ITimerTask* timerTask);
00111 
00112     /***************************************************************************************
00113      ** Display/window management functionality
00114      ***************************************************************************************/
00115     
00129     virtual GHOST_TSuccess disposeWindow(GHOST_IWindow* window);
00130 
00136     virtual bool validWindow(GHOST_IWindow* window);
00137 
00146     virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window,
00147         const bool stereoVisual, const GHOST_TUns16 numOfAASamples=0);
00148 
00153     virtual GHOST_TSuccess endFullScreen(void);
00154 
00159     virtual bool getFullScreen(void);
00160 
00161 
00162     /***************************************************************************************
00163      ** Event management functionality
00164      ***************************************************************************************/
00165 
00179     virtual bool dispatchEvents();
00180 
00186     virtual GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer* consumer);
00187 
00193     virtual GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer* consumer);
00194 
00195     /***************************************************************************************
00196      ** Cursor management functionality
00197      ***************************************************************************************/
00198 
00204     /***************************************************************************************
00205      ** Access to mouse button and keyboard states.
00206      ***************************************************************************************/
00207 
00214     virtual GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool& isDown) const;
00215 
00222     virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const;
00223     
00224     /***************************************************************************************
00225      ** Other (internal) functionality.
00226      ***************************************************************************************/
00227 
00234     virtual GHOST_TSuccess pushEvent(GHOST_IEvent* event);
00235 
00240     inline virtual GHOST_TimerManager* getTimerManager() const;
00241 
00246     virtual inline GHOST_EventManager* getEventManager() const;
00247 
00252     virtual inline GHOST_WindowManager* getWindowManager() const;
00253 
00254 #ifdef WITH_INPUT_NDOF
00255 
00259     virtual inline GHOST_NDOFManager* getNDOFManager() const;
00260 #endif
00261 
00267     virtual GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys& keys) const = 0;
00268 
00274     virtual GHOST_TSuccess getButtons(GHOST_Buttons& buttons) const = 0;
00275 
00282     virtual GHOST_TUns8* getClipboard(bool selection) const = 0;
00283       
00289       virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
00290 
00291     
00292 protected:
00297     virtual GHOST_TSuccess init();
00298 
00303     virtual GHOST_TSuccess exit();
00304 
00310     virtual GHOST_TSuccess createFullScreenWindow(GHOST_Window** window,
00311         const bool stereoVisual, const GHOST_TUns16 numOfAASamples=0);
00312 
00314     GHOST_DisplayManager* m_displayManager;
00315 
00317     GHOST_TimerManager* m_timerManager;
00318 
00320     GHOST_WindowManager* m_windowManager;
00321 
00323     GHOST_EventManager* m_eventManager;
00324 
00325 #ifdef WITH_INPUT_NDOF
00326 
00327     GHOST_NDOFManager* m_ndofManager;
00328 #endif
00329     
00331 #ifdef GHOST_DEBUG
00332     GHOST_EventPrinter* m_eventPrinter;
00333 #endif // GHOST_DEBUG
00334 
00336     GHOST_DisplaySetting m_preFullScreenSetting;
00337 };
00338 
00339 inline GHOST_TimerManager* GHOST_System::getTimerManager() const
00340 {
00341     return m_timerManager;
00342 }
00343 
00344 inline GHOST_EventManager* GHOST_System::getEventManager() const
00345 {
00346     return m_eventManager;
00347 }
00348 
00349 inline GHOST_WindowManager* GHOST_System::getWindowManager() const
00350 {
00351     return m_windowManager;
00352 }
00353 
00354 #ifdef WITH_INPUT_NDOF
00355 inline GHOST_NDOFManager* GHOST_System::getNDOFManager() const
00356 {
00357     return m_ndofManager;
00358 }
00359 #endif
00360 
00361 #endif // _GHOST_SYSTEM_H_
00362