mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-19 04:59:35 +00:00
Using background color attribute on entries to dispaly colorized images
This commit is contained in:
@@ -35,6 +35,8 @@ typedef NS_ENUM(NSInteger, MPIconDownloadStatus) {
|
||||
@interface MPIconSelectViewController () <NSCollectionViewDelegate>
|
||||
|
||||
/* UI properties */
|
||||
@property (weak) IBOutlet NSColorWell *foregroundColorWell;
|
||||
@property (weak) IBOutlet NSColorWell *backgroundColorWell;
|
||||
@property (weak) IBOutlet MPCollectionView *iconCollectionView;
|
||||
@property (weak) IBOutlet NSButton *imageButton;
|
||||
@property (weak) IBOutlet NSButton *downloadIconButton;
|
||||
@@ -63,6 +65,18 @@ typedef NS_ENUM(NSInteger, MPIconDownloadStatus) {
|
||||
[menu addItem:[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"DELETE", @"") action:@selector(deleteIcon:) keyEquivalent:@""]];
|
||||
self.iconCollectionView.menu = menu;
|
||||
|
||||
KPKEntry *entry = [self.representedObject asEntry];
|
||||
if(entry) {
|
||||
self.foregroundColorWell.enabled = YES;
|
||||
self.foregroundColorWell.color = entry.foregroundColor ? entry.foregroundColor : NSColor.clearColor;
|
||||
self.backgroundColorWell.enabled = YES;
|
||||
self.backgroundColorWell.color = entry.backgroundColor ? entry.backgroundColor : NSColor.clearColor;
|
||||
}
|
||||
else {
|
||||
self.foregroundColorWell.enabled = NO;
|
||||
self.backgroundColorWell.enabled = NO;
|
||||
}
|
||||
|
||||
[self _updateCollectionViewContent];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user