home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / e / EasyGUI_v33b2.lha / Src / EasyGUI / imagebutton_test.e < prev    next >
Text File  |  1997-02-10  |  6KB  |  129 lines

  1. MODULE 'tools/easygui', 'tools/exceptions', 'tools/copylist',
  2.        'intuition/intuition',
  3.        'plugins/imagebutton'
  4.  
  5. DEF pp1, pp2, b2=NIL:PTR TO imagebutton
  6.  
  7. PROC main() HANDLE
  8.   DEF b1=NIL:PTR TO imagebutton, b3=NIL:PTR TO imagebutton,
  9.       bp=NIL:PTR TO imagebutton, img1, img2, img3,
  10.       d1=NIL, d2=NIL, d3=NIL, d4=NIL, d5=NIL
  11.   img1:=[0,0,22,22,3,
  12.          d1:=copyListToChip([    /* Plane 0 */
  13.                              $00000000,$00000000,$00000000,$00000000,
  14.                              $00FC0000,$00060000,$00058000,$0404C000,
  15.                              $0407E000,$04006000,$04006000,$04006000,
  16.                              $04006000,$04006000,$04006000,$04006000,
  17.                              $04006000,$04006000,$04006000,$07FFE000,
  18.                              $01FFE000,$00000000,
  19.                               /* Plane 1 */
  20.                              $00000000,$02000000,$0A800000,$07000000,
  21.                              $38C00000,$07F80000,$0BFA8000,$07FB4000,
  22.                              $07F82000,$07FFA000,$07FFA000,$07FFA000,
  23.                              $03FFA000,$03FFA000,$03FFA000,$03FFA000,
  24.                              $03FFA000,$03FFA000,$03FFA000,$00002000,
  25.                              $01FFE000,$00000000,
  26.                               /* Plane 2 */
  27.                              $00000000,$00000000,$00000000,$00000000,
  28.                              $00C00000,$00000000,$00008000,$04004000,
  29.                              $04002000,$04002000,$04002000,$04002000,
  30.                              $00002000,$00002000,$00002000,$00002000,
  31.                              $00002000,$00002000,$00002000,$00002000,
  32.                              $01FFE000,$00000000]),
  33.          $0007,0,NIL]:image
  34.   img2:=[0,0,22,22,3,
  35.          d2:=copyListToChip([    /* Plane 0 */
  36.                              $00000000,$00007000,$0003F000,$000FF000,
  37.                              $001FF800,$000FF800,$0007F800,$1E0FF000,
  38.                              $21DFF000,$40FFF000,$407FF000,$40FB2000,
  39.                              $5FFF8000,$50008000,$7000E000,$6000C000,
  40.                              $60018000,$60018000,$40010000,$7FFE0000,
  41.                              $00000000,$00000000,
  42.                               /* Plane 1 */
  43.                              $00000000,$00004000,$00022000,$0001E000,
  44.                              $0017E800,$000BE800,$0003D800,$0007D000,
  45.                              $1ECE5000,$3F1DB000,$3FB9F000,$3F752000,
  46.                              $20000000,$2FFF0000,$3FFF6000,$1FFF4000,
  47.                              $1FFF8000,$3FFE8000,$3FFE0000,$00000000,
  48.                              $00000000,$00000000,
  49.                               /* Plane 2 */
  50.                              $00000000,$00004000,$00020000,$00000000,
  51.                              $00100800,$00080800,$00001800,$00001000,
  52.                              $1EC01000,$3F01B000,$3F81F000,$3F052000,
  53.                              $20000000,$25550000,$3AAA6000,$15554000,
  54.                              $0AAB8000,$35548000,$2AAA0000,$00000000,
  55.                              $00000000,$00000000]),
  56.          $0007,0,NIL]:image
  57.   img3:=[0,0,22,22,3,
  58.          d3:=copyListToChip([    /* Plane 0 */
  59.                              $00000000,$10000000,$3C000000,$7E000000,
  60.                              $3F000000,$1FB00000,$0FF00000,$07FC0000,
  61.                              $07FC0000,$0BFC0000,$17FF8000,$17F8C000,
  62.                              $11F8C000,$17FFE000,$14002000,$1C003800,
  63.                              $18003000,$18006000,$18006000,$10004000,
  64.                              $1FFF8000,$00000000,
  65.                               /* Plane 1 */
  66.                              $00000000,$00000000,$14000000,$3A000000,
  67.                              $1D000000,$0E900000,$07200000,$03EC0000,
  68.                              $01EC0000,$05F40000,$0BF00000,$08F74000,
  69.                              $0F374000,$08000000,$0BFFC000,$0FFFD800,
  70.                              $07FFD000,$07FFE000,$0FFFA000,$0FFF8000,
  71.                              $00000000,$00000000,
  72.                               /* Plane 2 */
  73.                              $00000000,$00000000,$04000000,$02000000,
  74.                              $01000000,$00900000,$00000000,$000C0000,
  75.                              $000C0000,$04040000,$08000000,$08074000,
  76.                              $0F274000,$08000000,$09554000,$0EAA9800,
  77.                              $05555000,$02AAE000,$0D552000,$0AAA8000,
  78.                              $00000000,$00000000]),
  79.          $0007,0,NIL]:image
  80.   pp1:=[0,0,22,7,2,
  81.         d4:=copyListToChip([$00030000, $0003C000, $0003F000, $0003FC00,
  82.                         $0003F000, $0003C000, $00030000,
  83.                         $E3800000, $E3800000, $E3800000, $E3800000,
  84.                         $E3800000, $E3800000, $E3800000]),
  85.         $0003, 0, NIL]:image
  86.   pp2:=[0,0,22,7,2,
  87.         d5:=copyListToChip([$E3800000, $E3800000, $E3800000, $E3800000,
  88.                         $E3800000, $E3800000, $E3800000,
  89.                         $00030000, $0003C000, $0003F000, $0003FC00,
  90.                         $0003F000, $0003C000, $00030000]),
  91.         $0003, 0, NIL]:image
  92.  
  93.   NEW bp.toggleimagebutton(pp1,30,22)
  94.  
  95.   easyguiA('BOOPSI in EasyGUI!',
  96.     [ROWS,
  97.       [TEXT,'ImageButton test...',NIL,TRUE,5],
  98.       [COLS,
  99.         [PLUGIN,{buttonaction1},NEW b1.toggleimagebutton(img1)],
  100.         [PLUGIN,{buttonaction1},NEW b2.pushimagebutton(img2)],
  101.         [PLUGIN,{buttonaction2},NEW b3.imagebutton(img3)],
  102.         [PLUGIN,{buttonaction3},bp]
  103.       ],
  104.       [SBUTTON,{toggle_enabled},'Toggle Enabled',bp]
  105.     ])
  106. EXCEPT DO
  107.   END b1,b2,b3,bp
  108.   Dispose(d1); Dispose(d2); Dispose(d3); Dispose(d4); Dispose(d5)
  109.   report_exception()
  110. ENDPROC
  111.  
  112. PROC buttonaction1(i,b:PTR TO imagebutton)
  113.   WriteF('button selected=\d\n', b.selected)
  114. ENDPROC
  115.  
  116. PROC buttonaction2(i,b:PTR TO imagebutton)
  117.   WriteF('button selected=\d\n', b.selected)
  118.   b2.setselected(FALSE)
  119. ENDPROC
  120.  
  121. PROC buttonaction3(i,b:PTR TO imagebutton)
  122.   WriteF('button selected=\d\n', b.selected)
  123.   b.setimage(IF b.selected THEN pp2 ELSE pp1)
  124. ENDPROC
  125.  
  126. PROC toggle_enabled(b:PTR TO imagebutton,i)
  127.   b.setdisabled(b.disabled=FALSE)
  128. ENDPROC
  129.