diff options
| author | Simon Tatham <anakin@pobox.com> | 2005-01-24 07:42:01 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2005-01-24 07:42:01 +0000 |
| commit | d90e909d66d6c3691215f8ea6ed8fa07cccd9c45 (patch) | |
| tree | 62c068a0562e9917b29a1fe62b152fb79970fa40 /osx.m | |
| parent | 5b695b8d8bac1dca52a696cfa8207311ca28af47 (diff) | |
| download | puzzles-d90e909d66d6c3691215f8ea6ed8fa07cccd9c45.zip puzzles-d90e909d66d6c3691215f8ea6ed8fa07cccd9c45.tar.gz puzzles-d90e909d66d6c3691215f8ea6ed8fa07cccd9c45.tar.bz2 puzzles-d90e909d66d6c3691215f8ea6ed8fa07cccd9c45.tar.xz | |
Added a dock menu which makes it more convenient to launch a new
game window.
[originally from svn r5184]
Diffstat (limited to 'osx.m')
| -rw-r--r-- | osx.m | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -10,11 +10,6 @@ * think help is HTML round here anyway so perhaps we can work * with what we already have. * - * - Can we arrange for a pop-up menu from the Dock icon which - * launches specific games, perhaps? - * + apparently we can; see the NSApplication method - * `applicationDockMenu:'. Good good. Do so. - * * - Why are the right and bottom edges of the Pattern grid one * pixel thinner than they should be? * @@ -1105,6 +1100,23 @@ void status_bar(frontend *fe, char *text) [win makeKeyAndOrderFront:self]; } +- (NSMenu *)applicationDockMenu:(NSApplication *)sender +{ + NSMenu *menu = newmenu("Dock Menu"); + { + int i; + + for (i = 0; i < gamecount; i++) { + id item = + initnewitem([DataMenuItem allocWithZone:[NSMenu menuZone]], + menu, gamelist[i]->name, "", self, + @selector(newGame:)); + [item setPayload:(void *)gamelist[i]]; + } + } + return menu; +} + @end /* ---------------------------------------------------------------------- @@ -1125,6 +1137,7 @@ int main(int argc, char **argv) [NSApp setApplicationIconImage:icon]; controller = [[[AppController alloc] init] autorelease]; + [NSApp setDelegate:controller]; [NSApp setMainMenu: newmenu("Main Menu")]; |