// diner preferences GUI definition

#define TabGeneral TabItem
{
	Text General,
	Child VerticalGroup
	{
		Child Frame
		{
			Text Directories,
			Child VerticalListView
			{
				VerticalWeight 0,
				Transparent true,
				Columns 2,
				ColumnWeight 0 0,
				Child RowGroup
				{
					Child Button( Name selectroot, Text "Root directory:", EventRoute ChangeRoot),
					Child TextInput( Name RootDir, Text "", MinimumWidthText "12345678901234567890", VerticalAlignment 1)
				},
				Child RowGroup
				{
					Child Button( Name selectlogfile, Text "Log file:", EventRoute ChangeLog),
					Child TextInput( Name Logfile, Text "", MinimumWidthText "12345678901234567890", VerticalAlignment 1)
				}
			}
		},
		Child VerticalSpace(),
		Child VerticalSpace(),
		Child Frame
		{
			Text "Port",
			Child HorizontalGroup
			{
				Child String( Text "Port:", Weights 0, VerticalAlignment 1),
				Child TextInput( Name Port, Text "", Weights 0, AcceptCharacters "123456789", MinimumWidthText "1234567890")
			}
		},
		Child VerticalSpace()
	}
}

#define ChangeRoot EventRoute
{
	Event 'fBUT',
	TargetName "diner preferences",
	MessageFilter WhatFilter( What 'dCHR')
}

#define ChangeLog EventRoute
{
	Event 'fBUT',
	TargetName "diner preferences",
	MessageFilter WhatFilter( What 'dCHL')
}

#define OKButtonEvent EventRoute
{
	Event 'fBUT',
	TargetName "diner preferences",
	MessageFilter WhatFilter( What 'dOKW')
}

#define CancelButtonEvent EventRoute
{
	Event 'fBUT',
	TargetName "diner preferences",
	MessageFilter WhatFilter( What 'dCNL')
}

// Tab Advanced
#define TabAdvanced TabItem
{
	Text Advanced,
	Child HorizontalGroup
	{
		Child VerticalGroup
		{
			Child Frame
			{
				Text "Network",
				Child VerticalListView
				{
					VerticalWeight 0,
					Transparent true,
					Columns 2,
					ColumnWeight 0 0,
					Child RowGroup
					{
						Child String( Text "Full Hostname:", VerticalAlignment 1),
						Child TextInput( Name HostName, Text "", AcceptCharacters "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW.-123456789", MinimumWidthText "123456789012345678901234567890")
					},
					Child RowGroup
					{
						Child String( Text "MaxConnections:", VerticalAlignment 1),
						Child TextInput( Name MaxConnections, Text "", AcceptCharacters "1234567890", MinimumWidthText "123456789012345678901234567890")
					}
				}
			},
			Child VerticalSpace,
			Child Frame
			{
				Text "Modules",
				Child VerticalGroup
				{
					Child VerticalListView
					{
						VerticalWeight 0,
						Transparent true,
						Columns 2,
						ColumnWeight 0 0,
						Child RowGroup
						{
							Child String( Text "CGI-Type:", VerticalAlignment 1),
							Child TextInput( Name CGIType, Text "", MinimumWidthText "123456789012345678901234567890")
						}
					},
					Child VerticalSpace,
					Child CheckBox( Name ServerHTML, Text "Server parsed HTML"),
				}
			},
			Child VerticalSpace,
			Child Frame
			{
				Text "Misc",
				Child VerticalGroup
				{
					Child VerticalListView
					{
						VerticalWeight 0,
						Transparent true,
						Columns 2,
						ColumnWeight 0 0,
						Child RowGroup
						{
							Child String( Text "Default indexfile:", VerticalAlignment 1),
							Child TextInput( Name Indexfile, Text "index.html", MinimumWidthText "12345678901234567890")
						}
					},
					Child VerticalSpace,
					Child CheckBox( Name ResolveHostname, Text "Resolve Hostnames for logfile"),
				}
			}
		}
	}
}

// Tab group
#define Tabs TabGroup
{
	Child TabGeneral,
	Child TabAdvanced
}

// This one is the main group which connects everything.
#define MainGroup VerticalGroup
{
	Child HorizontalGroup
	{
		Child Tabs
	},
	Child HorizontalGroup
	{
		VerticalWeight 0,
		Child Button( Name Cancel, Text Cancel, VerticalWeight 0, VerticalAlignment 1, EventRoute CancelButtonEvent),
		Child VerticalSpace(),
		Child Button( Name OK, Text OK, VerticalWeight 0, VerticalAlignment 1, EventRoute OKButtonEvent)
	}
}

// This is the window as a framework around everything.

#define Main Window
{
	Title "diner preferences", Object MainGroup,
	MoveTo 100 100
}
