Skip to content

Commit

Permalink
forward declare missing colors
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Jan 3, 2019
1 parent 46298ef commit 0be9257
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
11 changes: 4 additions & 7 deletions atom/browser/api/atom_api_system_preferences_mac.mm
Expand Up @@ -7,13 +7,13 @@
#include <map>

#import <AVFoundation/AVFoundation.h>
#import <AppKit/NSColor.h>
#import <Cocoa/Cocoa.h>

#include "atom/browser/mac/atom_application.h"
#include "atom/browser/mac/dict_util.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "base/strings/stringprintf.h"
#include "base/strings/sys_string_conversions.h"
#include "base/values.h"
#include "native_mate/object_template_builder.h"
Expand Down Expand Up @@ -107,12 +107,9 @@ AVMediaType ParseMediaType(const std::string& media_type) {

// Convert color to RGB hex value like "#ABCDEF"
std::string ToRGBHex(NSColor* color) {
NSString* rgbHex = [NSString
stringWithFormat:@"#%02X%02X%02X", (int)(color.redComponent * 0xFF),
(int)(color.greenComponent * 0xFF),
(int)(color.blueComponent * 0xFF)];

return std::string([rgbHex UTF8String]);
return base::StringPrintf("#%02X%02X%02X", (int)(color.redComponent * 0xFF),
(int)(color.greenComponent * 0xFF),
(int)(color.blueComponent * 0xFF));
}

} // namespace
Expand Down
21 changes: 21 additions & 0 deletions atom/browser/mac/atom_application.h
Expand Up @@ -37,6 +37,27 @@ typedef NS_ENUM(NSInteger, AVAuthorizationStatusMac) {
(AVMediaType)mediaType API_AVAILABLE(macosx(10.14));
@end

@interface NSColor (MojaveSDK)
@property(class, strong, readonly)
NSColor* systemBlueColor API_AVAILABLE(macosx(10.10));
@property(class, strong, readonly)
NSColor* systemBrownColor API_AVAILABLE(macosx(10.10));
@property(class, strong, readonly)
NSColor* systemGrayColor API_AVAILABLE(macosx(10.10));
@property(class, strong, readonly)
NSColor* systemGreenColor API_AVAILABLE(macosx(10.10));
@property(class, strong, readonly)
NSColor* systemOrangeColor API_AVAILABLE(macosx(10.10));
@property(class, strong, readonly)
NSColor* systemPinkColor API_AVAILABLE(macosx(10.10));
@property(class, strong, readonly)
NSColor* systemPurpleColor API_AVAILABLE(macosx(10.10));
@property(class, strong, readonly)
NSColor* systemRedColor API_AVAILABLE(macosx(10.10));
@property(class, strong, readonly)
NSColor* systemYellowColor API_AVAILABLE(macosx(10.10));
@end

extern "C" {
#if !defined(MAC_OS_X_VERSION_10_14) || \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_14
Expand Down

0 comments on commit 0be9257

Please sign in to comment.