#!/bin/sh

[ -z $GTKDIALOG ] && GTKDIALOG=gtkdialog

funcbtnCreate() {
	echo '<button image-position="'$2'">
			<label>"'"$3"'"</label>
			<input file stock="'$4'"></input>
			<action>echo "'"$5"' '$1'"</action>
			<action function="'"$3"'">'$1'</action>
		</button>'
}

funcrdoCreate() {
	echo '<label>'"$2"'</label>
			<variable>'$1'</variable>
			<action>echo '$1' changed to $'$1'</action>
		</radiobutton>'
}

MAIN_DIALOG='
<window title="RadioButton Advanced" resizable="false">
	<vbox border-width="15" spacing="10">
		<text>
			<label>"Groups of radiobutton widgets are bound by containers
i.e. the notebook, vbox, hbox and frame widgets."</label>
		</text>
		<hseparator></hseparator>
		<hbox homogeneous="true">
			<radiobutton>
				<action>if true enable:btnCancel</action>
				'"`funcrdoCreate rdo0_0 "Enable the Cancel button"`"'
			<radiobutton>
				<action>if true disable:btnCancel</action>
				'"`funcrdoCreate rdo0_1 "Disable the Cancel button"`"'
		</hbox>
		<hbox homogeneous="true">
			'"`funcbtnCreate rdo0_0 0 Disable gtk-no Disabling`"'
			'"`funcbtnCreate rdo0_0 0 Enable gtk-yes Enabling`"'
			'"`funcbtnCreate rdo0_1 0 Disable gtk-no Disabling`"'
			'"`funcbtnCreate rdo0_1 0 Enable gtk-yes Enabling`"'
		</hbox>
		<frame>
			<radiobutton>
				<action>if true enable:btnOK</action>
				'"`funcrdoCreate rdo1_0 "Enable the OK button"`"'
			<radiobutton active="true">
				<action>if true disable:btnOK</action>
				'"`funcrdoCreate rdo1_1 "Disable the OK button (initially active=\"true\")"`"'
 		</frame>
		<hbox spacing="20">
			<vbox>
				<radiobutton draw-indicator="false">
					'"`funcrdoCreate rdo2_0 "draw-indicator=\"false\""`"'
				<radiobutton draw-indicator="false">
					<default>true</default>
					'"`funcrdoCreate rdo2_1 "default directive contains \"true\""`"'
			</vbox>
			<vseparator></vseparator>
			<vbox>
				<radiobutton>
					'"`funcrdoCreate rdo3_0 "Some label"`"'
				<radiobutton inconsistent="true">
					'"`funcrdoCreate rdo3_1 "inconsistent=\"true\""`"'
			</vbox>
		</hbox>
		<hseparator></hseparator>
		<hbox homogeneous="true">
			<button cancel><variable>btnCancel</variable></button>
			<button ok><variable>btnOK</variable></button>
		</hbox>
	</vbox>
</window>
'
export MAIN_DIALOG

case $1 in
	-d | --dump) echo "$MAIN_DIALOG" ;;
	*) $GTKDIALOG --program=MAIN_DIALOG ;;
esac
