Blender V4.3
GHOST_WindowCocoa.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#ifndef __APPLE__
13# error Apple OSX only!
14#endif // __APPLE__
15
16#include "GHOST_Window.hh"
17#ifdef WITH_INPUT_IME
18# include "GHOST_Event.hh"
19#endif
20
21@class CAMetalLayer;
22@class CocoaMetalView;
23@class CocoaOpenGLView;
24@class BlenderWindow;
25@class NSCursor;
26@class NSScreen;
27
29
31 public:
48 const char *title,
49 int32_t left,
50 int32_t bottom,
51 uint32_t width,
52 uint32_t height,
55 const bool stereoVisual,
56 bool is_debug,
57 bool dialog,
58 GHOST_WindowCocoa *parentWindow,
59 const GHOST_GPUDevice &preferred_device);
60
65 ~GHOST_WindowCocoa() override;
66
71 bool getValid() const override;
72
77 void *getOSWindow() const override;
78
83 void setTitle(const char *title) override;
88 std::string getTitle() const override;
89
94 GHOST_TSuccess setPath(const char *filepath) override;
95
102 void getWindowBounds(GHOST_Rect &bounds) const override;
103
109 void getClientBounds(GHOST_Rect &bounds) const override;
110
115 GHOST_TSuccess setClientWidth(uint32_t width) override;
116
121 GHOST_TSuccess setClientHeight(uint32_t height) override;
122
128 GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override;
129
134 GHOST_TWindowState getState() const override;
135
141 GHOST_TSuccess setModifiedState(bool isUnsavedChanges) override;
142
150 void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
151
159 void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override;
160
169 void clientToScreenIntern(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
170
179 void screenToClientIntern(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const;
180
185 NSScreen *getScreen();
186
193
200
201 NSCursor *getStandardCursor(GHOST_TStandardCursor cursor) const;
202 void loadCursor(bool visible, GHOST_TStandardCursor cursor) const;
203
204 bool isDialog() const override;
205
207 {
208 return m_tablet;
209 }
210
215 GHOST_TSuccess setProgressBar(float progress) override;
216
221
222 void setNativePixelSize();
223
225 {
226 return GHOST_kFailure;
227 }
228
230 {
231 return GHOST_kFailure;
232 }
233
236 {
237 return m_window;
238 };
239
240 /* Internal value to ensure proper redraws during animations */
241 void setImmediateDraw(bool value)
242 {
243 m_immediateDraw = value;
244 }
245 bool getImmediateDraw() const
246 {
247 return m_immediateDraw;
248 }
249
250#ifdef WITH_INPUT_IME
251 void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed) override;
252 void endIME() override;
253#endif /* WITH_INPUT_IME */
254
255 protected:
261
266 GHOST_TSuccess invalidate() override;
267
272 GHOST_TSuccess setWindowCursorVisibility(bool visible) override;
273
279
286
292 uint8_t *mask,
293 int sizex,
294 int sizey,
295 int hotX,
296 int hotY,
297 bool canInvertColor) override;
298
301
303 CocoaOpenGLView *m_openGLView;
304 CocoaMetalView *m_metalView;
305 CAMetalLayer *m_metalLayer;
306
309
310 NSCursor *m_customCursor;
311
313
315 bool m_debug_context; // for debug messages during context setup
318};
319
320#ifdef WITH_INPUT_IME
321class GHOST_EventIME : public GHOST_Event {
322 public:
329 GHOST_EventIME(uint64_t msec, GHOST_TEventType type, GHOST_IWindow *window, void *customdata)
330 : GHOST_Event(msec, type, window)
331 {
332 this->m_data = customdata;
333 }
334};
335
336typedef int GHOST_ImeStateFlagCocoa;
337enum {
338 GHOST_IME_INPUT_FOCUSED = (1 << 0),
339 GHOST_IME_ENABLED = (1 << 1),
340 GHOST_IME_COMPOSING = (1 << 2),
341 GHOST_IME_KEY_CONTROL_CHAR = (1 << 3),
342 GHOST_IME_COMPOSITION_EVENT = (1 << 4), // For Korean input
343 GHOST_IME_RESULT_EVENT = (1 << 5) // For Korean input
344};
345#endif /* WITH_INPUT_IME */
GHOST_TWindowState
GHOST_TStandardCursor
GHOST_TEventType
GHOST_TDrawingContextType
GHOST_TWindowOrder
GHOST_TSuccess
Definition GHOST_Types.h:87
@ GHOST_kFailure
Definition GHOST_Types.h:87
GHOST_TGrabCursorMode
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition btDbvt.cpp:299
btAlignedObjectArray< btScalar > m_data
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
GHOST_Event(uint64_t msec, GHOST_TEventType type, GHOST_IWindow *window)
bool isDialog() const override
GHOST_TSuccess setProgressBar(float progress) override
GHOST_TSuccess setWindowCursorShape(GHOST_TStandardCursor shape) override
GHOST_SystemCocoa * m_systemCocoa
bool getImmediateDraw() const
GHOST_TSuccess setState(GHOST_TWindowState state) override
std::string getTitle() const override
BlenderWindow * m_window
void setImmediateDraw(bool value)
GHOST_TSuccess setClientHeight(uint32_t height) override
void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
void setTitle(const char *title) override
GHOST_TSuccess setModifiedState(bool isUnsavedChanges) override
GHOST_TSuccess invalidate() override
CocoaOpenGLView * m_openGLView
CAMetalLayer * m_metalLayer
GHOST_TSuccess endProgressBar() override
NSCursor * getStandardCursor(GHOST_TStandardCursor cursor) const
GHOST_TWindowState getState() const override
GHOST_TSuccess setClientWidth(uint32_t width) override
GHOST_GPUDevice m_preferred_device
GHOST_TabletData m_tablet
GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa, const char *title, int32_t left, int32_t bottom, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_TDrawingContextType type, const bool stereoVisual, bool is_debug, bool dialog, GHOST_WindowCocoa *parentWindow, const GHOST_GPUDevice &preferred_device)
GHOST_TSuccess endFullScreen() const override
GHOST_TSuccess hasCursorShape(GHOST_TStandardCursor shape) override
void clientToScreenIntern(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const
void * getOSWindow() const override
GHOST_TabletData & GetCocoaTabletData()
void getClientBounds(GHOST_Rect &bounds) const override
GHOST_TSuccess beginFullScreen() const override
void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
void getWindowBounds(GHOST_Rect &bounds) const override
GHOST_Context * newDrawingContext(GHOST_TDrawingContextType type) override
GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) override
GHOST_TSuccess setWindowCustomCursorShape(uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor) override
GHOST_TSuccess setOrder(GHOST_TWindowOrder order) override
void screenToClientIntern(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const
CocoaMetalView * m_metalView
GHOST_TSuccess setPath(const char *filepath) override
bool getValid() const override
GHOST_TSuccess setWindowCursorVisibility(bool visible) override
BlenderWindow * getViewWindow() const
void loadCursor(bool visible, GHOST_TStandardCursor cursor) const
GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) override
static ulong state[N]
unsigned int uint32_t
Definition stdint.h:80
signed int int32_t
Definition stdint.h:77
unsigned char uint8_t
Definition stdint.h:78
unsigned __int64 uint64_t
Definition stdint.h:90