ref: 810814823f35c158fa667896c6176950470b66a4
parent: ae6c7381272f84c0fd398f6d3e496f571ba42ec8
author: Simon Tatham <[email protected]>
date: Wed Apr 9 10:36:08 EDT 2008
Implement tick marks in the Type menu on OS X. [originally from svn r7981]
--- a/osx.m
+++ b/osx.m
@@ -426,6 +426,7 @@
- (void)deactivateTimer;
- (void)setStatusLine:(char *)text;
- (void)resizeForNewGameParams;
+- (void)updateTypeMenuTick;
@end
@implementation MyImageView
@@ -766,6 +767,7 @@
}
[self resizeForNewGameParams];
+ [self updateTypeMenuTick];
}
}
- (void)undoMove:(id)sender
@@ -815,8 +817,21 @@
{
while ([typemenu numberOfItems] > 1)
[typemenu removeItemAtIndex:0];
+ [[typemenu itemAtIndex:0] setState:NSOffState];
}
+- (void)updateTypeMenuTick
+{
+ int i, total, n;
+
+ total = [typemenu numberOfItems];
+ n = midend_which_preset(me);
+ if (n < 0)
+ n = total - 1; /* that's always where "Custom" lives */
+ for (i = 0; i < total; i++)
+ [[typemenu itemAtIndex:i] setState:(i == n ? NSOnState : NSOffState)];
+}
+
- (void)becomeKeyWindow
{
int n;
@@ -849,6 +864,8 @@
[typemenu insertItem:item atIndex:0];
}
}
+
+ [self updateTypeMenuTick];
}
- (void)resignKeyWindow
@@ -894,6 +911,7 @@
midend_new_game(me);
[self resizeForNewGameParams];
+ [self updateTypeMenuTick];
}
- (void)startConfigureSheet:(int)which
@@ -1215,6 +1233,7 @@
} else {
midend_new_game(me);
[self resizeForNewGameParams];
+ [self updateTypeMenuTick];
}
}
sfree(cfg_controls);