This is MiscSwitchView.h in view mode; [Download] [Up]
// $Id$
//
// -------------------- MiscSwitchView Class Interface ------------------------
//
// Yet another view that supports a switchable subview. Features a selection
// of border styles including a border suitable for using the MiscTabCell to
// create a file folder interface. Supports various alignments of the
// switchable subview within MiscSwitchView's frame.
//
// Written by Art Isbell (inspired by TTools' SwitchView and UHSelectView).
// 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/NSView.h>
#ifndef NOMISC
#import <misckit/MiscTabMatrix.h>
#else NOMISC
#import "MiscTabMatrix.h"
#endif NOMISC
// ---------------- Typedef, Struct, and Union Declarations -------------------
// Defining the various positions of the view
typedef enum
{
MiscTopLeft = 0,
MiscTopCenter,
MiscTopRight,
MiscLeft,
MiscCenter,
MiscRight,
MiscBottomLeft,
MiscBottomCenter,
MiscBottomRight
} MiscPosition;
// Supported border types
typedef enum
{
MiscNone = 0,
MiscLine,
MiscBezel,
MiscGroove,
MiscButton,
MiscTab
} MiscBorderType;
// --------------------- Constant and Enum Definitions ------------------------
extern int MiscNoView;
// Notifications (through the default notification center)
extern NSString *MiscViewWillSwitchNotification;
extern NSString *MiscViewDidSwitchNotification;
extern NSString *MiscNextViewNumberKey;
@interface MiscSwitchView:NSView <NSCoding, MiscTabSwitchViews>
{
// -------------------- Instance Variable Declarations ------------------------
@private
int _viewNumber; // current view number
BOOL _useMatrixBehavior; // use Matrix target/action behavior
MiscPosition _position; // view position
MiscBorderType _borderType; // type of selectview border
NSMutableArray *_views; // list of views to be shown
NSView *_originalSuperview; // current view's original superview
NSRect _originalFrame; // current view's original frame
@protected
IBOutlet id delegate;
@public
}
// ---------------------- Factory Method Declarations -------------------------
+ (void)initialize;
// ---------------- Overridden Instance Method Declarations -------------------
- (id)initWithFrame:(NSRect)frameRect;
// NSCoding protocol
- (id)initWithCoder:(NSCoder *)aDecoder;
- (void)encodeWithCoder:(NSCoder *)aCoder;
- (void)dealloc;
- (void)drawRect:(NSRect)aRect;
// ------------------- New Instance Method Declarations -----------------------
- (void)setBorderType:(MiscBorderType)aType;
- (MiscBorderType)borderType;
- (void)setDelegate:(id)aDelegate;
- (void)setPosition:(MiscPosition)aPosition;
- (MiscPosition)position;
- (void)setUseMatrixBehavior:(BOOL)aFlag;
// MiscTabSwitchViews protocol
- (BOOL)useMatrixBehavior;
- (void)setViewNumber:(int)aViewNumber;
- (int)viewNumber;
- (NSArray *)views;
- (IBAction)takeViewNumberFrom:(id)aSender;
- (IBAction)takeTagFrom:(id)aSender;
- (IBAction)takeIntValueFrom:(id)aSender;
- (IBAction)takeSelectedRowFrom:(id)aSender;
- (IBAction)takeSelectedColumnFrom:(id)aSender;
- (unsigned)count;
- (NSView *)currentView;
- (NSView *)viewAtIndex:(unsigned)anIndex;
- (unsigned)indexOfView:(NSView *)aView;
- (void)addView:(NSView *)aView;
- (void)addView:(NSView *)aView atIndex:(unsigned)anIndex;
- (void)removeView:(NSView *)aView;
- (void)removeViewAtIndex:(unsigned)anIndex;
- (SEL)valueSelectorForSwitchSource:aSender;
- (void)subviewFrameChanged:(NSNotification *)aNotification;
// ----------------- Delegate Instance Method Declarations --------------------
@end
// Methods implemented by the delegate
@interface NSObject(Delegate)
// Invoked before and after a view has been switched and displayed.
- (void)viewWillSwitch:(NSNotification *)aNotification;
- (void)viewDidSwitch:(NSNotification *)aNotification;
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.