mirror of
https://github.com/netbirdio/systray.git
synced 2026-05-22 17:08:41 -07:00
Made statusItem imagePosition update based on if title and/or icon exists on mac
This commit is contained in:
+15
-1
@@ -65,13 +65,27 @@
|
||||
|
||||
- (void)setIcon:(NSImage *)image {
|
||||
statusItem.button.image = image;
|
||||
statusItem.button.imagePosition = NSImageLeft;
|
||||
[self updateTitleButtonStyle];
|
||||
}
|
||||
|
||||
- (void)setTitle:(NSString *)title {
|
||||
statusItem.button.title = title;
|
||||
[self updateTitleButtonStyle];
|
||||
}
|
||||
|
||||
-(void)updateTitleButtonStyle {
|
||||
if (statusItem.button.image != nil) {
|
||||
if ([statusItem.button.title length] == 0) {
|
||||
statusItem.button.imagePosition = NSImageOnly;
|
||||
} else {
|
||||
statusItem.button.imagePosition = NSImageLeft;
|
||||
}
|
||||
} else {
|
||||
statusItem.button.imagePosition = NSNoImage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)setTooltip:(NSString *)tooltip {
|
||||
statusItem.button.toolTip = tooltip;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user