public CTabControl(CTabPage tp) { this.Name = "CTabControl" + count; this.TabPages.Add(tp); count++; }
public void tabPageToolStripMenuItem_Click(object sender, EventArgs e) { CTabPage tabPage = ControlFactory.BuildCTabPage(model.currentClickedControl); tabPage.MouseDown += Control_Click; editor = new ControlEditor(); editor.Show(tabPage); }
public CToolStripButton(Section s) { if (s == null) { throw new ArgumentNullException(); } this.TypeId = count; this.Name = s.Name; this.Text = s.Text; this.RelatedTabPage = null; this.CheckOnClick = true; count++; }
private void SetContextMenuStrip(string type) { enableDropDownItems(contextMenu.Items[0] as ToolStripMenuItem, -1, true); if (type == "CGroupBox" || type == "CPanel") { // Editable Containers contextMenu.Items[0].Enabled = true; // New enableDropDownItems(contextMenu.Items[0] as ToolStripMenuItem, 11, false); contextMenu.Items[1].Enabled = true; // Edit contextMenu.Items[3].Enabled = true; // Copy contextMenu.Items[4].Enabled = true; // Cut contextMenu.Items[7].Enabled = true; // Delete } else if (type == "TabPage") { // Section Tabs contextMenu.Items[0].Enabled = true; enableDropDownItems(contextMenu.Items[0] as ToolStripMenuItem, 11, false); contextMenu.Items[1].Enabled = false; contextMenu.Items[3].Enabled = false; contextMenu.Items[4].Enabled = false; contextMenu.Items[7].Enabled = false; } else if (type == "CTabPage") { // Custom Tabs contextMenu.Items[0].Enabled = true; enableDropDownItems(contextMenu.Items[0] as ToolStripMenuItem, 11, false); contextMenu.Items[1].Enabled = true; contextMenu.Items[3].Enabled = false; contextMenu.Items[4].Enabled = false; contextMenu.Items[7].Enabled = true; // Check if it is the only and last tab inside the CTabcontrol CTabPage p = model.currentClickedControl as CTabPage; if ((p.Parent as CTabControl).TabCount <= 1) { contextMenu.Items[7].Enabled = false; } } else if (type == "CTabControl") { contextMenu.Items[0].Enabled = true; enableDropDownItems(contextMenu.Items[0] as ToolStripMenuItem, 11, true); contextMenu.Items[1].Enabled = true; contextMenu.Items[3].Enabled = false; contextMenu.Items[4].Enabled = true; contextMenu.Items[7].Enabled = true; } else { // Not a container contextMenu.Items[0].Enabled = false; enableDropDownItems(contextMenu.Items[0] as ToolStripMenuItem, 11, false); contextMenu.Items[1].Enabled = true; contextMenu.Items[3].Enabled = true; contextMenu.Items[4].Enabled = true; contextMenu.Items[7].Enabled = true; } // Set the PASTE option if (model.copiedControl || model.cutControl) { contextMenu.Items[5].Enabled = true; } else { contextMenu.Items[5].Enabled = false; } }