Browse Source

Added method Desktop::isOSXDarkModeActive()

tags/2021-05-28
jules 10 years ago
parent
commit
28a322138d
4 changed files with 14 additions and 9 deletions
  1. +1
    -1
      modules/juce_core/files/juce_File.cpp
  2. +5
    -0
      modules/juce_gui_basics/components/juce_Desktop.h
  3. +1
    -4
      modules/juce_gui_basics/native/juce_ios_Windowing.mm
  4. +7
    -4
      modules/juce_gui_basics/native/juce_mac_Windowing.mm

+ 1
- 1
modules/juce_core/files/juce_File.cpp 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");


+ 5
- 0
modules/juce_gui_basics/components/juce_Desktop.h 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;


+ 1
- 4
modules/juce_gui_basics/native/juce_ios_Windowing.mm 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"]);
}
//==============================================================================


+ 7
- 4
modules/juce_gui_basics/native/juce_mac_Windowing.mm 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")];
}

Loading…
Cancel
Save