internal void MovePageToLeaf(TabGroupLeaf leaf) { // Remember original auto compact mode bool autoCompact = _tabbedGroups.AutoCompact; // Turn mode off as it interferes with reorganisation _tabbedGroups.AutoCompact = false; // Get the requested tab page to be moved to new leaf River.Orqa.Controls.Controls.TabPage tp = _tabControl.SelectedTab; // Remove page from ourself _tabControl.TabPages.Remove(tp); // Add into the new leaf leaf.TabPages.Add(tp); // Make new leaf the active one _tabbedGroups.ActiveLeaf = leaf; River.Orqa.Controls.Controls.TabControl tc = leaf.GroupControl as Controls.TabControl; // Select the newly added page tc.SelectedTab = tp; // Reset compacting mode as we have updated the structure _tabbedGroups.AutoCompact = autoCompact; // Do we need to compact? if (_tabbedGroups.AutoCompact) { _tabbedGroups.Compact(); } }
public TGPageLoadingEventArgs(Controls.TabPage tp, XmlTextReader xmlIn) { // Definie initial state _tp = tp; _xmlIn = xmlIn; _cancel = false; }
public TGContextMenuEventArgs(TabGroupLeaf tgl, Controls.TabControl tc, Controls.TabPage tp, PopupMenu contextMenu) : base(tgl, tc, tp) { // Definie initial state _contextMenu = contextMenu; }
public TGCloseRequestEventArgs(TabGroupLeaf tgl, Controls.TabControl tc, Controls.TabPage tp) { // Definie initial state _tgl = tgl; _tc = tc; _tp = tp; _cancel = false; }
protected void AddGroupToSequence(TabGroupSequence tgs, TabGroupLeaf sourceLeaf, bool before) { // Remember original auto compact mode bool autoCompact = _tabbedGroups.AutoCompact; // Turn mode off as it interferes with reorganisation _tabbedGroups.AutoCompact = false; // Find our index into parent collection int pos = tgs.IndexOf(this); TabGroupLeaf newGroup = null; // New group inserted before existing one? if (before) { newGroup = tgs.InsertNewLeaf(pos); } else { // No, are we at the end of the collection? if (pos == (tgs.Count - 1)) { newGroup = tgs.AddNewLeaf(); } else { newGroup = tgs.InsertNewLeaf(pos + 1); } } // Get tab control for source leaf Controls.TabControl tc = sourceLeaf.GroupControl as Controls.TabControl; River.Orqa.Controls.Controls.TabPage tp = tc.SelectedTab; // Remove page from ourself tc.TabPages.Remove(tp); // Add into the new leaf newGroup.TabPages.Add(tp); // Reset compacting mode as we have updated the structure _tabbedGroups.AutoCompact = autoCompact; // Do we need to compact? if (_tabbedGroups.AutoCompact) { _tabbedGroups.Compact(); } }
protected override void OnPaint(PaintEventArgs e) { // Fill background in required color if (_style == VisualStyle.IDE) { using (SolidBrush fillBrush = new SolidBrush(_backIDE)) e.Graphics.FillRectangle(fillBrush, this.ClientRectangle); } else { using (SolidBrush fillBrush = new SolidBrush(this.BackColor)) e.Graphics.FillRectangle(fillBrush, this.ClientRectangle); } // Style specific outline drawing DrawOutline(e.Graphics, true); // Draw border around area using (Pen borderPen = new Pen(ControlPaint.LightLight(this.ForeColor))) { // Draw each of the draw objects foreach (DrawTab dt in _drawTabs) { Rectangle drawRect = dt.DrawRect; AdjustRectForEdge(ref drawRect); // Style specific cell outline drawing DrawOutlineForCell(e.Graphics, borderPen, drawRect); // Draw the image in the left/top of the cell River.Orqa.Controls.Controls.TabPage page = dt.TabPage; int xDraw; int yDraw; switch (_edge) { case Edge.Left: case Edge.Right: xDraw = drawRect.Left + (drawRect.Width - _imageVector) / 2; yDraw = drawRect.Top + _imageGap; break; case Edge.Top: case Edge.Bottom: case Edge.None: default: xDraw = drawRect.Left + _imageGap; yDraw = drawRect.Top + (drawRect.Height - _imageVector) / 2; break; } if ((page.ImageIndex != -1) && (page.ImageList != null)) { // Draw the actual image e.Graphics.DrawImage(page.ImageList.Images[page.ImageIndex], new Rectangle(xDraw, yDraw, _imageVector, _imageVector)); } // Is anything currently selected if (_selectedIndex != -1) { // Is this page selected? if (page == _tabPages[_selectedIndex]) { Rectangle textRect; StringFormat drawFormat = new StringFormat(); drawFormat.FormatFlags = StringFormatFlags.NoClip | StringFormatFlags.NoWrap; drawFormat.Alignment = StringAlignment.Center; drawFormat.LineAlignment = StringAlignment.Center; // Create text drawing rectangle switch (_edge) { case Edge.Left: case Edge.Right: textRect = new Rectangle(drawRect.Left, yDraw + _imageVector + _imageGap, drawRect.Width, drawRect.Height - _imageVector - _imageGap * 2); drawFormat.FormatFlags |= StringFormatFlags.DirectionVertical; break; case Edge.Top: case Edge.Bottom: case Edge.None: default: textRect = new Rectangle(xDraw + _imageVector + _imageGap, drawRect.Top, drawRect.Width - _imageVector - _imageGap * 2, drawRect.Height); break; } Color brushColor = this.ForeColor; if (_style == VisualStyle.IDE) { brushColor = ControlPaint.Light(brushColor); } using (SolidBrush drawBrush = new SolidBrush(brushColor)) e.Graphics.DrawString(page.Title, this.Font, drawBrush, textRect, drawFormat); } } } } // Style specific outline drawing DrawOutline(e.Graphics, false); base.OnPaint(e); }
public DrawTab(River.Orqa.Controls.Controls.TabPage tabPage, Rectangle drawRect, int index) { _index = index; _tabPage = tabPage; _drawRect = drawRect; }
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 TGPageSavingEventArgs(Controls.TabPage tp, XmlTextWriter xmlOut) { // Definie initial state _tp = tp; _xmlOut = xmlOut; }