home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / gpacks / vib / busy.icn next >
Text File  |  2000-07-29  |  4KB  |  145 lines

  1. #  busy.icn -- vib application demo and tester
  2. #
  3. #  A complex user interface that does nothing useful
  4. #  (except to assist in testing VIB)
  5.  
  6. link vsetup
  7.  
  8. global vidgets
  9.  
  10.  
  11. #  main procedure
  12.  
  13. procedure main(args)
  14.  
  15.    vidgets := ui(args, cbk)            # set up vidgets
  16.  
  17.    VSetItems(vidgets["list1"],
  18.       ["Select", " your", "custom", "pizza", "below"])
  19.    VSetItems(vidgets["list2"],
  20.       ["individual", "small", "medium", "large", "family"])
  21.    VSetItems(vidgets["list3"],
  22.       ["anchovies", "bacon", "black olive", "bell pepper", "broccoli",
  23.       "capicolla", "garlic", "green olive", "linguisa", "mushroom", "onion",
  24.       "pepperoni", "pineapple", "sausage", "spinach", "tomato", "extra cheese"])
  25.  
  26.    GetEvents(vidgets["root"], quitcheck)    # enter event loop
  27. end
  28.  
  29.  
  30. #  quitcheck() -- handle events that fall outside the vidgets
  31.  
  32. procedure quitcheck(e)
  33.    if e === QuitEvents() then
  34.       exit()
  35.    else
  36.       write("unhandled event: ", image(e))
  37. end
  38.  
  39.  
  40. #===<<vib:begin>>===    modify using vib; do not remove this marker line
  41. procedure ui_atts()
  42.    return ["size=490,401", "bg=pale gray", "label=An Icon Busy-Box"]
  43. end
  44.  
  45. procedure ui(win, cbk)
  46. return vsetup(win, cbk,
  47.    [":Sizer:::0,0,490,401:An Icon Busy-Box",],
  48.    ["DUMP:Button:regular::11,31,73,20:DUMP",dump],
  49.    ["QUIT:Button:regular::11,56,73,20:QUIT",quit],
  50.    ["Toggles:Label:::25,159,49,13:Toggles",],
  51.    ["b1:Button:regular::129,189,28,27:1",],
  52.    ["b2:Button:regular::129,216,28,27:2",],
  53.    ["b3:Button:regular::129,243,28,27:3",],
  54.    ["b4:Button:regular::129,270,28,27:4",],
  55.    ["b5:Button:regular::129,297,28,27:5",],
  56.    ["check1:Button:xbox:1:21,282,37,37:",],
  57.    ["checko:Button:check:1:123,108,69,20:checko",],
  58.    ["circlo:Button:circle:1:123,83,69,20:circlo",],
  59.    ["line1:Line:::128,154,186,171:",],
  60.    ["line2:Line:::131,147,189,164:",],
  61.    ["line3:Line:::12,24,150,24:",],
  62.    ["list1:List:r::350,10,120,115:",],
  63.    ["list2:List:w::350,141,120,115:",],
  64.    ["list3:List:a::350,274,120,115:",],
  65.    ["menu1:Menu:pull::12,110,71,21:Food Menu",foodhandler,
  66.       ["American",
  67.          ["Burgers","Barbecue","Tex-Mex","Creole","New England"],
  68.       "Chinese",
  69.          ["Cantonese","Mandarin","Szechuan"],
  70.       "Greek","Italian",
  71.          ["Pasta","Pizza","Sandwiches",
  72.             ["Grinder","Hoagie","Poor Boy","Submarine"]],
  73.       "Mexican",
  74.          ["Sonoran","Chihuahuan","Angelino","Taco Bell"],
  75.       "Japanese","Korean","French","German","English",
  76.       "Scottish","Irish"]],
  77.    ["sbar1:Scrollbar:v:1:316,10,18,379:77,22,66",],
  78.    ["sbar2:Scrollbar:h::20,345,280,18:999,1,777",],
  79.    ["slider1:Slider:h::20,369,280,18:0,1000,200",],
  80.    ["slider2:Slider:v:1:290,10,18,312:33,67,44",],
  81.    ["stations:Choice::5:204,83,57,105:",,
  82.       ["KUAT","KUAZ","KXCI","KJZZ","WOI"]],
  83.    ["tcheck:Button:checkno:1:23,235,62,20:check",],
  84.    ["tcircle:Button:circleno:1:22,256,69,20:circle",],
  85.    ["text:Text::12:122,54,157,19:password:\\=swordfish",],
  86.    ["title1:Label:::11,10,126,13:Some VIB Experimen",],
  87.    ["title2:Label:::137,10,14,13:ts",],
  88.    ["tline:Line:::26,181,92,181:",],
  89.    ["tregular:Button:regular:1:23,189,56,20:regular",],
  90.    ["tsimple:Button:regularno:1:24,213,77,20:no-outline",],
  91.    ["xgrooved:Button:xboxno:1:64,284,33,33:",],
  92.    ["rectx:Rect:grooved::62,282,37,37:",],
  93.    ["rect1:Rect:grooved::188,202,30,50:",],
  94.    ["rect2:Rect:sunken::229,201,30,50:",],
  95.    ["rect3:Rect:raised::188,263,30,50:",],
  96.    ["rect4:Rect:invisible::230,263,30,50:",],
  97.    ["trect:Rect:grooved::12,151,98,176:",],
  98.    )
  99. end
  100. #===<<vib:end>>===    end of section maintained by vib
  101.  
  102.  
  103. procedure cbk(v, x)
  104.    writes("CALLBACK: ")
  105.    VEcho(v, x)
  106.    return
  107. end
  108.  
  109. procedure foodhandler(v, x)
  110.    writes("FOOD: ")
  111.    every writes(" ", !x)
  112.    write()
  113.    return
  114. end
  115.  
  116. procedure dump(v, x)
  117.    local l, id
  118.  
  119.    write()
  120.    write("key         v.id        VGetState(v)   image(v)")
  121.    write("---------   ---------   ------------   -----------------------------")
  122.    l := sort(vidgets, 3)
  123.    while id := get(l) do {
  124.       v := get(l)
  125.       write(left(\id | "**NULL**", 12), left(\v.id | "**NULL**", 12),
  126.      left(vimage(VGetState(v)) | "---", 15), image(v))
  127.       }
  128.    write()
  129.    return
  130. end
  131.  
  132. procedure vimage(a)
  133.    local s
  134.  
  135.    if (type(a) ~== "list") then
  136.       return image(a)
  137.    s := "["
  138.    every s ||:= image(!a) || ","
  139.    return s[1:-1] || "]"
  140. end
  141.  
  142. procedure quit(v, x)
  143.    exit()
  144. end
  145.