home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
357.lha
/
intuisup_v1.15
/
examples
/
list
/
test.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-03-10
|
3KB
|
100 lines
#include <intuition/intuisup.h>
#include <intuition/intuitionbase.h>
struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
#ifdef ISUP_RUNTIME
struct Library *iSupBase;
#else
struct Device *ConsoleDevice;
struct IOStdReq ConsoleMsg;
#endif
VOID main(argc, argv)
LONG argc;
char **argv;
{
extern struct IntuiMessage *GetMsg();
extern struct Window *OpenStdWindow();
BOOL mainswitch, ioswitch;
LONG class;
SHORT pick;
struct IntuiMessage *message;
struct ListSupport *list1, *list2;
struct Window *window;
struct Screen *s;
if ( !(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 0))
|| !(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 0))
#ifdef ISUP_RUNTIME
|| !(iSupBase = (struct Library *)OpenLibrary("isup.library", 0))
#else
|| !(!OpenDevice("console.device", -1, &ConsoleMsg, 0) && (ConsoleDevice=ConsoleMsg.io_Device))
#endif
) goto MAIN_DONE;
s = IntuitionBase->FirstScreen;
if (!(window=OpenStdWindow("List Requester Example", 0x1B, 15, 65, 350, 70, NULL))) goto MAIN_DONE;
list1 = GetListSupport((LONG)s, (LONG)&s->NextScreen, (LONG)&s->Title);
list2 = GetListSupport((LONG)s, (LONG)&s->NextScreen, (LONG)&s->Title);
if ((window == NULL) || (list1 == NULL) || (list2 == NULL)) goto MAIN_DONE;
Emit(window, "Click here for a List requester", 42, 40, 2);
list2->ReqTitle = (UBYTE *)"Select a Screen";
list2->MaxChars = 21;
list2->MaxLines = 10;
SetFlag(list1->Flags, LR_DRAG_BAR_OFF | LR_AUTO_CENTER );
SetFlag(list2->Flags, LR_AUTO_CENTER);
mainswitch = TRUE;
pick = 0;
while (mainswitch)
{
WaitPort(window->UserPort);
ioswitch = FALSE;
while (message = GetMsg(window->UserPort))
{
class = message->Class;
ReplyMsg(message);
switch(class)
{
case CLOSEWINDOW: mainswitch=FALSE; break;
default:
/* If any other event occurs, bring up that old requester! */
ioswitch = TRUE;
break;
}
}
if (ioswitch)
{
if (pick == 0) GetListName(list1, window, 6, 15);
else GetListName(list2, window, 6, 15);
pick = 1 - pick;
}
}
MAIN_DONE:
if (list1) ReleaseList(list1);
if (list2) ReleaseList(list2);
if (window) CloseStdWindow(window);
#ifdef ISUP_RUNTIME
if (iSupBase) CloseLibrary(iSupBase);
#else
if (ConsoleDevice) CloseDevice(&ConsoleMsg);
#endif
if (IntuitionBase) CloseLibrary(IntuitionBase);
if (GfxBase) CloseLibrary(GfxBase);
}