Blender V4.5
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 bool wantStereoVisual = false,
39 const bool exclusive = false);
40
65
70 ~GHOST_Window() override;
71
76 bool getValid() const override
77 {
78 return m_context != nullptr;
79 }
80
85 void *getOSWindow() const override;
86
87 GHOST_TSuccess setPath(const char * /*filepath*/) override
88 {
89 return GHOST_kFailure;
90 }
91
96
102 GHOST_TWindowDecorationStyleFlags styleFlags) override;
103
109 GHOST_WindowDecorationStyleSettings decorationSettings) override;
110
115 {
116 return GHOST_kSuccess;
117 }
118
123 inline GHOST_TStandardCursor getCursorShape() const override;
124
125 bool isDialog() const override
126 {
127 return false;
128 }
129
136
145 GHOST_TSuccess setCustomCursorShape(uint8_t *bitmap,
146 uint8_t *mask,
147 int sizex,
148 int sizey,
149 int hotX,
150 int hotY,
151 bool canInvertColor) override;
152
154
159 inline bool getCursorVisibility() const override;
161 inline bool getCursorGrabModeIsWarp() const;
162 inline GHOST_TAxisFlag getCursorGrabAxis() const;
163 inline void getCursorGrabInitPos(int32_t &x, int32_t &y) const;
164 inline void getCursorGrabAccum(int32_t &x, int32_t &y) const;
165 inline void setCursorGrabAccum(int32_t x, int32_t y);
166
172 GHOST_TSuccess setCursorVisibility(bool visible) override;
173
180 GHOST_TAxisFlag wrap_axis,
182 int32_t mouse_ungrab_xy[2]) override;
183
189
191 GHOST_TAxisFlag &wrap_axis,
193 bool &use_software_cursor) override;
197 bool getCursorGrabUseSoftwareDisplay() override;
198
203 GHOST_TSuccess setProgressBar(float /*progress*/) override
204 {
205 return GHOST_kFailure;
206 }
207
212 {
213 return GHOST_kFailure;
214 }
215
221 GHOST_TSuccess setSwapInterval(int interval) override;
222
227 GHOST_TSuccess getSwapInterval(int &intervalOut) override;
228
232 void setAcceptDragOperation(bool canAccept) override;
233
238 bool canAcceptDragOperation() const override;
239
245 GHOST_TSuccess setModifiedState(bool isUnsavedChanges) override;
246
251 bool getModifiedState() override;
252
258
267
273
278 GHOST_TSuccess swapBuffers() override;
279
285
292
298
303 unsigned int getDefaultFramebuffer() override;
304
305#ifdef WITH_VULKAN_BACKEND
306 virtual GHOST_TSuccess getVulkanSwapChainFormat(
307 GHOST_VulkanSwapChainData *r_swap_chain_data) override;
308#endif
309
315 {
316 return m_userData;
317 }
318
323 void setUserData(const GHOST_TUserDataPtr userData) override
324 {
325 m_userData = userData;
326 }
327
328 float getNativePixelSize() override
329 {
330 if (m_nativePixelSize > 0.0f) {
331 return m_nativePixelSize;
332 }
333 return 1.0f;
334 }
335
340 uint16_t getDPIHint() override
341 {
342 return 96;
343 }
344
345#ifdef WITH_INPUT_IME
346 void beginIME(
347 int32_t /*x*/, int32_t /*y*/, int32_t /*w*/, int32_t /*h*/, bool /*completed*/) override
348 {
349 /* do nothing temporarily if not in windows */
350 }
351
352 void endIME() override
353 {
354 /* do nothing temporarily if not in windows */
355 }
356#endif /* WITH_INPUT_IME */
357
358 protected:
365
370 virtual GHOST_TSuccess setWindowCursorVisibility(bool visible) = 0;
371
380
386
392 uint8_t *mask,
393 int szx,
394 int szy,
395 int hotX,
396 int hotY,
397 bool canInvertColor) = 0;
398
400
403
406
409
412
415
418
421
424
427
430
433
436
439
443
446
451
452 /* OSX only, retina screens */
454
455 private:
456 GHOST_Context *m_context;
457};
458
463
465{
466 return m_cursorVisible;
467}
468
473
478
483
489
495
501
GHOST_TWindowState
void * GHOST_TUserDataPtr
Definition GHOST_Types.h:78
GHOST_TStandardCursor
GHOST_TAxisFlag
GHOST_TDrawingContextType
GHOST_TSuccess
Definition GHOST_Types.h:80
@ GHOST_kFailure
Definition GHOST_Types.h:80
@ GHOST_kSuccess
Definition GHOST_Types.h:80
GHOST_TGrabCursorMode
@ GHOST_kGrabWrap
@ GHOST_kGrabHide
GHOST_TWindowDecorationStyleFlags
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition btDbvt.cpp:299
GHOST_TWindowDecorationStyleFlags m_windowDecorationStyleFlags
~GHOST_Window() override
GHOST_TSuccess setCustomCursorShape(uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor) override
GHOST_TSuccess getSwapInterval(int &intervalOut) override
GHOST_Rect m_cursorGrabBounds
uint16_t getDPIHint() override
GHOST_WindowDecorationStyleSettings m_windowDecorationStyleSettings
bool getCursorGrabUseSoftwareDisplay() override
virtual void setWindowDecorationStyleSettings(GHOST_WindowDecorationStyleSettings decorationSettings) override
GHOST_TSuccess endProgressBar() override
GHOST_TSuccess getCursorGrabBounds(GHOST_Rect &bounds) const override
void setCursorGrabAccum(int32_t x, int32_t y)
void getCursorGrabInitPos(int32_t &x, int32_t &y) const
void * getOSWindow() const override
GHOST_TGrabCursorMode m_cursorGrab
GHOST_TAxisFlag getCursorGrabAxis() const
int32_t m_cursorGrabAccumPos[2]
bool m_wantStereoVisual
int32_t m_cursorGrabInitPos[2]
GHOST_TStandardCursor getCursorShape() const override
GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type) override
GHOST_TStandardCursor m_cursorShape
GHOST_Context * getContext()
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
virtual GHOST_TWindowDecorationStyleFlags getWindowDecorationStyleFlags() override
GHOST_TSuccess releaseNativeHandles()
GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursorShape) override
GHOST_TAxisFlag m_cursorGrabAxis
void setUserData(const GHOST_TUserDataPtr userData) override
GHOST_TUserDataPtr getUserData() const override
virtual GHOST_TSuccess setWindowCustomCursorShape(uint8_t *bitmap, uint8_t *mask, int szx, int szy, int hotX, int hotY, bool canInvertColor)=0
GHOST_TDrawingContextType getDrawingContextType() override
bool getModifiedState() override
GHOST_TSuccess setCursorVisibility(bool visible) 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
GHOST_TDrawingContextType m_drawingContextType
GHOST_TSuccess activateDrawingContext() override
GHOST_TSuccess swapBuffers() override
uint32_t m_fullScreenHeight
GHOST_IContext * getDrawingContext() override
GHOST_TGrabCursorMode getCursorGrabMode() const
bool m_isUnsavedChanges
GHOST_Window(uint32_t width, uint32_t height, GHOST_TWindowState state, const bool wantStereoVisual=false, const bool exclusive=false)
float m_nativePixelSize
bool isDialog() const override
void getCursorGrabState(GHOST_TGrabCursorMode &mode, GHOST_TAxisFlag &wrap_axis, GHOST_Rect &bounds, bool &use_software_cursor) override
GHOST_TSuccess updateDrawingContext()
GHOST_TUserDataPtr m_userData
virtual void setWindowDecorationStyleFlags(GHOST_TWindowDecorationStyleFlags styleFlags) override
void setAcceptDragOperation(bool canAccept) override
GHOST_TSuccess setModifiedState(bool isUnsavedChanges) override
bool m_progressBarVisible
virtual GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape)=0
virtual GHOST_Context * newDrawingContext(GHOST_TDrawingContextType type)=0
bool m_canAcceptDragOperation
virtual GHOST_TSuccess applyWindowDecorationStyle() override
bool getCursorGrabModeIsWarp() const
void getCursorGrabAccum(int32_t &x, int32_t &y) const
uint32_t m_fullScreenWidth
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
static ulong state[N]