home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------------------------
- This is the "application delegate", the object messaged if the true
- Application object doesn't understand a message. We use this as a
- sort of substitute for main().
-
- We're actually vended as a distributed object--other processes or
- threads within this process can hook up to us and send us messages.
- This is done to serialize output to the windowserver and appkit--
- otherwise we run into problems with critical sections.
-
- We initialize some things in appDidInit:. When the user hits one
- of the menu items, we get the message and act upon it.
-
- This is not in any way, shape, or form optimized for speed. There
- are a bunch of things that could be done to speed things up. The
- biggest offendor is probably the CircleView class, which is banging
- on the window server in various ways.
-
- This file is set up for a width of 130 columns, with tab stops
- every two spaces.
-
- HISTORY
-
- 10Oct93 DM New
- ----------------------------------------------------------------------------*/
-
-
- #import <appkit/appkit.h>
-
- // This is a formal protocol declaration of the object methods that must be implemented
- // by our example server. These are implemented in the .m file.
-
- @protocol ServerInterface
-
- // The main methods called by the threads, which output things to the screen.
- // All the data sent to these methods is strictly input.
-
- - showIncreasing // Show an increasing number in the text field
- :(in int)pNumber; // INPUT: the number to show
-
- - showPrime // Show a prime number in the text field
- :(in int)pPrime; // INPUT: the prime to show
-
- - showFib // Show a fibonaci number in the text field
- :(in int)pFib; // INPUT: the fib to show
-
- - drawRandomCircleAt // Draw a circle at the given point with the given radius
- :(in NXPoint)pPoint // INPUT: where to draw it at (the center)
- withRadius:(in float)pRadius; // INPUT: the radius
-
- @end
-
- // Adopt the ServerInterface protocol as our own. We're a subclass of Object.
-
- @interface AppDelegate:Object <ServerInterface>
- {
- id increasingDisp; // ScrollView that holds increasing number sequence
- id primeDisp; // ScrollView that holds increasing prime sequence
- id fibDisp; // ScrollView that holds increasing fibonacci sequence
- id circleView; // View in which random circles are displayed
-
- NXConnection *connection; // Our Distributed Object connection
-
- @public
- BOOL isRunning;
- }
-
-
- // App initialization delegate method
-
- - appDidInit:sender; // called after application object is initialized
-
- - doThreads:sender; // Starts doing things--slamming numbers to the screen. Clears things out, too
- - stopThreads:sender; // Stops all the treads
-
- - addToText // Utility method--adds text at end of given text obj
- :(Text*)pTextObj // INPUT: text obj to add to
- string:(char*)pString; // INPUT: the text we're adding
-
- @end
-