From 3041164cc01a185c96c1f05fd87fdc807616409d Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 24 Jan 2005 07:42:01 +0000 Subject: [PATCH] Added a dock menu which makes it more convenient to launch a new game window. git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5184 cda61777-01e9-0310-a592-d414129be87e --- osx.m | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/osx.m b/osx.m index fae2e15..2514130 100644 --- a/osx.m +++ b/osx.m @@ -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")]; -- 2.11.0