/*
 * Source generated by GenGui V1.0
 * which is (c)1994 by Matthias Meixner
 */

#ifndef _GUI_LAYOUT
#define _GUI_LAYOUT

#include <exec/types.h>
#include <libraries/gadtools.h>
#include <proto/gadtools.h>

#include <intuition/gadgetclass.h>
#define GL_VBOX -1
#define GL_HBOX -2
#define CUSTOM_KIND -3

#define MODE_NEW     0
#define MODE_RESIZE  1
#define MODE_REFRESH 2
#define MODE_FREE    3
#define MODE_BACKUP  4
#define MODE_RESTORE 5

#define BOXFLG_CUSTOM   1
#define BOXFLG_STRING   2
#define BOXFLG_INTEGER  4
#define BOXFLG_DISABLED 8
#define BOXFLG_BACKUP  16
#define BOXFLG_INITED  (1<<15)

#define GetString(g) (((struct StringInfo * )g->SpecialInfo)->Buffer)
#define GetNumber(g) (((struct StringInfo * )g->SpecialInfo)->LongInt)
#define GetInfo(g) ((struct GadInfo *)((g)->UserData))
#define GetUserData(g) (GetInfo(g)->UserData)

struct GadDim {
   int Kind;
   USHORT Rx,Ry,Cx,Cy,Px,Py,SRx,SRy,SPx,SPy;
   USHORT Flags;
};

struct Box {
   struct GadDim Dim;
   struct Box **Entry;
};

struct WinInfo {
   struct Box *Box;
   struct Gadget **Gadgets;
   struct Gadget *Prev;
   struct Window *Window;
   struct Gadget *GList;
   int FontX,FontY;
   struct TextAttr TextAttr;
   APTR Visual;
   char Mode,Render;
   USHORT MinX,MinY;
};

struct GadInfo {
   struct GadDim dim;
   int XSpace,YSpace,GadNum;
   int (*CustomFunc)(struct WinInfo *WInfo,
                     struct NewGadget *NewGad,
                     struct GadInfo *GadInfo,
                     int Left, int Top, int Width, int Height);
   struct TextAttr *TextAttr;
   char *Text;
   int GadgetID;
   ULONG Flags,UserData;
   int(*HookFunc)(struct IntuiMessage *);
   ULONG *Tags;
   ULONG *SaveTags;
   ULONG Code;
   struct Gadget *ThisGad;
};

int RenderGui(struct Window *win, struct WinInfo *winfo);
int ResizeGui(struct WinInfo *winfo);
int RefreshGui(struct WinInfo *winfo);
void FreeGui(struct WinInfo *winfo);
void StopGui(struct WinInfo *winfo);
int SubGui(struct WinInfo *, struct WinInfo *,int ,int ,int , int );

void ClearWindow(struct Window *);
struct IntuiMessage *Gui_GetIMsg(struct MsgPort *userport,struct IntuiMessage *);

BOOL Gui_SetGadgetAttrs(struct Gadget *,struct Window *,
                        struct Requester *, ULONG ,...);
BOOL Gui_SetGadgetAttrsA(struct Gadget *,struct Window *,
                        struct Requester *, ULONG *);
#endif

struct Gadget *Gui1_Gadgets[2];

#define Gui1_1 0

ULONG Gui1Tags1[]={
   TAG_DONE
};

struct GadInfo Gui11={
   BUTTON_KIND,1,1,0,0,0+0,0+0,0,0,0,0,0,
   INTERWIDTH,INTERHEIGHT,0,NULL,NULL,
   "1" ,1,0,0,NULL,Gui1Tags1
};

#define Gui1_2 1

ULONG Gui1Tags2[]={
   TAG_DONE
};

struct GadInfo Gui12={
   BUTTON_KIND,1,1,0,0,0+0,0+0,0,0,0,0,0,
   INTERWIDTH,INTERHEIGHT,1,NULL,NULL,
   "2" ,2,0,0,NULL,Gui1Tags2
};

struct Box *Gui1V0[]={
   (struct Box *)&Gui11,
   (struct Box *)&Gui12,
   NULL
};

struct Box Gui10={
   GL_VBOX,1,1,0,0,0+0,0+0,0,0,0,0,0,Gui1V0
};

struct WinInfo Gui1 = {
   &Gui10,Gui1_Gadgets
};

struct Gadget *Gui2_Gadgets[2];

#define Gui2_3 0

ULONG Gui2Tags1[]={
   GTST_MaxChars,256 ,TAG_DONE
};

struct GadInfo Gui21={
   STRING_KIND,1,1,0,0,0+0,0+0,0,0,0,0,BOXFLG_STRING,
   INTERWIDTH,INTERHEIGHT,0,NULL,NULL,
   "",3,0,0,NULL,Gui2Tags1
};

#define Gui2_4 1

ULONG Gui2Tags2[]={
   TAG_DONE
};

struct GadInfo Gui22={
   BUTTON_KIND,1,1,0,0,0+0,0+0,0,0,0,0,0,
   INTERWIDTH,INTERHEIGHT,1,NULL,NULL,
   "2" ,4,0,0,NULL,Gui2Tags2
};

