/* * GadgetDEMO.c - © Copyright 1990-91 Jaba Development * * Just a little demo of some of the gadget functions of the * tool.library V7++ */ #include "functions.h" #include "tool.h" #include "GadgetDEMO.h" struct ToolBase *ToolBase; struct IntuitionBase *IntuitionBase; struct Window *window; struct IntuiMessage *msg; struct Gadget *pressed; ULONG class; USHORT id; BOOL OnOff = FALSE, DeSel = FALSE, Erase = FALSE; LONG Shadow = 0; void main() { if(ToolBase = (struct ToolBase *) OpenLibrary("tool.library",TOOL_VERSION)) { IntuitionBase = ToolBase->IntuitionBase; if(window = (struct Window *)OpenWindow(NEWWINDOW)) { FOREVER { Wait(1 << window->UserPort->mp_SigBit); while(msg = (struct IntuiMessage *)GetMsg(window->UserPort)) { class = msg->Class; pressed = (struct Gadget *)msg->IAddress; id = pressed->GadgetID; ReplyMsg((struct Message *)msg); switch(class) { case CLOSEWINDOW: CloseWindow(window); CloseLibrary(ToolBase); exit(0); break; case GADGETUP: switch(id) { case mutex_ID: MutualExclude(window,pressed,&first_ex,NULL); break; case mutin_ID: MutualInclude(window,pressed,&first_in,NULL); break; case ongd_ID: if(! OnOff) { OffGList(window,&first_on,NULL,4); OnOff = TRUE; } else { OnGList(window,&first_on,NULL,4); OnOff = FALSE; } break; case ergd_ID: if(! Erase) { EraseGList(window,&first_er,NULL,4); Erase = TRUE; } else { RefreshGList(&first_er,window,NULL,4); Erase = FALSE; } break; case segd_ID: if(! DeSel) { SelectGList(window,&first_se,NULL,4); DeSel = TRUE; } else { DeSelectGList(window,&first_se,NULL,4); DeSel = FALSE; } break; case shgd_ID: if(Shadow++ > 3) Shadow = 0; ShadowGList(window,&first_sh,NULL,Shadow,4); break; } break; default: break; } } } } CloseLibrary(ToolBase); } }