/* inspectors - Various inspectors for control elements Copyright (C) 2001 Free Software Foundation, Inc. Author: Adam Fedor Laurent Julliard Date: Aug 2001 This file is part of GNUstep. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include "../../GormPrivate.h" /*---------------------------------------------------------------------------- NSBox */ @implementation NSBox (IBInspectorClassNames) - (NSString*) inspectorClassName { return @"GormBoxAttributesInspector"; } @end @interface GormBoxAttributesInspector : IBInspector { id positionMatrix; id borderMatrix; id titleField; id horizontalSlider; id verticalSlider; } @end @implementation GormBoxAttributesInspector - (void) _setValuesFromControl: control { if (control == positionMatrix) { [object setTitlePosition: [[control selectedCell] tag] ]; } else if (control == borderMatrix) { [object setBorderType: [[control selectedCell] tag] ]; } else if (control == titleField) { [object setTitle: [[control cellAtIndex: 0] stringValue] ]; } else if (control == horizontalSlider) { [object setContentViewMargins: NSMakeSize([control floatValue], [verticalSlider floatValue]) ]; } else if (control == verticalSlider) { [object setContentViewMargins: NSMakeSize([horizontalSlider floatValue], [control floatValue]) ]; }} - (void) _getValuesFromObject: anObject { if (anObject != object) return; [positionMatrix selectCellWithTag: [anObject titlePosition] ]; [borderMatrix selectCellWithTag: [anObject borderType] ]; [[titleField cellAtIndex: 0] setStringValue: [anObject title] ]; [horizontalSlider setFloatValue: [anObject contentViewMargins].width]; [verticalSlider setFloatValue: [anObject contentViewMargins].height]; } - (void) controlTextDidEndEditing: (NSNotification*)aNotification { id notifier = [aNotification object]; [self _setValuesFromControl: notifier]; } - (void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver: self]; RELEASE(window); [super dealloc]; } - (id) init { if ([super init] == nil) return nil; if ([NSBundle loadNibNamed: @"GormBoxInspector" owner: self] == NO) { NSLog(@"Could not gorm GormBoxInspector"); return nil; } [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(controlTextDidEndEditing:) name: NSControlTextDidEndEditingNotification object: nil]; return self; } - (void) ok: (id)sender { NSDebugLog(@"ok: sender : %@", sender); [self _setValuesFromControl: sender]; } - (void) setObject: (id)anObject { [super setObject: anObject]; [self _getValuesFromObject: anObject]; } @end /*---------------------------------------------------------------------------- NSButton */ @implementation NSButton (IBInspectorClassNames) - (NSString*) inspectorClassName { return @"GormButtonAttributesInspector"; } @end @interface GormButtonAttributesInspector : IBInspector { id alignMatrix; id iconMatrix; id keyField; id optionMatrix; id tagField; id titleForm; id typeButton; } - (void) _getValuesFromObject: anObject; @end @implementation GormButtonAttributesInspector /* The button type isn't stored in the button, so reverse-engineer it */ - (NSButtonType) buttonTypeForObject: button { NSButtonCell *cell; NSButtonType type; int highlight, stateby; /* We could be passed the button or the cell */ cell = ([button isKindOfClass: [NSButton class]]) ? [button cell] : button; highlight = [cell highlightsBy]; stateby = [cell showsStateBy]; NSDebugLog(@"highlight = %d, stateby = %d",[cell highlightsBy],[cell showsStateBy]); type = NSMomentaryPushButton; if (highlight == NSChangeBackgroundCellMask) { if (stateby == NSNoCellMask) type = NSMomentaryLight; else type = NSOnOffButton; } else if (highlight == (NSPushInCellMask | NSChangeGrayCellMask) ) { if (stateby == NSNoCellMask) type = NSMomentaryPushButton; else type = NSPushOnPushOffButton; } else if (highlight == (NSPushInCellMask | NSContentsCellMask) ) { type = NSToggleButton; } else if (highlight == NSContentsCellMask) { if (stateby == NSNoCellMask) type = NSMomentaryChangeButton; else type = NSToggleButton; /* Really switch or radio. What should it be? */ } else NSDebugLog(@"Ack! no button type"); return type; } /* We may need to reset some parameters based on the previous type */ - (void) setButtonType: (NSButtonType)type forObject: button { [object setButtonType: type ]; } - (void) _setValuesFromControl: control { if (control == alignMatrix) { [object setAlignment: (NSTextAlignment)[[control selectedCell] tag] ]; } else if (control == iconMatrix) { [object setImagePosition: (NSCellImagePosition)[[control selectedCell] tag] ]; } else if (control == keyField) { [object setKeyEquivalent: [[control cellAtIndex: 0] stringValue] ]; } else if (control == optionMatrix) { BOOL flag; flag = ([[control cellAtRow: 0 column: 0] state] == NSOnState) ? YES : NO; [object setBordered: flag]; flag = ([[control cellAtRow: 1 column: 0] state] == NSOnState) ? YES : NO; [object setContinuous: flag]; flag = ([[control cellAtRow: 2 column: 0] state] == NSOnState) ? YES : NO; [object setEnabled: flag]; [object setState: [[control cellAtRow: 3 column: 0] state]]; flag = ([[control cellAtRow: 4 column: 0] state] == NSOnState) ? YES : NO; [object setTransparent: flag]; } else if (control == tagField) { [object setTag: [[control cellAtIndex: 0] intValue] ]; } else if (control == titleForm) { NSString *string; NSImage *image; [object setTitle: [[control cellAtIndex: 0] stringValue] ]; [object setAlternateTitle: [[control cellAtIndex: 1] stringValue] ]; string = [[control cellAtIndex: 2] stringValue]; if ([string length] > 0) { image = [NSImage imageNamed: string ]; [object setImage: image ]; } string = [[control cellAtIndex: 3] stringValue]; if ([string length] > 0) { image = [NSImage imageNamed: string ]; [object setAlternateImage: image ]; } } else if ([control isKindOfClass: [NSMenuItem class]]) { // We do receive the selected menu item here. Not the PopUpbutton 'typeButton' // FIXME: Ideally we should test if the menu item belongs to the 'type button' // control. How to do that? NSDebugLog(@"button type from OK= %d",[control tag]); [self setButtonType: [control tag] forObject: object]; } } - (void) _getValuesFromObject: anObject { NSImage *image; if (anObject != object) return; [alignMatrix selectCellWithTag: [anObject alignment] ]; [iconMatrix selectCellWithTag: [anObject imagePosition] ]; [[keyField cellAtIndex: 0] setStringValue: [anObject keyEquivalent] ]; [optionMatrix deselectAllCells]; if ([anObject isBordered]) [optionMatrix selectCellAtRow: 0 column: 0]; if ([anObject isContinuous]) [optionMatrix selectCellAtRow: 1 column: 0]; if ([anObject isEnabled]) [optionMatrix selectCellAtRow: 2 column: 0]; if ([anObject state] == NSOnState) [optionMatrix selectCellAtRow: 3 column: 0]; if ([anObject isTransparent]) [optionMatrix selectCellAtRow: 4 column: 0]; [[tagField cellAtIndex: 0] setIntValue: [anObject tag] ]; [[titleForm cellAtIndex: 0] setStringValue: [anObject title] ]; [[titleForm cellAtIndex: 1] setStringValue: [anObject alternateTitle] ]; image = [anObject image]; if (image) [[titleForm cellAtIndex: 2] setStringValue: [image name] ]; else [[titleForm cellAtIndex: 2] setStringValue: @""]; image = [anObject alternateImage]; if (image) [[titleForm cellAtIndex: 3] setStringValue: [image name] ]; else [[titleForm cellAtIndex: 3] setStringValue: @"" ]; [typeButton selectItemAtIndex: [typeButton indexOfItemWithTag: [self buttonTypeForObject: anObject ] ] ]; } - (void) controlTextDidEndEditing: (NSNotification*)aNotification { id notifier = [aNotification object]; [self _setValuesFromControl: notifier]; } - (void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver: self]; RELEASE(window); RELEASE(okButton); [super dealloc]; } - (id) init { if ([super init] == nil) return nil; if ([NSBundle loadNibNamed: @"GormButtonInspector" owner: self] == NO) { NSLog(@"Could not gorm GormButtonInspector"); return nil; } [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(controlTextDidEndEditing:) name: NSControlTextDidEndEditingNotification object: nil]; /* Need to set up popup button */ [typeButton removeAllItems]; [typeButton addItemWithTitle: @"Momentary Push"]; [[typeButton lastItem] setTag: 0]; [typeButton addItemWithTitle: @"Push On/Off"]; [[typeButton lastItem] setTag: 1]; [typeButton addItemWithTitle: @"Toggle"]; [[typeButton lastItem] setTag: 2]; [typeButton addItemWithTitle: @"Momentary Change"]; [[typeButton lastItem] setTag: 5]; [typeButton addItemWithTitle: @"On/Off"]; [[typeButton lastItem] setTag: 6]; [typeButton addItemWithTitle: @"Momentary Light"]; [[typeButton lastItem] setTag: 7]; /* Doesn't work yet? */ // [typeButton setAction: @selector(setButtonTypeFrom:)]; // [typeButton setTarget: self]; return self; } - (void) ok: (id)sender { NSDebugLog(@"ok: sender = %@",sender); [self _setValuesFromControl: sender]; } - (void) setObject: (id)anObject { [super setObject: anObject]; [self _getValuesFromObject: anObject]; } @end /*---------------------------------------------------------------------------- NSButtonCell */ @implementation NSButtonCell (IBInspectorClassNames) - (NSString*) inspectorClassName { return @"GormButtonCellAttributesInspector"; } @end @interface GormButtonCellAttributesInspector : GormButtonAttributesInspector { } @end @implementation GormButtonCellAttributesInspector @end /*---------------------------------------------------------------------------- NSCell */ @implementation NSCell (IBInspectorClassNames) - (NSString*) inspectorClassName { return @"GormCellAttributesInspector"; } @end @interface GormCellAttributesInspector: IBInspector { id disabledSwitch; id tagForm; } @end @implementation GormCellAttributesInspector - (void) _setValuesFromControl: control { if (control == disabledSwitch) { [object setEnabled: ([control state] == NSOffState)]; } else if (control == tagForm) { [object setTag: [[control cellAtIndex: 0] intValue] ]; } } - (void) _getValuesFromObject: anObject { if (anObject != object) return; [disabledSwitch setState: ([anObject isEnabled]) ? NSOffState : NSOnState]; [[tagForm cellAtRow: 0 column: 0] setIntValue: [anObject tag] ]; } - (void) controlTextDidEndEditing: (NSNotification*)aNotification { id notifier = [aNotification object]; [self _setValuesFromControl: notifier]; } - (void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver: self]; RELEASE(window); [super dealloc]; } - (id) init { if ([super init] == nil) return nil; if ([NSBundle loadNibNamed: @"GormCellInspector" owner: self] == NO) { NSLog(@"Could not gorm GormCellInspector"); return nil; } [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(controlTextDidEndEditing:) name: NSControlTextDidEndEditingNotification object: nil]; return self; } - (void) ok: (id)sender { [self _setValuesFromControl: sender]; } - (void) setObject: (id)anObject { [super setObject: anObject]; [self _getValuesFromObject: anObject]; } @end /*---------------------------------------------------------------------------- NSForm */ @implementation NSForm (IBInspectorClassNames) - (NSString*) inspectorClassName { return @"GormFormAttributesInspector"; } @end @interface GormFormAttributesInspector: IBInspector { id backgroundColorWell; id drawsBackgroundSwitch; id optionMatrix; id tagForm; id textMatrix; id titleMatrix; } @end @implementation GormFormAttributesInspector - (void) _setValuesFromControl: control { int rows,cols,i; [object getNumberOfRows: &rows columns: &cols]; if (control == backgroundColorWell) { [object setBackgroundColor: [control color]]; } else if (control == drawsBackgroundSwitch) { [object setDrawsBackground: ([control state] == NSOnState)]; } else if (control == optionMatrix) { BOOL flag; // Cells tags = Positions? flag = ([[control cellAtRow: 0 column: 0] state] == NSOnState) ? YES : NO; if (flag == YES) { for (i=0; i 1)) { for (i=0; i 1) && (cols ==1)) { for (i=0; i1) || (cols == 1 && rows>1)) [autotagSwitch setEnabled: YES]; else [autotagSwitch setEnabled: NO]; } [backgroundColorWell setColor: [anObject backgroundColor] ]; [drawsBackgroundSwitch setState: ([anObject drawsBackground]) ? NSOnState : NSOffState]; [modeMatrix selectCellWithTag: [(NSMatrix *)anObject mode] ]; [selRectSwitch setState: ([anObject isSelectionByRect]) ? NSOnState : NSOffState]; [[tagForm cellAtIndex: 0] setIntValue: [anObject tag] ]; } - (void) controlTextDidEndEditing: (NSNotification*)aNotification { id notifier = [aNotification object]; [self _setValuesFromControl: notifier]; } - (void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver: self]; RELEASE(window); RELEASE(okButton); [super dealloc]; } - (id) init { if ([super init] == nil) return nil; if ([NSBundle loadNibNamed: @"GormMatrixInspector" owner: self] == NO) { NSLog(@"Could not gorm GormMatrixInspector"); return nil; } [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(controlTextDidEndEditing:) name: NSControlTextDidEndEditingNotification object: nil]; return self; } - (void) ok: (id)sender { [self _setValuesFromControl: sender]; } - (void) setObject: (id)anObject { [super setObject: anObject]; [self _getValuesFromObject: anObject]; } @end /*---------------------------------------------------------------------------- NSPopUpButton */ @implementation NSPopUpButton (IBInspectorClassNames) - (NSString*) inspectorClassName { return @"GormPopUpButtonAttributesInspector"; } @end @interface GormPopUpButtonAttributesInspector : IBInspector { id typeMatrix; id disabledSwitch; id tagForm; } @end @implementation GormPopUpButtonAttributesInspector - (void) _setValuesFromControl: control { if (control == typeMatrix) { [object setPullsDown: [[control selectedCell] tag] ]; } else if (control == disabledSwitch) { [object setAutoenablesItems: ([control state] == NSOffState) ]; } else if (control == tagForm) { [object setTag: [[control cellAtIndex: 0] intValue] ]; } } - (void) _getValuesFromObject: anObject { if (anObject != object) return; [typeMatrix selectCellWithTag: [anObject pullsDown] ]; [disabledSwitch setState: ![anObject autoenablesItems] ]; [[tagForm cellAtRow: 0 column: 0] setIntValue: [anObject tag] ]; } - (void) controlTextDidEndEditing: (NSNotification*)aNotification { id notifier = [aNotification object]; [self _setValuesFromControl: notifier]; } - (void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver: self]; RELEASE(window); [super dealloc]; } - (id) init { if ([super init] == nil) return nil; if ([NSBundle loadNibNamed: @"GormPopUpButtonInspector" owner: self] == NO) { NSLog(@"Could not gorm GormPopUpButtonInspector"); return nil; } [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(controlTextDidEndEditing:) name: NSControlTextDidEndEditingNotification object: nil]; return self; } - (void) ok: (id)sender { [self _setValuesFromControl: sender]; } - (void) setObject: (id)anObject { [super setObject: anObject]; [self _getValuesFromObject: anObject]; } @end /*---------------------------------------------------------------------------- NSSlider */ @implementation NSSlider (IBInspectorClassNames) - (NSString*) inspectorClassName { return @"GormSliderAttributesInspector"; } @end @interface GormSliderAttributesInspector : IBInspector { id altForm; id knobField; id numberOfTicks; id snapToTicks; id tickPosition; id unitForm; id valueForm; id altIncrementForm; id optionMatrix; id knobThicknessForm; id tagForm; } @end @implementation GormSliderAttributesInspector - (void) _setValuesFromControl: control { if (control == valueForm) { [object setMinValue: [[control cellAtIndex: 0] doubleValue]]; [object setDoubleValue: [[control cellAtIndex: 1] doubleValue]]; [object setMaxValue: [[control cellAtIndex: 2] doubleValue]]; } else if (control == optionMatrix) { BOOL flag; flag = ([[control cellAtRow: 0 column: 0] state] == NSOnState) ? YES : NO; [object setContinuous: flag]; flag = ([[control cellAtRow: 1 column: 0] state] == NSOnState) ? YES : NO; [object setEnabled: flag]; } else if (control == altIncrementForm) { [[object cell] setAltIncrementValue: [[control cellAtIndex: 0] doubleValue]]; } else if (control == knobThicknessForm) { [[object cell] setKnobThickness: [[control cellAtIndex: 0] floatValue]]; } else if (control == tagForm) { [[object cell] setTag: [[control cellAtIndex: 0] intValue]]; } } - (void) _getValuesFromObject: anObject { if (anObject != object) return; [[valueForm cellAtIndex: 0] setDoubleValue: [anObject minValue]]; [[valueForm cellAtIndex: 1] setDoubleValue: [anObject doubleValue]]; [[valueForm cellAtIndex: 2] setDoubleValue: [anObject maxValue]]; [optionMatrix deselectAllCells]; if ([anObject isContinuous]) [optionMatrix selectCellAtRow: 0 column: 0]; if ([anObject isEnabled]) [optionMatrix selectCellAtRow: 1 column: 0]; [[altIncrementForm cellAtIndex: 0] setDoubleValue: [[anObject cell] altIncrementValue] ]; [[knobThicknessForm cellAtIndex: 0] setFloatValue: [[anObject cell] knobThickness] ]; [[tagForm cellAtIndex: 0] setIntValue: [[anObject cell] tag] ]; } - (void) controlTextDidEndEditing: (NSNotification*)aNotification { id notifier = [aNotification object]; [self _setValuesFromControl: notifier]; } - (void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver: self]; RELEASE(window); [super dealloc]; } - (id) init { if ([super init] == nil) return nil; if ([NSBundle loadNibNamed: @"GormSliderInspector" owner: self] == NO) { NSLog(@"Could not gorm GormSliderInspector"); return nil; } [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(controlTextDidEndEditing:) name: NSControlTextDidEndEditingNotification object: nil]; return self; } - (void) ok: (id)sender { [self _setValuesFromControl: sender]; } - (void) setObject: (id)anObject { [super setObject: anObject]; [self _getValuesFromObject: anObject]; } @end /*---------------------------------------------------------------------------- NSStepper */ @implementation NSStepper (IBInspectorClassNames) - (NSString*) inspectorClassName { return @"GormStepperAttributesInspector"; } - (NSString*) sizeInspectorClassName { return nil; } @end @interface GormStepperAttributesInspector : IBInspector { NSTextField *valueField; NSTextField *minimumValueField; NSTextField *maximumValueField; NSTextField *incrementValueField; NSButton *autorepeatButton; NSButton *valueWrapsButton; } @end @implementation GormStepperAttributesInspector - (void) _setValuesFromControl: control { if (control == valueField) { [object setDoubleValue:[control doubleValue]]; [object setNeedsDisplay: YES]; } else if (control == minimumValueField) { [object setMinValue:[control doubleValue]]; [object setNeedsDisplay: YES]; } else if (control == maximumValueField) { [object setMaxValue:[control doubleValue]]; [object setNeedsDisplay: YES]; } else if (control == incrementValueField) { [object setIncrement:[control doubleValue]]; [object setNeedsDisplay: YES]; } else if (control == autorepeatButton) { switch ([control state]) { case 0: [object setAutorepeat: NO]; break; case 1: [object setAutorepeat: YES]; break; } } else if (control == valueWrapsButton) { switch ([control state]) { case 0: [object setValueWraps: NO]; break; case 1: [object setValueWraps: YES]; break; } } } - (void) _getValuesFromObject: anObject { if (anObject != object) return; [valueField setDoubleValue: [anObject doubleValue]]; [minimumValueField setDoubleValue: [anObject minValue]]; [maximumValueField setDoubleValue: [anObject maxValue]]; if ([object autorepeat]) [autorepeatButton setState: 1]; else [autorepeatButton setState: 0]; if ([object valueWraps]) [valueWrapsButton setState: 1]; else [valueWrapsButton setState: 0]; } - (void) controlTextDidEndEditing: (NSNotification*)aNotification { id notifier = [aNotification object]; [self _setValuesFromControl: notifier]; } - (void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver: self]; RELEASE(window); [super dealloc]; } - (id) init { if ([super init] == nil) return nil; if ([NSBundle loadNibNamed: @"GormStepperInspector" owner: self] == NO) { NSLog(@"Could not gorm GormStepperAttributesInspector"); return nil; } [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(controlTextDidEndEditing:) name: NSControlTextDidEndEditingNotification object: nil]; return self; } - (void) ok: (id)sender { [self _setValuesFromControl: valueField]; [self _setValuesFromControl: minimumValueField]; [self _setValuesFromControl: maximumValueField]; [self _setValuesFromControl: incrementValueField]; [self _setValuesFromControl: autorepeatButton]; [self _setValuesFromControl: valueWrapsButton]; } - (void) setObject: (id)anObject { [super setObject: anObject]; [self _getValuesFromObject: anObject]; } @end /*---------------------------------------------------------------------------- NSStepperCell */ @implementation NSStepperCell (IBInspectorClassNames) - (NSString*) inspectorClassName { return @"GormStepperCellAttributesInspector"; } @end @interface GormStepperCellAttributesInspector : GormStepperAttributesInspector { } @end @implementation GormStepperCellAttributesInspector @end /*---------------------------------------------------------------------------- NSTextField */ @implementation NSTextField (IBInspectorClassNames) - (NSString*) inspectorClassName { return @"GormTextFieldAttributesInspector"; } @end @interface GormTextFieldAttributesInspector : IBInspector { id alignMatrix; id backgroundColor; id drawsBackground; id textColor; id optionMatrix; id borderMatrix; id tagForm; } @end @implementation GormTextFieldAttributesInspector - (void) _setValuesFromControl: control { if (control == alignMatrix) { [object setAlignment: (NSTextAlignment)[[control selectedCell] tag] ]; } else if (control == backgroundColor) { [object setBackgroundColor: [control color]]; } else if (control == drawsBackground) { [object setDrawsBackground: ([control state] == NSOnState)]; } else if (control == textColor) { [object setTextColor: [control color]]; } else if (control == optionMatrix) { BOOL flag; flag = ([[control cellAtRow: 0 column: 0] state] == NSOnState) ? YES :NO; [object setEditable: flag]; flag = ([[control cellAtRow: 1 column: 0] state] == NSOnState) ? YES :NO; [object setSelectable: flag]; flag = ([[control cellAtRow: 2 column: 0] state] == NSOnState) ? YES :NO; [[object cell] setScrollable: flag]; } else if (control == borderMatrix) { BOOL bordered, bezeled; if ([[control cellAtRow: 0 column: 0] state] == NSOnState) bordered = bezeled = NO; else if ([[control cellAtRow: 0 column: 1] state] == NSOnState) { bordered = YES; bezeled = NO; } else if ([[control cellAtRow: 0 column: 2] state] == NSOnState) bordered = NO; bezeled = YES; [object setBordered: bordered]; [object setBezeled: bezeled]; } else if (control == tagForm) { [object setTag: [[control cellAtIndex: 0] intValue] ]; } } - (void) _getValuesFromObject: anObject { if (anObject != object) return; [alignMatrix selectCellWithTag: [anObject alignment] ]; [backgroundColor setColor: [anObject backgroundColor] ]; [textColor setColor: [anObject textColor] ]; [drawsBackground setState: ([anObject drawsBackground]) ? NSOnState : NSOffState]; [optionMatrix deselectAllCells]; if ([anObject isEditable]) [optionMatrix selectCellAtRow: 0 column: 0]; if ([anObject isSelectable]) [optionMatrix selectCellAtRow: 1 column: 0]; if ([[anObject cell] isScrollable]) [optionMatrix selectCellAtRow: 2 column: 0]; NSDebugLog(@"isBordered: %d",[anObject isBordered]); NSDebugLog(@"isBezeled: %d",[anObject isBezeled]); if ([anObject isBordered] == YES) [borderMatrix selectCellAtRow: 0 column: 1]; else { if ([anObject isBezeled] == YES) [borderMatrix selectCellAtRow: 0 column: 2]; else [borderMatrix selectCellAtRow: 0 column: 0]; } [[tagForm cellAtIndex: 0] setIntValue: [anObject tag] ]; } - (void) controlTextDidEndEditing: (NSNotification*)aNotification { id notifier = [aNotification object]; [self _setValuesFromControl: notifier]; } - (void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver: self]; RELEASE(window); RELEASE(okButton); [super dealloc]; } - (id) init { if ([super init] == nil) return nil; if ([NSBundle loadNibNamed: @"GormTextFieldInspector" owner: self] == NO) { NSLog(@"Could not gorm GormTextFieldInspector"); return nil; } [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(controlTextDidEndEditing:) name: NSControlTextDidEndEditingNotification object: nil]; return self; } - (void) ok: (id)sender { [self _setValuesFromControl: sender]; } - (void) setObject: (id)anObject { [super setObject: anObject]; [self _getValuesFromObject: anObject]; } @end