home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1994 June / NEBULA_SE.ISO / SourceCode / Broadcast / BroadcastDaemon / Controller.m < prev    next >
Encoding:
Text File  |  1993-01-14  |  1.4 KB  |  54 lines

  1. #import "Controller.h"
  2. #import <shared.h>
  3.  
  4. @implementation Controller
  5.  
  6. /*=========================================================================
  7.  * NAME        : appDidInit:
  8.  * DESCRIPTION : Delegate message of Application.
  9.  *=========================================================================*/
  10. - appDidInit:sender
  11. {
  12.     // Move the application icon off screen
  13.     [[NXApp appIcon] moveTo:-1000.0 :-1000.0];
  14.     
  15.     // Don't become the key application
  16.     [NXApp deactivateSelf];
  17.  
  18.     return self;
  19. }
  20.  
  21. /*=========================================================================
  22.  * NAME        : broadcast:from:
  23.  * DESCRIPTION : Delegate message from Listener.  This is a request to
  24.  *         pop up a panel with a message.
  25.  *=========================================================================*/
  26. - (int) broadcast:(char *)msg from:(char *)user
  27. {
  28.     //id thePanel = nil;
  29.     char title[128];
  30.     
  31.     // Get rid of previous panel
  32.     //if (thePanel) {
  33.     //    [thePanel orderOut:self];
  34.     //[thePanel free];
  35.     //thePanel = nil;
  36.    // }
  37.     
  38.     // Build title
  39.     if (user && strlen(user))
  40.         sprintf(title, "Alert from %s", user);
  41.     else
  42.         strcpy(title, "Alert");
  43.     
  44.     // Show panel
  45.     if (msg && strlen(msg)) {
  46.         NXRunAlertPanel(title, msg, "OK", NULL, NULL);
  47.         //thePanel = NXGetAlertPanel(title, msg, NULL, NULL, NULL);
  48.     //[thePanel orderFront:self];
  49.     }
  50.     return 0;
  51. }
  52.  
  53. @end
  54.