Blender V5.3
GHOST_Window.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_IWindow.hh"
13
14class GHOST_Context;
15
24 public:
35 GHOST_Window(uint32_t width,
36 uint32_t height,
38 const GHOST_ContextParams &context_params,
39 const bool exclusive = false);
40
66
71 ~GHOST_Window() override;
72
74 bool getValid() const override
75 {
76 return context_ != nullptr;
77 }
78
80 void setPath(const char * /*filepath*/) override
81 {
82 /* Pass. */
83 }
84
87
90
93 GHOST_WindowDecorationStyleSettings decoration_settings) override;
94
100
102 inline GHOST_TStandardCursor getCursorShape() const override;
103
104 bool isDialog() const override
105 {
106 return false;
107 }
108
111
113 GHOST_TSuccess setCustomCursorShape(const uint8_t *bitmap,
114 const uint8_t *mask,
115 const int size[2],
116 const int hot_spot[2],
117 bool can_invert_color) override;
118
121
123
125 inline bool getCursorVisibility() const override;
127 inline bool getCursorGrabModeIsWarp() const;
128 inline GHOST_TAxisFlag getCursorGrabAxis() const;
129 inline void getCursorGrabInitPos(int32_t &x, int32_t &y) const;
130 inline void getCursorGrabAccum(int32_t &x, int32_t &y) const;
131 inline void setCursorGrabAccum(int32_t x, int32_t y);
132
134 GHOST_TSuccess setCursorVisibility(bool visible) override;
135
138 GHOST_TAxisFlag wrap_axis,
140 int32_t mouse_ungrab_xy[2]) override;
141
143 GHOST_TAxisFlag &wrap_axis,
145 bool &use_software_cursor) override;
146
148 GHOST_TSuccess setProgressBar(float /*progress*/) override
149 {
150 return GHOST_kFailure;
151 }
152
155 {
156 return GHOST_kFailure;
157 }
158
160 GHOST_TSuccess setSwapInterval(int interval) override;
162 GHOST_TSuccess getSwapInterval(int &interval_out) override;
163
165 void setAcceptDragOperation(bool can_accept) override;
166
168 GHOST_TSuccess setModifiedState(bool is_unsaved_changes) override;
169
172
180
183
188
191
198
204
206 bool hasAlpha() const override;
207
209 unsigned int getDefaultFramebuffer() override;
210
211#ifdef WITH_VULKAN_BACKEND
213 virtual GHOST_TSuccess getVulkanSwapChainFormat(
214 GHOST_VulkanSwapChainData *r_swap_chain_data) override;
215#endif
216
219 {
220 return user_data_;
221 }
222
224 void setUserData(const GHOST_TUserDataPtr user_data) override
225 {
226 user_data_ = user_data;
227 }
228
230 float getNativePixelSize() override
231 {
232 if (native_pixel_size_ > 0.0f) {
233 return native_pixel_size_;
234 }
235 return 1.0f;
236 }
237
239 uint16_t getDPIHint() override
240 {
241 return 96;
242 }
243
246 {
247 return hdr_info_;
248 }
249
250#ifdef WITH_INPUT_IME
251 void beginIME(
252 int32_t /*x*/, int32_t /*y*/, int32_t /*w*/, int32_t /*h*/, bool /*completed*/) override
253 {
254 /* do nothing temporarily if not in windows */
255 }
256
257 void endIME() override
258 {
259 /* do nothing temporarily if not in windows */
260 }
261#endif /* WITH_INPUT_IME */
262
267 virtual void *getOSWindow() const;
268
273 virtual bool canAcceptDragOperation() const;
274
279 virtual GHOST_TSuccess getCursorGrabBounds(GHOST_Rect &bounds) const;
280
281 protected:
288
293 virtual GHOST_TSuccess setWindowCursorVisibility(bool visible) = 0;
294
303
306
308 virtual GHOST_TSuccess setWindowCustomCursorShape(const uint8_t *bitmap,
309 const uint8_t *mask,
310 const int size[2],
311 const int hot_size[2],
312 bool can_invert_color) = 0;
315 {
316 cursor_generator->free_fn(cursor_generator);
317 return GHOST_kFailure;
318 };
319
323 virtual bool getCursorGrabUseSoftwareDisplay();
324
329 virtual bool getModifiedState();
330
332
335
338
341
344
347
350
353
356
359
362
365
368
371
375
378
383
384 /* OSX only, retina screens */
386
388
389 private:
390 GHOST_Context *context_;
391};
392
397
399{
400 return cursor_visible_;
401}
402
407
412
417
423
429
435
void * GHOST_TUserDataPtr
GHOST_TWindowState
GHOST_TStandardCursor
GHOST_TAxisFlag
GHOST_TDrawingContextType
GHOST_TSuccess
@ GHOST_kFailure
@ GHOST_kSuccess
#define GHOST_WINDOW_HDR_INFO_NONE
GHOST_TGrabCursorMode
@ GHOST_kGrabWrap
@ GHOST_kGrabHide
GHOST_TWindowDecorationStyleFlags
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition btDbvt.cpp:299
virtual GHOST_TSuccess getCursorGrabBounds(GHOST_Rect &bounds) const
GHOST_ContextParams want_context_params_
int32_t cursor_grab_accum_pos_[2]
GHOST_WindowHDRInfo getHDRInfo() override
uint16_t getDPIHint() override
virtual bool getCursorGrabUseSoftwareDisplay()
GHOST_TSuccess swapBufferRelease() override
float native_pixel_size_
void setWindowDecorationStyleFlags(GHOST_TWindowDecorationStyleFlags style_flags) override
GHOST_TStandardCursor cursor_shape_
GHOST_TSuccess endProgressBar() override
GHOST_TAxisFlag cursor_grab_axis_
virtual bool getModifiedState()
bool can_accept_drag_operation_
GHOST_TSuccess setModifiedState(bool is_unsaved_changes) override
void setCursorGrabAccum(int32_t x, int32_t y)
void getCursorGrabInitPos(int32_t &x, int32_t &y) const
void setUserData(const GHOST_TUserDataPtr user_data) override
GHOST_TAxisFlag getCursorGrabAxis() const
GHOST_WindowDecorationStyleSettings window_decoration_style_settings_
GHOST_TStandardCursor getCursorShape() const override
GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type) override
GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursor_shape) override
uint32_t full_screen_width_
GHOST_Context * getContext()
GHOST_TSuccess applyWindowDecorationStyle() override
void setPath(const char *) override
int32_t cursor_grab_init_pos_[2]
GHOST_TSuccess setProgressBar(float) override
GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_TAxisFlag wrap_axis, GHOST_Rect *bounds, int32_t mouse_ungrab_xy[2]) override
unsigned int getDefaultFramebuffer() override
GHOST_TSuccess setSwapInterval(int interval) override
virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode)
GHOST_TUserDataPtr user_data_
GHOST_TDrawingContextType drawing_context_type_
GHOST_TWindowDecorationStyleFlags getWindowDecorationStyleFlags() override
GHOST_TSuccess releaseNativeHandles()
virtual GHOST_TSuccess setWindowCustomCursorGenerator(GHOST_CursorGenerator *cursor_generator)
virtual void * getOSWindow() const
GHOST_TUserDataPtr getUserData() const override
void setWindowDecorationStyleSettings(GHOST_WindowDecorationStyleSettings decoration_settings) override
GHOST_TWindowDecorationStyleFlags window_decoration_style_flags_
virtual bool canAcceptDragOperation() const
uint32_t full_screen_height_
GHOST_TDrawingContextType getDrawingContextType() override
GHOST_TSuccess setCursorVisibility(bool visible) override
GHOST_TSuccess setCustomCursorShape(const uint8_t *bitmap, const uint8_t *mask, const int size[2], const int hot_spot[2], bool can_invert_color) override
float getNativePixelSize() override
GHOST_TSuccess getCursorBitmap(GHOST_CursorBitmapRef *bitmap) override
bool getValid() const override
virtual GHOST_TSuccess setWindowCursorVisibility(bool visible)=0
bool getCursorVisibility() const override
void setAcceptDragOperation(bool can_accept) override
GHOST_TSuccess activateDrawingContext() override
GHOST_IContext * getDrawingContext() override
GHOST_TGrabCursorMode getCursorGrabMode() const
bool isDialog() const override
void getCursorGrabState(GHOST_TGrabCursorMode &mode, GHOST_TAxisFlag &wrap_axis, GHOST_Rect &bounds, bool &use_software_cursor) override
GHOST_TSuccess updateDrawingContext()
bool is_unsaved_changes_
GHOST_Window(uint32_t width, uint32_t height, GHOST_TWindowState state, const GHOST_ContextParams &context_params, const bool exclusive=false)
GHOST_TSuccess getSwapInterval(int &interval_out) override
virtual GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape)=0
virtual GHOST_Context * newDrawingContext(GHOST_TDrawingContextType type)=0
GHOST_Rect cursor_grab_bounds_
bool progress_bar_visible_
GHOST_WindowHDRInfo hdr_info_
GHOST_TSuccess swapBufferAcquire() override
GHOST_TGrabCursorMode cursor_grab_
bool getCursorGrabModeIsWarp() const
void getCursorGrabAccum(int32_t &x, int32_t &y) const
GHOST_TSuccess setCustomCursorGenerator(GHOST_CursorGenerator *cursor_generator) override
bool hasAlpha() const override
virtual GHOST_TSuccess setWindowCustomCursorShape(const uint8_t *bitmap, const uint8_t *mask, const int size[2], const int hot_size[2], bool can_invert_color)=0
const int state
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void(*) free_fn(struct GHOST_CursorGenerator *cursor_generator)