Blender V5.3
GHOST_SystemCocoa.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#ifndef __APPLE__
13# error Apple OSX only!
14#endif // __APPLE__
15
16// #define __CARBONSOUND__
17
18#include "GHOST_System.hh"
19
21class GHOST_EventKey;
22class GHOST_EventWindow;
24
26 public:
30 GHOST_SystemCocoa(bool background);
32
36 ~GHOST_SystemCocoa() override;
37
38 /***************************************************************************************
39 * Time(r) functionality.
40 ***************************************************************************************/
41
48 uint64_t getMilliSeconds() const override;
49
50 /***************************************************************************************
51 * Display/window management functionality.
52 ***************************************************************************************/
53
58 uint8_t getNumDisplays() const override;
59
64 void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const override;
65
69 void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const override;
70
87 GHOST_IWindow *createWindow(const char *title,
88 int32_t left,
89 int32_t top,
90 uint32_t width,
91 uint32_t height,
93 GHOST_GPUSettings gpu_settings,
94 const bool exclusive = false,
95 const bool is_dialog = false,
96 const GHOST_IWindow *parent_window = nullptr) override;
97
104
111
119
120 /***************************************************************************************
121 * Event management functionality.
122 ***************************************************************************************/
123
129 bool processEvents(bool waitForEvent) override;
130
135 void handleQuitRequest();
136
141 bool handleOpenDocumentRequest(void *filepathStr);
142
154 GHOST_TDragnDropTypes draggedObjectType,
155 GHOST_WindowCocoa *window,
156 int mouseX,
157 int mouseY,
158 void *data);
159
160 /***************************************************************************************
161 * Cursor management functionality.
162 ***************************************************************************************/
163
171
178 uint32_t getCursorPreferredLogicalSize() const override;
179
187
193 GHOST_TSuccess getPixelAtCursor(float r_color[3]) const override;
194
195 /***************************************************************************************
196 * Access to mouse button and keyboard states.
197 ***************************************************************************************/
198
205
211 GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const override;
212
213 GHOST_TCapabilityFlag getCapabilities() const override;
214
215 /***************************************************************************************
216 * Clipboard get / set.
217 ***************************************************************************************/
218
224 char *getClipboard(bool selection) const override;
225
231 void putClipboard(const char *buffer, bool selection) const override;
232
236 GHOST_TSuccess hasClipboardImage() const override;
237
244 uint *getClipboardImage(int *r_width, int *r_height) const override;
245
252 GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const override;
253
261
267
271 bool hasDialogWindow();
272
277
282 {
283 return false;
284 }
285
294 GHOST_TSuccess handleTabletEvent(void *eventPtr, short eventType);
295 bool handleTabletEvent(void *eventPtr);
296
302 GHOST_TSuccess handleMouseEvent(void *eventPtr);
303
309 GHOST_TSuccess handleKeyEvent(void *eventPtr);
310
320 GHOST_TSuccess showMessageBox(const char *title,
321 const char *message,
322 const char *help_label,
323 const char *continue_label,
324 const char *link,
325 GHOST_DialogOptions dialog_options) const override;
326
327 protected:
333 GHOST_TSuccess init() override;
334
342
346
350
353
356
359
367};
GHOST_TWindowState
GHOST_TEventType
GHOST_TCapabilityFlag
GHOST_TSuccess
GHOST_TDragnDropTypes
GHOST_TConsoleWindowState
GHOST_DialogOptions
void init()
unsigned long long int uint64_t
bool processEvents(bool waitForEvent) override
uint * getClipboardImage(int *r_width, int *r_height) const override
GHOST_TSuccess disposeContext(GHOST_IContext *context) override
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const override
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const override
GHOST_TSuccess handleWindowEvent(GHOST_TEventType eventType, GHOST_WindowCocoa *window)
GHOST_TSuccess handleDraggingEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType, GHOST_WindowCocoa *window, int mouseX, int mouseY, void *data)
GHOST_TSuccess handleApplicationBecomeActiveEvent()
GHOST_TSuccess hasClipboardImage() const override
GHOST_TSuccess handleMouseEvent(void *eventPtr)
GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const override
GHOST_TSuccess handleKeyEvent(void *eventPtr)
GHOST_TSuccess getPixelAtCursor(float r_color[3]) const override
uint64_t getMilliSeconds() const override
GHOST_TCapabilityFlag getCapabilities() const override
bool setConsoleWindowState(GHOST_TConsoleWindowState) override
GHOST_TSuccess showMessageBox(const char *title, const char *message, const char *help_label, const char *continue_label, const char *link, GHOST_DialogOptions dialog_options) const override
uint8_t getNumDisplays() const override
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const override
GHOST_TSuccess handleTabletEvent(void *eventPtr, short eventType)
bool handleOpenDocumentRequest(void *filepathStr)
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y) override
char * getClipboard(bool selection) const override
GHOST_TSuccess setMouseCursorPosition(int32_t x, int32_t y)
void putClipboard(const char *buffer, bool selection) const override
GHOST_TSuccess getButtons(GHOST_Buttons &buttons) const override
GHOST_IWindow * getWindowUnderCursor(int32_t x, int32_t y) override
GHOST_IContext * createOffscreenContext(GHOST_GPUSettings gpu_settings) override
uint32_t getCursorPreferredLogicalSize() const override
GHOST_IWindow * createWindow(const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_GPUSettings gpu_settings, const bool exclusive=false, const bool is_dialog=false, const GHOST_IWindow *parent_window=nullptr) override
bool need_delayed_application_become_active_event_processing_
GHOST_TSuccess putClipboardImage(uint *rgba, int width, int height) const override
GHOST_SystemCocoa(bool background)
const int state