private CToolStripButton CreateToolStripButton(String text) { CToolStripButton ctsb = ControlFactory.BuildCToolStripButton(text); sectionMenu.Items.Add(ctsb); return(ctsb); }
public void SetSelectedButton(CToolStripButton toolStripItem) { if (toolStripItem != null) { UnCheckButtons(); SelectedButton = toolStripItem; } }
static public CToolStripButton BuildCToolStripButton(String s) { CToolStripButton c = new CToolStripButton(); c.SetSectionName(s); c.MouseHover += model.UpdateInfoLabel; c.MouseLeave += model.EraseInfoLabel; return(c); }
public Section(CToolStripButton ctsb, System.Windows.Forms.TabPage tp, string name, string text, bool selected) { this.Name = name; this.text = text; this.Selected = selected; this.Button = ctsb; this.Tab = tp; this.Id = count; tp.Name = this.Name; this.Button.Text = text; count++; }
public Section(CToolStripButton b, System.Windows.Forms.TabPage t, String text, bool Selected) { this.Name = "Section" + count; this.text = text; this.Selected = Selected; this.Id = count; this.Button = b; this.Tab = t; t.Name = this.Name; this.Button.Text = text; count++; }
public void UpdateInfoLabel(object sender, EventArgs e) { if (sender is CToolStripButton) { CToolStripButton ct = sender as CToolStripButton; if (currentSection.Button == ct) { SetInfoLabelText((sender as CToolStripButton).ToolTipText); } } else if (!String.IsNullOrEmpty((sender as ICustomControl).cd.Hint)) { SetInfoLabelText((sender as ICustomControl).cd.Hint); } }
static public Section BuildSection(String name, String text, bool selected) { while (model.sections.Exists(e => e.Name == "Section" + Section.count)) { Section.count++; } CToolStripButton ctsb = BuildCToolStripButton(text); TabPage tp = BuildTabPage(name); Section s = new Section(ctsb, tp, text, selected); Model.getInstance().currentSection = s; Model.getInstance().sections.Add(s); model.logCreator.Append("+ Added: " + s.Name); return(s); }
private Section CreateDefinedSection(XElement i) { try { String name = i.Element("Name").Value; String realText = i.Element("Text").Value; String display = i.Element("DisplayRight").Value.ToString().Substring(2); String modify = i.Element("ModificationRight").Value.ToString().Substring(2); String hint = i.Element("Hint").Value; bool selected = false; if (i.Element("Selected").Value == "true") { selected = true; } String text = TokenTextTranslator.TranslateFromTextFile(realText); CToolStripButton ctsb = ControlFactory.BuildCToolStripButton(realText); TabPage tp = ControlFactory.BuildTabPage(name); Section s = new Section(ctsb, tp, name, text, selected); s.RealText = realText; s.DisplayRight = display; s.ModificationRight = modify; s.Hint = hint; Model.getInstance().currentSection = s; Model.getInstance().sections.Add(s); return(s); } catch (Exception e) { String caption = Model.GetTranslationFromID(37); String msg = Model.GetTranslationFromID(47) + " " + Model.GetTranslationFromID(52); MessageBox.Show(msg, caption, MessageBoxButtons.OK, MessageBoxIcon.Error); model.logCreator.Append("Creating defined section:" + i.Element("Name").Value); model.logCreator.Append(msg); model.logCreator.Append(e.ToString()); System.Environment.Exit(1); return(null); } }
private void editSectionNameToolStripMenuItem_Click(object sender, EventArgs e) { MouseEventArgs me = e as MouseEventArgs; CToolStripButton tb = null; foreach (Section s in model.sections) { if (s.Selected) { tb = s.Button; } } if (tb != null) { SectionEditor se = new SectionEditor(model.currentSection); se.ShowDialog(); //sectionMenuView.readAndShow(); } }
private void ToolStripButton_Click(object sender, EventArgs e) { if (sender is CToolStripButton) { CToolStripButton b = (CToolStripButton)sender; SelectedButton = b; UnCheckButtons(); SelectedButton.Checked = true; Section s = model.sections.Find(se => se.Button == SelectedButton); UnSelectSections(); s.Selected = true; int buttonIndex = sectionMenu.Items.IndexOf(SelectedButton); int labelIndex = 0; for (int i = 0; i < sectionMenu.Items.Count; i++) { if (sectionMenu.Items[i] is ToolStripTextBox) { labelIndex = i; } } MoveInfoLabel(buttonIndex, labelIndex); sectionMenu.Refresh(); model.currentSection = s; Debug.WriteLine("! Clicked: " + b.Name + " \"" + b.Text + "\""); sectionTabControl.SelectTab(s.Tab); Debug.WriteLine("! Selected: " + model.currentSection.Name + " with Text: " + s.Text); } }