diff options
| author | Aksel Kornesjö | 2018-10-16 13:29:12 +0200 | 
|---|---|---|
| committer | Aksel Kornesjö | 2018-10-16 13:29:12 +0200 | 
| commit | 6f103f9f13a325617926c2e66da5ff3e0700f919 (patch) | |
| tree | 0c8f6f984b0a01b6045366d130b347fd31cbb8e5 /systray_darwin.m | |
| parent | f644d12312f2231d4677f8382407f81c2880803c (diff) | |
| download | systray-6f103f9f13a325617926c2e66da5ff3e0700f919.tar.bz2 | |
Made statusItem imagePosition update based on if title and/or icon exists on mac
Diffstat (limited to 'systray_darwin.m')
| -rw-r--r-- | systray_darwin.m | 16 | 
1 files changed, 15 insertions, 1 deletions
| diff --git a/systray_darwin.m b/systray_darwin.m index 3e5e2ff..e466948 100644 --- a/systray_darwin.m +++ b/systray_darwin.m @@ -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;  } | 
