Blender V4.3
GHOST_System.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10#pragma once
11
12#include "GHOST_ISystem.hh"
13
14#include "GHOST_Buttons.hh"
15#include "GHOST_Debug.hh"
16#include "GHOST_EventManager.hh"
17#include "GHOST_ModifierKeys.hh"
18#ifdef WITH_GHOST_DEBUG
19# include "GHOST_EventPrinter.hh"
20#endif // WITH_GHOST_DEBUG
21
23class GHOST_Event;
25class GHOST_Window;
27#ifdef WITH_INPUT_NDOF
29#endif
30
39 protected:
45
50 virtual ~GHOST_System();
51
52 public:
53 /***************************************************************************************
54 * Time(r) functionality
55 ***************************************************************************************/
56
70 uint64_t interval,
71 GHOST_TimerProcPtr timerProc,
72 GHOST_TUserDataPtr userData = nullptr);
73
80
81 /***************************************************************************************
82 * Display/window management functionality
83 ***************************************************************************************/
84
91
98
104 bool validWindow(GHOST_IWindow *window);
105
115 GHOST_IWindow **window,
116 const bool stereoVisual);
117
126
132
137 bool getFullScreen();
138
143 bool useNativePixel();
145
149 void useWindowFocus(const bool use_focus);
150
152
156 void setAutoFocus(const bool auto_focus);
158
166
167 /***************************************************************************************
168 * Event management functionality
169 ***************************************************************************************/
170
181 void dispatchEvents();
182
189
196
197 /***************************************************************************************
198 * Cursor management functionality
199 ***************************************************************************************/
200
201 /* Client relative functions use a default implementation
202 * that converts from screen-coordinates to client coordinates.
203 * Implementations may override. */
204
206 int32_t &x,
207 int32_t &y) const;
209
218 /***************************************************************************************
219 * Access to mouse button and keyboard states.
220 ***************************************************************************************/
221
228 GHOST_TSuccess getModifierKeyState(GHOST_TModifierKey mask, bool &isDown) const;
229
236 GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &isDown) const;
237
242 void setMultitouchGestures(const bool use);
243
248 virtual void setTabletAPI(GHOST_TTabletAPI api);
250
256 GHOST_TSuccess getPixelAtCursor(float r_color[3]) const;
257
258#ifdef WITH_INPUT_NDOF
259 /***************************************************************************************
260 * Access to 3D mouse.
261 ***************************************************************************************/
262
267 void setNDOFDeadZone(float deadzone);
268#endif
269
270 /***************************************************************************************
271 * Other (internal) functionality.
272 ***************************************************************************************/
273
281
285 inline GHOST_TimerManager *getTimerManager() const;
286
290 inline GHOST_EventManager *getEventManager() const;
291
296
297#ifdef WITH_INPUT_NDOF
301 inline GHOST_NDOFManager *getNDOFManager() const;
302#endif
303
310
316 virtual GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const = 0;
317
323 virtual char *getClipboard(bool selection) const = 0;
324
330 virtual void putClipboard(const char *buffer, bool selection) const = 0;
331
336
343 uint *getClipboardImage(int *r_width, int *r_height) const;
344
351 GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const;
352
362 virtual GHOST_TSuccess showMessageBox(const char * /*title*/,
363 const char * /*message*/,
364 const char * /*help_label*/,
365 const char * /*continue_label*/,
366 const char * /*link*/,
367 GHOST_DialogOptions /*dialog_options*/) const
368 {
369 return GHOST_kFailure;
370 };
371
372 /***************************************************************************************
373 * Debugging
374 ***************************************************************************************/
375
380 virtual void initDebug(GHOST_Debug debug);
381
385 virtual bool isDebugEnabled();
386
387 protected:
392 virtual GHOST_TSuccess init();
393
398 virtual GHOST_TSuccess exit();
399
406 const GHOST_DisplaySetting &settings,
407 const bool stereoVisual);
408
411
414
417
420
421#ifdef WITH_INPUT_NDOF
423 GHOST_NDOFManager *m_ndofManager;
424#endif
425
427#ifdef WITH_GHOST_DEBUG
428 GHOST_EventPrinter *m_eventPrinter;
429#endif // WITH_GHOST_DEBUG
430
433
434 /* Use multi-touch gestures? */
436
439
441};
442
447
452
457
458#ifdef WITH_INPUT_NDOF
459inline GHOST_NDOFManager *GHOST_System::getNDOFManager() const
460{
461 return m_ndofManager;
462}
463#endif
unsigned int uint
#define pushEvent
void * GHOST_TUserDataPtr
Definition GHOST_Types.h:85
void(* GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, uint64_t time)
GHOST_TModifierKey
GHOST_TSuccess
Definition GHOST_Types.h:87
@ GHOST_kFailure
Definition GHOST_Types.h:87
GHOST_TButton
GHOST_TTabletAPI
GHOST_DialogOptions
Definition GHOST_Types.h:80
virtual GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const =0
GHOST_TTabletAPI getTabletAPI()
GHOST_EventManager * getEventManager() const
GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const
GHOST_DisplaySetting m_preFullScreenSetting
GHOST_TSuccess hasClipboardImage() const
void setAutoFocus(const bool auto_focus)
virtual void putClipboard(const char *buffer, bool selection) const =0
void useWindowFocus(const bool use_focus)
GHOST_WindowManager * getWindowManager() const
GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting &setting, GHOST_IWindow **window, const bool stereoVisual)
GHOST_TSuccess removeTimer(GHOST_ITimerTask *timerTask)
virtual char * getClipboard(bool selection) const =0
virtual bool isDebugEnabled()
virtual ~GHOST_System()
virtual GHOST_TSuccess exit()
bool getFullScreen()
uint * getClipboardImage(int *r_width, int *r_height) const
GHOST_TSuccess getPixelAtCursor(float r_color[3]) const
bool m_multitouchGestures
virtual GHOST_TSuccess init()
virtual void setTabletAPI(GHOST_TTabletAPI api)
GHOST_TimerManager * getTimerManager() const
bool useNativePixel()
GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &isDown) const
GHOST_TSuccess getModifierKeyState(GHOST_TModifierKey mask, bool &isDown) const
GHOST_TSuccess disposeWindow(GHOST_IWindow *window)
GHOST_IWindow * getWindowUnderCursor(int32_t x, int32_t y)
void setMultitouchGestures(const bool use)
GHOST_TSuccess endFullScreen()
GHOST_WindowManager * m_windowManager
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)
virtual GHOST_IContext * createOffscreenContext(GHOST_GPUSettings gpuSettings)=0
GHOST_TimerManager * m_timerManager
GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer *consumer)
GHOST_TSuccess setCursorPositionClientRelative(GHOST_IWindow *window, int32_t x, int32_t y)
GHOST_DisplayManager * m_displayManager
GHOST_TTabletAPI m_tabletAPI
bool m_is_debug_enabled
GHOST_EventManager * m_eventManager
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
GHOST_ITimerTask * installTimer(uint64_t delay, uint64_t interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData=nullptr)
GHOST_TSuccess createFullScreenWindow(GHOST_Window **window, const GHOST_DisplaySetting &settings, const bool stereoVisual)
GHOST_TSuccess updateFullScreen(const GHOST_DisplaySetting &setting, GHOST_IWindow **window)
GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer *consumer)
signed int int32_t
Definition stdint.h:77
unsigned __int64 uint64_t
Definition stdint.h:90