#ifndef MAKE_ID
#define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
#endif

#ifdef _DCC
#define __inline
#endif

#include "GroupGui.h"

struct ObjMain_Window_Group * CreateMain_Window_Group(void)
{
        struct ObjMain_Window_Group * Object;

        APTR    GROUP_ROOT_0, Attributes, Group_PageMode, Horizontal_Label, SameWidth_Label;
        APTR    Same_Height_Label, Same_Size_Label, Columns_Label, Rows_Label, HorizSpacing_Label;
        APTR    VertSpacing_Label, Reg_Attributes, Columns_Rows, Number_Label, Spacing_Group;
        APTR    Attrib_HSpacing_label, Attrib_VSpacing_label, GroupId_Group, Group_ID_Label_Label;

        if (!(Object = AllocVec(sizeof(struct ObjMain_Window_Group), MEMF_PUBLIC|MEMF_CLEAR)))
                return(NULL);

        Group_PageMode = Label("Page Mode");

        Object->PageMode_Label = CheckMark(FALSE);

        Horizontal_Label = Label("Horizontal Group");

        Object->Group_Horizontal = CheckMark(FALSE);

        SameWidth_Label = Label("Same Width");

        Object->Group_SameWidth = CheckMark(FALSE);

        Same_Height_Label = Label("Same Height");

        Object->Group_SameHeight = CheckMark(FALSE);

        Same_Size_Label = Label("Same Size");

        Object->Group_SameSize = CheckMark(FALSE);

        Columns_Label = Label("Columns");

        Object->Group_Columns = CheckMark(FALSE);

        Rows_Label = Label("Rows");

        Object->Group_Rows = CheckMark(FALSE);

        HorizSpacing_Label = Label("Horizontal Spacing");

        Object->Group_HorizontalSpacing = CheckMark(FALSE);

        VertSpacing_Label = Label("Vertical Spacing");

        Object->Group_VerticalSpacing = CheckMark(FALSE);

        Attributes = GroupObject,
                MUIA_Frame, MUIV_Frame_Group,
                MUIA_FrameTitle, "Attributes",
                MUIA_Group_Columns, 2,
                MUIA_Group_VertSpacing, 5,
                Child, Group_PageMode,
                Child, Object->PageMode_Label,
                Child, Horizontal_Label,
                Child, Object->Group_Horizontal,
                Child, SameWidth_Label,
                Child, Object->Group_SameWidth,
                Child, Same_Height_Label,
                Child, Object->Group_SameHeight,
                Child, Same_Size_Label,
                Child, Object->Group_SameSize,
                Child, Columns_Label,
                Child, Object->Group_Columns,
                Child, Rows_Label,
                Child, Object->Group_Rows,
                Child, HorizSpacing_Label,
                Child, Object->Group_HorizontalSpacing,
                Child, VertSpacing_Label,
                Child, Object->Group_VerticalSpacing,
        End;

        Number_Label = Label("Number");

        Object->Group_ColRowNumber = StringObject,
                MUIA_Disabled, TRUE,
                MUIA_Frame, MUIV_Frame_String,
                MUIA_HelpNode, "Group_ColRowNumber",
                MUIA_String_Contents, "2",
                MUIA_String_Accept, "-0123456789",
                MUIA_String_MaxLen, 2,
        End;

        Columns_Rows = GroupObject,
                MUIA_Frame, MUIV_Frame_Group,
                MUIA_Group_Horiz, TRUE,
                Child, Number_Label,
                Child, Object->Group_ColRowNumber,
        End;

        Attrib_HSpacing_label = Label("Horizontal");

        Object->HorizontalSpacing_Number = StringObject,
                MUIA_Disabled, TRUE,
                MUIA_Frame, MUIV_Frame_String,
                MUIA_HelpNode, "HorizontalSpacing_Number",
                MUIA_String_Contents, "0",
                MUIA_String_Accept, "-0123456789",
                MUIA_String_MaxLen, 3,
        End;

        Attrib_VSpacing_label = Label("Vertical");

        Object->VerticalSpacing_Number = StringObject,
                MUIA_Disabled, TRUE,
                MUIA_Frame, MUIV_Frame_String,
                MUIA_HelpNode, "VerticalSpacing_Number",
                MUIA_String_Contents, "0",
                MUIA_String_Accept, "-0123456789",
                MUIA_String_MaxLen, 3,
        End;

        Spacing_Group = GroupObject,
                MUIA_Frame, MUIV_Frame_Group,
                MUIA_Group_Columns, 2,
                Child, Attrib_HSpacing_label,
                Child, Object->HorizontalSpacing_Number,
                Child, Attrib_VSpacing_label,
                Child, Object->VerticalSpacing_Number,
        End;

        Group_ID_Label_Label = Label("Label");

        Object->Group_ID_Label = StringObject,
                MUIA_Disabled, TRUE,
                MUIA_Frame, MUIV_Frame_String,
                MUIA_HelpNode, "Group_ID_Label",
                MUIA_String_Contents, "Grp_grp_0",
        End;

        GroupId_Group = GroupObject,
                MUIA_Frame, MUIV_Frame_Group,
                MUIA_FrameTitle, "Group Identification",
                MUIA_Group_Columns, 2,
                Child, Group_ID_Label_Label,
                Child, Object->Group_ID_Label,
        End;

        Reg_Attributes = GroupObject,
                Child, Columns_Rows,
                Child, Spacing_Group,
                Child, GroupId_Group,
        End;

        Object->Group_Group = GroupObject,
                MUIA_Group_Horiz, TRUE,
                Child, Attributes,
                Child, Reg_Attributes,
        End;
     /*
        GROUP_ROOT_0 = GroupObject,
                Child, Object->Group_Group,
        End;

        Object->Main_Window_Group = WindowObject,
                MUIA_Window_Title, "window_title",
                MUIA_Window_ID, MAKE_ID('0', 'W', 'I', 'N'),
                WindowContents, GROUP_ROOT_0,
        End;
      */

        if (!Object->Group_Group)
        {
                FreeVec(Object);
                return(NULL);
        }
          /*
        DoMethod(Object->Main_Window_Group,
                MUIM_Window_SetCycleChain, Object->Group_Group,
                Object->PageMode_Label,
                Object->Group_Horizontal,
                Object->Group_SameWidth,
                Object->Group_SameHeight,
                Object->Group_SameSize,
                Object->Group_Columns,
                Object->Group_Rows,
                Object->Group_HorizontalSpacing,
                Object->Group_VerticalSpacing,
                Object->Group_ColRowNumber,
                Object->HorizontalSpacing_Number,
                Object->VerticalSpacing_Number,
                Object->Group_ID_Label,
                0
                );

        */
        return(Object);
}

void DisposeMain_Window_Group(struct ObjMain_Window_Group * Object)
{
        MUI_DisposeObject(Object->Group_Group);
        FreeVec(Object);
}
