public void Initialize()
        {
            manager.Initialize();

            #region /// Master ///
            master = new SideBar(manager);
            master.Init();
            master.Name = "Sidebar";
            master.Width = Width;
            master.Height = OrbIt.game.MainWindow.ClientArea.Height;
            master.Visible = true;
            master.Anchor = Anchors.Top | Anchors.Left | Anchors.Bottom;

            ui.game.MainWindow.Add(master);
            #endregion

            #region  /// tabcontrol ///
            tbcMain = new TabControl(manager);
            tbcMain.Init();
            //tbcMain.BackColor = Color.Transparent;
            //tbcMain.Color = Color.Transparent;
            tbcMain.Parent = master;
            tbcMain.Left = 0;
            tbcMain.Top = 0;
            tbcMain.Width = master.Width - 5;
            tbcMain.Height = master.Height - 40;
            tbcMain.Anchor = Anchors.All;
            activeTabControl = tbcMain;
            #endregion

            #region  /// Page1 ///

            tbcMain.AddPage();
            tbcMain.TabPages[0].Text = "First";
            TabPage first = tbcMain.TabPages[0];
            tbcMain.SelectedIndex = 0;

            #region  /// Title ///
            title1 = new Label(manager);
            title1.Init();
            title1.Parent = first;

            title1.Top = HeightCounter;
            title1.Text = "Node List";
            title1.Width = 130;
            title1.Left = first.Width / 2 - title1.Width / 2; //TODO : Center auto
            HeightCounter += VertPadding + title1.Height;
            title1.Anchor = Anchors.Left;
            #endregion

            #region  /// List Main ///
            lstMain = new ListBox(manager);
            lstMain.Init();
            lstMain.Parent = first;

            lstMain.Top = HeightCounter;
            lstMain.Left = LeftPadding;
            lstMain.Width = first.Width - LeftPadding * 2;
            lstMain.Height = first.Height / 5; HeightCounter += VertPadding + lstMain.Height;
            lstMain.Anchor = Anchors.Top | Anchors.Left | Anchors.Bottom;

            lstMain.HideSelection = false;
            lstMain.ItemIndexChanged += lstMain_ItemIndexChanged;
            lstMain.Click += lstMain_Click;
            lstMain.Refresh();
            //room.nodes.CollectionChanged += nodes_Sync;

            mainNodeContextMenu = new ContextMenu(manager);
            ConvertIntoList = new MenuItem("Make Default of new Group.");
            ConvertIntoList.Click += ConvertIntoList_Click;
            PromoteToDefault = new MenuItem("Make Default of current Group");
            PromoteToDefault.Click += PromoteToDefault_Click;
            mainNodeContextMenu.Items.Add(ConvertIntoList);
            lstMain.ContextMenu = mainNodeContextMenu;

            ui.SetScrollableControl(lstMain, lstMain_ChangeScrollPosition);
            #endregion

            #region  /// List Picker ///

            cbListPicker = new ComboBox(manager);
            cbListPicker.Init();
            cbListPicker.Parent = first;
            cbListPicker.MaxItems = 20;

            cbListPicker.Width = first.Width - LeftPadding * 6;
            cbListPicker.Left = LeftPadding;
            cbListPicker.Top = HeightCounter;
            cbListPicker.Items.Add("Other Objects");
            cbListPicker.ItemIndex = 0;
            //cbListPicker.
            cbListPicker.Click += cbListPicker_Click;
            cbListPicker.ItemIndexChanged += cbListPicker_ItemIndexChanged;

            #endregion

            #region /// Delete Group Button ///

            btnDeleteGroup = new Button(manager);
            btnDeleteGroup.Init();
            btnDeleteGroup.Parent = first;
            btnDeleteGroup.Left = LeftPadding + cbListPicker.Width + 5;
            btnDeleteGroup.Width = 15;
            btnDeleteGroup.Height = cbListPicker.Height;
            btnDeleteGroup.Top = HeightCounter; HeightCounter += VertPadding + cbListPicker.Height;
            btnDeleteGroup.Text = "X";
            btnDeleteGroup.Click += btnDeleteGroup_Click;

            #endregion

            #region  /// Remove Node Button ///
            btnRemoveNode = new Button(manager);
            btnRemoveNode.Init();
            btnRemoveNode.Parent = first;

            btnRemoveNode.Top = HeightCounter;
            btnRemoveNode.Width = first.Width / 2 - LeftPadding;
            btnRemoveNode.Height = 24;
            btnRemoveNode.Left = LeftPadding;

            btnRemoveNode.Text = "Remove Node";
            btnRemoveNode.Click += btnRemoveNode_Click;
            #endregion

            #region  /// Remove All Nodes Button ///
            btnRemoveAllNodes = new Button(manager);
            btnRemoveAllNodes.Init();
            btnRemoveAllNodes.Parent = first;

            btnRemoveAllNodes.Top = HeightCounter;
            //btnRemoveAllNodes.Width = first.Width / 2 - LeftPadding;
            btnRemoveAllNodes.Width = first.Width / 2 - LeftPadding;
            btnRemoveAllNodes.Height = 24; HeightCounter += VertPadding + btnRemoveAllNodes.Height;
            btnRemoveAllNodes.Left = LeftPadding + btnRemoveNode.Width;

            btnRemoveAllNodes.Text = "Remove All";
            btnRemoveAllNodes.Click += btnRemoveAllNodes_Click;
            #endregion

            #region  /// Add Componenet ///
            btnAddComponent = new Button(manager);
            btnAddComponent.Init();
            btnAddComponent.Parent = first;

            btnAddComponent.Top = HeightCounter;
            btnAddComponent.Width = first.Width / 2 - LeftPadding;
            btnAddComponent.Height = 20;
            btnAddComponent.Left = LeftPadding;

            btnAddComponent.Text = "Add Component";
            btnAddComponent.Click += btnAddComponent_Click;
            #endregion

            #region  /// Default Node ///
            btnDefaultNode = new Button(manager);
            btnDefaultNode.Init();
            btnDefaultNode.Parent = first;

            btnDefaultNode.Top = HeightCounter;
            btnDefaultNode.Width = first.Width / 2 - LeftPadding;
            btnDefaultNode.Height = 20; HeightCounter += VertPadding + btnDefaultNode.Height;
            btnDefaultNode.Left = LeftPadding + btnRemoveNode.Width;

            btnDefaultNode.Text = "Default Node";
            btnDefaultNode.Click += btnDefaultNode_Click;
            #endregion

            #region  /// Presets Dropdown ///
            cbPresets = new ComboBox(manager);
            cbPresets.Init();
            cbPresets.Parent = first;
            cbPresets.MaxItems = 20;
            cbPresets.Width = 160;
            cbPresets.Left = LeftPadding;
            cbPresets.Top = HeightCounter; HeightCounter += cbPresets.Height;
            Assets.NodePresets.CollectionChanged += NodePresets_Sync;
            cbPresets.ItemIndexChanged += cbPresets_ItemIndexChanged;
            cbPresets.Click += cmbPresets_Click;
            #endregion

            inspectorArea = new InspectorArea(this, first, LeftPadding, HeightCounter);

            HeightCounter += inspectorArea.Height;

            #region  /// Apply to Group ///
            btnApplyToAll = new Button(manager);
            btnApplyToAll.Init();
            btnApplyToAll.Parent = first;

            btnApplyToAll.Text = "Apply To Group";
            btnApplyToAll.Top = HeightCounter;
            btnApplyToAll.Width = first.Width / 2 - LeftPadding;
            btnApplyToAll.Height = 20; //HeightCounter += VertPadding + btnApplyToAll.Height;
            btnApplyToAll.Left = LeftPadding;
            btnApplyToAll.Click += applyToAllNodesMenuItem_Click;
            #endregion

            #region  /// Save as Preset ///
            btnSaveNode = new Button(manager);
            btnSaveNode.Init();
            btnSaveNode.Text = "Save Node";
            btnSaveNode.Top = HeightCounter;
            btnSaveNode.Width = first.Width / 2 - LeftPadding;
            btnSaveNode.Height = 20; HeightCounter += VertPadding + btnSaveNode.Height;
            btnSaveNode.Left = LeftPadding + btnApplyToAll.Width;
            btnSaveNode.Parent = first;
            btnSaveNode.Click += btnSaveNode_Click;
            #endregion

            #endregion

            #region  /// Page 2 ///
            tbcMain.AddPage();
            tbcMain.TabPages[1].Text = "Second";
            TabPage second = tbcMain.TabPages[1];
            HeightCounter = 0;

            #endregion

            inspectorArea.ResetInspectorBox(ActiveDefaultNode);

            InitializeSecondPage();
            InitializeThirdPage();
        }
        public void Initialize()
        {
            HeightCounter = 0;
            Width = parent.Width - LeftPadding * 2;

            #region /// GroupBox (back panel) ///
            backPanel = new Panel(manager);
            backPanel.Init();
            //backPanel.Left = Left;//change
            backPanel.Top = Top;
            backPanel.Width = Width;
            backPanel.Parent = parent;
            backPanel.Text = "";
            backPanel.Color = sidebar.master.BackColor;

            #endregion

            int WidthReduction = 15; //change

            #region  /// Inspector Address Label ///
            lblInspectorAddress = new Label(manager);
            lblInspectorAddress.Init();
            //lblInspectorAddress.Visible = false; //change
            lblInspectorAddress.Parent = backPanel;
            lblInspectorAddress.Top = HeightCounter; //HeightCounter += VertPadding + lblInspectorAddress.Height + 10;
            lblInspectorAddress.Width = Width - WidthReduction;
            lblInspectorAddress.Height = lblInspectorAddress.Height * 2; //HeightCounter += lblInspectorAddress.Height;
            labelDoubleHeight = lblInspectorAddress.Height;
            //lblInspectorAddress.Left = LeftPadding;
            //lblInspectorAddress.Anchor = Anchors.Left;
            lblInspectorAddress.Text = ">No Node Selected<";
            bool changed = false;
            lblInspectorAddress.TextChanged += delegate(object s, EventArgs e)
            {
                if (!changed)
                {
                    changed = true;
                    Label l = (Label)s;
                    l.Text = l.Text.wordWrap(25);
                }
                changed = false;
            };
            #endregion
            //btnToggleFields = new Button(manager);
            //btnToggleFields.Init();
            //btnToggleFields.Parent = backPanel;
            //btnToggleFields.Left = LeftPadding + backPanel.Width - 30;
            //btnToggleFields.Width = 15;
            //btnToggleFields.Height = 20;
            //btnToggleFields.Top = HeightCounter + 10;
            //btnToggleFields.Text = "F";
            //btnToggleFields.Click += delegate(object s, EventArgs e)
            //{
            //    this.GenerateFields = !this.GenerateFields;
            //    //ResetInspectorBox(ActiveInspectorParent.obj);
            //    ActiveInspectorParent.DoubleClickItem(this);
            //};

            HeightCounter += lblInspectorAddress.Height;

            #region  /// Component List ///
            InsBox = new ListBox(manager);
            InsBox.Init();
            //manager.Add(InsBox);
            InsBox.Parent = backPanel;

            InsBox.Top = HeightCounter;
            InsBox.Left = 10;
            InsBox.Width = Width - WidthReduction;
            InsBox.Height = 140; HeightCounter += InsBox.Height;

            InsBox.HideSelection = false;
            InsBox.ItemIndexChanged += InsBox_ItemIndexChanged;
            InsBox.Click += InsBox_Click;
            InsBox.DoubleClick += InsBox_DoubleClick;
            InsBox.Refresh();

            sidebar.ui.SetScrollableControl(InsBox, InsBox_ChangeScrollPosition);

            #region  /// Context Menu ///
            contextMenuInsBox = new ContextMenu(manager);
            applyToAllNodesMenuItem = new MenuItem("Apply to Group");
            applyToAllNodesMenuItem.Click += applyToAllNodesMenuItem_Click;
            toggleComponentMenuItem = new MenuItem("Toggle Component");
            toggleComponentMenuItem.Click += toggleComponentMenuItem_Click;
            removeComponentMenuItem = new MenuItem("Remove Component");
            removeComponentMenuItem.Click += removeComponentMenuItem_Click;
            toggleBoolMenuItem = new MenuItem("Toggle");
            toggleBoolMenuItem.Click += toggleBoolMenuItem_Click;
            toggleLinkMenuItem = new MenuItem("Toggle link");
            toggleLinkMenuItem.Click += toggleLinkMenuItem_Click;
            removeLinkMenuItem = new MenuItem("Delete link");
            removeLinkMenuItem.Click += removeLinkMenuItem_Click;
            addComponentToLinkMenuItem = new MenuItem("Add Link Component");
            addComponentToLinkMenuItem.Click += AddComponentToLinkMenuItem_Click;

            contextMenuInsBox.Items.Add(applyToAllNodesMenuItem);

            InsBox.ContextMenu = contextMenuInsBox;
            #endregion

            #endregion

            #region  /// GroupPanel ///
            GroupPanel groupPanel = new GroupPanel(manager);
            groupPanel.Init();
            groupPanel.Parent = backPanel;
            //groupPanel.Visible = false;//change
            groupPanel.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
            groupPanel.Width = Width - WidthReduction;
            groupPanel.Top = HeightCounter;
            groupPanel.Height = 90; HeightCounter += VertPadding + groupPanel.Height;
            groupPanel.Left = InsBox.Left;
            groupPanel.Text = "Inspector Property";
            #endregion

            #region  /// PropertyEditPanel ///
            propertyEditPanel = new PropertyEditPanel(this, groupPanel);
            #endregion

            backPanel.Height = groupPanel.Top + groupPanel.Height;
        }
