This is MiscSwitchView.rtf in view mode; [Download] [Up]
paperh18648 margl-907 margr0 margt0 margb0fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1996, All Rights Reserved. pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 fs28 fs16 fs28 fs16 fs28 pard s5 li2116 fi0 ri1007 ql f0 b fs56 MiscSwitchView fs16 fs56 pard s17 li4888 fi-2771 ri1007 ql tx4888 f1 b0 fs28 fs16 fs28 f0 b fs28 Inherits From: b0 fs28 f1 NSBox fs16 s10 fs16 fs28 f0 b fs28 Declared In: b0 fs28 f1 MiscSwitchView.h fs16 fs28 pard s13 li1360 fi0 ri1007 ql f0 b fs36 fs16 fs36 Class Description fs16 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs28 fs16 fs28 The SwitchView is a Box that manages multiple content views. A particular content view can be "switched" (made visible) with a variety of control-like action messages. The SwitchView is particularly useful in the construction of inspector panels, such as those found in the Workspace and Interface Builder. The SwitchView is palettized for easy usage. fs16 fs28 fs16 fs28 The SwitchView supports a delegate which is notified before and after all significant operations with the following methods: fs16 fs28 fs16 fs28 {pard s11 li7648 fi-5131 ri1007 ql tx7648 tx10180 fs16 fs28 -switchViewWillAddView: } {pard s11 li7648 fi-5131 ri1007 ql tx7648 tx10180 fs16 fs28 -switchView:willInsertViewAtIndex: } {pard s11 li7648 fi-5131 ri1007 ql tx7648 tx10180 fs16 fs28 -switchView:willDeleteViewAtIndex: } {pard s11 li7648 fi-5131 ri1007 ql tx7648 tx10180 fs16 fs28 -switchView:willDisplayViewAtIndex: } {pard s11 li7648 fi-5131 ri1007 ql tx7648 tx10180 fs16 fs28 -switchViewDidAddView: } {pard s11 li7648 fi-5131 ri1007 ql tx7648 tx10180 fs16 fs28 -switchView:didInsertViewAtIndex: } {pard s11 li7648 fi-5131 ri1007 ql tx7648 tx10180 fs16 fs28 -switchView:didDeleteViewAtIndex: } {pard s11 li7648 fi-5131 ri1007 ql tx7648 tx10180 fs16 fs28 -switchView:didDisplayViewAtIndex: } fs16 fs28 fs16 fs28 The delegate is only sent messages it responds to. fs28s13 li1360 fi0 ri1007 ql f0 b fs36 fs16 fs36 Global Variables fs16 SYNOPSIS b MiscSwitchViewNoViewVisibleb0; pard s13 li1360 fi0 ri1007 ql f0 b fs36 fs16 fs36 Instance Variables fs16 pard s18 li2116 fi0 ri1007 ql tx2872 f1 b0 fs28 @private NSMutableArray* b _viewsb0 ; id b _delegateb0 ; pard s11 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 fs28 _views Array of views to be switched. fs16 fs28 _delegate Delegate. pard s13 li1360 fi0 ri1007 ql f0 b fs36 fs16 fs36 Method Types fs16 f1 b0 fs28 s35 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 fs28 Accessor methods {f3 -} setViews: pard s34 li6652 fi-503 ri1007 ql tx9676 tx10180 {f3 -} views {f3 -} setDelegate: {f3 -} delegate pard s35 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 fs28 Initialization / deallocation {f3 -} initWithFrame: pard s34 li6652 fi-503 ri1007 ql tx9676 tx10180 {f3 -} dealloc pard s35 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 fs28 Manipulating subviews {f3 -} addView pard s34 li6652 fi-503 ri1007 ql tx9676 tx10180 {f3 -} insertViewAtIndex: {f3 -} displayViewAtIndex: {f3 -} deleteViewAtIndex: {f3 -} viewCount {f3 -} viewAtIndex: pard s35 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 fs28 Obtaining indexes {f3 -} firstIndex pard s34 li6652 fi-503 ri1007 ql tx9676 tx10180 {f3 -} lastIndex {f3 -} indexBefore: {f3 -} indexAfter: {f3 -} indexOfVisibleView {f3 -} isIndexValid: pard s35 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 fs28 Contol interoperability {f3 -} takeIntValueFrom: pard s34 li6652 fi-503 ri1007 ql tx9676 tx10180 {f3 -} takeStringValueFrom: {f3 -} takeFloatValueFrom: {f3 -} takeDoubleValueFrom: {f3 -} takeTagValueFrom: {f3 -} takeSelectedTagValueFrom: pard s35 li6148 fi-4031 ri1007 ql tx6148 tx9676 tx10180 fs16 fs28 Archiving {f3 -} initWithCoder: pard s34 li6652 fi-503 ri1007 ql tx9676 tx10180 {f3 -} encodeWithCoder: {f3 -} resetObjectHierarchy pard s13 li1360 fi0 ri1007 ql f0 b fs36 fs16 fs36 Instance Methods fs16 fs36 s21 li2493 fi-1132 fi-376 fs28 fs16 fs29 b addView s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b addViewb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Adds a view to the end of the receiver's subview array. The view isn't added if the delegate responds to b switchViewWillAddView:b0 with NO. If the operation is successful, the delegate is notified with b switchViewDidAddView:b0 . fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b dealloc s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b deallocb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Standard deallocator. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b delegate s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (id)b delegateb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Returns the receiver's delegate. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b deleteViewAtIndex: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b deleteViewAtIndex:b0 (int)i indexi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Displays the view at the specified i indexi0 , or raises an NSRangeException if i indexi0 is invalid. The view isn't displayed if the delegate responds to b switchView:willDeleteViewAtIndex:b0 with NO. If the operation is successful, the delegate is notified with b switchView:didDeleteViewAtIndex:b0 . fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b displayViewAtIndex: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b displayViewAtIndex:b0 (int)i indexi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Displays the view at the specified i indexi0 , or raises an NSRangeException if i indexi0 is invalid. The view isn't displayed if the delegate responds to b switchView:willDisplayViewAtIndex:b0 with NO. If the operation is successful, the delegate is notified with b switchView:didDisplayViewAtIndex:b0 . fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b encodeWithCoder: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b encodeWithCoder:b0 (NSCoder*)i coderi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Extends the superclass method to encode the subviews to the i coderi0 . fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b firstIndex s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (int)b firstIndexb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Return the index of the first view in the receiver's subview array. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b indexAfter: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (int)b indexAfter:b0 (int)i indexi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Returns the i indexi0 of the view just after the view at the specified i indexi0 , [b selfb0 firstIndex] if the argument is equal to [b selfb0 lastIndex], or [b selfb0 lastIndex] if the argument is an invalid i indexi0 . fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b indexBefore: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (int)b indexBefore:b0 (int)i indexi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Returns the i indexi0 of the view just before the view at the specified i indexi0 , [b selfb0 lastIndex] if the argument is equal to [b selfb0 firstIndex], or [b selfb0 firstIndex] if the argument is an invalid i indexi0 . fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b indexOfVisibleView s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (int)b indexOfVisibleViewb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Returns the index of the currently visible view. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b initWithCoder: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (id)b initWithCoder:b0 (NSCoder*)i coderi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Extends the superclass method to read the subviews from the i coderi0 . Returns b selfb0 if successful, b nilb0 otherwise. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b initWithFrame: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (id)b initWithFrame:b0 (NSRect)i frameRecti0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Extends the superclass method to set the reciever's title, allocate an array to hold it's subviews, and add a single blank view by default. Returns b selfb0 if successful, b nilb0 otherwise. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b insertViewAtIndex: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b insertViewAtIndex:b0 (int)i indexi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Inserts a new view at the specified i indexi0 , or raises an NSRangeException if i indexi0 is invalid. The view isn't added if the delegate responds to b switchView:willInsertViewAtIndex:b0 with NO. If the operation is successful, the delegate is notified with b switchView:didInsertViewAtIndex:b0 . fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b isIndexValid: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (BOOL)b isIndexValid:b0 (int)i indexi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Returns YES if the specified i indexi0 is valid, NO otherwise. Only valid indexes can be passed to the methods in this class that expect an i indexi0 . Passing an invalid i indexi0 to these methods will almost certainly cause the instance to throw an exception. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b lastIndex s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (int)b lastIndexb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Return the index of the last view in the receiver's subview array. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b resetObjectHierarchy s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b resetObjectHierarchyb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Reset the object hierarchy. This method fixes a strage bug whereby objects couldn't be dragged on a selected MiscSwitchView--the box just wouldn't activate. Poking around in IB I discovered that the IBViewEditor for the MiscSwitchView's subview(s) wasn't a subview of the IBBoxEditor for the MiscSwitchView itself. This code seems to reset that relationship and fix the problem. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b setDelegate: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b setDelegate:b0 (id)i delegatei0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Sets the receiver's i delegatei0 . The argument is i noti0 retained. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b setViews: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b setViews:b0 (NSMutableArray*)i viewsi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Sets the reciver's subview array. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b takeDoubleValueFrom: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b takeDoubleValueFrom:b0 (id)i senderi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Displays the view at the index obtained by invoking [i senderi0 doubleValue] and coercing the result to an integer. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b takeFloatValueFrom: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b takeFloatValueFrom:b0 (id)i senderi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Displays the view at the index obtained by invoking [i senderi0 floatValue] and coercing the result to an integer. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b takeIntValueFrom: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b takeIntValueFrom:b0 (id)i senderi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Displays the view at the index obtained by invoking [i senderi0 intValue]. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b takeSelectedTagValueFrom: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b takeSelectedTagValueFrom:b0 (id)i senderi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Displays the view at the index obtained by invoking [i senderi0 selectedTag]. Nothing is done if i senderi0 doesn't have a selected cell (i.e., responds to [i senderi0 selectedCell] with b nilb0 ). fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b takeStringValueFrom: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b takeStringValueFrom:b0 (id)i senderi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Displays the view at the index obtained by invoking [[i senderi0 stringValue] intValue]. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b takeTagValueFrom: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (void)b takeTagValueFrom:b0 (id)i senderi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Displays the view at the index obtained by invoking [i senderi0 tag]. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b viewAtIndex: s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (NSView*)b viewAtIndex:b0 (int)i indexi0 b b0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Returns the view at the specified i indexi0 , or raises an NSRangeException if i indexi0 is invalid. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b viewCount s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (int)b viewCountb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Returns the number of views in the receiver's subview array. fs16 fs28 pard s19 li2493 fi-376 ri1007 ql f0 fs28 fs16 fs29 b views s20 li3249 fi-1132 fi-756 f1 b0 fs28 {f3 -} (NSMutableArray*)b viewsb0 pard s0 li2116 fi0 ri1007 ql tx2494 tx2872 tx3250 fs16 fs28 Returns the receiver's subview array. }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.