Blender V4.5
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
9
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
22class GHOST_Event;
24class GHOST_Window;
26#ifdef WITH_INPUT_NDOF
28#endif
29
38 protected:
44
49 ~GHOST_System() override;
50
51 public:
52 /***************************************************************************************
53 * Time(r) functionality
54 ***************************************************************************************/
55
69 uint64_t interval,
70 GHOST_TimerProcPtr timerProc,
71 GHOST_TUserDataPtr userData = nullptr) override;
72
78 GHOST_TSuccess removeTimer(GHOST_ITimerTask *timerTask) override;
79
80 /***************************************************************************************
81 * Display/window management functionality
82 ***************************************************************************************/
83
90
97
103 bool validWindow(GHOST_IWindow *window) override;
104
109 bool useNativePixel() override;
111
115 void useWindowFocus(const bool use_focus) override;
116
118
122 void setAutoFocus(const bool auto_focus) override;
124
132
133 /***************************************************************************************
134 * Event management functionality
135 ***************************************************************************************/
136
142
147 void dispatchEvents() override;
148
155
162
163 /***************************************************************************************
164 * Cursor management functionality
165 ***************************************************************************************/
166
167 /* Client relative functions use a default implementation
168 * that converts from screen-coordinates to client coordinates.
169 * Implementations may override. */
170
172 int32_t &x,
173 int32_t &y) const override;
175 int32_t x,
176 int32_t y) override;
177
178 uint32_t getCursorPreferredLogicalSize() const override;
179
187
188 /***************************************************************************************
189 * Access to mouse button and keyboard states.
190 ***************************************************************************************/
191
198 GHOST_TSuccess getModifierKeyState(GHOST_TModifierKey mask, bool &isDown) const override;
199
206 GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &isDown) const override;
207
212 void setMultitouchGestures(const bool use) override;
213
218 void setTabletAPI(GHOST_TTabletAPI api) override;
220
226 GHOST_TSuccess getPixelAtCursor(float r_color[3]) const override;
227
228#ifdef WITH_INPUT_NDOF
229 /***************************************************************************************
230 * Access to 3D mouse.
231 ***************************************************************************************/
232
237 void setNDOFDeadZone(float deadzone) override;
238#endif
239
240 /***************************************************************************************
241 * Other (internal) functionality.
242 ***************************************************************************************/
243
251
255 inline GHOST_TimerManager *getTimerManager() const;
256
260 inline GHOST_EventManager *getEventManager() const;
261
266
267#ifdef WITH_INPUT_NDOF
271 inline GHOST_NDOFManager *getNDOFManager() const;
272#endif
273
280
286 virtual GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const = 0;
287
293 char *getClipboard(bool selection) const override = 0;
294
300 void putClipboard(const char *buffer, bool selection) const override = 0;
301
305 GHOST_TSuccess hasClipboardImage() const override;
306
313 uint *getClipboardImage(int *r_width, int *r_height) const override;
314
321 GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const override;
322
332 GHOST_TSuccess showMessageBox(const char * /*title*/,
333 const char * /*message*/,
334 const char * /*help_label*/,
335 const char * /*continue_label*/,
336 const char * /*link*/,
337 GHOST_DialogOptions /*dialog_options*/) const override
338 {
339 return GHOST_kFailure;
340 };
341
342 /***************************************************************************************
343 * Debugging
344 ***************************************************************************************/
345
350 void initDebug(GHOST_Debug debug) override;
351
355 bool isDebugEnabled() override;
356
357 protected:
362 GHOST_TSuccess init() override;
363
368 GHOST_TSuccess exit() override;
369
372
375
378
379#ifdef WITH_INPUT_NDOF
381 GHOST_NDOFManager *m_ndofManager;
382#endif
383
385#ifdef WITH_GHOST_DEBUG
386 GHOST_EventPrinter *m_eventPrinter;
387#endif // WITH_GHOST_DEBUG
388
389 /* Use multi-touch gestures? */
391
394
396};
397
402
407
412
413#ifdef WITH_INPUT_NDOF
414inline GHOST_NDOFManager *GHOST_System::getNDOFManager() const
415{
416 return m_ndofManager;
417}
418#endif
unsigned int uint
#define pushEvent
void * GHOST_TUserDataPtr
Definition GHOST_Types.h:78
void(* GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, uint64_t time)
GHOST_TModifierKey
GHOST_TSuccess
Definition GHOST_Types.h:80
@ GHOST_kFailure
Definition GHOST_Types.h:80
GHOST_TButton
GHOST_TTabletAPI
GHOST_DialogOptions
Definition GHOST_Types.h:73
unsigned long long int uint64_t
GHOST_TSuccess showMessageBox(const char *, const char *, const char *, const char *, const char *, GHOST_DialogOptions) const override
GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer *consumer) override
GHOST_TSuccess getPixelAtCursor(float r_color[3]) const override
GHOST_TSuccess removeTimer(GHOST_ITimerTask *timerTask) override
virtual GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const =0
void setMultitouchGestures(const bool use) override
uint * getClipboardImage(int *r_width, int *r_height) const override
GHOST_TTabletAPI getTabletAPI()
GHOST_EventManager * getEventManager() const
~GHOST_System() override
GHOST_WindowManager * getWindowManager() const
GHOST_TSuccess getCursorPositionClientRelative(const GHOST_IWindow *window, int32_t &x, int32_t &y) const override
GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer *consumer) override
char * getClipboard(bool selection) const override=0
uint32_t getCursorPreferredLogicalSize() const override
bool m_multitouchGestures
GHOST_TSuccess init() override
GHOST_TimerManager * getTimerManager() const
void putClipboard(const char *buffer, bool selection) const override=0
GHOST_ITimerTask * installTimer(uint64_t delay, uint64_t interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData=nullptr) override
GHOST_TSuccess disposeWindow(GHOST_IWindow *window) override
void initDebug(GHOST_Debug debug) override
bool validWindow(GHOST_IWindow *window) override
void useWindowFocus(const bool use_focus) override
GHOST_TSuccess hasClipboardImage() const override
void setTabletAPI(GHOST_TTabletAPI api) override
GHOST_WindowManager * m_windowManager
bool useNativePixel() override
GHOST_IContext * createOffscreenContext(GHOST_GPUSettings gpuSettings) override=0
GHOST_TimerManager * m_timerManager
GHOST_TTabletAPI m_tabletAPI
bool m_is_debug_enabled
GHOST_IWindow * getWindowUnderCursor(int32_t x, int32_t y) override
GHOST_EventManager * m_eventManager
virtual GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const =0
GHOST_TSuccess exit() override
GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const override
void dispatchEvents() override
bool isDebugEnabled() override
GHOST_TSuccess setCursorPositionClientRelative(GHOST_IWindow *window, int32_t x, int32_t y) override
GHOST_TSuccess getModifierKeyState(GHOST_TModifierKey mask, bool &isDown) const override
GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &isDown) const override
void setAutoFocus(const bool auto_focus) override
ccl_device_inline float2 mask(const MaskType mask, const float2 a)