Refactoring code for image drawing

This commit is contained in:
relikd
2019-07-03 14:00:02 +02:00
parent 8e712cae20
commit 29a48384c7
8 changed files with 249 additions and 366 deletions

View File

@@ -40,9 +40,9 @@
self = [super initWithFrame: NSZeroRect];
self.row = 0;
// Insert matrix header (the three icons)
[self head:0 tooltip:NSLocalizedString(@"Show in menu bar", nil) class:[SettingsIconGlobal class]];
[self head:1 tooltip:NSLocalizedString(@"Show in group menu", nil) class:[SettingsIconGroup class]];
[self head:2 tooltip:NSLocalizedString(@"Show in feed menu", nil) class:[RSSIcon class]];
[self head:0 img:RSSImageSettingsGlobal tooltip:NSLocalizedString(@"Show in menu bar", nil)];
[self head:1 img:RSSImageSettingsGroup tooltip:NSLocalizedString(@"Show in group menu", nil)];
[self head:2 img:RSSImageSettingsFeed tooltip:NSLocalizedString(@"Show in feed menu", nil)];
// Generate checkbox matrix (checkbox state, X: default ON, O: default OFF, blank: hidden)
[self entry:"X " label:NSLocalizedString(@"Tint menu bar icon on unread", nil)];
[self entry:"X " label:NSLocalizedString(@"Update all feeds", nil)];
@@ -57,8 +57,8 @@
}
/// Helper method for matrix table header icons
- (void)head:(int)x tooltip:(NSString*)ttip class:(Class)cls {
[[[[cls alloc] initWithFrame:NSMakeRect(0, 0, IconSize, IconSize)] tooltip:ttip] placeIn:self x:PAD_WIN + x * colWidth yTop:PAD_WIN];
- (void)head:(int)x img:(NSImageName)img tooltip:(NSString*)ttip {
[[[NSView imageView:img size:IconSize] tooltip:ttip] placeIn:self x:PAD_WIN + x * colWidth yTop:PAD_WIN];
}
/// Create new entry with 1-3 checkboxes and a descriptive label

View File

@@ -199,7 +199,9 @@ NSUserInterfaceItemIdentifier const CustomCellName = @"NameColumnCell";
self = [super initWithFrame:frameRect];
self.identifier = CustomCellName;
self.imageView = [[NSView imageView:nil size:16] placeIn:self x:1 yTop:1];
self.imageView.accessibilityLabel = NSLocalizedString(@"Feed icon", nil);
self.textField = [[[NSView label:@""] placeIn:self x:25 yTop:0] sizeToRight:0];
self.textField.accessibilityLabel = NSLocalizedString(@"Feed title", nil);
return self;
}
@@ -222,6 +224,7 @@ NSUserInterfaceItemIdentifier const CustomCellRefresh = @"RefreshColumnCell";
self = [super initWithFrame:frameRect];
self.identifier = CustomCellRefresh;
self.textField = [[[[NSView label:@""] textRight] placeIn:self x:0 yTop:0] sizeToRight:0];
self.textField.accessibilityLabel = NSLocalizedString(@"Refresh interval", nil);
return self;
}