Blender V5.0
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
58 uint64_t interval,
59 GHOST_TimerProcPtr timer_proc,
60 GHOST_TUserDataPtr user_data = nullptr) override;
62 GHOST_TSuccess removeTimer(GHOST_ITimerTask *timerTask) override;
63
64 /***************************************************************************************
65 * Display/window management functionality
66 ***************************************************************************************/
67
70
73
75 bool validWindow(GHOST_IWindow *window) override;
76
78 bool useNativePixel() override;
80
82 void useWindowFocus(const bool use_focus) override;
83
85
87 void setAutoFocus(const bool auto_focus) override;
89
92
93 /***************************************************************************************
94 * Event management functionality
95 ***************************************************************************************/
96
104
106 void dispatchEvents() override;
111
112 /***************************************************************************************
113 * Cursor management functionality
114 ***************************************************************************************/
115
116 /* Client relative functions use a default implementation
117 * that converts from screen-coordinates to client coordinates.
118 * Implementations may override. */
119
122 int32_t &x,
123 int32_t &y) const override;
126 int32_t x,
127 int32_t y) override;
128
130 uint32_t getCursorPreferredLogicalSize() const override;
131
139
140 /***************************************************************************************
141 * Access to mouse button and keyboard states.
142 ***************************************************************************************/
143
145 GHOST_TSuccess getModifierKeyState(GHOST_TModifierKey mask, bool &is_down) const override;
146
148 GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &is_down) const override;
149
151 void setMultitouchGestures(const bool use) override;
152
154 void setTabletAPI(GHOST_TTabletAPI api) override;
156
158 GHOST_TSuccess getPixelAtCursor(float r_color[3]) const override;
159
160#ifdef WITH_INPUT_NDOF
161 /***************************************************************************************
162 * Access to 3D mouse.
163 ***************************************************************************************/
164
166 void setNDOFDeadZone(float deadzone) override;
167#endif
168
169 /***************************************************************************************
170 * Access to the Clipboard
171 ***************************************************************************************/
172
174 char *getClipboard(bool selection) const override = 0;
176 void putClipboard(const char *buffer, bool selection) const override = 0;
178 GHOST_TSuccess hasClipboardImage() const override;
180 uint *getClipboardImage(int *r_width, int *r_height) const override;
182 GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const override;
183
185 GHOST_TSuccess showMessageBox(const char * /*title*/,
186 const char * /*message*/,
187 const char * /*help_label*/,
188 const char * /*continue_label*/,
189 const char * /*link*/,
190 GHOST_DialogOptions /*dialog_options*/) const override
191 {
192 return GHOST_kFailure;
193 };
194
195 /***************************************************************************************
196 * Other (internal) functionality.
197 ***************************************************************************************/
198
206
210 inline GHOST_TimerManager *getTimerManager() const;
211
215 inline GHOST_EventManager *getEventManager() const;
216
221
222#ifdef WITH_INPUT_NDOF
226 inline GHOST_NDOFManager *getNDOFManager() const;
227#endif
228
235
241 virtual GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const = 0;
242
243 /***************************************************************************************
244 * Debugging
245 ***************************************************************************************/
246
248 void initDebug(GHOST_Debug debug) override;
249
251 bool isDebugEnabled() override;
252
253 protected:
255 GHOST_TSuccess init() override;
257 GHOST_TSuccess exit() override;
258
261
264
267
268#ifdef WITH_INPUT_NDOF
270 GHOST_NDOFManager *ndof_manager_;
271#endif
272
273#ifdef WITH_GHOST_DEBUG
275 GHOST_EventPrinter *event_printer_;
276#endif // WITH_GHOST_DEBUG
277
280
283
285};
286
291
296
301
302#ifdef WITH_INPUT_NDOF
303inline GHOST_NDOFManager *GHOST_System::getNDOFManager() const
304{
305 return ndof_manager_;
306}
307#endif
unsigned int uint
#define pushEvent
void * GHOST_TUserDataPtr
Definition GHOST_Types.h:55
void(* GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, uint64_t time)
GHOST_TModifierKey
GHOST_TSuccess
Definition GHOST_Types.h:57
@ GHOST_kFailure
Definition GHOST_Types.h:57
GHOST_TButton
GHOST_TTabletAPI
GHOST_DialogOptions
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
GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &is_down) const override
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_TimerManager * timer_manager_
GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer *consumer) override
GHOST_ITimerTask * installTimer(uint64_t delay, uint64_t interval, GHOST_TimerProcPtr timer_proc, GHOST_TUserDataPtr user_data=nullptr) override
GHOST_IContext * createOffscreenContext(GHOST_GPUSettings gpu_settings) override=0
GHOST_WindowManager * window_manager_
char * getClipboard(bool selection) const override=0
uint32_t getCursorPreferredLogicalSize() const override
GHOST_TSuccess init() override
GHOST_TimerManager * getTimerManager() const
GHOST_TTabletAPI tablet_api_
void putClipboard(const char *buffer, bool selection) const override=0
GHOST_TSuccess getModifierKeyState(GHOST_TModifierKey mask, bool &is_down) const 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
bool useNativePixel() override
bool multitouch_gestures_
GHOST_IWindow * getWindowUnderCursor(int32_t x, int32_t y) override
virtual GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const =0
GHOST_TSuccess exit() override
GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const override
GHOST_EventManager * event_manager_
void dispatchEvents() override
bool isDebugEnabled() override
GHOST_TSuccess setCursorPositionClientRelative(GHOST_IWindow *window, int32_t x, int32_t y) override
void setAutoFocus(const bool auto_focus) override
ccl_device_inline float2 mask(const MaskType mask, const float2 a)