Blender V5.0
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 *getOSWindow() const override;
81
83 GHOST_TSuccess setPath(const char * /*filepath*/) override
84 {
85 return GHOST_kFailure;
86 }
87
90
93 GHOST_TWindowDecorationStyleFlags style_flags) override;
94
97 GHOST_WindowDecorationStyleSettings decoration_settings) override;
98
101 {
102 return GHOST_kSuccess;
103 }
104
106 inline GHOST_TStandardCursor getCursorShape() const override;
107
108 bool isDialog() const override
109 {
110 return false;
111 }
112
115
117 GHOST_TSuccess setCustomCursorShape(const uint8_t *bitmap,
118 const uint8_t *mask,
119 const int size[2],
120 const int hot_spot[2],
121 bool can_invert_color) override;
122
125
127
129 inline bool getCursorVisibility() const override;
131 inline bool getCursorGrabModeIsWarp() const;
132 inline GHOST_TAxisFlag getCursorGrabAxis() const;
133 inline void getCursorGrabInitPos(int32_t &x, int32_t &y) const;
134 inline void getCursorGrabAccum(int32_t &x, int32_t &y) const;
135 inline void setCursorGrabAccum(int32_t x, int32_t y);
136
138 GHOST_TSuccess setCursorVisibility(bool visible) override;
139
142 GHOST_TAxisFlag wrap_axis,
144 int32_t mouse_ungrab_xy[2]) override;
145
148
150 GHOST_TAxisFlag &wrap_axis,
152 bool &use_software_cursor) override;
154 bool getCursorGrabUseSoftwareDisplay() override;
155
157 GHOST_TSuccess setProgressBar(float /*progress*/) override
158 {
159 return GHOST_kFailure;
160 }
161
164 {
165 return GHOST_kFailure;
166 }
167
169 GHOST_TSuccess setSwapInterval(int interval) override;
171 GHOST_TSuccess getSwapInterval(int &interval_out) override;
172
174 void setAcceptDragOperation(bool can_accept) override;
175
177 bool canAcceptDragOperation() const override;
178
180 GHOST_TSuccess setModifiedState(bool is_unsaved_changes) override;
181
183 bool getModifiedState() override;
184
187
195
198
203
206
213
219
221 unsigned int getDefaultFramebuffer() override;
222
223#ifdef WITH_VULKAN_BACKEND
225 virtual GHOST_TSuccess getVulkanSwapChainFormat(
226 GHOST_VulkanSwapChainData *r_swap_chain_data) override;
227#endif
228
231 {
232 return user_data_;
233 }
234
236 void setUserData(const GHOST_TUserDataPtr user_data) override
237 {
238 user_data_ = user_data;
239 }
240
242 float getNativePixelSize() override
243 {
244 if (native_pixel_size_ > 0.0f) {
245 return native_pixel_size_;
246 }
247 return 1.0f;
248 }
249
251 uint16_t getDPIHint() override
252 {
253 return 96;
254 }
255
258 {
259 return hdr_info_;
260 }
261
262#ifdef WITH_INPUT_IME
263 void beginIME(
264 int32_t /*x*/, int32_t /*y*/, int32_t /*w*/, int32_t /*h*/, bool /*completed*/) override
265 {
266 /* do nothing temporarily if not in windows */
267 }
268
269 void endIME() override
270 {
271 /* do nothing temporarily if not in windows */
272 }
273#endif /* WITH_INPUT_IME */
274
275 protected:
282
287 virtual GHOST_TSuccess setWindowCursorVisibility(bool visible) = 0;
288
297
300
302 virtual GHOST_TSuccess setWindowCustomCursorShape(const uint8_t *bitmap,
303 const uint8_t *mask,
304 const int size[2],
305 const int hot_size[2],
306 bool can_invert_color) = 0;
309 {
310 cursor_generator->free_fn(cursor_generator);
311 return GHOST_kFailure;
312 };
313
315
318
321
324
327
330
333
336
339
342
345
348
351
354
358
361
366
367 /* OSX only, retina screens */
369
371
372 private:
373 GHOST_Context *context_;
374};
375
380
382{
383 return cursor_visible_;
384}
385
390
395
400
406
412
418
GHOST_TWindowState
void * GHOST_TUserDataPtr
Definition GHOST_Types.h:55
GHOST_TStandardCursor
GHOST_TAxisFlag
GHOST_TDrawingContextType
GHOST_TSuccess
Definition GHOST_Types.h:57
@ GHOST_kFailure
Definition GHOST_Types.h:57
@ GHOST_kSuccess
Definition GHOST_Types.h:57
#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
~GHOST_Window() override
GHOST_ContextParams want_context_params_
int32_t cursor_grab_accum_pos_[2]
GHOST_WindowHDRInfo getHDRInfo() override
uint16_t getDPIHint() override
GHOST_TSuccess swapBufferRelease() override
bool getCursorGrabUseSoftwareDisplay() override
float native_pixel_size_
virtual void setWindowDecorationStyleFlags(GHOST_TWindowDecorationStyleFlags style_flags) override
GHOST_TStandardCursor cursor_shape_
GHOST_TSuccess endProgressBar() override
GHOST_TAxisFlag cursor_grab_axis_
GHOST_TSuccess getCursorGrabBounds(GHOST_Rect &bounds) const override
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 * getOSWindow() const override
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()
int32_t cursor_grab_init_pos_[2]
bool canAcceptDragOperation() const override
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_TSuccess setPath(const char *) override
GHOST_TUserDataPtr user_data_
GHOST_TDrawingContextType drawing_context_type_
virtual GHOST_TWindowDecorationStyleFlags getWindowDecorationStyleFlags() override
GHOST_TSuccess releaseNativeHandles()
virtual GHOST_TSuccess setWindowCustomCursorGenerator(GHOST_CursorGenerator *cursor_generator)
GHOST_TUserDataPtr getUserData() const override
virtual void setWindowDecorationStyleSettings(GHOST_WindowDecorationStyleSettings decoration_settings) override
GHOST_TWindowDecorationStyleFlags window_decoration_style_flags_
uint32_t full_screen_height_
GHOST_TDrawingContextType getDrawingContextType() override
bool getModifiedState() 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_
virtual GHOST_TSuccess applyWindowDecorationStyle() override
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
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
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
static ulong state[N]
void(* free_fn)(struct GHOST_CursorGenerator *cursor_generator)