iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
IGraphicsMac.mm
1/*
2 ==============================================================================
3
4 This file is part of the iPlug 2 library. Copyright (C) the iPlug 2 developers.
5
6 See LICENSE.txt for more info.
7
8 ==============================================================================
9*/
10
11#include "IGraphicsMac.h"
12#import "IGraphicsMac_view.h"
13
14#include "IControl.h"
15#include "IPopupMenuControl.h"
16
17#pragma clang diagnostic ignored "-Wdeprecated-declarations"
18
19using namespace iplug;
20using namespace igraphics;
21
22static int GetSystemVersion()
23{
24 static int32_t v;
25 if (!v)
26 {
27 if (NSAppKitVersionNumber >= 1266.0)
28 {
29 if (NSAppKitVersionNumber >= 1404.0)
30 v = 0x10b0;
31 else
32 v = 0x10a0; // 10.10+ Gestalt(gsv) return 0x109x, so we bump this to 0x10a0
33 }
34 else
35 {
36 SInt32 a = 0x1040;
37 Gestalt(gestaltSystemVersion,&a);
38 v=a;
39 }
40 }
41 return v;
42}
43
44StaticStorage<CoreTextFontDescriptor> sFontDescriptorCache;
45
46#pragma mark -
47
48IGraphicsMac::IGraphicsMac(IGEditorDelegate& dlg, int w, int h, int fps, float scale)
49: IGRAPHICS_DRAW_CLASS(dlg, w, h, fps, scale)
50{
51 NSApplicationLoad();
52 StaticStorage<CoreTextFontDescriptor>::Accessor storage(sFontDescriptorCache);
53 storage.Retain();
54}
55
56IGraphicsMac::~IGraphicsMac()
57{
58 StaticStorage<CoreTextFontDescriptor>::Accessor storage(sFontDescriptorCache);
59 storage.Release();
60
61 CloseWindow();
62}
63
64PlatformFontPtr IGraphicsMac::LoadPlatformFont(const char* fontID, const char* fileNameOrResID)
65{
66 return CoreTextHelpers::LoadPlatformFont(fontID, fileNameOrResID, GetBundleID(), GetSharedResourcesSubPath());
67}
68
69PlatformFontPtr IGraphicsMac::LoadPlatformFont(const char* fontID, const char* fontName, ETextStyle style)
70{
71 return CoreTextHelpers::LoadPlatformFont(fontID, fontName, style);
72}
73
74PlatformFontPtr IGraphicsMac::LoadPlatformFont(const char* fontID, void* pData, int dataSize)
75{
76 return CoreTextHelpers::LoadPlatformFont(fontID, pData, dataSize);
77}
78
79void IGraphicsMac::CachePlatformFont(const char* fontID, const PlatformFontPtr& font)
80{
81 CoreTextHelpers::CachePlatformFont(fontID, font, sFontDescriptorCache);
82}
83
84float IGraphicsMac::MeasureText(const IText& text, const char* str, IRECT& bounds) const
85{
86 return IGRAPHICS_DRAW_CLASS::MeasureText(text, str, bounds);
87}
88
89void* IGraphicsMac::OpenWindow(void* pParent)
90{
91 TRACE
92 CloseWindow();
93 IGRAPHICS_VIEW* pView = [[IGRAPHICS_VIEW alloc] initWithIGraphics: this];
94 mView = (void*) pView;
95
96 ActivateGLContext();
97 OnViewInitialized([pView layer]);
98 SetScreenScale([[NSScreen mainScreen] backingScaleFactor]);
99 GetDelegate()->LayoutUI(this);
100 UpdateTooltips();
101 GetDelegate()->OnUIOpen();
102
103 if (pParent)
104 {
105 [(NSView*) pParent addSubview: pView];
106 }
107
108 return mView;
109}
110
111void IGraphicsMac::AttachPlatformView(const IRECT& r, void* pView)
112{
113 NSView* pNewSubView = (NSView*) pView;
114 [pNewSubView setFrame:ToNSRect(this, r)];
115
116 [(IGRAPHICS_VIEW*) mView addSubview:(NSView*) pNewSubView];
117}
118
119void IGraphicsMac::RemovePlatformView(void* pView)
120{
121 [(NSView*) pView removeFromSuperview];
122}
123
124void IGraphicsMac::HidePlatformView(void* pView, bool hide)
125{
126 [(NSView*) pView setHidden:hide];
127}
128
129void IGraphicsMac::CloseWindow()
130{
131 if (mView)
132 {
133 IGRAPHICS_VIEW* pView = (IGRAPHICS_VIEW*) mView;
134
135#ifdef IGRAPHICS_GL
136 [[pView pixelFormat] release];
137 [[pView openGLContext] release];
138#endif
139
140 [pView removeAllToolTips];
141 [pView killTimer];
142 [pView removeFromSuperview];
143 [pView release];
144
145 mView = nullptr;
146 OnViewDestroyed();
147 }
148}
149
150bool IGraphicsMac::WindowIsOpen()
151{
152 return mView;
153}
154
155void IGraphicsMac::PlatformResize(bool parentHasResized)
156{
157 if (mView)
158 {
159 NSSize size = { static_cast<CGFloat>(WindowWidth()), static_cast<CGFloat>(WindowHeight()) };
160
161 [NSAnimationContext beginGrouping]; // Prevent animated resizing
162 [[NSAnimationContext currentContext] setDuration:0.0];
163 [(IGRAPHICS_VIEW*) mView setFrameSize: size ];
164
165 [NSAnimationContext endGrouping];
166 }
167
168 UpdateTooltips();
169}
170
171void IGraphicsMac::PointToScreen(float& x, float& y) const
172{
173 if (mView)
174 {
175 x *= GetDrawScale();
176 y *= GetDrawScale();
177 NSWindow* pWindow = [(IGRAPHICS_VIEW*) mView window];
178 NSPoint wndpt = [(IGRAPHICS_VIEW*) mView convertPoint:NSMakePoint(x, y) toView:nil];
179 NSPoint pt = [pWindow convertRectToScreen: NSMakeRect(wndpt.x, wndpt.y, 0.0, 0.0)].origin;
180
181 x = pt.x;
182 y = pt.y;
183 }
184}
185
186void IGraphicsMac::ScreenToPoint(float& x, float& y) const
187{
188 if (mView)
189 {
190 NSWindow* pWindow = [(IGRAPHICS_VIEW*) mView window];
191 NSPoint wndpt = [pWindow convertRectFromScreen: NSMakeRect(x, y, 0.0, 0.0)].origin;
192 NSPoint pt = [(IGRAPHICS_VIEW*) mView convertPoint:NSMakePoint(wndpt.x, wndpt.y) fromView:nil];
193
194 x = pt.x / GetDrawScale();
195 y = pt.y / GetDrawScale();
196 }
197}
198
199void IGraphicsMac::HideMouseCursor(bool hide, bool lock)
200{
201#if defined AU_API
202 if (!IsXPCAuHost())
203#elif defined AUv3_API
204 if (!IsOOPAuv3AppExtension())
205#endif
206 {
207 if (mCursorHidden == hide)
208 return;
209
210 mCursorHidden = hide;
211
212 if (hide)
213 {
214 StoreCursorPosition();
215 CGDisplayHideCursor(kCGDirectMainDisplay);
216 mCursorLock = lock;
217 }
218 else
219 {
220 DoCursorLock(mCursorX, mCursorY, mCursorX, mCursorY);
221 CGDisplayShowCursor(kCGDirectMainDisplay);
222 mCursorLock = false;
223 }
224 }
225}
226
227void IGraphicsMac::MoveMouseCursor(float x, float y)
228{
229 if (mTabletInput)
230 return;
231
232 PointToScreen(x, y);
233 RepositionCursor(CGPoint{x, y});
234 StoreCursorPosition();
235}
236
237void IGraphicsMac::DoCursorLock(float x, float y, float& prevX, float& prevY)
238{
239 if (mCursorHidden && mCursorLock && !mTabletInput)
240 {
241 RepositionCursor(mCursorLockPosition);
242 prevX = mCursorX;
243 prevY = mCursorY;
244 }
245 else
246 {
247 mCursorX = prevX = x;
248 mCursorY = prevY = y;
249 }
250}
251
252void IGraphicsMac::RepositionCursor(CGPoint point)
253{
254 point = CGPoint{point.x, CGDisplayPixelsHigh(CGMainDisplayID()) - point.y};
255 CGAssociateMouseAndMouseCursorPosition(false);
256 CGDisplayMoveCursorToPoint(CGMainDisplayID(), point);
257 CGAssociateMouseAndMouseCursorPosition(true);
258}
259
260void IGraphicsMac::StoreCursorPosition()
261{
262 // Get position in screen coordinates
263 NSPoint mouse = [NSEvent mouseLocation];
264 mCursorX = mouse.x = std::round(mouse.x);
265 mCursorY = mouse.y = std::round(mouse.y);
266 mCursorLockPosition = CGPoint{mouse.x, mouse.y};
267
268 // Convert to IGraphics coordinates
269 ScreenToPoint(mCursorX, mCursorY);
270}
271
272void IGraphicsMac::GetMouseLocation(float& x, float&y) const
273{
274 // Get position in screen coordinates
275 NSPoint mouse = [NSEvent mouseLocation];
276 x = mouse.x;
277 y = mouse.y;
278
279 // Convert to IGraphics coordinates
280 ScreenToPoint(x, y);
281}
282
283EMsgBoxResult IGraphicsMac::ShowMessageBox(const char* str, const char* title, EMsgBoxType type, IMsgBoxCompletionHandlerFunc completionHandler)
284{
285 ReleaseMouseCapture();
286
287 NSString* messageContent = @(str ? str : "");
288 NSString* alertTitle = @(title ? title : "");
289
290 NSAlert* alert = [[NSAlert alloc] init];
291 [alert setMessageText:alertTitle];
292 [alert setInformativeText:messageContent];
293
294 EMsgBoxResult result = kCANCEL;
295
296 switch (type)
297 {
298 case kMB_OK:
299 [alert addButtonWithTitle:@"OK"];
300 result = kOK;
301 break;
302 case kMB_OKCANCEL:
303 [alert addButtonWithTitle:@"OK"];
304 [alert addButtonWithTitle:@"Cancel"];
305 result = kCANCEL;
306 break;
307 case kMB_YESNO:
308 [alert addButtonWithTitle:@"Yes"];
309 [alert addButtonWithTitle:@"No"];
310 result = kNO;
311 break;
312 case kMB_RETRYCANCEL:
313 [alert addButtonWithTitle:@"Retry"];
314 [alert addButtonWithTitle:@"Cancel"];
315 result = kCANCEL;
316 break;
317 case kMB_YESNOCANCEL:
318 [alert addButtonWithTitle:@"Yes"];
319 [alert addButtonWithTitle:@"No"];
320 [alert addButtonWithTitle:@"Cancel"];
321 result = kCANCEL;
322 break;
323 }
324
325 NSModalResponse response = [alert runModal];
326
327 switch (type)
328 {
329 case kMB_OK:
330 result = kOK;
331 break;
332 case kMB_OKCANCEL:
333 result = (response == NSAlertFirstButtonReturn) ? kOK : kCANCEL;
334 break;
335 case kMB_YESNO:
336 result = (response == NSAlertFirstButtonReturn) ? kYES : kNO;
337 break;
338 case kMB_RETRYCANCEL:
339 result = (response == NSAlertFirstButtonReturn) ? kRETRY : kCANCEL;
340 break;
341 case kMB_YESNOCANCEL:
342 if (response == NSAlertFirstButtonReturn) result = kYES;
343 else if (response == NSAlertSecondButtonReturn) result = kNO;
344 else result = kCANCEL;
345 break;
346 }
347
348 if (completionHandler)
349 {
350 completionHandler(result);
351 }
352
353 [alert release];
354
355 return result;
356}
357
358void IGraphicsMac::ForceEndUserEdit()
359{
360 if (mView)
361 {
362 [(IGRAPHICS_VIEW*) mView endUserInput];
363 }
364}
365
366void IGraphicsMac::UpdateTooltips()
367{
368 if (!(mView && TooltipsEnabled()))
369 return;
370
371 @autoreleasepool {
372
373 [(IGRAPHICS_VIEW*) mView removeAllToolTips];
374
375 if (GetPopupMenuControl() && GetPopupMenuControl()->GetState() > IPopupMenuControl::kCollapsed)
376 {
377 return;
378 }
379
380 auto func = [this](IControl* pControl)
381 {
382 if (pControl->GetTooltip() && !pControl->IsHidden())
383 {
384 IRECT pR = pControl->GetTargetRECT();
385 if (!pR.Empty())
386 {
387 [(IGRAPHICS_VIEW*) mView registerToolTip: pR];
388 }
389 }
390 };
391
392 ForStandardControlsFunc(func);
393
394 }
395}
396
397const char* IGraphicsMac::GetPlatformAPIStr()
398{
399 return "Cocoa";
400}
401
402bool IGraphicsMac::RevealPathInExplorerOrFinder(WDL_String& path, bool select)
403{
404 BOOL success = FALSE;
405
406 @autoreleasepool {
407
408 if(path.GetLength())
409 {
410 NSString* pPath = [NSString stringWithUTF8String:path.Get()];
411
412 if([[NSFileManager defaultManager] fileExistsAtPath : pPath] == YES)
413 {
414 if (select)
415 {
416 NSString* pParentDirectoryPath = [pPath stringByDeletingLastPathComponent];
417
418 if (pParentDirectoryPath)
419 {
420 success = [[NSWorkspace sharedWorkspace] openFile:pParentDirectoryPath];
421
422 if (success)
423 success = [[NSWorkspace sharedWorkspace] selectFile: pPath inFileViewerRootedAtPath:pParentDirectoryPath];
424 }
425 }
426 else {
427 success = [[NSWorkspace sharedWorkspace] openFile:pPath];
428 }
429
430 }
431 }
432
433 }
434 return (bool) success;
435}
436
437void IGraphicsMac::PromptForFile(WDL_String& fileName, WDL_String& path, EFileAction action, const char* ext, IFileDialogCompletionHandlerFunc completionHandler)
438{
439 if (!WindowIsOpen())
440 {
441 fileName.Set("");
442 return;
443 }
444
445 NSString* pDefaultFileName = nil;
446 NSString* pDefaultPath = nil;
447 NSArray* pFileTypes = nil;
448
449 if (fileName.GetLength())
450 pDefaultFileName = [NSString stringWithUTF8String:fileName.Get()];
451 else
452 pDefaultFileName = @"";
453
454 if (path.GetLength())
455 pDefaultPath = [NSString stringWithUTF8String:path.Get()];
456 else
457 pDefaultPath = @"";
458
459 fileName.Set(""); // reset it
460
461 if (CStringHasContents(ext))
462 pFileTypes = [[NSString stringWithUTF8String:ext] componentsSeparatedByString: @" "];
463
464 auto doHandleResponse = [](NSPanel* pPanel, NSModalResponse response, WDL_String& fileName, WDL_String& path, IFileDialogCompletionHandlerFunc completionHandler){
465 if (response == NSOKButton)
466 {
467 NSString* pFullPath = [(NSSavePanel*) pPanel filename] ;
468 fileName.Set([pFullPath UTF8String]);
469
470 NSString* pTruncatedPath = [pFullPath stringByDeletingLastPathComponent];
471
472 if (pTruncatedPath)
473 {
474 path.Set([pTruncatedPath UTF8String]);
475 path.Append("/");
476 }
477 }
478
479 if (completionHandler)
480 completionHandler(fileName, path);
481 };
482
483 NSPanel* pPanel = nullptr;
484
485 if (action == EFileAction::Save)
486 {
487 pPanel = [NSSavePanel savePanel];
488
489 [(NSSavePanel*) pPanel setAllowedFileTypes: pFileTypes];
490 [(NSSavePanel*) pPanel setDirectoryURL: [NSURL fileURLWithPath: pDefaultPath]];
491 [(NSSavePanel*) pPanel setNameFieldStringValue: pDefaultFileName];
492 [(NSSavePanel*) pPanel setAllowsOtherFileTypes: NO];
493 }
494 else
495 {
496 pPanel = [NSOpenPanel openPanel];
497
498 [(NSOpenPanel*) pPanel setAllowedFileTypes: pFileTypes];
499 [(NSOpenPanel*) pPanel setDirectoryURL: [NSURL fileURLWithPath: pDefaultPath]];
500 [(NSOpenPanel*) pPanel setCanChooseFiles:YES];
501 [(NSOpenPanel*) pPanel setCanChooseDirectories:NO];
502 [(NSOpenPanel*) pPanel setResolvesAliases:YES];
503 }
504 [pPanel setFloatingPanel: YES];
505
506 if (completionHandler)
507 {
508 NSWindow* pWindow = [(IGRAPHICS_VIEW*) mView window];
509
510 [(NSSavePanel*) pPanel beginSheetModalForWindow:pWindow completionHandler:^(NSModalResponse response) {
511 WDL_String fileNameAsync, pathAsync;
512 doHandleResponse(pPanel, response, fileNameAsync, pathAsync, completionHandler);
513 }];
514 }
515 else
516 {
517 NSModalResponse response = [(NSSavePanel*) pPanel runModal];
518 doHandleResponse(pPanel, response, fileName, path, nullptr);
519 }
520}
521
522void IGraphicsMac::PromptForDirectory(WDL_String& dir, IFileDialogCompletionHandlerFunc completionHandler)
523{
524 NSString* defaultPath;
525
526 if (dir.GetLength())
527 {
528 defaultPath = [NSString stringWithUTF8String:dir.Get()];
529 }
530 else
531 {
532 defaultPath = [NSString stringWithUTF8String:DEFAULT_PATH];
533 dir.Set(DEFAULT_PATH);
534 }
535
536 NSOpenPanel* panelOpen = [NSOpenPanel openPanel];
537
538 [panelOpen setTitle:@"Choose a Directory"];
539 [panelOpen setCanChooseFiles:NO];
540 [panelOpen setCanChooseDirectories:YES];
541 [panelOpen setResolvesAliases:YES];
542 [panelOpen setCanCreateDirectories:YES];
543 [panelOpen setFloatingPanel: YES];
544 [panelOpen setDirectoryURL: [NSURL fileURLWithPath: defaultPath]];
545
546 auto doHandleResponse = [](NSOpenPanel* pPanel, NSModalResponse response, WDL_String& pathAsync, IFileDialogCompletionHandlerFunc completionHandler){
547 if (response == NSOKButton)
548 {
549 NSString* fullPath = [pPanel filename] ;
550 pathAsync.Set([fullPath UTF8String]);
551 pathAsync.Append("/");
552 }
553 else
554 {
555 pathAsync.Set("");
556 }
557
558 if (completionHandler)
559 {
560 WDL_String fileNameAsync; // not used
561 completionHandler(fileNameAsync, pathAsync);
562 }
563 };
564
565 if (completionHandler)
566 {
567 NSWindow* pWindow = [(IGRAPHICS_VIEW*) mView window];
568
569 [panelOpen beginSheetModalForWindow:pWindow completionHandler:^(NSModalResponse response) {
570 WDL_String pathAsync;
571 doHandleResponse(panelOpen, response, pathAsync, completionHandler);
572 }];
573 }
574 else
575 {
576 NSModalResponse response = [panelOpen runModal];
577 doHandleResponse(panelOpen, response, dir, nullptr);
578 }
579}
580
581bool IGraphicsMac::PromptForColor(IColor& color, const char* str, IColorPickerHandlerFunc func)
582{
583 if (mView)
584 return [(IGRAPHICS_VIEW*) mView promptForColor:color : func];
585
586 return false;
587}
588
589IPopupMenu* IGraphicsMac::CreatePlatformPopupMenu(IPopupMenu& menu, const IRECT bounds, bool& isAsync)
590{
591 isAsync = true;
592
593 dispatch_async(dispatch_get_main_queue(), ^{
594 IPopupMenu* pReturnMenu = nullptr;
595
596 if (mView)
597 {
598 NSRect areaRect = ToNSRect(this, bounds);
599 pReturnMenu = [(IGRAPHICS_VIEW*) mView createPopupMenu: menu: areaRect];
600 }
601
602 if (pReturnMenu && pReturnMenu->GetFunction())
603 pReturnMenu->ExecFunction();
604
605 this->SetControlValueAfterPopupMenu(pReturnMenu);
606 });
607
608 return nullptr;
609}
610
611void IGraphicsMac::CreatePlatformTextEntry(int paramIdx, const IText& text, const IRECT& bounds, int length, const char* str)
612{
613 if (mView)
614 {
615 NSRect areaRect = ToNSRect(this, bounds);
616 [(IGRAPHICS_VIEW*) mView createTextEntry: paramIdx : text: str: length: areaRect];
617 }
618}
619
620ECursor IGraphicsMac::SetMouseCursor(ECursor cursorType)
621{
622 if (mView)
623 [(IGRAPHICS_VIEW*) mView setMouseCursor: cursorType];
624
625 return IGraphics::SetMouseCursor(cursorType);
626}
627
628bool IGraphicsMac::OpenURL(const char* url, const char* msgWindowTitle, const char* confirmMsg, const char* errMsgOnFailure)
629{
630 #pragma REMINDER("Warning and error messages for OpenURL not implemented")
631 NSURL* pNSURL = nullptr;
632 if (strstr(url, "http"))
633 pNSURL = [NSURL URLWithString:[NSString stringWithUTF8String:url]];
634 else
635 pNSURL = [NSURL fileURLWithPath:[NSString stringWithUTF8String:url]];
636
637 if (pNSURL)
638 {
639 bool ok = ([[NSWorkspace sharedWorkspace] openURL:pNSURL]);
640 return ok;
641 }
642 return true;
643}
644
645void* IGraphicsMac::GetWindow()
646{
647 if (mView) return mView;
648 else return 0;
649}
650
651// static
652int IGraphicsMac::GetUserOSVersion() // Returns a number like 0x1050 (10.5).
653{
654 return (int) GetSystemVersion();
655}
656
657bool IGraphicsMac::GetTextFromClipboard(WDL_String& str)
658{
659 NSString* pTextOnClipboard = [[NSPasteboard generalPasteboard] stringForType: NSStringPboardType];
660
661 if (pTextOnClipboard == nil)
662 {
663 str.Set("");
664 return false;
665 }
666 else
667 {
668 str.Set([pTextOnClipboard UTF8String]);
669 return true;
670 }
671}
672
673bool IGraphicsMac::SetTextInClipboard(const char* str)
674{
675 NSString* pTextForClipboard = [NSString stringWithUTF8String:str];
676 [[NSPasteboard generalPasteboard] clearContents];
677 return [[NSPasteboard generalPasteboard] setString:pTextForClipboard forType:NSStringPboardType];
678}
679
680bool IGraphicsMac::SetFilePathInClipboard(const char* path)
681{
682 NSPasteboard* pPasteboard = [NSPasteboard generalPasteboard];
683 [pPasteboard clearContents]; // clear pasteboard to take ownership
684 NSURL* pFileURL = [NSURL fileURLWithPath: [NSString stringWithUTF8String:path]];
685 BOOL success = [pPasteboard writeObjects: [NSArray arrayWithObject:pFileURL]];
686 return (bool)success;
687}
688
689bool IGraphicsMac::InitiateExternalFileDragDrop(const char* path, const IRECT& iconBounds)
690{
691 NSPasteboardItem* pasteboardItem = [[NSPasteboardItem alloc] init];
692 NSURL* fileURL = [NSURL fileURLWithPath: [NSString stringWithUTF8String:path]];
693 [pasteboardItem setString:fileURL.absoluteString forType:NSPasteboardTypeFileURL];
694
695 NSDraggingItem* draggingItem = [[NSDraggingItem alloc] initWithPasteboardWriter:pasteboardItem];
696 NSRect draggingFrame = ToNSRect(this, iconBounds);
697 NSImage* iconImage = [[NSWorkspace sharedWorkspace] iconForFile:fileURL.path];
698 [iconImage setSize:NSMakeSize(64, 64)];
699 [draggingItem setDraggingFrame:draggingFrame contents: iconImage];
700
701 IGRAPHICS_VIEW* view = (IGRAPHICS_VIEW*) mView;
702 NSDraggingSession* draggingSession = [view beginDraggingSessionWithItems:@[draggingItem] event:[NSApp currentEvent] source: view];
703 draggingSession.animatesToStartingPositionsOnCancelOrFail = YES;
704 draggingSession.draggingFormation = NSDraggingFormationNone;
705
706 ReleaseMouseCapture();
707
708 return true;
709}
710
711EUIAppearance IGraphicsMac::GetUIAppearance() const
712{
713 if (@available(macOS 10.14, *)) {
714 if(mView)
715 {
716 IGRAPHICS_VIEW* pView = (IGRAPHICS_VIEW*) mView;
717 BOOL isDarkMode = [[[pView effectiveAppearance] name] isEqualToString: (NSAppearanceNameDarkAqua)];
718 return isDarkMode ? EUIAppearance::Dark : EUIAppearance::Light;
719 }
720 }
721
722 return EUIAppearance::Light;
723}
724
725void IGraphicsMac::ActivateGLContext()
726{
727 IGRAPHICS_VIEW* pView = (IGRAPHICS_VIEW*) mView;
728 [pView activateGLContext];
729}
730
731void IGraphicsMac::DeactivateGLContext()
732{
733 IGRAPHICS_VIEW* pView = (IGRAPHICS_VIEW*) mView;
734 [pView deactivateGLContext];
735}
736
737#if defined IGRAPHICS_NANOVG
738 #include "IGraphicsNanoVG.cpp"
739#elif defined IGRAPHICS_SKIA
740 #include "IGraphicsSkia.cpp"
741#else
742 #error Either NO_IGRAPHICS or one and only one choice of graphics library must be defined!
743#endif
This file contains the base IControl implementation, along with some base classes for specific types ...
The lowest level base class of an IGraphics control.
Definition: IControl.h:49
An editor delegate base class that uses IGraphics for the UI.
virtual ECursor SetMouseCursor(ECursor cursorType=ECursor::ARROW)
Sets the mouse cursor to one of ECursor (implementations should return the result of the base impleme...
Definition: IGraphics.h:828
A class for setting the contents of a pop up menu.
Used to manage color data, independent of draw class/platform.
Used to manage a rectangular area, independent of draw class/platform.
bool Empty() const
IText is used to manage font and text/text entry style for a piece of text on the UI,...