using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace UI.Winforms
{
    public partial class MdiForm : Form
    {
        SimulationViewer simulationForm;
        PreferencesForm prefrencesForm;

        //MdiClient mdiClient = null;
        //private const int SB_BOTH = 3;
        //private const int WM_NCCALCSIZE = 0x83;
        //[DllImport("user32.dll")]
        //private static extern int ShowScrollBar(IntPtr hWnd, int wBar, int bShow);
        //protected override void WndProc(ref Message m)
        //{
        //    if (mdiClient != null)
        //    {
        //        ShowScrollBar(mdiClient.Handle, SB_BOTH, 0 /*Hide the ScrollBars*/);
        //    }
        //    base.WndProc(ref m);
        //}

        public MdiForm()
        {
            InitializeComponent();

            //Control drawingSurface = Activator.CreateInstance(Core.Module.Graphics.DrawingControl) as Control;
            //Controls.Add(drawingSurface);
            //drawingSurface.Size = this.ClientSize;
            //drawingSurface.Dock = DockStyle.Fill;

            ////Find the MdiClient in the MdiWindow
            //foreach (Control c in this.Controls)
            //{
            //    if (c is MdiClient)
            //    {
            //        mdiClient = c as MdiClient;
            //    }
            //}

        }

        private void newSimulationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (simulationForm == null || simulationForm.Created == false)
            {
                simulationForm = new SimulationViewer();
                simulationForm.MdiParent = this;
            }

            simulationForm.Dock = DockStyle.Fill;
            simulationForm.Show();
            simulationForm.SendToBack();
        }

        private void prefrencesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (prefrencesForm == null || prefrencesForm.Created == false)
            {
                prefrencesForm = new PreferencesForm();
                prefrencesForm.MdiParent = this;
            }

            prefrencesForm.MinimizeBox = false;
            prefrencesForm.MinimizeBox = false;
            prefrencesForm.BringToFront();
            prefrencesForm.Show();
        }

        private void editorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form newEditorForm = new DnaEditor();
            newEditorForm.MdiParent = this;
            newEditorForm.BringToFront();
            newEditorForm.Show();
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form newAboutForm = new AboutBox();
            newAboutForm.MdiParent = this;
            newAboutForm.BringToFront();
            newAboutForm.Show();
        }

        private void MdiForm_Load(object sender, EventArgs e)
        {

        }

        private void MdiForm_Scroll(object sender, ScrollEventArgs e)
        {

        }


    }
}