Blender  V3.3
GHOST_System.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
9 #pragma once
10 
11 #include "GHOST_ISystem.h"
12 
13 #include "GHOST_Buttons.h"
14 #include "GHOST_Debug.h"
15 #include "GHOST_EventManager.h"
16 #include "GHOST_ModifierKeys.h"
17 #ifdef WITH_GHOST_DEBUG
18 # include "GHOST_EventPrinter.h"
19 #endif // WITH_GHOST_DEBUG
20 
22 class GHOST_Event;
23 class GHOST_TimerManager;
24 class GHOST_Window;
26 #ifdef WITH_INPUT_NDOF
27 class GHOST_NDOFManager;
28 #endif
29 
37 class GHOST_System : public GHOST_ISystem {
38  protected:
43  GHOST_System();
44 
49  virtual ~GHOST_System();
50 
51  public:
52  /***************************************************************************************
53  * Time(r) functionality
54  ***************************************************************************************/
55 
62  virtual uint64_t getMilliSeconds() const;
63 
77  uint64_t interval,
78  GHOST_TimerProcPtr timerProc,
79  GHOST_TUserDataPtr userData = NULL);
80 
87 
88  /***************************************************************************************
89  * Display/window management functionality
90  ***************************************************************************************/
91 
98 
105 
111  bool validWindow(GHOST_IWindow *window);
112 
122  GHOST_IWindow **window,
123  const bool stereoVisual,
124  const bool alphaBackground);
125 
134 
140 
145  bool getFullScreen(void);
146 
151  bool useNativePixel(void);
153 
154  bool supportsCursorWarp(void);
155  bool supportsWindowPosition(void);
156 
160  void useWindowFocus(const bool use_focus);
161 
163 
171 
172  /***************************************************************************************
173  * Event management functionality
174  ***************************************************************************************/
175 
186  void dispatchEvents();
187 
194 
201 
202  /***************************************************************************************
203  * Cursor management functionality
204  ***************************************************************************************/
205 
206  /* Client relative functions use a default implementation
207  * that converts from screen-coordinates to client coordinates.
208  * Implementations may override. */
209 
211  int32_t &x,
212  int32_t &y) const;
214 
223  /***************************************************************************************
224  * Access to mouse button and keyboard states.
225  ***************************************************************************************/
226 
234 
241  GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &isDown) const;
242 
247  void setMultitouchGestures(const bool use);
248 
253  virtual void setTabletAPI(GHOST_TTabletAPI api);
255 
256 #ifdef WITH_INPUT_NDOF
257  /***************************************************************************************
258  * Access to 3D mouse.
259  ***************************************************************************************/
260 
265  void setNDOFDeadZone(float deadzone);
266 #endif
267 
268  /***************************************************************************************
269  * Other (internal) functionality.
270  ***************************************************************************************/
271 
279 
283  inline GHOST_TimerManager *getTimerManager() const;
284 
288  inline GHOST_EventManager *getEventManager() const;
289 
293  inline GHOST_WindowManager *getWindowManager() const;
294 
295 #ifdef WITH_INPUT_NDOF
299  inline GHOST_NDOFManager *getNDOFManager() const;
300 #endif
301 
308 
314  virtual GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const = 0;
315 
322  virtual char *getClipboard(bool selection) const = 0;
323 
329  virtual void putClipboard(const char *buffer, bool selection) const = 0;
330 
340  virtual GHOST_TSuccess showMessageBox(const char * /*title*/,
341  const char * /*message*/,
342  const char * /*help_label*/,
343  const char * /*continue_label*/,
344  const char * /*link*/,
345  GHOST_DialogOptions /*dialog_options*/) const
346  {
347  return GHOST_kFailure;
348  };
349 
350  /***************************************************************************************
351  * Debugging
352  ***************************************************************************************/
353 
358  virtual void initDebug(GHOST_Debug debug);
359 
363  virtual bool isDebugEnabled();
364 
365  protected:
370  virtual GHOST_TSuccess init();
371 
376  virtual GHOST_TSuccess exit();
377 
384  const GHOST_DisplaySetting &settings,
385  const bool stereoVisual,
386  const bool alphaBackground = 0);
387 
390 
393 
396 
399 
400 #ifdef WITH_INPUT_NDOF
402  GHOST_NDOFManager *m_ndofManager;
403 #endif
404 
406 #ifdef WITH_GHOST_DEBUG
407  GHOST_EventPrinter *m_eventPrinter;
408 #endif // WITH_GHOST_DEBUG
409 
412 
413  /* Use multitouch gestures? */
415 
418 
420 };
421 
423 {
424  return m_timerManager;
425 }
426 
428 {
429  return m_eventManager;
430 }
431 
433 {
434  return m_windowManager;
435 }
436 
437 #ifdef WITH_INPUT_NDOF
438 inline GHOST_NDOFManager *GHOST_System::getNDOFManager() const
439 {
440  return m_ndofManager;
441 }
442 #endif
void * GHOST_TUserDataPtr
Definition: GHOST_Types.h:72
void(* GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, uint64_t time)
Definition: GHOST_Types.h:614
GHOST_TModifierKey
Definition: GHOST_Types.h:118
GHOST_TSuccess
Definition: GHOST_Types.h:74
@ GHOST_kFailure
Definition: GHOST_Types.h:74
GHOST_TButton
Definition: GHOST_Types.h:156
GHOST_TTabletAPI
Definition: GHOST_Types.h:89
GHOST_DialogOptions
Definition: GHOST_Types.h:67
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
virtual uint64_t getMilliSeconds() const
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:427
GHOST_DisplaySetting m_preFullScreenSetting
Definition: GHOST_System.h:411
virtual void putClipboard(const char *buffer, bool selection) const =0
void useWindowFocus(const bool use_focus)
GHOST_WindowManager * getWindowManager() const
Definition: GHOST_System.h:432
GHOST_TSuccess removeTimer(GHOST_ITimerTask *timerTask)
GHOST_TTabletAPI getTabletAPI(void)
GHOST_TSuccess endFullScreen(void)
virtual bool isDebugEnabled()
virtual ~GHOST_System()
virtual GHOST_TSuccess exit()
virtual GHOST_IContext * createOffscreenContext(GHOST_GLSettings glSettings)=0
bool m_multitouchGestures
Definition: GHOST_System.h:414
virtual GHOST_TSuccess init()
virtual void setTabletAPI(GHOST_TTabletAPI api)
GHOST_TimerManager * getTimerManager() const
Definition: GHOST_System.h:422
virtual char * getClipboard(bool selection) const =0
bool supportsWindowPosition(void)
bool m_windowFocus
Definition: GHOST_System.h:162
GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &isDown) const
GHOST_TSuccess getModifierKeyState(GHOST_TModifierKey mask, bool &isDown) const
GHOST_TSuccess disposeWindow(GHOST_IWindow *window)
bool useNativePixel(void)
GHOST_IWindow * getWindowUnderCursor(int32_t x, int32_t y)
void setMultitouchGestures(const bool use)
GHOST_WindowManager * m_windowManager
Definition: GHOST_System.h:395
virtual void initDebug(GHOST_Debug debug)
GHOST_TSuccess getCursorPositionClientRelative(const GHOST_IWindow *window, int32_t &x, int32_t &y) const
void dispatchEvents()
bool validWindow(GHOST_IWindow *window)
GHOST_ITimerTask * installTimer(uint64_t delay, uint64_t interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData=NULL)
GHOST_TSuccess pushEvent(GHOST_IEvent *event)
GHOST_TimerManager * m_timerManager
Definition: GHOST_System.h:392
GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer *consumer)
GHOST_TSuccess setCursorPositionClientRelative(GHOST_IWindow *window, int32_t x, int32_t y)
GHOST_DisplayManager * m_displayManager
Definition: GHOST_System.h:389
bool m_nativePixel
Definition: GHOST_System.h:152
bool supportsCursorWarp(void)
GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting &setting, GHOST_IWindow **window, const bool stereoVisual, const bool alphaBackground)
GHOST_TTabletAPI m_tabletAPI
Definition: GHOST_System.h:417
bool m_is_debug_enabled
Definition: GHOST_System.h:419
GHOST_EventManager * m_eventManager
Definition: GHOST_System.h:398
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:340
GHOST_TSuccess updateFullScreen(const GHOST_DisplaySetting &setting, GHOST_IWindow **window)
bool getFullScreen(void)
GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer *consumer)
ccl_global float * buffer
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
signed int int32_t
Definition: stdint.h:77
unsigned __int64 uint64_t
Definition: stdint.h:90