struct Box *Gui2V0[]={
   (struct Box *)&Gui21,
   (struct Box *)&Gui22,
   NULL
};

struct Box Gui20={
   GL_HBOX,1,1,0,0,0+0,0+0,0,0,0,0,0,Gui2V0
};

struct WinInfo Gui2 = {
   &Gui20,Gui2_Gadgets
};

struct Gadget *Gui3_Gadgets[4];

#define Gui3_5 0

ULONG Gui3Tags2[]={
   TAG_DONE
};

struct GadInfo Gui32={
   BUTTON_KIND,1,1,0,0,0+0,0+0,0,0,0,0,0,
   INTERWIDTH,INTERHEIGHT,0,NULL,NULL,
   "1" ,5,0,0,NULL,Gui3Tags2
};

#define Gui3_6 1

ULONG Gui3Tags3[]={
   TAG_DONE
};

struct GadInfo Gui33={
   BUTTON_KIND,1,1,0,0,0+0,0+0,0,0,0,0,0,
   INTERWIDTH,INTERHEIGHT,1,NULL,NULL,
   "2" ,6,0,0,NULL,Gui3Tags3
};

struct Box *Gui3V1[]={
   (struct Box *)&Gui32,
   (struct Box *)&Gui33,
   NULL
};

struct Box Gui31={
   GL_HBOX,1,1,0,0,0+0,0+0,0,0,0,0,0,Gui3V1
};

#define Gui3_7 2

ULONG Gui3Tags5[]={
   TAG_DONE
};

struct GadInfo Gui35={
   BUTTON_KIND,1,1,0,0,0+0,0+0,0,0,0,0,0,
   INTERWIDTH,INTERHEIGHT,2,NULL,NULL,
   "3" ,7,0,0,NULL,Gui3Tags5
};

#define Gui3_8 3

ULONG Gui3Tags6[]={
   TAG_DONE
};

struct GadInfo Gui36={
   BUTTON_KIND,1,1,0,0,0+0,0+0,0,0,0,0,0,
   INTERWIDTH,INTERHEIGHT,3,NULL,NULL,
   "4" ,8,0,0,NULL,Gui3Tags6
};

struct Box *Gui3V4[]={
   (struct Box *)&Gui35,
   (struct Box *)&Gui36,
   NULL
};

struct Box Gui34={
   GL_HBOX,1,1,0,0,0+0,0+0,0,0,0,0,0,Gui3V4
};

struct Box *Gui3V0[]={
   &Gui31,
   &Gui34,
   NULL
};

struct Box Gui30={
   GL_VBOX,1,1,0,0,0+0,0+0,0,0,0,0,0,Gui3V0
};

struct WinInfo Gui3 = {
   &Gui30,Gui3_Gadgets
};

char *modes[]={"Mode 1","Mode 2","Mode 3",NULL};
struct WinInfo *muxmodes[]={&Gui1,&Gui2,&Gui3};
int gui_mux=0;
extern struct WinInfo TestPro;
int MHook(struct IntuiMessage *msg)
{
   StopGui(&TestPro);
   gui_mux=msg->Code;
   ClearWindow(TestPro.Window);
/*   SetRast(TestPro.Window->RPort,0);
   EraseRect(TestPro.Window->RPort,0,0,
             TestPro.Window->Width-1,TestPro.Window->Height-1); */
   RefreshWindowFrame(TestPro.Window);
   RenderGui(TestPro.Window,&TestPro);
   return(1);
}
int Multiplex(struct WinInfo *winfo,
                     struct NewGadget *ng,
                     struct GadInfo *gad,
                     int left, int top, int width, int height)
{
   return(SubGui(winfo,muxmodes[gui_mux],left,top,width,height));
}
struct Gadget *TestPro_Gadgets[2];

#define TestPro_10 0

ULONG TestProTags1[]={
   GTCY_Labels,(ULONG)modes ,TAG_DONE
};

struct GadInfo TestPro1={
   CYCLE_KIND,1,0,0,1,0+0,4+INTERHEIGHT,0,0,0,0,0,
   INTERWIDTH,INTERHEIGHT,0,NULL,NULL,
   "",10,0,0,MHook ,TestProTags1
};

#define TestPro_11 1

ULONG TestProTags2[]={
   TAG_DONE
};

struct GadInfo TestPro2={
   CUSTOM_KIND,1,1,0,0,0+0,0+0,0,0,0,0,BOXFLG_CUSTOM,
   INTERWIDTH,INTERHEIGHT,1,Multiplex ,NULL,
   "",11,0,0,NULL,TestProTags2
};

struct Box *TestProV0[]={
   (struct Box *)&TestPro1,
   (struct Box *)&TestPro2,
   NULL
};

struct Box TestPro0={
   GL_VBOX,1,1,0,0,0+0,0+0,0,0,0,0,0,TestProV0
};

struct WinInfo TestPro = {
   &TestPro0,TestPro_Gadgets
};

