//------------------------------------------------------------------------------
// PropsDialog.java:
//		Implementation for container control initialization class PropsDialog
//
// WARNING: Do not modify this file.  This file is recreated each time its
//          associated .rct/.res file is sent through the Java Resource Wizard!
//
// This class can be use to create controls within any container, however, the
// following describes how to use this class with an Applet.  For addtional
// information on using Java Resource Wizard generated classes, refer to the
// Visual J++ 1.1 documention.
//
// 1) Import this class in the .java file for the Applet that will use it:
//
//      import PropsDialog;
//
// 2) Create an instance of this class in your Applet's 'init' member, and call
//    CreateControls() through this object:
//
//      PropsDialog ctrls = new PropsDialog (this);
//      ctrls.CreateControls();
//
// 3) To process events generated from user action on these controls, implement
//    the 'handleEvent' member for your applet:
//
//      public boolean handleEvent (Event evt)
//      {
//
//      }
//
//------------------------------------------------------------------------------
import java.awt.*;
import DialogLayout;

public class PropsDialog
{
	Container    m_Parent       = null;
	boolean      m_fInitialized = false;
	DialogLayout m_Layout;

	// Control definitions
	//--------------------------------------------------------------------------
	Button        ok_button;
	Button        cancel_button;
	Label         IDC_STATIC1;
	Label         IDC_STATIC2;
	TextField     edge_id;
	Label         IDC_STATIC3;
	Label         IDC_STATIC4;
	Label         IDC_STATIC5;
	TextField     edge_label;
	TextArea      edge_help;
	CheckboxGroup group1;
	Checkbox      type_and;
	Checkbox      type_or;
	Checkbox      type_text;
	TextArea      text;
	Label         IDC_STATIC6;
	TextArea      node_help;
	Label         IDC_STATIC7;
	TextField     node_name;
	Button        browse_button;
	Checkbox      edge_id_auto;
	Button        activate_button;
	Checkbox      type_and_leaf;
	TextField     rows;
	Label         IDC_STATIC8;
	TextField     Cols;
	Label         IDC_STATIC9;
	Button        help_button;
	Checkbox      type_ior;
	Label         IDC_STATIC10;
	Label         IDC_STATIC11;


	// Constructor
	//--------------------------------------------------------------------------
	public PropsDialog (Container parent)
	{
		m_Parent = parent;
	}

