Blender  V2.93
GHOST_System.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
25 #pragma once
26 
27 #include "GHOST_ISystem.h"
28 
29 #include "GHOST_Buttons.h"
30 #include "GHOST_Debug.h"
31 #include "GHOST_EventManager.h"
32 #include "GHOST_ModifierKeys.h"
33 #ifdef WITH_GHOST_DEBUG
34 # include "GHOST_EventPrinter.h"
35 #endif // WITH_GHOST_DEBUG
36 
38 class GHOST_Event;
39 class GHOST_TimerManager;
40 class GHOST_Window;
42 #ifdef WITH_INPUT_NDOF
43 class GHOST_NDOFManager;
44 #endif
45 
53 class GHOST_System : public GHOST_ISystem {
54  protected:
59  GHOST_System();
60 
65  virtual ~GHOST_System();
66 
67  public:
68  /***************************************************************************************
69  * Time(r) functionality
70  ***************************************************************************************/
71 
78  virtual GHOST_TUns64 getMilliSeconds() const;
79 
93  GHOST_TUns64 interval,
94  GHOST_TimerProcPtr timerProc,
95  GHOST_TUserDataPtr userData = NULL);
96 
103 
104  /***************************************************************************************
105  * Display/window management functionality
106  ***************************************************************************************/
107 
114 
121 
127  bool validWindow(GHOST_IWindow *window);
128 
138  GHOST_IWindow **window,
139  const bool stereoVisual,
140  const bool alphaBackground);
141 
150 
156 
161  bool getFullScreen(void);
162 
167  bool useNativePixel(void);
169 
173  void useWindowFocus(const bool use_focus);
175 
176  /***************************************************************************************
177  * Event management functionality
178  ***************************************************************************************/
179 
190  void dispatchEvents();
191 
198 
205 
206  /***************************************************************************************
207  * Cursor management functionality
208  ***************************************************************************************/
209 
218  /***************************************************************************************
219  * Access to mouse button and keyboard states.
220  ***************************************************************************************/
221 
229 
237 
242  void setTabletAPI(GHOST_TTabletAPI api);
244 
245 #ifdef WITH_INPUT_NDOF
246  /***************************************************************************************
247  * Access to 3D mouse.
248  ***************************************************************************************/
249 
254  void setNDOFDeadZone(float deadzone);
255 #endif
256 
257  /***************************************************************************************
258  * Other (internal) functionality.
259  ***************************************************************************************/
260 
268 
272  inline GHOST_TimerManager *getTimerManager() const;
273 
277  inline GHOST_EventManager *getEventManager() const;
278 
282  inline GHOST_WindowManager *getWindowManager() const;
283 
284 #ifdef WITH_INPUT_NDOF
288  inline GHOST_NDOFManager *getNDOFManager() const;
289 #endif
290 
297 
303  virtual GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const = 0;
304 
311  virtual GHOST_TUns8 *getClipboard(bool selection) const = 0;
312 
318  virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
319 
329  virtual GHOST_TSuccess showMessageBox(const char * /*title*/,
330  const char * /*message*/,
331  const char * /*help_label */,
332  const char * /*continue_label */,
333  const char * /*link*/,
334  GHOST_DialogOptions /*dialog_options*/) const
335  {
336  return GHOST_kFailure;
337  };
338 
339  /***************************************************************************************
340  * Debugging
341  ***************************************************************************************/
342 
346  virtual void initDebug(bool is_debug_enabled);
347 
351  virtual bool isDebugEnabled();
352 
353  protected:
358  virtual GHOST_TSuccess init();
359 
364  virtual GHOST_TSuccess exit();
365 
372  const GHOST_DisplaySetting &settings,
373  const bool stereoVisual,
374  const bool alphaBackground = 0);
375 
378 
381 
384 
387 
388 #ifdef WITH_INPUT_NDOF
390  GHOST_NDOFManager *m_ndofManager;
391 #endif
392 
394 #ifdef WITH_GHOST_DEBUG
395  GHOST_EventPrinter *m_eventPrinter;
396 #endif // WITH_GHOST_DEBUG
397 
400 
403 
405 };
406 
408 {
409  return m_timerManager;
410 }
411 
413 {
414  return m_eventManager;
415 }
416 
418 {
419  return m_windowManager;
420 }
421 
422 #ifdef WITH_INPUT_NDOF
423 inline GHOST_NDOFManager *GHOST_System::getNDOFManager() const
424 {
425  return m_ndofManager;
426 }
427 #endif
void * GHOST_TUserDataPtr
Definition: GHOST_Types.h:89
unsigned long long GHOST_TUns64
Definition: GHOST_Types.h:86
void(* GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, GHOST_TUns64 time)
Definition: GHOST_Types.h:608
GHOST_TButtonMask
Definition: GHOST_Types.h:164
char GHOST_TInt8
Definition: GHOST_Types.h:59
GHOST_TSuccess
Definition: GHOST_Types.h:91
@ GHOST_kFailure
Definition: GHOST_Types.h:91
GHOST_TModifierKeyMask
Definition: GHOST_Types.h:133
unsigned char GHOST_TUns8
Definition: GHOST_Types.h:60
GHOST_TTabletAPI
Definition: GHOST_Types.h:106
GHOST_DialogOptions
Definition: GHOST_Types.h:76
GHOST_TSuccess createFullScreenWindow(GHOST_Window **window, const GHOST_DisplaySetting &settings, const bool stereoVisual, const bool alphaBackground=0)
virtual GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const =0
GHOST_EventManager * getEventManager() const
Definition: GHOST_System.h:412
GHOST_DisplaySetting m_preFullScreenSetting
Definition: GHOST_System.h:399
void useWindowFocus(const bool use_focus)
GHOST_WindowManager * getWindowManager() const
Definition: GHOST_System.h:417
GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool &isDown) const
GHOST_TSuccess removeTimer(GHOST_ITimerTask *timerTask)
GHOST_TTabletAPI getTabletAPI(void)
GHOST_TSuccess endFullScreen(void)
virtual bool isDebugEnabled()
virtual ~GHOST_System()
virtual GHOST_TSuccess exit()
GHOST_ITimerTask * installTimer(GHOST_TUns64 delay, GHOST_TUns64 interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData=NULL)
virtual GHOST_IContext * createOffscreenContext(GHOST_GLSettings glSettings)=0
virtual GHOST_TSuccess init()
void setTabletAPI(GHOST_TTabletAPI api)
GHOST_TimerManager * getTimerManager() const
Definition: GHOST_System.h:407
virtual GHOST_TUns8 * getClipboard(bool selection) const =0
bool m_windowFocus
Definition: GHOST_System.h:174
virtual void initDebug(bool is_debug_enabled)
GHOST_TSuccess disposeWindow(GHOST_IWindow *window)
bool useNativePixel(void)
GHOST_WindowManager * m_windowManager
Definition: GHOST_System.h:383
GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const
void dispatchEvents()
bool validWindow(GHOST_IWindow *window)
GHOST_TSuccess pushEvent(GHOST_IEvent *event)
GHOST_TimerManager * m_timerManager
Definition: GHOST_System.h:380
GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer *consumer)
GHOST_DisplayManager * m_displayManager
Definition: GHOST_System.h:377
bool m_nativePixel
Definition: GHOST_System.h:168
GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting &setting, GHOST_IWindow **window, const bool stereoVisual, const bool alphaBackground)
GHOST_TTabletAPI m_tabletAPI
Definition: GHOST_System.h:402
bool m_is_debug_enabled
Definition: GHOST_System.h:404
GHOST_EventManager * m_eventManager
Definition: GHOST_System.h:386
virtual GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const =0
virtual GHOST_TSuccess showMessageBox(const char *, const char *, const char *, const char *, const char *, GHOST_DialogOptions) const
Definition: GHOST_System.h:329
virtual GHOST_TUns64 getMilliSeconds() const
GHOST_TSuccess updateFullScreen(const GHOST_DisplaySetting &setting, GHOST_IWindow **window)
bool getFullScreen(void)
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const =0
GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer *consumer)
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)