home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / amigae / e_v3.2a / rkrmsrc / intuition / images_text / shadowborder.e < prev    next >
Text File  |  1977-12-31  |  3KB  |  66 lines

  1. -> shadowborder.e - Program to show the use of an Intuition Border.
  2.  
  3. OPT OSVERSION=37  -> E-Note: silently require V37
  4.  
  5. MODULE 'graphics/rastport',
  6.        'intuition/intuition',
  7.        'intuition/screens'
  8.  
  9. ENUM ERR_NONE, ERR_DRAW, ERR_PUB, ERR_WIN
  10.  
  11. RAISE ERR_DRAW IF GetScreenDrawInfo()=NIL,
  12.       ERR_PUB  IF LockPubScreen()=NIL,
  13.       ERR_WIN  IF OpenWindowTagList()=NIL
  14.  
  15. CONST MYBORDER_LEFT=0, MYBORDER_TOP=0
  16.  
  17. -> Main routine. Open required window and draw the images.  This routine opens
  18. -> a very simple window with no IDCMP.  See the chapters on "Windows" and
  19. -> "Input and Output Methods" for more info.  Free all resources when done.
  20. PROC main() HANDLE
  21.   DEF screen=NIL, win=NIL:PTR TO window, drawinfo=NIL:PTR TO drawinfo,
  22.       shineBorder, shadowBorder, mySHADOWPEN=1, mySHINEPEN=2
  23.  
  24.   -> E-Note: C version doesn't think these should cause fatal errors...
  25.   screen:=LockPubScreen(NIL)
  26.   drawinfo:=GetScreenDrawInfo(screen)
  27.  
  28.   -> Get a copy of the correct pens for the screen.  This is very important in
  29.   -> case the user or the application has the pens set in a unusual way.
  30.   mySHADOWPEN:=drawinfo.pens[SHADOWPEN]
  31.   mySHINEPEN:=drawinfo.pens[SHINEPEN]
  32.  
  33.   -> Open a simple window on the workbench screen for displaying a border.  An
  34.   -> application would probably never use such a window, but it is useful for
  35.   -> demonstrating graphics...
  36.   -> E-Note: C version uses "screen" after unlocking it!
  37.   win:=OpenWindowTagList(NIL, [WA_PUBSCREEN, screen, WA_RMBTRAP, TRUE, NIL])
  38.  
  39.   shineBorder:=[MYBORDER_LEFT, MYBORDER_TOP, mySHINEPEN, 0,
  40.                 RP_JAM1, 5, [0,0, 50,0, 50,30, 0,30, 0,0]:INT,
  41.                 NIL]:border
  42.   shadowBorder:=[MYBORDER_LEFT+1, MYBORDER_TOP+1, mySHADOWPEN, 0,
  43.                  RP_JAM1, 5, [0,0, 50,0, 50,30, 0,30, 0,0]:INT,
  44.                  shineBorder]:border
  45.  
  46.   -> Draw the border at 10, 10
  47.   DrawBorder(win.rport, shadowBorder, 10, 10)
  48.  
  49.   -> Draw the border again at 100, 10
  50.   DrawBorder(win.rport, shadowBorder, 100, 10)
  51.  
  52.   -> Wait a bit, then quit.
  53.   -> In a real application, this would be an event loop, like the one described
  54.   -> in the Intuition Input and Output Methods chapter.
  55.   Delay(200)
  56.  
  57. EXCEPT DO
  58.   IF win THEN CloseWindow(win)
  59.   IF drawinfo THEN FreeScreenDrawInfo(screen, drawinfo)
  60.   IF screen THEN UnlockPubScreen(NIL, screen)
  61.   SELECT exception
  62.   CASE ERR_DRAW; WriteF('Error: Failed to get DrawInfo for screen\n')
  63.   CASE ERR_PUB;  WriteF('Error: Failed to lock public screen\n')
  64.   CASE ERR_WIN;  WriteF('Error: Failed to open window\n')
  65.   ENDSELECT
  66. ENDPROC