MENU
/*includes*/
#include <exec/types.h>
#include <exec/nodes.h>
#include <exec/lists.h>
#include <intuition/intuition.h>
#include <proto/exec.h>
#include <proto/intuition.h>
#include <stdlib.h>
/*Global Variables & Structures*/
USHORT wakeup; /* Wake me up for event */
USHORT class; /* Intu event class */
USHORT code; /* Intu event code */
struct Window *w;
struct IntuiMessage *message;
struct RastPort *WindowRastPort;
int ecode;
void Quit(void)
{
CloseWindow(w);
exit(ecode);
}
/************************ Intuition Defines ***********************************/
struct IntuiText SecItemText =
{
1,2,JAM2,1,1,NULL,(UBYTE *)"Item 2",NULL,
};
struct MenuItem SecItem =
{
NULL,0,12,60,12,ITEMTEXT | ITEMENABLED | HIGHCOMP,0,
(APTR)&SecItemText,NULL,0,NULL,0,
};
struct IntuiText FirstItemText =
{
1,2,JAM2,1,1,NULL,(UBYTE *)"Item 1",NULL,
};
struct MenuItem FirstItem =
{
&SecItem,0,0,60,12,ITEMTEXT | ITEMENABLED | HIGHCOMP,0,
(APTR)&FirstItemText,NULL,0,NULL,0,
};
struct Menu Script =
{
NULL,10,10,100,100,MENUENABLED,(BYTE *) "Scripts",&FirstItem,
};
/*Window defenition*/
struct NewWindow nw = {
600,20, /* Starting corner */
260,10, /* Width, height */
1,2, /* detail, block pens */
CLOSEWINDOW,
ACTIVATE |
WINDOWDEPTH | WINDOWDRAG | WINDOWCLOSE,
/* Window flags */
NULL, /* Pointer to first gadget */
NULL, /* Pointer to checkmark */
"SCRIPTMASTER", /* title */
NULL, /* screen pointer */
NULL, /* bitmap pointer */
150,50,320,200, /* window not sized */
WBENCHSCREEN /* type of screen */
};
/************************ Main procedure ******************************/
void main(void)
{
int event;
event=0;
/************************ Set-Up GUI **********************************/
w = OpenWindow(&nw);
SetMenuStrip(w, &Script);
/************************ Main Loop ***********************************/
FOREVER
{
/*Get Intuition Message*/
if ((message = (struct IntuiMessage *)
GetMsg(w->UserPort)) == NULL)
{
Wait(1L<<w->UserPort->mp_SigBit);
continue;
}
class = message->Class;
code = message->Code;
ReplyMsg((struct Message *)message);
/*React On Message*/
switch(class)
case CLOSEWINDOW:
Quit();
}
}
