Skip to content

Commit

Permalink
Add OakTheme: An Objective-C version of theme_t
Browse files Browse the repository at this point in the history
This doesn’t do any caching of style lookups so performance is worse than theme_t and it also lacks an API to control the initial base font.

For now, the intention is to use this for system dialogs, such as the Find dialog, but long-term it should also be used by OakTextView, at which point, caching and base font support should be added.
  • Loading branch information
sorbits committed Nov 22, 2018
1 parent 82de801 commit db41b4b
Show file tree
Hide file tree
Showing 3 changed files with 455 additions and 1 deletion.
27 changes: 27 additions & 0 deletions Frameworks/theme/src/OakTheme.h
@@ -0,0 +1,27 @@
#include <bundles/bundles.h>
#include <scope/scope.h>

@class OakThemeStyles;

@interface OakTheme : NSObject
@property (nonatomic, readonly) NSUUID* identifier;
@property (nonatomic, readonly) NSColor* foregroundColor;
@property (nonatomic, readonly) NSColor* backgroundColor;
@property (nonatomic, readonly) NSFont* font;
+ (instancetype)theme;
- (instancetype)initWithBundleItem:(bundles::item_ptr const&)themeItem;
- (OakThemeStyles*)stylesForScope:(scope::scope_t const&)scope;
@end

@interface OakThemeStyles : NSObject
@property (nonatomic, readonly) NSColor* foregroundColor;
@property (nonatomic, readonly) NSColor* backgroundColor;
@property (nonatomic, readonly) NSColor* caretColor;
@property (nonatomic, readonly) NSColor* selectionColor;
@property (nonatomic, readonly) NSColor* invisiblesColor;
@property (nonatomic, readonly) NSFont* font;
@property (nonatomic, readonly) NSFontDescriptorSymbolicTraits fontTraits;
@property (nonatomic, readonly) BOOL underlined;
@property (nonatomic, readonly) BOOL strikethrough;
@property (nonatomic, readonly) BOOL misspelled;
@end

0 comments on commit db41b4b

Please sign in to comment.