ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.s.gnutar.gz#/MiscKit/Palettes/MiscValueFieldPalette/MiscSliderCellInspector.m

This is MiscSliderCellInspector.m in view mode; [Download] [Up]

//
//	MiscSliderCellInspector.m -- an IBInspector that edits a MiscSliderCell
//                                  or its MiscSliderField.
//	   Written by David Fedchenko. Copyright 1994 by David Fedchenko.
//	       		 Version 1.0  All rights reserved.
//
//		This notice may not be removed from this source code.
//
//	This object is included in the MiscKit by permission from the author
//	and its use is governed by the MiscKit license, found in the file
//	"LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
//	for a list of all applicable permissions and restrictions.
//	

#import "MiscSliderCellInspector.h"

@implementation MiscSliderCellInspector

- init
    {
    char    buf[MAXPATHLEN + 1];
    id      bundle;
    
    [super init];
    
    bundle = [NXBundle bundleForClass:[MiscSliderCell class]];
    [bundle getPath:buf forResource:"MiscSliderCellInspector" ofType:"nib"];
    [NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
    
    return self;
    }

- updateControls
    {
    [idSoftLower setEnabled:[idExpandLower state]];
    [idSoftLowerLabel setEnabled:[idExpandLower state]];
    [idSoftUpper setEnabled:[idExpandUpper state]];
    [idSoftUpperLabel setEnabled:[idExpandUpper state]];
    
    return self;
    }

- ok:sender
    {
    float t;
    
    [object setMinValue:[idHardLower doubleValue]];
    [object setMaxValue:[idHardUpper doubleValue]];
    [object setMinBoundary:[idSoftLower doubleValue]];
    [object setMaxBoundary:[idSoftUpper doubleValue]];
    [object setExpandMin:[idExpandLower state]];
    [object setExpandMax:[idExpandUpper state]];
    [object setContinuous:[idContinuous state]];
    [object setPosition:[[idPosition selectedCell] tag]];
    t = [idSplit intValue];
    t = MAX(0, t);
    t = MIN(100, t);
    [object setSplit:t];
    [object setIntegerOnly:[idIntOnly state]];
    
    [self updateControls];
    
    return [super ok:sender];
    }

- revert:sender
    {
    // there is casting here because the NeXT headers have a type conflict
    // for these two methods.
    [idHardLower setDoubleValue:[(MiscSliderField *)object minValue]];
    [idHardUpper setDoubleValue:[(MiscSliderField *)object maxValue]];
    [idSoftLower setDoubleValue:[object minBoundary]];
    [idSoftUpper setDoubleValue:[object maxBoundary]];
    [idExpandLower setState:[object expandMin]];
    [idExpandUpper setState:[object expandMax]];
    [idContinuous setState:[object isContinuous]];
    [idPosition selectCellWithTag:[object position]];
    [idSplit setIntValue:[object split]];
    [idIntOnly setState:[object integerOnly]];
    
    [self updateControls];

    return [super revert:sender];
    }

- (BOOL)wantsButtons
    {
    return NO;
    }

// the text delegate functions to get the info more better
- textDidEnd:sender endChar:(unsigned short)whyEnd 
    {
    [self ok:sender];
    
    return self;
    }

@end


@implementation MiscSliderCell (AttributesInspector)

- (const char *)getInspectorClassName
    {
    NXEvent *ev;

    ev = [NXApp currentEvent];
    if (ev->flags&NX_ALTERNATEMASK) // get the superclass inspector
        return [super getInspectorClassName];
    else // the real inspector
        return "MiscSliderCellInspector";
    }

@end


@implementation MiscSliderField (AttributesInspector)

- (const char *)getInspectorClassName
    {
    NXEvent *ev;

    ev = [NXApp currentEvent];
    if (ev->flags & NX_ALTERNATEMASK) // get the superclass inspector
        return [super getInspectorClassName];
    else // the real inspector
        return "MiscSliderCellInspector";
    }

// this is an override for a category method provided by IB
- placeView:(NXRect *)rect
    {
    float yPos;
    
    switch ([cell position])
        {
	case MSC_ABOVELEFT:
	case MSC_ABOVECENTER:
	case MSC_ABOVERIGHT:
	case MSC_BELOWLEFT:
	case MSC_BELOWCENTER:
	case MSC_BELOWRIGHT:
	    yPos = rect->origin.y + rect->size.height;
	    rect->size.height -= MSC_WIDTH + MSC_SPACING;
	    [super placeView:rect];
	    rect->size.height = frame.size.height + MSC_WIDTH + MSC_SPACING;
	    rect->origin.y = yPos - rect->size.height;
	    [self setFrame:rect];
	    break;
	    
	default:
	    [super placeView:rect];
	    break;
        }
    
    return self;
    }

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.