home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_01 / HISPEED2.LZH / GEMDEMO / DEMOMENU.PAS < prev    next >
Pascal/Delphi Source File  |  1991-07-02  |  2KB  |  67 lines

  1. {---------------------------------------------------------------------
  2.                  GEM Menu Interface for GEMDEMO
  3.  
  4.                 Copyright (c) 1990 D-House I ApS
  5.                        All rights reserved
  6.  
  7.                  Programmed by Martin Eskildsen
  8. ---------------------------------------------------------------------}
  9.  
  10. {$D+}
  11.  
  12. unit DemoMenu;
  13.  
  14. INTERFACE
  15.  
  16. uses GemDecl, GemAES, DemoInterface, DemoWindows;
  17.  
  18. { Handle the menu messages
  19.   title  : drow-down menu's title index
  20.   index  : menu item's index
  21. }
  22. procedure HandleMenu(title, index : Integer);
  23.  
  24. {$F+,D-,R-,S-}
  25.  
  26. IMPLEMENTATION
  27.  
  28. { Handle the ABOUTBOX }
  29. procedure DoAboutBox;
  30. var
  31.   x, y, w, h : Integer;   { Dialog box outline size                   }
  32.   i          : Integer;   { Item index ending dialog box (ABOUTOK)    }
  33. begin
  34.   form_center(about, x, y, w, h);                { centre on screen   }
  35.   form_dial(FMD_START, 0, 0, 0, 0, x, y, w, h);  { reserve RAM        }
  36.   form_dial(FMD_GROW, 0, 0, 0, 0, x, y, w, h);   { draw growing box   }
  37.   objc_draw(about, 0, $7FFF, x, y, w, h);        { draw dialog box    }
  38.   i := form_do(about, -1);                       { do the dialog      }
  39.   form_dial(FMD_SHRINK, 0, 0, 0, 0, x, y, w, h); { shrinking box      }
  40.   form_dial(FMD_FINISH, 0, 0, 0, 0, x, y, w, h); { release RAM        }
  41.   SetObjectStatus(about, ABOUTOK, NORMAL)        { reset button state }
  42. end;
  43.  
  44. { Not very optimally programmed! But easy to extend, however }
  45. procedure HandleMenu;
  46. begin
  47.   case title of
  48.     DESKMENU : case index of
  49.                  ABOUTBAR : DoAboutBox
  50.                end;
  51.     WINMENU  : case index of
  52.                  WINCLOSE : CloseTopWindow;
  53.                  TXTOPEN  : OpenTextWindow;
  54.                  TXTCLOSE : CloseTextWindow;
  55.                  GRAOPEN  : OpenGraphicsWindow;
  56.                  GRACLOSE : CloseGraphicsWindow;
  57.                  GRASELEC : SelectGraphicsDemo
  58.                end;
  59.     QUITMENU : case index of
  60.                  QUITBAR  : quit := TRUE
  61.                end
  62.   end;
  63.   menu_tnormal(menu, title, 1)    { set menu title back to normal }
  64. end;
  65.  
  66. end.
  67.