/*
Copyright (C) 2002-2003, Jeffrey D. Argast.
The authors make NO WARRANTY or representation, either express or implied,
with respect to this software, its quality, accuracy, merchantability, or
fitness for a particular purpose. This software is provided "AS IS", and you,
its user, assume the entire risk as to its quality and accuracy.
Permission is hereby granted to use, copy, modify, and distribute this
software or portions thereof for any purpose, without fee, subject to these
conditions:
(1) If any part of the source code is distributed, then this
statement must be included, with this copyright and no-warranty notice
unaltered.
(2) Permission for use of this software is granted only if the user accepts
full responsibility for any undesirable consequences; the authors accept
NO LIABILITY for damages of any kind.
*/
#import <AppKit/AppKit.h>
@interface TextControlWithClear : NSControl
{
NSBezierPath* fFocusPath;
BOOL fResetCache;
BOOL fDrawFocusRing;
NSImage* fClearEditIcon;
NSPoint fIconPosition;
NSRect fIconHitRect;
NSRect fTextCellFrame;
NSText* fFieldEditor;
NSImage* fCachedBackground;
IBOutlet id delegate;
}
- (void) setStringValue:(NSString*) stringValue;
- (NSString*) stringValue;
- (void) selectText:(id)sender;
- (void)setDelegate:(id)anObject;
- (id)delegate;
// Since this control is very similar to an NSTextField, it
// has the same delegate methods
- (BOOL)textShouldBeginEditing:(NSText *)textObject;
- (BOOL)textShouldEndEditing:(NSText *)textObject;
- (void)textDidBeginEditing:(NSNotification *)notification;
- (void)textDidEndEditing:(NSNotification *)notification;
- (void)textDidChange:(NSNotification *)notification;
// It also has one more, textDidClear, which is called
// when the text is cleared while NOT editing. If the
// user clicks on the clear widget while editing, it
// simply clears the text but does not call the delegate.
// The signature of the method the delegate should implement
// is exactly the same as this textDidClear (unlike
// the delegates for NSTextField which all have control
// prepended).
- (void) textDidClear:(NSControl*)sender;
@end