This is Controller.m in view mode; [Download] [Up]
/* * Controller.m * * Purpose: * Manages the windows in this example and passes menu messages * to the other objects. * * You may freely copy, distribute, and reuse the code in this example. * NeXT disclaims any warranty of any kind, expressed or implied, as to its * fitness for any particular use. * * Written by: Mary McNabb * Created: Apr 91 * */ #import "Controller.h" #import "FindObject.h" #import "InfoPanel.h" #import <appkit/ScrollView.h> #import <appkit/Text.h> #import <appkit/Application.h> @implementation Controller /* * We need the handle for the text object in the scrollview. */ - appDidInit:sender { fileDocView = [fileScrollView docView]; [[fileScrollView window] makeKeyAndOrderFront:self]; return self; } /* * User wants a find panel. Create it. Also, set the text to be searched to the * firstResponder object. */ - findPanel:sender { id myObject; if (!findObject) findObject = [[FindObject alloc] init]; myObject = [[NXApp keyWindow] firstResponder]; if (myObject == fileDocView) [findObject setSearchMe:fileDocView]; else [findObject setSearchMe:theMatrix]; [findObject findPanel:self]; return self; } /* * Find the Next instance of the string we are looking for. Called when the user * uses the menu. */ - findNext:sender { if (findObject) [findObject findNext:sender]; return self; } /* * Find the Previous instance of the string we are looking for. Called when the user * uses the menu. */ - findPrevious:sender { if (findObject) [findObject findPrevious:sender]; return self; } /* * User wants the Info panel...show it. */ - infoPanel:sender { if (!infoPanel) infoPanel = [[InfoPanel alloc] init]; [infoPanel orderInfoPanelFront:sender]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.