Blender V5.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
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
94
95 /***************************************************************************************
96 * Event management functionality
97 ***************************************************************************************/
98
106
108 void dispatchEvents() override;
113
114 /***************************************************************************************
115 * Cursor management functionality
116 ***************************************************************************************/
117
118 /* Client relative functions use a default implementation
119 * that converts from screen-coordinates to client coordinates.
120 * Implementations may override. */
121
124 int32_t &x,
125 int32_t &y) const override;
128 int32_t x,
129 int32_t y) override;
130
132 uint32_t getCursorPreferredLogicalSize() const override;
133
141
142 /***************************************************************************************
143 * Access to mouse button and keyboard states.
144 ***************************************************************************************/
145
147 GHOST_TSuccess getModifierKeyState(GHOST_TModifierKey mask, bool &is_down) const override;
148
150 GHOST_TSuccess getButtonState(GHOST_TButton mask, bool &is_down) const override;
151
153 void setMultitouchGestures(const bool use) override;
154
156 void setTabletAPI(GHOST_TTabletAPI api) override;
158
160 GHOST_TSuccess getPixelAtCursor(float r_color[3]) const override;
161
162#ifdef WITH_INPUT_NDOF
163 /***************************************************************************************
164 * Access to 3D mouse.
165 ***************************************************************************************/
166
168 void setNDOFDeadZone(float deadzone) override;
169#endif
170
171 /***************************************************************************************
172 * Access to the Clipboard
173 ***************************************************************************************/
174
176 char *getClipboard(bool selection) const override = 0;
178 void putClipboard(const char *buffer, bool selection) const override = 0;
180 GHOST_TSuccess hasClipboardImage() const override;
182 uint *getClipboardImage(int *r_width, int *r_height) const override;
184 GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const override;
185
186 /***************************************************************************************
187 * Window "Client Side Decorations" (CSD)
188 ***************************************************************************************/
189
190 void setWindowCSD(const GHOST_CSD_Params &params) override;
191 const GHOST_CSD_Params &getWindowCSD() const;
192 void setWindowCSD_Layout(const GHOST_CSD_Layout &csd_layout);
193 const GHOST_CSD_Layout &getWindowCSD_Layout() const override;
194
195 /***************************************************************************************
196 * Window Icon Generator.
197 ***************************************************************************************/
198
200 void setIconGenerator(const GHOST_IconGenerator *icon_generator) override;
202
204 GHOST_TSuccess showMessageBox(const char * /*title*/,
205 const char * /*message*/,
206 const char * /*help_label*/,
207 const char * /*continue_label*/,
208 const char * /*link*/,
209 GHOST_DialogOptions /*dialog_options*/) const override
210 {
211 return GHOST_kFailure;
212 };
213
214 /***************************************************************************************
215 * Other (internal) functionality.
216 ***************************************************************************************/
217
224 GHOST_TSuccess pushEvent(std::unique_ptr<const GHOST_IEvent> event);
225
229 inline GHOST_TimerManager *getTimerManager() const;
230
234 inline GHOST_EventManager *getEventManager() const;
235
240
241#ifdef WITH_INPUT_NDOF
245 inline GHOST_NDOFManager *getNDOFManager() const;
246#endif
247
254
260 virtual GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const = 0;
261
262 /***************************************************************************************
263 * Debugging
264 ***************************************************************************************/
265
267 void initDebug(GHOST_Debug debug) override;
268
270 bool isDebugEnabled() override;
271
272 protected:
274 GHOST_TSuccess init() override;
276 GHOST_TSuccess exit() override;
277
280
283
286
287#ifdef WITH_INPUT_NDOF
289 GHOST_NDOFManager *ndof_manager_;
290#endif
291
292#ifdef WITH_GHOST_DEBUG
294 GHOST_EventPrinter *event_printer_;
295#endif // WITH_GHOST_DEBUG
296
299
302
304};
305
310
315
320
321#ifdef WITH_INPUT_NDOF
322inline GHOST_NDOFManager *GHOST_System::getNDOFManager() const
323{
324 return ndof_manager_;
325}
326#endif
#define pushEvent
void * GHOST_TUserDataPtr
GHOST_TModifierKey
GHOST_TSuccess
@ GHOST_kFailure
GHOST_TButton
void(*)(GHOST_ITimerTask *task, uint64_t time) GHOST_TimerProcPtr
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
void setWindowCSD(const GHOST_CSD_Params &params) 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
void setIconGenerator(const GHOST_IconGenerator *icon_generator) override
uint * getClipboardImage(int *r_width, int *r_height) const override
GHOST_TTabletAPI getTabletAPI()
GHOST_EventManager * getEventManager() const
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
const GHOST_CSD_Params & getWindowCSD() const
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
const GHOST_CSD_Layout & getWindowCSD_Layout() 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
GHOST_CSD_Layout window_csd_layout_
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
const GHOST_IconGenerator * icon_generator_
GHOST_CSD_Params window_csd_params_
bool isDebugEnabled() override
GHOST_TSuccess setCursorPositionClientRelative(GHOST_IWindow *window, int32_t x, int32_t y) override
void setWindowCSD_Layout(const GHOST_CSD_Layout &csd_layout)
void setAutoFocus(const bool auto_focus) override
ccl_device_inline float2 mask(const MaskType mask, const float2 a)