/// <summary>
        /// Constructs a demo object with the appropriate gui.
        /// </summary>
        public DemoWindow()
            : base("Moonfire Games' Gtk Demo")
        {
            // Create a window
            SetDefaultSize(1000, 800);
            DeleteEvent += OnWindowDelete;

            demoComponents = new DemoComponents();

            // Create a user action manager.
            var actionManager = new ActionManager(this);
            actionManager.Add(GetType().Assembly);

            demoConfiguratorsTab = new DemoConfiguratorsTab(this);

            actionManager.Add(demoConfiguratorsTab);

            demoActions = new DemoActions(actionManager);

            // Load the layout from the file system.
            layout = new ActionLayout(new FileInfo("ActionLayout1.xml"));
            actionManager.SetLayout(layout);

            // Load the keybinding from a file.
            keybindings = new ActionKeybindings(new FileInfo("ActionKeybindings1.xml"));
            actionManager.SetKeybindings(keybindings);

            // Create the window frame
            var box = new VBox();
            Add(box);

            // Create the components we need before the menu.
            notebook = new Notebook();

            actionManager.Add(new SwitchPageAction(notebook, 0, "Components"));
            actionManager.Add(new SwitchPageAction(notebook, 1, "Text Editor"));
            actionManager.Add(new SwitchPageAction(notebook, 2, "Actions"));
            actionManager.Add(new SwitchPageAction(notebook, 3, "Configurators"));

            // Create a notebook
            notebook.BorderWidth = 5;

            notebook.AppendPage(demoComponents, new Label("Components"));
            notebook.AppendPage(demoActions, new Label("Actions"));
            notebook.AppendPage(demoConfiguratorsTab, new Label("Configurators"));

            // Add the status bar
            statusbar = new Statusbar();
            statusbar.Push(0, "Welcome!");
            statusbar.HasResizeGrip = true;

            // Create the menu
            menubar = new MenuBar();

            // Back everything into place.
            box.PackStart(CreateGuiMenu(), false, false, 0);
            box.PackStart(notebook, true, true, 0);
            box.PackStart(statusbar, false, false, 0);
        }
        /// <summary>
        /// Sets the action layout.
        /// </summary>
        /// <param name="newLayout">The new layout.</param>
        public void SetLayout(ActionLayout newLayout)
        {
            // Clear out the old layout
            if (layout != null)
            {
                layout.ActionManager = null;
            }

            // Save the new layout.
            layout = newLayout;

            // Clear out the new layout
            if (layout != null)
            {
                layout.ActionManager = this;
            }
        }
        /// <summary>
        /// Sets the action layout.
        /// </summary>
        /// <param name="newLayout">The new layout.</param>
        public void SetLayout(ActionLayout newLayout)
        {
            // Clear out the old layout
            if (layout != null)
            {
                layout.ActionManager = null;
            }

            // Save the new layout.
            layout = newLayout;

            // Clear out the new layout
            if (layout != null)
            {
                layout.ActionManager = this;
            }
        }