1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-14 00:14:18 +00:00

Added method Desktop::isOSXDarkModeActive()

This commit is contained in:
jules 2016-02-03 11:30:55 +00:00
parent 48ea4da185
commit 28a322138d
4 changed files with 14 additions and 9 deletions

View file

@ -1048,7 +1048,7 @@ public:
expect (! tempFile.withFileExtension ("h").hasFileExtension ("bar;foo;xx"));
expect (tempFile.getSiblingFile ("foo").isAChildOf (temp));
expect (tempFile.hasWriteAccess());
expect (home.getChildFile (".") == home);
expect (home.getChildFile ("..") == home.getParentDirectory());
expect (home.getChildFile (".xyz").getFileName() == ".xyz");

View file

@ -394,6 +394,11 @@ public:
/** True if the OS supports semitransparent windows */
static bool canUseSemiTransparentWindows() noexcept;
#if JUCE_MAC
/** OSX-specific function to check for the "dark" title-bar and menu mode. */
static bool isOSXDarkModeActive();
#endif
private:
//==============================================================================
static Desktop* instance;

View file

@ -363,10 +363,7 @@ void SystemClipboard::copyTextToClipboard (const String& text)
String SystemClipboard::getTextFromClipboard()
{
if (NSString* text = [[UIPasteboard generalPasteboard] valueForPasteboardType: @"public.text"])
return nsStringToJuce (text);
return String();
return nsStringToJuce ([[UIPasteboard generalPasteboard] valueForPasteboardType: @"public.text"]);
}
//==============================================================================

View file

@ -431,10 +431,7 @@ void SystemClipboard::copyTextToClipboard (const String& text)
String SystemClipboard::getTextFromClipboard()
{
NSString* text = [[NSPasteboard generalPasteboard] stringForType: NSStringPboardType];
return text == nil ? String()
: nsStringToJuce (text);
return nsStringToJuce ([[NSPasteboard generalPasteboard] stringForType: NSStringPboardType]);
}
void Process::setDockIconVisible (bool isVisible)
@ -447,3 +444,9 @@ void Process::setDockIconVisible (bool isVisible)
jassertfalse; // sorry, not available in 10.5!
#endif
}
bool Desktop::isOSXDarkModeActive()
{
return [[[NSUserDefaults standardUserDefaults] stringForKey: nsStringLiteral ("AppleInterfaceStyle")]
isEqualToString: nsStringLiteral ("Dark")];
}