public TGContextMenuEventArgs(TabGroupLeaf tgl, Controls.TabControl tc, Controls.TabPage tp, PopupMenu contextMenu) : base(tgl, tc, tp) { // Definie initial state _contextMenu = contextMenu; }
public TGPageLoadingEventArgs(Controls.TabPage tp, XmlTextReader xmlIn) { // Definie initial state _tp = tp; _xmlIn = xmlIn; _cancel = false; }
protected void OnPageDragStart(object sender, MouseEventArgs e) { if (this.RedockAllowed) { // There must be a selected page for this event to occur Controls.TabPage page = _tabControl.SelectedTab; // Event page must specify its Content object Content c = page.Tag as Content; // Remember the position of the tab before it is removed _dragPageIndex = _tabControl.TabPages.IndexOf(page); // Remove page from TabControl _tabControl.TabPages.Remove(page); // Force the entire window to redraw to ensure the Redocker does not start drawing // the XOR indicator before the window repaints itself. Otherwise the repainted // control will interfere with the XOR indicator. this.Refresh(); // Start redocking activity for the single Content of this WindowContent _redocker = new RedockerContent(_tabControl, c, this, new Point(e.X, e.Y)); } }
public TGCloseRequestEventArgs(TabGroupLeaf tgl, Controls.TabControl tc, Controls.TabPage tp) { // Definie initial state _tgl = tgl; _tc = tc; _tp = tp; _cancel = false; }
protected void OnDoubleClickTab(Controls.TabControl tc, Controls.TabPage page) { Content c = (Content)page.Tag; // Make Content record its current position and remember it for the future c.RecordRestore(); // Invert docked status c.Docked = (c.Docked == false); // Remove from current WindowContent and restore its position _manager.HideContent(c, false, true); _manager.ShowContent(c); }
protected override void OnContentInserted(int index, object value) { base.OnContentInserted(index, value); Content content = value as Content; // Create TabPage to represent the Content Controls.TabPage newPage = new Controls.TabPage(); // Reflect the Content properties int the TabPage newPage.Title = content.Title; newPage.ImageList = content.ImageList; newPage.ImageIndex = content.ImageIndex; newPage.Control = content.Control; newPage.Tag = content; // Reflect same order in TabPages collection as Content collection _tabControl.TabPages.Insert(index, newPage); }
protected void RestoreDraggingPage() { // Create TabPage to represent the Content Controls.TabPage newPage = new Controls.TabPage(); Content content = _redocker.Content; // Reflect the Content properties int the TabPage newPage.Title = content.Title; newPage.ImageList = content.ImageList; newPage.ImageIndex = content.ImageIndex; newPage.Control = content.Control; newPage.Tag = content; newPage.Selected = true; // Put it back where it came from _tabControl.TabPages.Insert(_dragPageIndex, newPage); // Update the title displayed NotifyFullTitleText(content.FullTitle); }
public void HideCurrentContent() { Controls.TabPage tp = _tabControl.SelectedTab; int count = _tabControl.TabPages.Count; // Find currently selected tab int index = _tabControl.SelectedIndex; // Decide which other tab to make selected instead if (count > 1) { // Move to the next control along int newSelect = index + 1; // Wrap around to first tab if at end if (newSelect == count) { newSelect = 0; } // Change selection _tabControl.SelectedIndex = newSelect; } else { // Hide myself as am about to die this.Hide(); // Ensure the focus goes somewhere else _manager.Container.Focus(); } if (tp != null) { // Have the manager perform the Hide operation for us _manager.HideContent(tp.Tag as Content); } }
public TGPageSavingEventArgs(Controls.TabPage tp, XmlTextWriter xmlOut) { // Definie initial state _tp = tp; _xmlOut = xmlOut; }
public override void LoadFromXml(XmlTextReader xmlIn) { // Grab the expected attributes string rawCount = xmlIn.GetAttribute(0); string rawUnique = xmlIn.GetAttribute(1); string rawSpace = xmlIn.GetAttribute(2); // Convert to correct types int count = Convert.ToInt32(rawCount); int unique = Convert.ToInt32(rawUnique); Decimal space = Convert.ToDecimal(rawSpace); // Update myself with new values _unique = unique; _space = space; // Load each of the children for (int i = 0; i < count; i++) { // Read to the first page element or if (!xmlIn.Read()) { throw new ArgumentException("An element was expected but could not be read in"); } // Must always be a page instance if (xmlIn.Name == "Page") { Controls.TabPage tp = new Controls.TabPage(); // Grab the expected attributes string title = xmlIn.GetAttribute(0); string rawImageList = xmlIn.GetAttribute(1); string rawImageIndex = xmlIn.GetAttribute(2); string rawSelected = xmlIn.GetAttribute(3); string controlType = xmlIn.GetAttribute(4); // Convert to correct types bool imageList = Convert.ToBoolean(rawImageList); int imageIndex = Convert.ToInt32(rawImageIndex); bool selected = Convert.ToBoolean(rawSelected); // Setup new page instance tp.Title = title; tp.ImageIndex = imageIndex; tp.Selected = selected; if (imageList) { tp.ImageList = _tabbedGroups.ImageList; } // Is there a type description of required control? if (controlType != "null") { try { // Get type description, if possible Type t = Type.GetType(controlType); // Was a valid, known type? if (t != null) { // Get the assembly this type is defined inside Assembly a = t.Assembly; if (a != null) { // Create a new instance form the assemnly object newObj = a.CreateInstance(t.FullName); Control newControl = newObj as Control; // Must derive from Control to be of use to us if (newControl != null) { tp.Control = newControl; } } } } catch { // We ignore failure to recreate given control type } } // Read to the custom data element if (!xmlIn.Read()) { throw new ArgumentException("An element was expected but could not be read in"); } if (xmlIn.Name != "CustomPageData") { throw new ArgumentException("Expected 'CustomPageData' element was not found"); } bool finished = xmlIn.IsEmptyElement; TGPageLoadingEventArgs e = new TGPageLoadingEventArgs(tp, xmlIn); // Give handlers chance to reconstruct per-page information _tabbedGroups.OnPageLoading(e); // Add into the control unless handler cancelled add operation if (!e.Cancel) { _tabControl.TabPages.Add(tp); } // Read everything until we get the end of custom data marker while (!finished) { // Check it has the expected name if (xmlIn.NodeType == XmlNodeType.EndElement) { finished = (xmlIn.Name == "CustomPageData"); } if (!finished) { if (!xmlIn.Read()) { throw new ArgumentException("An element was expected but could not be read in"); } } } // Read past the end of page element if (!xmlIn.Read()) { throw new ArgumentException("An element was expected but could not be read in"); } // Check it has the expected name if (xmlIn.NodeType != XmlNodeType.EndElement) { throw new ArgumentException("End of 'page' element expected but missing"); } } else { throw new ArgumentException("Unknown element was encountered"); } } }
public override void LoadFromXml(XmlTextReader xmlIn) { // Grab the expected attributes string rawCount = xmlIn.GetAttribute(0); string rawUnique = xmlIn.GetAttribute(1); string rawSpace = xmlIn.GetAttribute(2); // Convert to correct types int count = Convert.ToInt32(rawCount); int unique = Convert.ToInt32(rawUnique); Decimal space = Convert.ToDecimal(rawSpace); // Update myself with new values _unique = unique; _space = space; // Load each of the children for(int i=0; i<count; i++) { // Read to the first page element or if (!xmlIn.Read()) throw new ArgumentException("An element was expected but could not be read in"); // Must always be a page instance if (xmlIn.Name == "Page") { Controls.TabPage tp = new Controls.TabPage(); // Grab the expected attributes string title = xmlIn.GetAttribute(0); string rawImageList = xmlIn.GetAttribute(1); string rawImageIndex = xmlIn.GetAttribute(2); string rawSelected = xmlIn.GetAttribute(3); string controlType = xmlIn.GetAttribute(4); // Convert to correct types bool imageList = Convert.ToBoolean(rawImageList); int imageIndex = Convert.ToInt32(rawImageIndex); bool selected = Convert.ToBoolean(rawSelected); // Setup new page instance tp.Title = title; tp.ImageIndex = imageIndex; tp.Selected = selected; if (imageList) tp.ImageList = _tabbedGroups.ImageList; // Is there a type description of required control? if (controlType != "null") { try { // Get type description, if possible Type t = Type.GetType(controlType); // Was a valid, known type? if (t != null) { // Get the assembly this type is defined inside Assembly a = t.Assembly; if (a != null) { // Create a new instance form the assemnly object newObj = a.CreateInstance(t.FullName); Control newControl = newObj as Control; // Must derive from Control to be of use to us if (newControl != null) tp.Control = newControl; } } } catch { // We ignore failure to recreate given control type } } // Read to the custom data element if (!xmlIn.Read()) throw new ArgumentException("An element was expected but could not be read in"); if (xmlIn.Name != "CustomPageData") throw new ArgumentException("Expected 'CustomPageData' element was not found"); bool finished = xmlIn.IsEmptyElement; TGPageLoadingEventArgs e = new TGPageLoadingEventArgs(tp, xmlIn); // Give handlers chance to reconstruct per-page information _tabbedGroups.OnPageLoading(e); // Add into the control unless handler cancelled add operation if (!e.Cancel) _tabControl.TabPages.Add(tp); // Read everything until we get the end of custom data marker while(!finished) { // Check it has the expected name if (xmlIn.NodeType == XmlNodeType.EndElement) finished = (xmlIn.Name == "CustomPageData"); if (!finished) { if (!xmlIn.Read()) throw new ArgumentException("An element was expected but could not be read in"); } } // Read past the end of page element if (!xmlIn.Read()) throw new ArgumentException("An element was expected but could not be read in"); // Check it has the expected name if (xmlIn.NodeType != XmlNodeType.EndElement) throw new ArgumentException("End of 'page' element expected but missing"); } else throw new ArgumentException("Unknown element was encountered"); } }
//, XmlTextWriter xmlOut) // protected XmlTextWriter _xmlOut; public TGPageSavingEventArgs(Controls.TabPage tp) { // Definie initial state _tp = tp; // _xmlOut = xmlOut; }
//, XmlTextReader xmlIn) public TGPageLoadingEventArgs(Controls.TabPage tp) { // Definie initial state _tp = tp; //_xmlIn = xmlIn; _cancel = false; }