public RecentDocumentList( RibbonItemCollection rightPaneItems, StringCollection files, LoadDocumentDelegate loadDocument) { this.rightPaneItems = rightPaneItems; this.files = files; this.loadDocument = loadDocument; // first create a header and make sure it's not selectable RibbonListItem listItem = new RibbonListItem(new RibbonLabel("Recent Documents")); listItem.AllowSelection = false; rightPaneItems.Add(listItem); rightPaneItems.Add(new RibbonListItem(new RibbonSeparator())); this.listTopIndex = rightPaneItems.Count; // create the recently used document list foreach (string document in this.files) { RecentDocumentItem item = new RecentDocumentItem(document, false, loadDocument); rightPaneItems.Add(item); string d = document; } }
public RecentDocumentItem(string fullFileName, bool pinned, LoadDocumentDelegate loadDocument) { this.fullFileName = fullFileName; string documentName = new FileInfo(fullFileName).Name; // each item consists of the name of the document and a push pin this.label = new RibbonLabel(documentName); this.pin = new RibbonToggleButton(); // allow the button to be selectable so we can toggle it this.pin.AllowSelection = true; this.pin.Pressed = pinned; this.pin.PressedChanged += delegate { this.SetPinImage(); }; this.SetPinImage(); this.Items.Add(this.label); this.Items.Add(this.pin); this.ToolTip = fullFileName; this.Click += delegate { loadDocument(this.FullFileName); }; }
public RecentDocumentItem(string fullFileName, bool pinned, LoadDocumentDelegate loadDocument) { this.fullFileName = fullFileName; string documentName = new FileInfo(fullFileName).Name; // each item consists of the name of the document and a push pin this.label = new RibbonLabel(documentName); this.pin = new RibbonToggleButton(); // allow the button to be selectable so we can toggle it this.pin.SelectableInListItem = true; this.pin.Pressed = pinned; this.pin.IconSet.Add(new C1.Framework.C1BitmapIcon("", new Size(16, 16), Color.Transparent, ControlExplorer.Properties.Resources.Unpinned)); this.pin.PressedIconSet.Add(new C1.Framework.C1BitmapIcon("", new Size(16, 16), Color.Transparent, ControlExplorer.Properties.Resources.Pinned)); this.Items.Add(this.label); this.Items.Add(this.pin); this.ToolTip = fullFileName; this.Click += delegate { loadDocument(this.FullFileName); }; }