- (id) initWithTitle:(NSString *)title buttons:(NSArray *)buttons defaultButtonIndex:(int)index {
if ((self = [super init])) {
+ [self setTitle:title];
[self setDelegate:self];
for (NSString *button in buttons) [self addButtonWithTitle:button];
[self setCancelButtonIndex:index];
button_ = buttonIndex + 1;
}
+- (void) dismiss {
+ [self dismissWithClickedButtonIndex:-1 animated:YES];
+}
+
- (int) yieldToPopupAlertAnimated:(BOOL)animated {
button_ = 0;
- [self popupAlertAnimated:animated];
+ [self show];
NSRunLoop *loop([NSRunLoop currentRunLoop]);
NSDate *future([NSDate distantFuture]);
while (button_ == 0 && [loop runMode:NSDefaultRunLoopMode beforeDate:future]);
defaultButtonIndex:0
] autorelease]);
- [sheet setBodyText:error];
+ [sheet setMessage:error];
[sheet yieldToPopupAlertAnimated:YES];
[sheet dismiss];
}
defaultButtonIndex:-1
] autorelease]);
- [role setBodyText:UCLocalize("ROLE_EX")];
+ [role setMessage:UCLocalize("ROLE_EX")];
int button([role yieldToPopupAlertAnimated:YES]);