/* NSControl.h Application Kit Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import @class NSCell, NSFont, NSTextView, NSNotification, NSAttributedString, NSFormatter; @interface NSControl : NSView { /*All instance variables are private*/ NSInteger _tag; id _cell; struct __conFlags { unsigned int enabled:1; unsigned int ignoreMultiClick:1; unsigned int calcSize:1; unsigned int drawingAncestor:1; unsigned int ibReserved:1; unsigned int updateCellFocus:1; unsigned int allowsLogicalLayoutDirection:1; unsigned int asmlwidth:1; unsigned int hsmlwidth:1; unsigned int dontValidate:1; unsigned int reserved:22; } _conFlags; } + (void)setCellClass:(Class)factoryId; + (Class)cellClass; - (id)initWithFrame:(NSRect)frameRect; - (void)sizeToFit; - (void)calcSize; - (id)cell; - (void)setCell:(NSCell *)aCell; - (id)selectedCell; - (id)target; - (void)setTarget:(id)anObject; - (SEL)action; - (void)setAction:(SEL)aSelector; - (NSInteger)tag; - (void)setTag:(NSInteger)anInt; - (NSInteger)selectedTag; - (void)setIgnoresMultiClick:(BOOL)flag; - (BOOL)ignoresMultiClick; - (NSInteger)sendActionOn:(NSInteger)mask; - (BOOL)isContinuous; - (void)setContinuous:(BOOL)flag; - (BOOL)isEnabled; - (void)setEnabled:(BOOL)flag; - (NSTextAlignment)alignment; - (void)setAlignment:(NSTextAlignment)mode; - (NSFont *)font; - (void)setFont:(NSFont *)fontObj; - (void)setFormatter:(NSFormatter *)newFormatter; - (id)formatter; - (void)setObjectValue:(id)obj; - (void)setStringValue:(NSString *)aString; - (void)setIntValue:(int)anInt; - (void)setFloatValue:(float)aFloat; - (void)setDoubleValue:(double)aDouble; - (id)objectValue; - (NSString *)stringValue; - (int)intValue; - (float)floatValue; - (double)doubleValue; - (void)setNeedsDisplay; - (void)updateCell:(NSCell *)aCell; - (void)updateCellInside:(NSCell *)aCell; - (void)drawCellInside:(NSCell *)aCell; - (void)drawCell:(NSCell *)aCell; - (void)selectCell:(NSCell *)aCell; - (BOOL)sendAction:(SEL)theAction to:(id)theTarget; - (void)takeIntValueFrom:(id)sender; - (void)takeFloatValueFrom:(id)sender; - (void)takeDoubleValueFrom:(id)sender; - (void)takeStringValueFrom:(id)sender; - (void)takeObjectValueFrom:(id)sender; - (NSText *)currentEditor; - (BOOL)abortEditing; - (void)validateEditing; - (void)mouseDown:(NSEvent *)theEvent; - (NSWritingDirection)baseWritingDirection; - (void)setBaseWritingDirection:(NSWritingDirection)writingDirection; - (NSInteger)integerValue NS_AVAILABLE_MAC(10_5); - (void)setIntegerValue:(NSInteger)anInteger NS_AVAILABLE_MAC(10_5); - (void)takeIntegerValueFrom:(id)sender NS_AVAILABLE_MAC(10_5); /* Gets and sets the ability for expansion tool tips to be shown or not. Expansion tooltips are automatically shown when the cell can not show the full content. This is controlled by the NSCell API expansionFrameWithFrame:inView: and is drawn by drawWithExpansionFrame:inView:. The default value is NO. This value is encoded along with the control. In general, it is recommended to turn this on for NSTextFields in a View Based NSTableView. */ - (BOOL)allowsExpansionToolTips NS_AVAILABLE_MAC(10_8); - (void)setAllowsExpansionToolTips:(BOOL)value NS_AVAILABLE_MAC(10_8); @end @interface NSControl(NSKeyboardUI) - (void)performClick:sender; - (void)setRefusesFirstResponder:(BOOL)flag; - (BOOL)refusesFirstResponder; @end @interface NSObject(NSControlSubclassNotifications) - (void)controlTextDidBeginEditing:(NSNotification *)obj; - (void)controlTextDidEndEditing:(NSNotification *)obj; - (void)controlTextDidChange:(NSNotification *)obj; @end @protocol NSControlTextEditingDelegate @optional // These delegate and notification methods are sent from NSControl subclasses that allow text editing such as NSTextField and NSMatrix. The classes that need to send these have delegates. NSControl does not. - (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor; - (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor; - (BOOL)control:(NSControl *)control didFailToFormatString:(NSString *)string errorDescription:(NSString *)error; - (void)control:(NSControl *)control didFailToValidatePartialString:(NSString *)string errorDescription:(NSString *)error; - (BOOL)control:(NSControl *)control isValidObject:(id)obj; - (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector; - (NSArray *)control:(NSControl *)control textView:(NSTextView *)textView completions:(NSArray *)words forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteger *)index; @end // userInfo keys: APPKIT_EXTERN NSString *NSControlTextDidBeginEditingNotification; // @"NSFieldEditor" APPKIT_EXTERN NSString *NSControlTextDidEndEditingNotification; // @"NSFieldEditor" APPKIT_EXTERN NSString *NSControlTextDidChangeNotification; // @"NSFieldEditor" @interface NSControl(NSControlAttributedStringMethods) - (NSAttributedString *)attributedStringValue; - (void)setAttributedStringValue:(NSAttributedString *)obj; @end @interface NSControl (NSDeprecated) // Use formatters instead. See -[NSControl formatter] and -[NSControl setFormatter:]. - (void)setFloatingPointFormat:(BOOL)autoRange left:(NSUInteger)leftDigits right:(NSUInteger)rightDigits NS_DEPRECATED_MAC(10_0, 10_0); @end