home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 408.lha / StarBlankers / app.c < prev    next >
C/C++ Source or Header  |  1990-09-02  |  4KB  |  144 lines

  1.  
  2.    /***********************************************************************
  3.    *                                                                      *
  4.    *                            COPYRIGHTS                                *
  5.    *                                                                      *
  6.    *   Copyright (c) 1990  Commodore-Amiga, Inc.  All Rights Reserved.    *
  7.    *                                                                      *
  8.    ***********************************************************************/
  9.  
  10. /* custom.c This file contains the custom code for a commodity */
  11. /* you should be able to write a new commodity by changing only */
  12. /* custom.c and custom.h */
  13.  
  14. #include "app.h"
  15.  
  16. #if WINDOW
  17.  
  18. #define V(x) ((VOID *)x)
  19.  
  20. struct TextAttr mydesiredfont =
  21.    {
  22.       "topaz.font",  /*  Name */
  23.       8,             /*  YSize */
  24.       0,             /*  Style */
  25.       0,             /*  Flags */
  26.    };
  27.  
  28. VOID setupCustomGadgets(gad)
  29. struct Gadget **gad;
  30. {
  31.    mysetupCustomGadgets(gad);
  32. }
  33. VOID HandleGadget(gad,code)
  34. ULONG gad,code;
  35. {
  36.    myHandleGadget(gad,code);
  37. }
  38. VOID setupCustomMenu()
  39. {
  40.    struct NewMenu mynewmenu [] =
  41.       {
  42.          {  NM_TITLE,   "Project",  0,    0, 0, 0,             },
  43.          {   NM_ITEM,   "Hide",     "H",  0, 0, V(MENU_HIDE),   },
  44.          {   NM_ITEM,   "Quit",      "Q",  0, 0, V(MENU_DIE),    },
  45.          {  NM_END,     0,          0,    0, 0, 0              },
  46.       };
  47.  
  48.    menu=CreateMenus(mynewmenu,TAG_DONE);
  49.    D( kprintf("custom: CreateMenus returns menu =  %lx\n",menu); )
  50. }
  51. VOID handleCustomMenu(code)
  52. UWORD code;
  53. {
  54.    struct MenuItem *item;
  55.    BOOL terminated=FALSE;
  56.  
  57.    D( kprintf("custom: handleCustomMenu(code=%lx)\n",code); )
  58.    while((code!=MENUNULL)&&(!terminated))
  59.    {
  60.       item=ItemAddress(menu,code);
  61.       switch((int)MENU_USERDATA(item))
  62.       {
  63.          case MENU_HIDE:
  64.                shutdownWindow();
  65.                terminated=TRUE; /* since window is gone NextSelect is invalid so...*/
  66.                break;
  67.          case MENU_DIE:
  68.                terminate();
  69.                break;
  70.          default:
  71.                break;
  72.       }
  73.       code=item->NextSelect;
  74.       D( kprintf("custom: handleCustomMenu next code=%lx\n",code); )
  75.    }
  76.    D( kprintf("custom: handleCustomMenu exits"); )
  77. }
  78. VOID refreshWindow()
  79. {
  80.    if(window)
  81.    {
  82.       if(IDCMPRefresh)
  83.          GT_BeginRefresh( window );
  84.  
  85.       SetAPen(window->RPort,2);
  86.       SetDrMd(window->RPort,JAM1);
  87.       SetFont(window->RPort,font);
  88.       Move(window->RPort,160,topborder+8);
  89.       Text(window->RPort,"Never Blank --",14);
  90.       Move(window->RPort,190,topborder+18);
  91.       Text(window->RPort,"Top Right",9);
  92.       Move(window->RPort,160,topborder+28);
  93.       Text(window->RPort,"Blank Now --",12);
  94.       Move(window->RPort,190,topborder+38);
  95.       Text(window->RPort,"Bottom Right",12);
  96.  
  97.       if(IDCMPRefresh)
  98.          GT_EndRefresh( window, 1L );
  99.  
  100.       /* It is possible that the user has selected a font so large */
  101.       /* that our imagery will fall off the bottom of the window   */
  102.       /* we RefreshWindowFrame here incase our borders were overwritten */
  103.       if((topborder+WINDOW_INNERHEIGHT) > window->Height)
  104.          RefreshWindowFrame(window);
  105.    }
  106.    return;
  107. }
  108.  
  109. #endif /* WINDOW */
  110.  
  111. BOOL setupCustomCX()
  112. {
  113.    return(setupBlanker());
  114. }
  115. VOID shutdownCustomCX()
  116. {
  117. }
  118. VOID handleCustomCXMsg(id)
  119. ULONG id;
  120. {
  121.    switch(id)
  122.    {
  123.       case 0:
  124.       default:
  125.             break;
  126.    }
  127. }
  128. VOID handleCustomCXCommand(id)
  129. ULONG id;
  130. {
  131.    switch(id)
  132.    {
  133.       case 0:
  134.       default:
  135.             break;
  136.    }
  137. }
  138. #if CSIGNAL
  139. VOID handleCustomSignal(VOID)
  140. {
  141.    MyHandleCustomSignal();
  142. }
  143. #endif
  144.