Blender V4.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
10#pragma once
11
12#include "GHOST_IWindow.hh"
13
14class GHOST_Context;
15
24 public:
36 uint32_t height,
38 const bool wantStereoVisual = false,
39 const bool exclusive = false);
40
70 virtual ~GHOST_Window();
71
76 virtual bool getValid() const override
77 {
78 return m_context != nullptr;
79 }
80
85 virtual void *getOSWindow() const override;
86
87 virtual GHOST_TSuccess setPath(const char * /*filepath*/) override
88 {
89 return GHOST_kFailure;
90 }
91
96 inline GHOST_TStandardCursor getCursorShape() const override;
97
98 inline bool isDialog() const override
99 {
100 return false;
101 }
102
109
119 uint8_t *mask,
120 int sizex,
121 int sizey,
122 int hotX,
123 int hotY,
124 bool canInvertColor) override;
125
127
132 inline bool getCursorVisibility() const override;
134 inline bool getCursorGrabModeIsWarp() const;
135 inline GHOST_TAxisFlag getCursorGrabAxis() const;
136 inline void getCursorGrabInitPos(int32_t &x, int32_t &y) const;
137 inline void getCursorGrabAccum(int32_t &x, int32_t &y) const;
138 inline void setCursorGrabAccum(int32_t x, int32_t y);
139
145 GHOST_TSuccess setCursorVisibility(bool visible) override;
146
153 GHOST_TAxisFlag wrap_axis,
155 int32_t mouse_ungrab_xy[2]) override;
156
162
164 GHOST_TAxisFlag &wrap_axis,
166 bool &use_software_cursor) override;
170 bool getCursorGrabUseSoftwareDisplay() override;
171
176 virtual GHOST_TSuccess setProgressBar(float /*progress*/) override
177 {
178 return GHOST_kFailure;
179 }
180
185 {
186 return GHOST_kFailure;
187 }
188
194 GHOST_TSuccess setSwapInterval(int interval) override;
195
200 GHOST_TSuccess getSwapInterval(int &intervalOut) override;
201
205 void setAcceptDragOperation(bool canAccept) override;
206
211 bool canAcceptDragOperation() const override;
212
218 virtual GHOST_TSuccess setModifiedState(bool isUnsavedChanges) override;
219
224 virtual bool getModifiedState() override;
225
231
240
245 virtual GHOST_IContext *getDrawingContext() override;
246
251 virtual GHOST_TSuccess swapBuffers() override;
252
257 virtual GHOST_TSuccess activateDrawingContext() override;
258
265
271
276 virtual unsigned int getDefaultFramebuffer() override;
277
278#ifdef WITH_VULKAN_BACKEND
279 virtual GHOST_TSuccess getVulkanSwapChainFormat(
280 GHOST_VulkanSwapChainData *r_swap_chain_data) override;
281#endif
282
287 inline GHOST_TUserDataPtr getUserData() const override
288 {
289 return m_userData;
290 }
291
296 void setUserData(const GHOST_TUserDataPtr userData) override
297 {
298 m_userData = userData;
299 }
300
301 float getNativePixelSize() override
302 {
303 if (m_nativePixelSize > 0.0f) {
304 return m_nativePixelSize;
305 }
306 return 1.0f;
307 }
308
313 virtual inline uint16_t getDPIHint() override
314 {
315 return 96;
316 }
317
318#ifdef WITH_INPUT_IME
319 virtual void beginIME(
320 int32_t /*x*/, int32_t /*y*/, int32_t /*w*/, int32_t /*h*/, bool /*completed*/) override
321 {
322 /* do nothing temporarily if not in windows */
323 }
324
325 virtual void endIME() override
326 {
327 /* do nothing temporarily if not in windows */
328 }
329#endif /* WITH_INPUT_IME */
330
331 protected:
338
343 virtual GHOST_TSuccess setWindowCursorVisibility(bool visible) = 0;
344
353
359
365 uint8_t *mask,
366 int szx,
367 int szy,
368 int hotX,
369 int hotY,
370 bool canInvertColor) = 0;
371
373
376
379
382
385
388
391
394
397
400
403
406
409
412
415
420
421 /* OSX only, retina screens */
423
424 private:
425 GHOST_Context *m_context;
426};
427
432
434{
435 return m_cursorVisible;
436}
437
442
447
452
454{
455 x = m_cursorGrabInitPos[0];
456 y = m_cursorGrabInitPos[1];
457}
458
460{
463}
464
470
GHOST_TWindowState
void * GHOST_TUserDataPtr
Definition GHOST_Types.h:85
GHOST_TStandardCursor
GHOST_TAxisFlag
GHOST_TDrawingContextType
GHOST_TSuccess
Definition GHOST_Types.h:87
@ GHOST_kFailure
Definition GHOST_Types.h:87
@ GHOST_kSuccess
Definition GHOST_Types.h:87
GHOST_TGrabCursorMode
@ GHOST_kGrabWrap
@ GHOST_kGrabHide
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition btDbvt.cpp:299
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
bool getCursorGrabUseSoftwareDisplay() override
virtual GHOST_TSuccess endProgressBar() override
virtual GHOST_TSuccess setProgressBar(float) 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
virtual void * getOSWindow() const override
virtual GHOST_TSuccess setPath(const char *) override
GHOST_TGrabCursorMode m_cursorGrab
GHOST_TAxisFlag getCursorGrabAxis() const
virtual uint16_t getDPIHint() override
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 setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_TAxisFlag wrap_axis, GHOST_Rect *bounds, int32_t mouse_ungrab_xy[2]) override
virtual unsigned int getDefaultFramebuffer() override
GHOST_TSuccess setSwapInterval(int interval) override
virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode)
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
virtual bool getModifiedState() override
GHOST_TSuccess setCursorVisibility(bool visible) override
float getNativePixelSize() override
GHOST_TSuccess getCursorBitmap(GHOST_CursorBitmapRef *bitmap) override
virtual GHOST_TSuccess setWindowCursorVisibility(bool visible)=0
bool getCursorVisibility() const override
GHOST_TDrawingContextType m_drawingContextType
virtual GHOST_TSuccess activateDrawingContext() override
virtual GHOST_TSuccess swapBuffers() override
uint32_t m_fullScreenHeight
virtual 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
void setAcceptDragOperation(bool canAccept) override
virtual GHOST_TSuccess setModifiedState(bool isUnsavedChanges) override
bool m_progressBarVisible
virtual ~GHOST_Window()
virtual GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape)=0
virtual GHOST_Context * newDrawingContext(GHOST_TDrawingContextType type)=0
bool m_canAcceptDragOperation
virtual bool getValid() const override
bool getCursorGrabModeIsWarp() const
void getCursorGrabAccum(int32_t &x, int32_t &y) const
uint32_t m_fullScreenWidth
static ulong state[N]
unsigned short uint16_t
Definition stdint.h:79
unsigned int uint32_t
Definition stdint.h:80
signed int int32_t
Definition stdint.h:77
unsigned char uint8_t
Definition stdint.h:78