Example #3
0
        public void Init(Control parent, Manager manager)
        {
            switch (Type)
            {
                case "Container":
                    Container container = new Container(manager);
                    container.Init();

                    SetProperties(container, parent, manager);

                    container.AutoScroll = true;
                    break;
                case "ImageBox":
                    ImageBox box = new ImageBox(manager);
                    box.Init();

                    SetProperties(box, parent, manager);

                    box.SizeMode = ImageMode;

                    if (!string.IsNullOrEmpty(ImageAsset))
                        box.Image = manager.Content.Load<Texture2D>(ImageAsset);
                    else if (AtlasAsset != null)
                    {
                        if (AtlasAsset.Atlas == "IconProvider")
                            box.Image = IconProvider.GetByName(AtlasAsset.Name);
                        else
                            box.Image = Provider.GetAtlas(AtlasAsset.Atlas).GetTexture(AtlasAsset.Name);
                    }

                    if (!string.IsNullOrEmpty(Draw))
                        box.Draw += delegate(object sender, DrawEventArgs e)
                        {
                            if (EventFieldDraw == null)
                            {
                                Type classType = parent.GetType();
                                EventFieldDraw = classType.GetMethod(Draw);
                            }

                            if (EventFieldDraw == null)
                                throw new Exception("Could not find: " + Draw + " method");

                            EventFieldDraw.Invoke(parent, new object[] { sender, e });
                        };
                    break;
                case "Label":
                    Label label = new Label(manager);
                    label.Init();

                    SetProperties(label, parent, manager);

                    label.Text = Text.StartsWith("TXT_KEY_") ? Provider.Instance.Translate(Text) : Text;

                    break;
                case "GameMapBox":
                    GameMapBox mapBox = new GameMapBox(manager);
                    mapBox.Init();

                    SetProperties(mapBox, parent, manager);

                    break;
                case "SideBar":
                    SideBar sideBar = new SideBar(manager);
                    sideBar.Init();

                    SetProperties(sideBar, parent, manager);

                    if (!string.IsNullOrEmpty(Draw))
                        sideBar.Draw += delegate(object sender, DrawEventArgs e)
                        {
                            if (EventFieldDraw == null)
                            {
                                Type classType = parent.GetType();
                                EventFieldDraw = classType.GetMethod(Draw);
                            }

                            if (EventFieldDraw == null)
                                throw new Exception("Could not find: " + Draw + " method");

                            EventFieldDraw.Invoke(parent, new object[] { sender, e });
                        };

                    break;
                case "ContextMenu":
                    ContextMenu contextMenu = new ContextMenu(manager);
                    contextMenu.Init();

                    contextMenu.Name = Name;
                    contextMenu.Tag = this;
                    contextMenu.Passive = Passive;
                    contextMenu.Enabled = Enabled;

                    foreach (MenuItemEntry entry in Items)
                    {
                        MenuItem menuItem = new MenuItem(entry.Title);
                        menuItem.Enabled = entry.Enabled;

                        contextMenu.Items.Add(menuItem);
                    }

                    if (!string.IsNullOrEmpty(Parent))
                        contextMenu.Parent = parent.GetControl(Parent);
                    else
                        parent.Add(contextMenu);

                    break;

                case "ImageListBox":
                    ImageListBox listBox = new ImageListBox(manager);
                    listBox.Init();

                    SetProperties(listBox, parent, manager);

                    listBox.HideSelection = HideSelection;

                    if (!string.IsNullOrEmpty(ContextMenu))
                        listBox.ContextMenu = parent.GetControl(ContextMenu) as ContextMenu;

                    break;

                case "TechInfoButton":
                    TechInfoButton techInfo = new TechInfoButton(manager);
                    techInfo.Init();

                    SetProperties(techInfo, parent, manager);

                    if (!string.IsNullOrEmpty(TechName))
                        techInfo.Tech = Provider.GetTech(TechName);

                    break;
                case "PolicyButton":
                    PolicyButton policyButton = new PolicyButton(manager);
                    policyButton.Init();

                    SetProperties(policyButton, parent, manager);

                    if (!string.IsNullOrEmpty(PolicyName))
                        policyButton.Policy = Provider.GetPolicy(PolicyName);

                    break;
                case "PolicyTypeBox":
                    PolicyTypeBox policyTypeBox = new PolicyTypeBox(manager);
                    policyTypeBox.Init();

                    SetProperties(policyTypeBox, parent, manager);

                    if (!string.IsNullOrEmpty(PolicyTypeName))
                        policyTypeBox.PolicyType = Provider.GetPolicyType(PolicyTypeName);

                    if (!string.IsNullOrEmpty(ImageAsset))
                        policyTypeBox.Image = manager.Content.Load<Texture2D>(ImageAsset);
                    else if (AtlasAsset != null)
                    {
                        if (AtlasAsset.Atlas == "IconProvider")
                            policyTypeBox.Image = IconProvider.GetByName(AtlasAsset.Name);
                        else
                            policyTypeBox.Image = Provider.GetAtlas(AtlasAsset.Atlas).GetTexture(AtlasAsset.Name);
                    }

                    break;
                case "ImageButton":
                    ImageButton button = new ImageButton(manager);
                    button.Init();

                    ApplyStyle(button, manager);
                    SetProperties(button, parent, manager);
                    SetAnimation(button, manager);

                    button.Text = Text;
                    break;
                case "ProgressBar":
                    ProgressBar progress = new ProgressBar(manager);
                    progress.Init();

                    SetProperties(progress, parent, manager);
                    break;
                case "CheckBox":
                    CheckBox check = new CheckBox(manager);
                    check.Init();

                    SetProperties(check, parent, manager);

                    check.Text = Text;
                    break;
                case "Graph":
                    Graph graph = new Graph(manager);
                    graph.Init();

                    SetProperties(graph, parent, manager);

                    break;
                case "RankingRow":
                    RankingRow rank = new RankingRow(manager);
                    rank.Init();

                    SetProperties(rank, parent, manager);
                    break;
                case "Include":
                    List<ControlItem> children = manager.Content.Load<List<ControlItem>>(Import);

                    foreach (ControlItem item in children)
                        item.Init(parent, manager);
                    break;
                default:
                    throw new Exception("No handling for " + Type);
            }
        }
        ////////////////////////////////////////////////////////////////////////////   
        public TaskControls(Manager manager)
            : base(manager)
        {
            MinimumWidth = 340;
              MinimumHeight = 140;
              Height = 480;
              Center();
              Text = "Controls Test";

              TopPanel.Visible = true;
              Caption.Text = "Information";
              Description.Text = "Demonstration of various controls available in Neoforce Controls library.";
              Caption.TextColor = Description.TextColor = new Color(96, 96, 96);

              grpEdit = new GroupPanel(Manager);
              grpEdit.Init();
              grpEdit.Parent = this;
              grpEdit.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
              grpEdit.Width = ClientWidth - 200;
              grpEdit.Height = 160;
              grpEdit.Left = 8;
              grpEdit.Top = TopPanel.Height + 8;
              grpEdit.Text = "EditBox";

              pnlControls = new Panel(Manager);
              pnlControls.Init();
              pnlControls.Passive = true;
              pnlControls.Parent = this;
              pnlControls.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
              pnlControls.Left = 8;
              pnlControls.Top = grpEdit.Top + grpEdit.Height + 8;
              pnlControls.Width = ClientWidth - 200;
              pnlControls.Height = BottomPanel.Top - 32 - pnlControls.Top;
              pnlControls.BevelBorder = BevelBorder.All;
              pnlControls.BevelMargin = 1;
              pnlControls.BevelStyle = BevelStyle.Etched;
              pnlControls.Color = Color.Transparent;

              lblEdit = new Label(manager);
              lblEdit.Init();
              lblEdit.Parent = grpEdit;
              lblEdit.Left = 16;
              lblEdit.Top = 8;
              lblEdit.Text = "Testing field:";
              lblEdit.Width = 128;
              lblEdit.Height = 16;

              txtEdit = new TextBox(manager);
              txtEdit.Init();
              txtEdit.Parent = grpEdit;
              txtEdit.Left = 16;
              txtEdit.Top = 24;
              txtEdit.Width = grpEdit.ClientWidth - 32;
              txtEdit.Height = 20;
              txtEdit.Anchor = Anchors.Left | Anchors.Top | Anchors.Right | Anchors.Bottom;
              txtEdit.Text = "Text";

              rdbNormal = new RadioButton(manager);
              rdbNormal.Init();
              rdbNormal.Parent = grpEdit;
              rdbNormal.Left = 16;
              rdbNormal.Top = 52;
              rdbNormal.Width = grpEdit.ClientWidth - 32;
              rdbNormal.Anchor = Anchors.Left | Anchors.Bottom | Anchors.Right;
              rdbNormal.Checked = true;
              rdbNormal.Text = "Normal mode";
              rdbNormal.ToolTip.Text = "Enables normal mode for TextBox control.";
              rdbNormal.CheckedChanged += new TomShane.Neoforce.Controls.EventHandler(ModeChanged);

              rdbPassword = new RadioButton(manager);
              rdbPassword.Init();
              rdbPassword.Parent = grpEdit;
              rdbPassword.Left = 16;
              rdbPassword.Top = 68;
              rdbPassword.Width = grpEdit.ClientWidth - 32;
              rdbPassword.Anchor = Anchors.Left | Anchors.Bottom | Anchors.Right;
              rdbPassword.Checked = false;
              rdbPassword.Text = "Password mode";
              rdbPassword.ToolTip.Text = "Enables password mode for TextBox control.";
              rdbPassword.CheckedChanged += new TomShane.Neoforce.Controls.EventHandler(ModeChanged);

              chkBorders = new CheckBox(manager);
              chkBorders.Init();
              chkBorders.Parent = grpEdit;
              chkBorders.Left = 16;
              chkBorders.Top = 96;
              chkBorders.Width = grpEdit.ClientWidth - 32;
              chkBorders.Anchor = Anchors.Left | Anchors.Bottom | Anchors.Right;
              chkBorders.Checked = false;
              chkBorders.Text = "Borderless mode";
              chkBorders.ToolTip.Text = "Enables or disables borderless mode for TextBox control.";
              chkBorders.CheckedChanged += new TomShane.Neoforce.Controls.EventHandler(chkBorders_CheckedChanged);

              chkReadOnly = new CheckBox(manager);
              chkReadOnly.Init();
              chkReadOnly.Parent = grpEdit;
              chkReadOnly.Left = 16;
              chkReadOnly.Top = 110;
              chkReadOnly.Width = grpEdit.ClientWidth - 32;
              chkReadOnly.Anchor = Anchors.Left | Anchors.Bottom | Anchors.Right;
              chkReadOnly.Checked = false;
              chkReadOnly.Text = "Read only mode";
              chkReadOnly.ToolTip.Text = "Enables or disables read only mode for TextBox control.\nThis mode is necessary to enable explicitly.";
              chkReadOnly.CheckedChanged += new TomShane.Neoforce.Controls.EventHandler(chkReadOnly_CheckedChanged);

              string[] colors = new string[] {"Red", "Green", "Blue", "Yellow", "Orange", "Purple", "White", "Black", "Magenta", "Cyan",
                                      "Brown", "Aqua", "Beige", "Coral", "Crimson", "Gray", "Azure", "Ivory", "Indigo", "Khaki",
                                      "Orchid", "Plum", "Salmon", "Silver", "Gold", "Pink", "Linen", "Lime", "Olive", "Slate"};

              spnMain = new SpinBox(manager, SpinBoxMode.List);
              spnMain.Init();
              spnMain.Parent = pnlControls;
              spnMain.Left = 16;
              spnMain.Top = 16;
              spnMain.Width = pnlControls.Width - 32;
              spnMain.Height = 20;
              spnMain.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
              spnMain.Items.AddRange(colors);
              spnMain.Mode = SpinBoxMode.Range;

              spnMain.ItemIndex = 0;

              cmbMain = new ComboBox(manager);
              cmbMain.Init();
              cmbMain.Parent = pnlControls;
              cmbMain.Left = 16;
              cmbMain.Top = 44;
              cmbMain.Width = pnlControls.Width - 32;
              cmbMain.Height = 20;
              cmbMain.ReadOnly = true;
              cmbMain.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
              cmbMain.Items.AddRange(colors);
              cmbMain.ItemIndex = 0;
              cmbMain.MaxItems = 5;
              cmbMain.ToolTip.Color = Color.Yellow;
              cmbMain.Movable = cmbMain.Resizable = true;
              cmbMain.OutlineMoving = cmbMain.OutlineResizing = true;

              trkMain = new TrackBar(manager);
              trkMain.Init();
              trkMain.Parent = pnlControls;
              trkMain.Left = 16;
              trkMain.Top = 72;
              trkMain.Width = pnlControls.Width - 32;
              trkMain.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
              trkMain.Range = 64;
              trkMain.Value = 16;
              trkMain.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(trkMain_ValueChanged);

              lblTrack = new Label(manager);
              lblTrack.Init();
              lblTrack.Parent = pnlControls;
              lblTrack.Left = 16;
              lblTrack.Top = 96;
              lblTrack.Width = pnlControls.Width - 32;
              lblTrack.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
              lblTrack.Alignment = Alignment.TopRight;
              lblTrack.TextColor = new Color(32, 32, 32);
              trkMain_ValueChanged(this, null); // forcing label redraw with init values

              mnuListBox = new ContextMenu(manager);

              MenuItem i1 = new MenuItem("This is very long text");
              MenuItem i2 = new MenuItem("Menu", true);
              MenuItem i3 = new MenuItem("Item", false);
              //i3.Enabled = false;
              MenuItem i4 = new MenuItem("Separated", true);

              MenuItem i11 = new MenuItem();
              MenuItem i12 = new MenuItem();
              MenuItem i13 = new MenuItem();
              MenuItem i14 = new MenuItem();

              MenuItem i111 = new MenuItem();
              MenuItem i112 = new MenuItem();
              MenuItem i113 = new MenuItem();

              mnuListBox.Items.AddRange(new MenuItem[]{i1,i2, i3, i4});
              i2.Items.AddRange(new MenuItem[] { i11, i12, i13, i14 });
              i13.Items.AddRange(new MenuItem[] { i111, i112, i113 });

              lstMain = new ListBox(manager);
              lstMain.Init();
              lstMain.Parent = this;
              lstMain.Top = TopPanel.Height + 8;
              lstMain.Left = grpEdit.Left + grpEdit.Width + 8;
              lstMain.Width = ClientWidth - lstMain.Left - 8;
              lstMain.Height = ClientHeight - 16 - BottomPanel.Height - TopPanel.Height;
              lstMain.Anchor = Anchors.Top | Anchors.Right | Anchors.Bottom;
              lstMain.HideSelection = false;
              lstMain.Items.AddRange(colors);
              lstMain.ContextMenu = mnuListBox;

              prgMain = new ProgressBar(manager);
              prgMain.Init();
              prgMain.Parent = this.BottomPanel;
              prgMain.Left = lstMain.Left;
              prgMain.Top = 10;
              prgMain.Width = lstMain.Width;
              prgMain.Height = 16;
              prgMain.Anchor = Anchors.Top | Anchors.Right;
              prgMain.Mode = ProgressBarMode.Infinite;
              prgMain.Passive = false;

              btnDisable = new Button(manager);
              btnDisable.Init();
              btnDisable.Parent = BottomPanel;
              btnDisable.Left = 8;
              btnDisable.Top = 8;
              btnDisable.Text = "Disable";
              btnDisable.Click += new Controls.EventHandler(btnDisable_Click);
              btnDisable.TextColor = Color.FromNonPremultiplied(255, 64, 32, 200);

              btnProgress = new Button(manager);
              btnProgress.Init();
              btnProgress.Parent = BottomPanel;
              btnProgress.Left = prgMain.Left - 16;
              btnProgress.Top = prgMain.Top;
              btnProgress.Height = 16;
              btnProgress.Width = 16;
              btnProgress.Text = "!";
              btnProgress.Anchor = Anchors.Top | Anchors.Right;
              btnProgress.Click += new Controls.EventHandler(btnProgress_Click);

              mnuMain = new MainMenu(manager);

              mnuMain.Items.Add(i2);
              mnuMain.Items.Add(i13);
              mnuMain.Items.Add(i3);
              mnuMain.Items.Add(i4);

              MainMenu = mnuMain;

              ToolBarPanel tlp = new ToolBarPanel(manager);
              ToolBarPanel = tlp;

              ToolBar tlb = new ToolBar(manager);
              ToolBar tlbx = new ToolBar(manager);
              tlb.FullRow = true;
              tlbx.Row = 1;
              tlbx.FullRow = false;

              tlp.Add(tlb);
              tlp.Add(tlbx);

              /*
              tlb.Init();
              tlb.Width = 256;
              tlb.Parent = ToolBarPanel;*/

              //tlbx.Init();
              /*
              tlbx.Width = 512;
              tlbx.Top = 25;
              tlbx.Parent = ToolBarPanel;*/

             /*
              ToolBarButton tb1 = new ToolBarButton(manager);
              tb1.Init();
              tb1.Parent = tlb;
              tb1.Left = 10;
              tb1.Top = 1;
              tb1.Glyph = new Glyph(Manager.Skin.Images["Icon.Warning"].Resource);
              tb1.Glyph.SizeMode = SizeMode.Stretched;  */

              StatusBar stb = new StatusBar(Manager);
              StatusBar = stb;

              DefaultControl = txtEdit;

              OutlineMoving = true;
              OutlineResizing = true;

              BottomPanel.BringToFront();

              SkinChanged += new TomShane.Neoforce.Controls.EventHandler(TaskControls_SkinChanged);
              TaskControls_SkinChanged(null, null);
        }
        public void InitializeThirdPage()
        {
            stackview2 = new StackView();
            tbcMain.AddPage();
            TabPage third = tbcMain.TabPages[2];
            third.Text = "Other";

            backPanel2 = new Panel(manager);
            backPanel2.Height = third.Height;
            backPanel2.Width = third.Width;
            //backPanel2.Width = second.Width + 20;
            backPanel2.AutoScroll = true;
            backPanel2.Init();
            third.Add(backPanel2);

            HeightCounter4 = 0;
            VertPadding4 = 0;

            ConsolePanel = new CollapsePanel(manager, backPanel2, "Console"); stackview2.AddPanel(ConsolePanel);
            PresetsPanel = new CollapsePanel(manager, backPanel2, "Presets"); stackview2.AddPanel(PresetsPanel);
            CheckBoxes = new CollapsePanel(manager, backPanel2, "CheckBoxes", extended: false); stackview2.AddPanel(CheckBoxes);
            //c14 = new CollapsePanel(manager, backPanel2, "fourth", extended: false); stackview2.AddPanel(c14);
            //c15 = new CollapsePanel(manager, backPanel2, "fifth", extended: false); stackview2.AddPanel(c15);
            //c16 = new CollapsePanel(manager, backPanel2, "sixth", extended: false); stackview2.AddPanel(c16);
            //c17 = new CollapsePanel(manager, backPanel2, "seventh", extended: false); stackview2.AddPanel(c17);
            //c18 = new CollapsePanel(manager, backPanel2, "eighth", extended: false); stackview2.AddPanel(c18);

            backPanel2.Color = UserInterface.TomDark;

            tbcMain.SelectedPage = tbcMain.TabPages[2];
            #region  /// Page 3 ///
            GroupPanel parent;
            #region /// Console ///
            parent = ConsolePanel.panel;

            #region  /// Console textbox ///
            consoletextbox = new TextBox(manager);
            consoletextbox.Init();
            consoletextbox.Parent = parent;

            consoletextbox.Left = LeftPadding;
            consoletextbox.Top = HeightCounter2;
            HeightCounter2 += VertPadding + consoletextbox.Height;
            consoletextbox.Width = parent.Width - LeftPadding * 2;
            consoletextbox.Height = consoletextbox.Height + 3;

            consoletextbox.ToolTip.Text = "Enter a command, and push enter";
            consoletextbox.KeyUp += consolePressed;
            #endregion

            #region  /// Enter Button ///
            Button btnEnter = new Button(manager);
            btnEnter.Init();
            btnEnter.Parent = parent;

            btnEnter.Left = LeftPadding;
            btnEnter.Top = HeightCounter2;
            btnEnter.Width = (parent.Width - LeftPadding * 2) / 2;

            btnEnter.Text = "Enter";
            btnEnter.Click += consolePressed;
            #endregion

            #region  /// Clear ///
            Button btnClear = new Button(manager);
            btnClear.Init();
            btnClear.Parent = parent;

            btnClear.Left = LeftPadding + btnEnter.Width;
            btnClear.Top = HeightCounter2; HeightCounter2 += VertPadding + btnClear.Height;
            btnClear.Width = (parent.Width - LeftPadding * 2) / 2;

            btnClear.Text = "Clear";
            btnClear.Click += btnClear_Click;
            #endregion
            #endregion
            ConsolePanel.Collapse();

            #region /// Presets ///
            parent = PresetsPanel.panel;
            PresetsPanel.ExpandedHeight = 175;
            HeightCounter4 = VertPadding4;

            lstPresets = new ListBox(manager);
            lstPresets.Init();
            lstPresets.Parent = parent;
            lstPresets.Top = HeightCounter4;
            lstPresets.Left = LeftPadding;
            lstPresets.Width = parent.Width - LeftPadding * 2;
            lstPresets.Height = third.Height / 4; HeightCounter += VertPadding + lstPresets.Height;
            lstPresets.Anchor = Anchors.Top | Anchors.Left | Anchors.Bottom;
            lstPresets.HideSelection = false;
            lstPresets.ItemIndexChanged += lstPresets_ItemIndexChanged;

            // go to cmbPresets to find the preset synching reference.

            #region /// Presets ContextMenu ///
            presetContextMenu = new ContextMenu(manager);
            deletePresetMenuItem = new MenuItem("Delete Preset");
            deletePresetMenuItem.Click += deletePresetMenuItem_Click;
            presetContextMenu.Items.Add(deletePresetMenuItem);
            presetContextMenu.Enabled = false;
            #endregion
            lstPresets.ContextMenu = presetContextMenu;

            CheckBoxes.ExpandedHeight = 150;

            HeightCounter4 = 0;

            cbUserLevel = new ComboBox(manager);
            cbUserLevel.Init();
            cbUserLevel.Parent = CheckBoxes.panel;
            cbUserLevel.Top = HeightCounter4;
            cbUserLevel.Width = 150;
            HeightCounter4 += cbUserLevel.Height;
            foreach(string ul in Enum.GetNames(typeof(UserLevel)))
            {
                cbUserLevel.Items.Add(ul);
            }
            cbUserLevel.ItemIndexChanged += (s, e) =>
            {
                userLevel = (UserLevel)cbUserLevel.ItemIndex;

            };
            int count = 0;
            foreach(object s in cbUserLevel.Items)
            {
                if (s.ToString().Equals(userLevel.ToString()))
                {
                    cbUserLevel.ItemIndex = count;
                }
                count++;
            }

            #endregion

            Dictionary<string, EventHandler> checkBoxHandlers = new Dictionary<string, EventHandler>(){
                { "FullScreen", (o,e) => {
                    if ((o as CheckBox).Checked) game.setResolution(resolutions.AutoFullScreen, true);
                    else game.setResolution(resolutions.WSXGA_1680x1050, false);
                } },
                { "Hide Links", (o,e) => {
                    game.room.DrawLinks = !(o as CheckBox).Checked;
                } },
            };

            foreach (string key in checkBoxHandlers.Keys)
            {
                CreateCheckBox(key, checkBoxHandlers[key]);
            }

            tbcMain.SelectedPage = tbcMain.TabPages[0];
            #endregion
        }