diff options
| author | joesis | 2018-10-17 03:17:44 -0700 | 
|---|---|---|
| committer | GitHub | 2018-10-17 03:17:44 -0700 | 
| commit | ea180a21ded587d29f409c5dbb978c0a2ec494cb (patch) | |
| tree | 0c8f6f984b0a01b6045366d130b347fd31cbb8e5 /systray_darwin.m | |
| parent | 89b3d9c45cc69f861868cc7f3159eba2b4cdfb22 (diff) | |
| parent | 6f103f9f13a325617926c2e66da5ff3e0700f919 (diff) | |
| download | systray-ea180a21ded587d29f409c5dbb978c0a2ec494cb.tar.bz2 | |
Merge pull request #66 from jefvel/fix-mac-deprecations
Fix mac deprecations
Diffstat (limited to 'systray_darwin.m')
| -rw-r--r-- | systray_darwin.m | 29 | 
1 files changed, 22 insertions, 7 deletions
| diff --git a/systray_darwin.m b/systray_darwin.m index a489bc4..e466948 100644 --- a/systray_darwin.m +++ b/systray_darwin.m @@ -64,15 +64,30 @@  }  - (void)setIcon:(NSImage *)image { -  [statusItem setImage:image]; +  statusItem.button.image = image; +  [self updateTitleButtonStyle];  }  - (void)setTitle:(NSString *)title { -  [statusItem setTitle: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 setToolTip:tooltip]; +  statusItem.button.toolTip = tooltip;  }  - (IBAction)menuHandler:(id)sender @@ -97,14 +112,14 @@    }    [menuItem setToolTip:item->tooltip];    if (item->disabled == 1) { -    [menuItem setEnabled:FALSE]; +    menuItem.enabled = FALSE;    } else { -    [menuItem setEnabled:TRUE]; +    menuItem.enabled = TRUE;    }    if (item->checked == 1) { -    [menuItem setState:NSOnState]; +    menuItem.state = NSControlStateValueOn;    } else { -    [menuItem setState:NSOffState]; +    menuItem.state = NSControlStateValueOff;    }  } | 
