ftp.nice.ch/Attic/openStep/developer/resources/MiscKit.2.0.5.s.gnutar.gz#/MiscKit2/Temp/TabbedViews/MiscTabSwitchViewPalette/MiscSwitchViewInspector.m

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

// Suppress compiler warning about rcsid being unused, yet prevent assembler
// code for this function from being produced.
inline extern const char *suppressCompilerWarning(void)
{
    static const char *rcsid = "$Id$ cc: "__FILE__" "__DATE__" "__TIME__;

    return rcsid;
}

//
// ------------- MiscSwitchViewInspector Class Implementation -----------------
//
// IB MiscSwitchView Attributes inspector.
//
// Written by Art Isbell.
// Copyright 1996 by Art Isbell.
// 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.
//	
// ----------------------------------------------------------------------------
//

// ----------------------------- Header Files ---------------------------------

#import <AppKit/AppKit.h>

#ifndef NOMISC
#import <misckit/MiscSwitchViewInspector.h>
#import <misckit/MiscSwitchView.h>

#else NOMISC

#import "MiscSwitchViewInspector.h"
#import "MiscSwitchView.h"
#endif NOMISC

// ---------------- Typedef, Struct, and Union Declarations -------------------

// --------------------- Constant and Enum Definitions ------------------------

// ------------------------- Function Declarations ----------------------------

@interface MiscSwitchViewInspector(Private)
// ---------------------- Private Method Declarations -------------------------

@end

@implementation MiscSwitchViewInspector
// ---------------------- Factory Method Definitions --------------------------

// ---------------- Overridden Instance Method Definitions --------------------

- (id)init
{
    self = [super init];

    // If self in not nil and inspector nib can't be loaded, autorelease self.
    if (self != nil &&
        ![NSBundle loadNibNamed:@"MiscSwitchViewInspector" owner:self])
    {
        [self autorelease];
        self = nil;
    }
    return self;
}

- (void)ok:sender
{
    MiscSwitchView *switchViewL = [self object];

    if (sender == positionMatrix)
    {
        MiscPosition positionL = (MiscPosition)[positionMatrix selectedTag];

        if (positionL != [switchViewL position])
        {
            [switchViewL setPosition:positionL];
        }
    }
    else if (sender == borderMatrix)
    {
        MiscBorderType borderTypeL = (MiscBorderType)[borderMatrix selectedTag];

        if (borderTypeL != [switchViewL borderType])
        {
            [switchViewL setBorderType:borderTypeL];
        }
    }
    else if (sender == selectionBehaviorMatrix)
    {
        [switchViewL setUseMatrixBehavior:(BOOL)[sender selectedTag]];
    }
    [super ok:sender];
}

- (void)revert:sender
{
    BOOL useMatrixBehaviorL;
    MiscBorderType borderTypeL;
    MiscSwitchView *switchViewL = [self object];
    MiscPosition positionL = [switchViewL position];

    if (positionL != (MiscPosition)[positionMatrix selectedTag])
    {
        [positionMatrix selectCellWithTag:(int)positionL];
    }
    borderTypeL = [switchViewL borderType];

    if (borderTypeL != (MiscBorderType)[borderMatrix selectedTag])
    {
        [borderMatrix selectCellWithTag:(int)borderTypeL];
    }
    useMatrixBehaviorL = [switchViewL useMatrixBehavior];

    if (useMatrixBehaviorL != (BOOL)[selectionBehaviorMatrix selectedTag])
    {
        [selectionBehaviorMatrix selectCellWithTag:(int)useMatrixBehaviorL];
    }
    [[self window] displayIfNeeded];
    [super revert:sender];
}

- (BOOL)wantsButtons
{
    return NO;
}

// -------------------- New Instance Method Definitions -----------------------

// ----------------- Delegate Instance Method Definitions ---------------------

@end

@implementation MiscSwitchViewInspector(Private)
// ---------------------- Private Method Definitions --------------------------

@end

// ------------------------- Function Definitions -----------------------------

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