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

This is MiscTabMatrix.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;
}

//
// ------------------ MiscTabMatrix Class Implementation ----------------------
//
//    MiscTabMatrix is designed to be used with an object that knows how to
// switch its subviews based on the MiscTabMatrix selection.  Set the
// MiscTabMatrix target to the object that knows how to switch its subviews
// using an appropriate action.
//    To use the behavior of a NSMatrix in which the matrix or cell action
// that causes the target's view to switch is sent on the mouse up event or
// when the left or right arrow key is pressed, set useMatrixBehavior to YES.
//    To mimic the behavior of the StackView in IB's Document Window in which
// the switchView's view is switched when the MiscTabMatrix' selectedCell
// changes (mouse down or mouse dragged), set useMatrixBehavior to NO.
//
// Written by Art Isbell (derived from UITabActionCell by Bill Edney,
//     Sean Hill, Mark Onyschuk).
// 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 ---------------------------------

#ifndef NOMISC
#import <misckit/MiscTabMatrix.h>

#else NOMISC

#import "MiscTabMatrix.h"
#endif NOMISC

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

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

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

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

@end

@implementation MiscTabMatrix
// ---------------------- Factory Method Definitions --------------------------

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

- (void)highlightCell:(BOOL)aFlag atRow:(int)aRow column:(int)aColumn
{
    id targetL = [self target];

    [super highlightCell:aFlag atRow:aRow column:aColumn];

    // If target requires standard NSMatrix behavior, then the action will
    // switch the view upon mouse up, and do nothing upon mouse entered or
    // mouse down.  However, if target doesn't require standard NSMatrix
    // behavior, mimic behavior of IB's StackView which switches its view upon
    // mouse entered or mouse down and then sends its action, if any, upon
    // mouse up.
    if ([targetL conformsToProtocol:@protocol(MiscTabSwitchViews)] &&
        ![targetL useMatrixBehavior])
    {
        unsigned viewNumberL = [[self cells] indexOfObjectIdenticalTo:[self
            selectedCell]];

        [targetL setViewNumber:viewNumberL];
    }
}

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

- (void)awakeFromNib
{
    // Initialize target.
    [[self target] performSelector:[self action] withObject:self];
}

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

@end

@implementation MiscTabMatrix(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.