//
//  MFClickThroughDisabler.h
//
//  Copyright (c) 2003 Michel Fortin.
//
//  This program is free software; you can redistribute it and/or modify it
//  under the terms of the GNU Lesser General Public License as published by the
//  Free Software Foundation, version 2 of the License or any later version.
//
//  http://michelf.webhop.org/lgpl.html
//

#import <Cocoa/Cocoa.h>

//  A MFClickThroughDisabler disable or enable a control depending on the window
//  status in order to remove the click-through behaviour as described in the 
//  Aqua Human Interface Guidelines. This prevent a control from being clicked 
//  while the window is not the main window.
//
//  Note: if you want to disable a control with a MFClickThroughDisabler
//  attached, you should detach the disabler [disabler setControl:nil] to
//  prevent it from activating the control when the window become main again.
//
//  Borrowed from the guidelines, here are the cases you should disable 
//  click-through:
//
//  Don't provide click-through for items or actions that 
//  * are potentially harmful (for example, the Delete button in Mail)
//  * are difficult to recover from, such as
//    * actions that are difficult or impossible to cancel (the Send button in 
//      Mail)
//    * dismissing a dialog without knowing what action was taken (for example, 
//      it's not easy to "unsave" a document)
//    * removing the user from the current context (selecting a new item in a 
//      column, for example, can change the target of the Finder window)

@interface MFClickThroughDisabler : NSObject {
	IBOutlet NSControl *control;
}

// Create a MFClickThroughtDisabler tied to a control
+ (id)clickThroughDisablerWithControl:(NSControl *)aControl;
- (id)initWithControl:(NSControl *)aControl;

- (NSControl *)control;
- (void)setControl:(NSControl *)aControl;
// You can set control to nil to "disable the disabler".

@end
