/*
        Copyright (c) 1996, NeXT Software, Inc.
        All rights reserved.

        You may freely copy, distribute and reuse the code in this example.
        NeXT disclaims any warranty of any kind, expressed or implied,
        as to its fitness for any particular use.
*/
#import "ExampleController.h"

@implementation ExampleController

- (BOOL)alertOrLoadNibNamed:(NSString *)nibName owner:(id)owner
{
    if ([NSBundle loadNibNamed:nibName owner:owner])
        return YES;
    NSRunAlertPanel(@"AssociationExample", @"Unable to load interface file %@", @"OK", NULL, NULL, nibName);

    return NO;
}

- (void)callPopUpDynamic:(id)sender
{
    if (!popupDynamicWindow)
        [self alertOrLoadNibNamed:@"PopUpDynamic" owner:self];

    [popupDynamicWindow makeKeyAndOrderFront:self];
}

- (void)callBrowser:(id)sender
{
    if (!browserWindow)
        [self alertOrLoadNibNamed:@"Browser" owner:self];

    [browserWindow makeKeyAndOrderFront:self];
}

- (void)callPickAMovie:(id)sender
{
    if (!pickAMovieWindow)
        [self alertOrLoadNibNamed:@"PickAMovie" owner:self];

    [pickAMovieWindow makeKeyAndOrderFront:self];
}

@end
