home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / apps / desktops / zest / zest_gfa.lst < prev    next >
File List  |  1991-04-03  |  5KB  |  160 lines

  1. ' ZeST Interface Demo
  2. ' 1991, David Becker
  3. ' -------------------------------------
  4. init
  5. draw_gadgets
  6. monitor_mouse
  7. PROCEDURE init
  8.   ' check screen resolution
  9.   rez=XBIOS(4)
  10.   IF rez<>2 THEN
  11.     ALERT 3,"| Monochrome only! ",1,"OK",ok%
  12.   ENDIF
  13.   ' fill entire screen with desktop pattern
  14.   CLS
  15.   DEFTEXT 1,0,0,13
  16.   DEFMOUSE 0
  17.   BOUNDARY 0
  18.   DEFFILL 1,2,4
  19.   PBOX 0,0,639,399
  20. RETURN
  21. PROCEDURE draw_gadgets
  22.   ' call procedures that draw gadgets
  23.   ' by passing upper x position, upper y, lower x and lower y
  24.   zest_button(100,50,300,100)
  25.   zest_info_box(100,150,300,250)
  26.   zest_text_box(100,300,300,380)
  27.   zest_window(340,50,600,280)
  28.   ' call procedures that draw lines
  29.   zest_line_box(340,300,600,370)
  30.   zest_vert_line(30,40,30,300)
  31.   zest_horiz_line(50,120,250,120)
  32.   ' insert text
  33.   GRAPHMODE 2
  34.   DEFTEXT 1,0,0,13
  35.   TEXT 178,80,"Button"
  36.   TEXT 168,200,"Info Box"
  37.   TEXT 168,345,"Text Box"
  38.   TEXT 447,170,"Window"
  39.   TEXT 439,335,"Line Box"
  40.   GRAPHMODE 0
  41. RETURN
  42. PROCEDURE monitor_mouse
  43.   DO
  44.     ' test mouse button
  45.     IF MOUSEK=1 THEN
  46.       ' test mouse x position
  47.       SELECT MOUSEX
  48.       CASE 100 TO 300
  49.         ' test mouse y position
  50.         SELECT MOUSEY
  51.         CASE 50 TO 100
  52.           ' mouse lies within button - press the button
  53.           zest_button_press(100,50,300,100)
  54.         ENDSELECT
  55.       CASE 345 TO 358
  56.         ' test mouse y position
  57.         SELECT MOUSEY
  58.         CASE 54 TO 68
  59.           ' mouse lies within close button on window - press the close button
  60.           zest_button_press(345,54,358,68)
  61.         ENDSELECT
  62.       ENDSELECT
  63.     ENDIF
  64.   LOOP UNTIL MOUSEK=2
  65.   END
  66. RETURN
  67. PROCEDURE zest_button(upper_x%,upper_y%,lower_x%,lower_y%)
  68.   DEFLINE 1,1
  69.   DEFFILL 0,2,8
  70.   PBOX upper_x%,upper_y%,lower_x%,lower_y%
  71.   DEFFILL 1,2,4
  72.   PBOX upper_x%+1,upper_y%+1,lower_x%,lower_y%
  73.   LINE upper_x%+1,lower_y%,lower_x%,lower_y%
  74.   LINE upper_x%,lower_y%+1,lower_x%,lower_y%+1
  75.   LINE lower_x%,upper_y%+1,lower_x%,lower_y%
  76.   LINE lower_x%+1,upper_y%,lower_x%+1,lower_y%+1
  77. RETURN
  78. PROCEDURE zest_button_press(upper_x%,upper_y%,lower_x%,lower_y%)
  79.   DEFLINE 1,1
  80.   GET upper_x%-1,upper_y%-1,lower_x%+1,lower_y%+1,button$
  81.   GET upper_x%+1,upper_y%+1,lower_x%-2,lower_y%-2,shift_button$
  82.   PUT upper_x%+2,upper_y%+2,shift_button$
  83.   LINE upper_x%,upper_y%,lower_x%,upper_y%
  84.   LINE upper_x%,upper_y%,upper_x%,lower_y%
  85.   COLOR 0
  86.   LINE upper_x%+1,lower_y%,lower_x%,lower_y%
  87.   LINE upper_x%,lower_y%+1,lower_x%,lower_y%+1
  88.   LINE lower_x%,upper_y%+1,lower_x%,lower_y%
  89.   LINE lower_x%+1,upper_y%,lower_x%+1,lower_y%+1
  90.   COLOR 1
  91.   DO
  92.   LOOP UNTIL MOUSEK=0
  93.   PAUSE 3
  94.   PUT upper_x%-1,upper_y%-1,button$
  95. RETURN
  96. PROCEDURE zest_info_box(upper_x%,upper_y%,lower_x%,lower_y%)
  97.   DEFLINE 1,1
  98.   DEFFILL 1,2,4
  99.   PBOX upper_x%,upper_y%,lower_x%,lower_y%
  100.   LINE upper_x%,upper_y%,lower_x%,upper_y%
  101.   LINE upper_x%,upper_y%+1,lower_x%,upper_y%+1
  102.   LINE upper_x%,upper_y%,upper_x%,lower_y%
  103.   LINE upper_x%+1,upper_y%,upper_x%+1,lower_y%
  104.   COLOR 0
  105.   LINE upper_x%+1,lower_y%,lower_x%,lower_y%
  106.   LINE upper_x%,lower_y%+1,lower_x%,lower_y%+1
  107.   LINE lower_x%,upper_y%+1,lower_x%,lower_y%
  108.   LINE lower_x%+1,upper_y%,lower_x%+1,lower_y%+1
  109.   COLOR 1
  110. RETURN
  111. PROCEDURE zest_text_box(upper_x%,upper_y%,lower_x%,lower_y%)
  112.   DEFLINE 1,1
  113.   DEFFILL 1,2,4
  114.   PBOX upper_x%,upper_y%,lower_x%,lower_y%
  115.   LINE upper_x%,upper_y%,lower_x%,upper_y%
  116.   LINE upper_x%,upper_y%+1,lower_x%,upper_y%+1
  117.   LINE upper_x%,upper_y%,upper_x%,lower_y%
  118.   LINE upper_x%+1,upper_y%,upper_x%+1,lower_y%
  119.   COLOR 0
  120.   LINE upper_x%+1,lower_y%,lower_x%,lower_y%
  121.   LINE upper_x%,lower_y%+1,lower_x%,lower_y%+1
  122.   LINE lower_x%,upper_y%+1,lower_x%,lower_y%
  123.   LINE lower_x%+1,upper_y%,lower_x%+1,lower_y%+1
  124.   COLOR 1
  125.   DEFFILL 0,2,8
  126.   PBOX upper_x%+2,upper_y%+2,lower_x%-2,lower_y%-2
  127. RETURN
  128. PROCEDURE zest_horiz_line(upper_x%,upper_y%,lower_x%,lower_y%)
  129.   DEFLINE 1,1
  130.   LINE upper_x%,upper_y%,lower_x%,lower_y%
  131.   COLOR 0
  132.   LINE upper_x%,upper_y%+1,lower_x%,lower_y%+1
  133.   COLOR 1
  134. RETURN
  135. PROCEDURE zest_vert_line(upper_x%,upper_y%,lower_x%,lower_y%)
  136.   DEFLINE 1,1
  137.   LINE upper_x%,upper_y%,lower_x%,lower_y%
  138.   COLOR 0
  139.   LINE upper_x%+1,upper_y%,lower_x%+1,lower_y%
  140.   COLOR 1
  141. RETURN
  142. PROCEDURE zest_line_box(upper_x%,upper_y%,lower_x%,lower_y%)
  143.   DEFLINE 1,1
  144.   COLOR 0
  145.   BOX upper_x%,upper_y%,lower_x%,lower_y%
  146.   COLOR 1
  147.   LINE upper_x%-1,upper_y%,upper_x%-1,lower_y%
  148.   LINE upper_x%+2,lower_y%-1,lower_x%-2,lower_y%-1
  149.   LINE lower_x%-1,upper_y%+2,lower_x%-1,lower_y%-2
  150.   LINE upper_x%-1,upper_y%-1,lower_x%,upper_y%-1
  151. RETURN
  152. PROCEDURE zest_window(upper_x%,upper_y%,lower_x%,lower_y%)
  153.   ' title bar
  154.   GOSUB zest_button(upper_x%,upper_y%,lower_x%,upper_y%+20)
  155.   ' window area
  156.   GOSUB zest_button(upper_x%,upper_y%+22,lower_x%,lower_y%)
  157.   ' close button
  158.   GOSUB zest_button(upper_x%+5,upper_y%+4,upper_x%+18,upper_y%+16)
  159. RETURN
  160.