
#import "ChangingAlert.h"
#import "MyButton.h"

@implementation ChangingAlert

- appDidInit:sender
{
    NXRect              fr;
    NXModalSession      session;

    [YesChanger setTargetButton:YesB :NoB];
    [NoChanger setTargetButton:NoB :YesB];
    [myPanel makeKeyAndOrderFront:self];
    [NXApp beginModalSession:&session for:myPanel];
    [myPanel addToEventMask:NX_MOUSEENTEREDMASK];
    [YesChanger getFrame:&fr];
    [myPanel setTrackingRect:&fr
     inside:(BOOL)NO
     owner:YesChanger
     tag:(int)1
     left:(BOOL)NO
     right:(BOOL)NO];
    [NoChanger getFrame:&fr];
    [myPanel setTrackingRect:&fr
     inside:(BOOL)NO
     owner:NoChanger
     tag:(int)2
     left:(BOOL)NO
     right:(BOOL)NO];
    [myPanel makeFirstResponder:myPanel];
    for (;;) {
	if ([NXApp runModalSession:&session] != NX_RUNCONTINUES)
	    break;
    }
    [NXApp endModalSession:&session];

    return self;
}

- Yes:sender
{
    [NXApp stopModal];
    NXRunAlertPanel(NULL, "You said YES!",
		    "I did not mean it.", NULL, NULL);
    [myPanel orderOut:self];
	[infoPanel perform:@selector(makeKeyAndOrderFront:) with :self
	 afterDelay:3000 cancelPrevious:YES];

    return self;
}


@end
