internal GroupViewItemCollection(GroupViewSection owner) { this._owner = owner; this._items = new ArrayList(); }
private void OnSectionSelected(int newIndex, bool uiSelection) { try { if (uiSelection) { this._itemContainer.BeginUpdate(); } if (this._selectedSection != null) { if (uiSelection) { this.OnSelectedSectionChanging(EventArgs.Empty); } this._selectedSection.OnDeactivate(); this._selectedSection = null; } this._selectedSectionIndex = newIndex; if (this._selectedSectionIndex != -1) { this._selectedSection = this._sectionCollection[this._selectedSectionIndex]; this._selectedSection.OnActivate(this._itemContainer); if (uiSelection) { this.OnSelectedSectionChanged(EventArgs.Empty); } } } finally { if (uiSelection) { this._itemContainer.EndUpdate(); } } this.DirtySectionRectangles(false); if (base.IsHandleCreated) { base.PerformLayout(); base.Invalidate(); } }
private void PaintSection(Graphics g, GroupViewSection section, int sectionIndex, Brush sectionBrush, Font font) { Brush control; Rectangle rect = section.Rectangle; Rectangle layoutRectangle = rect; layoutRectangle.Inflate(-2, -2); if ((sectionIndex == this._mouseDownIndex) || (sectionIndex == this._selectedSectionIndex)) { g.FillRectangle(SystemBrushes.ControlDark, rect); control = SystemBrushes.Control; } else { g.FillRectangle(sectionBrush, rect); control = SystemBrushes.ControlText; } if (this._sectionImages != null) { if ((section.ImageIndex != -1) && (this._sectionImages.Images.Count > section.ImageIndex)) { int x = (rect.Left + 2) + 1; int y = rect.Top + ((rect.Height - 0x10) / 2); this._sectionImages.Draw(g, x, y, section.ImageIndex); } int num3 = 20; layoutRectangle.X += num3; layoutRectangle.Width -= num3; } StringFormat format = new StringFormat(StringFormatFlags.NoWrap); format.Alignment = StringAlignment.Near; format.LineAlignment = StringAlignment.Center; format.Trimming = StringTrimming.EllipsisCharacter; g.DrawString(section.Text, font, control, layoutRectangle, format); format.Dispose(); if (sectionIndex == this._hoverIndex) { g.DrawRectangle(SystemPens.ControlDark, rect.Left, rect.Top, rect.Width - 1, rect.Height - 1); } }
internal void OnSectionChanged(GroupViewSection section, bool relayoutRequired) { if (relayoutRequired) { this.DirtySectionRectangles(base.IsHandleCreated); if (section.Visible && (this._selectedSectionIndex == -1)) { int index = this._sectionCollection.IndexOf(section); this.SelectedSectionIndex = index; } else if (!section.Visible && (section == this._selectedSection)) { int nextVisibleSection = this.GetNextVisibleSection(this._selectedSectionIndex); this.SelectedSectionIndex = nextVisibleSection; } base.PerformLayout(); } if (base.IsHandleCreated) { base.Invalidate(); } }
internal void OnSectionRemoved(GroupViewSection section) { if (section == this._selectedSection) { int selectedSectionIndex = this.SelectedSectionIndex; if (selectedSectionIndex == this._sectionCollection.Count) { selectedSectionIndex--; } this.SelectedSectionIndex = selectedSectionIndex; } else { for (int i = 0; i < this._sectionCollection.Count; i++) { if (this._sectionCollection[i] == this._selectedSection) { this.SelectedSectionIndex = i; } } } section.SetOwner(null); }
public void Remove(GroupViewSection value) { this._sections.Remove(value); this._owner.OnSectionRemoved(value); }
internal void OnSectionAdded(GroupViewSection section) { section.SetOwner(this); if ((this._selectedSectionIndex == -1) && section.Visible) { this.SelectedSectionIndex = 0; } }
public int IndexOf(GroupViewSection section) { int count = this.Count; for (int i = 0; i < count; i++) { if (this[i] == section) { return i; } } return -1; }
public bool Contains(GroupViewSection section) { return (this.IndexOf(section) != -1); }
public void AddRange(GroupViewSection[] sections) { foreach (GroupViewSection section in sections) { this.Add(section); } }
public void Add(GroupViewSection value) { this._sections.Add(value); this._owner.OnSectionAdded(value); }
private void OnSectionAdded(object sender, ToolboxSectionEventArgs e) { ToolboxSection section = e.Section; this._groupViewImages.Images.Add(section.Icon); GroupViewSection section2 = new GroupViewSection(); section2.ImageIndex = this._groupViewImages.Images.Count - 1; section2.Text = section.Name; section2.Visible = false; foreach (ToolboxDataItem item in section.ToolboxDataItems) { ToolboxDataGroupViewItem item2 = new ToolboxDataGroupViewItem(item, this); section2.Items.Add(item2); } SectionInfo info = new SectionInfo(); info.ToolboxSection = section; info.UISection = section2; this._sections.Add(info); this._groupView.Sections.Add(section2); section.ItemsChanged += new EventHandler(this.OnToolboxSectionItemsChanged); this.UpdateToolboxClient(); }