ftp.nice.ch/pub/next/developer/resources/palettesfor2.xx/EntryCheckForm.N.bs.tar.gz#/EntryCheckForm/GeneralFormCellInspector.m

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

/*------------------------------------------------------#
   Copyright 1992 Don McGregor
   You may freely use this code in any way you wish.
   however, you may not charge any money for the use
   of it.
   
   No warranty of any kind, etc, etc.
 ------------------------------------------------------#*/

#import <appkit/NXBrowser.h>
#import <appkit/NXBrowserCell.h>
#import <appkit/Form.h>
#import <objc/List.h>
#import <strings.h>

#import "GeneralFormCellInspector.h"
#import "GeneralFormCell.h"

@implementation GeneralFormCellInspector


/* << The first two class methods don't get inherited >> */

+ finishLoading:(struct mach_header *) hdr {
    NIBDidLoadClass(self, hdr);
    return nil;
}

+ startUnloading
{
    NIBWillUnloadClass(self);
    return nil;
}


- revert:sender
{
  /*-------------------------------------------------------------------
     Also used to display the initial settings when the inspector
     comes up.  Display the contents of the scroller by setting
     the NXBrowser's deleagte to be the GeneralCell object.  
   -------------------------------------------------------------------*/   
   	
	//Get the browser set up w/ the current fiter highlighted
	
    [filterScroller setDelegate:object];
    [filterScroller loadColumnZero];
    [filterScroller setPath:[object currentQualName]];
    
    	//the tag field
	
    [tagForm setIntValue:[object tag]];
    
    	//enabled and or scrollable option matrix
 
    if([object isEnabled])
    	[enabledMatrix selectCellWithTag:0];
      else
        [enabledMatrix setState:0 at:0 :0];
	
    if([object isScrollable])
        [enabledMatrix selectCellWithTag:1];
      else
        [enabledMatrix setState:0 at:1 :0];
        
    return [super revert:sender];
}

- ok:sender
{
  /*-------------------------------------------------------------------
     Make any changes permanent by inspecting the values of the
     interface objects, then sending the appropriate msgs to
     the Cell object.
  -------------------------------------------------------------------*/
  
  NXAtom 	qualNameSelected;	//the selected qualifier in the browser
  
  	//The enabled and scrollabe check-box options
	
  if([[enabledMatrix cellAt:0 :0] state] == 1)	//Switched on
      [object setEnabled:YES];
   else
      [object setEnabled:NO];
      
  if([[enabledMatrix cellAt:1 :0] state] == 1)	
      [object setScrollable:YES];
   else
      [object setScrollable:NO];
  
  
  	//The tag for the cell

  [object setTag:[tagForm intValueAt:0]];
  
  	//The name of the entry-checking qualifier used.  The
	//field separator inserts an inital "/" in the name
	//returned, so we need to blot that out.
  
  qualNameSelected = [[[filterScroller matrixInColumn:0] 
  					selectedCell] 
					stringValue];
					
  qualNameSelected = NXUniqueString(qualNameSelected);
			    
  [object setEntryQual:qualNameSelected];
  
  
  return [super ok:sender];
}

- init
{
    [super init];
    [NXApp loadNibSection:"GeneralFormCellInspector.nib" owner:self];
    return self;
}

  
- read:(NXTypedStream*)stream
{
  [super read:stream];
  
  enabledMatrix  = NXReadObject(stream);
  tagForm 	 = NXReadObject(stream);
  filterScroller = NXReadObject(stream);
  
  return self;
}
  
- write:(NXTypedStream*)stream
{
  [super write:stream];
  
  NXWriteObjectReference(stream, enabledMatrix);
  NXWriteObjectReference(stream, tagForm);
  NXWriteObjectReference(stream, filterScroller);
  
  return self;
}
 
@end

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