	// Initialization.
	//--------------------------------------------------------------------------
	public boolean CreateControls()
	{
		// Can only init controls once
		//----------------------------------------------------------------------
		if (m_fInitialized || m_Parent == null)
			return false;

		// Parent must be a derivation of the Container class
		//----------------------------------------------------------------------
		if (!(m_Parent instanceof Container))
			return false;

		// Since there is no way to know if a given font is supported from
		// platform to platform, we only change the size of the font, and not
		// type face name.  And, we only change the font if the dialog resource
		// specified a font.
		//----------------------------------------------------------------------
		Font OldFnt = m_Parent.getFont();
		
		if (OldFnt != null)
		{
			Font NewFnt = new Font(OldFnt.getName(), OldFnt.getStyle(), 10);

			m_Parent.setFont(NewFnt);
		}

		// All position and sizes are in Dialog Units, so, we use the
		// DialogLayout manager.
		//----------------------------------------------------------------------
		m_Layout = new DialogLayout(m_Parent, 252, 339);
		m_Parent.setLayout(m_Layout);
		m_Parent.addNotify();

		Dimension size   = m_Layout.getDialogSize();
		Insets    insets = m_Parent.insets();
		
		m_Parent.resize(insets.left + size.width  + insets.right,
                        insets.top  + size.height + insets.bottom);

		// Control creation
		//----------------------------------------------------------------------
		ok_button = new Button ("OK");
		m_Parent.add(ok_button);
		m_Layout.setShape(ok_button, 13, 318, 44, 14);

		cancel_button = new Button ("Cancel");
		m_Parent.add(cancel_button);
		m_Layout.setShape(cancel_button, 64, 318, 44, 14);

		IDC_STATIC1 = new Label ("Edge", Label.LEFT);
		m_Parent.add(IDC_STATIC1);
		m_Layout.setShape(IDC_STATIC1, 10, 14, 39, 11);

		IDC_STATIC2 = new Label ("Node", Label.LEFT);
		m_Parent.add(IDC_STATIC2);
		m_Layout.setShape(IDC_STATIC2, 10, 119, 31, 11);

		edge_id = new TextField ("");
		m_Parent.add(edge_id);
		m_Layout.setShape(edge_id, 66, 24, 108, 19);

		IDC_STATIC3 = new Label ("Identifier:", Label.LEFT);
		m_Parent.add(IDC_STATIC3);
		m_Layout.setShape(IDC_STATIC3, 13, 28, 42, 12);

		IDC_STATIC4 = new Label ("description:", Label.LEFT);
		m_Parent.add(IDC_STATIC4);
		m_Layout.setShape(IDC_STATIC4, 13, 80, 43, 12);

		IDC_STATIC5 = new Label ("Label:", Label.LEFT);
		m_Parent.add(IDC_STATIC5);
		m_Layout.setShape(IDC_STATIC5, 13, 49, 36, 12);

		edge_label = new TextField ("");
		m_Parent.add(edge_label);
		m_Layout.setShape(edge_label, 66, 46, 173, 19);

		edge_help = new TextArea ("");
		m_Parent.add(edge_help);
		m_Layout.setShape(edge_help, 66, 69, 173, 46);

		group1 = new CheckboxGroup ();
		type_and = new Checkbox ("Ramification", group1, false);
		m_Parent.add(type_and);
		m_Layout.setShape(type_and, 13, 132, 63, 12);

		type_or = new Checkbox ("Decision", group1, false);
		m_Parent.add(type_or);
		m_Layout.setShape(type_or, 13, 146, 43, 12);

		type_text = new Checkbox ("Text", group1, false);
		m_Parent.add(type_text);
		m_Layout.setShape(type_text, 13, 177, 35, 11);

		text = new TextArea ("");
		m_Parent.add(text);
		m_Layout.setShape(text, 66, 197, 173, 46);

		IDC_STATIC6 = new Label ("commentary:", Label.LEFT);
		m_Parent.add(IDC_STATIC6);
		m_Layout.setShape(IDC_STATIC6, 13, 274, 45, 15);

		node_help = new TextArea ("");
		m_Parent.add(node_help);
		m_Layout.setShape(node_help, 66, 263, 173, 46);

		IDC_STATIC7 = new Label ("Filename:", Label.LEFT);
		m_Parent.add(IDC_STATIC7);
		m_Layout.setShape(IDC_STATIC7, 83, 129, 134, 13);

		node_name = new TextField ("");
		m_Parent.add(node_name);
		m_Layout.setShape(node_name, 81, 142, 121, 19);

		browse_button = new Button ("Browse...");
		m_Parent.add(browse_button);
		m_Layout.setShape(browse_button, 205, 144, 38, 14);

		edge_id_auto = new Checkbox ("Auto generate");
		m_Parent.add(edge_id_auto);
		m_Layout.setShape(edge_id_auto, 180, 27, 65, 12);

		activate_button = new Button ("Activate");
		m_Parent.add(activate_button);
		m_Layout.setShape(activate_button, 115, 318, 44, 14);

		type_and_leaf = new Checkbox ("Ending", group1, false);
		m_Parent.add(type_and_leaf);
		m_Layout.setShape(type_and_leaf, 13, 244, 45, 13);

		rows = new TextField ("");
		m_Parent.add(rows);
		m_Layout.setShape(rows, 98, 173, 25, 19);

		IDC_STATIC8 = new Label ("Rows:", Label.LEFT);
		m_Parent.add(IDC_STATIC8);
		m_Layout.setShape(IDC_STATIC8, 71, 176, 24, 15);

		Cols = new TextField ("");
		m_Parent.add(Cols);
		m_Layout.setShape(Cols, 159, 173, 25, 19);

		IDC_STATIC9 = new Label ("Cols:", Label.LEFT);
		m_Parent.add(IDC_STATIC9);
		m_Layout.setShape(IDC_STATIC9, 136, 176, 21, 16);

		help_button = new Button ("Help");
		m_Parent.add(help_button);
		m_Layout.setShape(help_button, 196, 318, 44, 14);

		type_ior = new Checkbox ("Multi-Decision", group1, false);
		m_Parent.add(type_ior);
		m_Layout.setShape(type_ior, 13, 161, 74, 11);

		IDC_STATIC10 = new Label ("Note /", Label.LEFT);
		m_Parent.add(IDC_STATIC10);
		m_Layout.setShape(IDC_STATIC10, 13, 70, 43, 12);

		IDC_STATIC11 = new Label ("Note /", Label.LEFT);
		m_Parent.add(IDC_STATIC11);
		m_Layout.setShape(IDC_STATIC11, 13, 264, 43, 12);

		m_fInitialized = true;
		return true;
	}
}
