public void HiddenTest() { CuiToolbar tb = new CuiToolbar("Test"); Assert.AreEqual("0", tb.Properties["Hidden"]); Assert.IsFalse(tb.Hidden); tb.Hidden = true; Assert.IsTrue(tb.Hidden); Assert.AreEqual("1", tb.Properties["Hidden"]); }
public void BoundsTestMethod() { CuiToolbar tb = new CuiToolbar("Test"); Assert.AreEqual("16 100 150 200 213", tb.Properties["CurPos"]); Assert.AreEqual(new Rectangle(100, 150, 100, 63), tb.Bounds); tb.Bounds = new Rectangle(50, 60, 200, 70); Assert.AreEqual(new Rectangle(50, 60, 200, 70), tb.Bounds); Assert.AreEqual("16 50 60 250 130", tb.Properties["CurPos"]); }
private void writeToolbar(StreamWriter writer, CuiToolbar toolbar) { this.writeSection(writer, toolbar); //Write items. if (toolbar.Items.Count > 0) { writer.WriteLine("ItemCount={0}", toolbar.Items.Count.ToString()); for (int i = 0; i < toolbar.Items.Count; i++) { writer.WriteLine("Item{0}={1}", i.ToString(), toolbar.Items[i].Value); foreach (String flyoff in toolbar.Items[i].FlyOffItems) writer.WriteLine(flyoff); } } }
private void readCuiWindowsSection(StreamReader reader) { while (!reader.EndOfStream) { if (reader.Peek() == '[') break; String line = reader.ReadLine(); //Check if the line matches F000=T: or F000=S: if (toolbarEntryPattern.IsMatch(line)) { String[] splitLine = toolbarEntryPattern.Split(line); CuiToolbar tb = new CuiToolbar(); tb.Name = splitLine[2]; tb.EntryType = splitLine[1]; this.toolbars.Add(tb); } } }
/// <summary> /// Removes the toolbar object from the CuiFile and returns true anything was removed. /// </summary> public Boolean RemoveToolbar(CuiToolbar toolbar) { return this.toolbars.Remove(toolbar); }
/// <summary> /// Adds a new toolbar to the CuiFile and returns the CuiToolbar object. /// </summary> /// <param name="name">The name of the toolbar to create.</param> /// <param name="numButtons">The number of (image) buttons to allocate size for.</param> /// <param name="numSeparators">The number of separators to allocate size for.</param> public CuiToolbar AddToolbar(String name, Int32 numButtons, Int32 numSeparators) { CuiToolbar toolbar = new CuiToolbar(name, numButtons, numSeparators); if (this.AddToolbar(toolbar)) return toolbar; else return null; }
/// <summary> /// Adds the toolbar to the CuiFile and returns true if it was added, false if a toolbar with the same name already exists. /// </summary> public Boolean AddToolbar(CuiToolbar toolbar) { if (this.toolbars.Exists(t => t.Name == toolbar.Name)) return false; this.toolbars.Add(toolbar); return true; }