BWToolkit / BWViewController.h

//  BWViewController.h
//  BWToolkit
//  Created by Mike on 03/07/2010.
//  Copyright 2010 Karelia Software. All rights reserved.

#import <Cocoa/Cocoa.h>

@interface BWViewController : NSViewController
    NSString            *_identifier;
    BWViewController    *_parent;   // weak ref

#pragma mark View
// Generally override this to do any post-load setup
- (void)viewDidLoad;

#pragma mark Properties
@property(nonatomic, copy) NSString *identifier;
@property(nonatomic, assign) BWViewController *parentViewController;


#pragma mark -

@interface NSViewController (BWViewController)

// This implementation returns nil since there's no good way to provide a setter method on 10.5. But subclasses are welcome to re-implement
- (NSString *)identifier;

//  Default implementations of these do nothing. But you should really call super if you override for forwards compatibility
- (void)viewWillAppear:(BOOL)animated;
- (void)viewDidAppear:(BOOL)animated;
- (void)viewWillDisappear:(BOOL)animated;
- (void)viewDidDisappear:(BOOL)animated;

// Default implementation does nothing. If desired in a subclass, override to store a *weak* reference
- (void)setParentViewController:(BWViewController *)parent;


#pragma mark -

@interface BWViewController (SubclassSupport)

// If you override -loadView NOT to call super, then the last thing you do should be to call -didCustomLoadView. This will take care of calling -viewDidLoad in the correct manner. Do NOT call -viewDidLoad directly yourself!
- (void)didCustomLoadView;