public IndentedComboBox() { this.InitializeComponent(); this.m_root = new IndentedComboBox.Item(); this.m_root.Owner = this; this.OnFontChanged(new EventArgs()); }
private void FillCategories(Inventory.Entry entry, IndentedComboBox.Item item) { if (!entry.IsDirectory) { return; } if (entry.Deleted) { return; } IndentedComboBox.Item item2 = new IndentedComboBox.Item(); item2.Tag = entry; item2.Text = entry.DisplayName; item2.Image = entry.Icon; item.Add(item2); int num = 0; Inventory.Entry[] children = entry.Children; for (int i = 0; i < children.Length; i++) { Inventory.Entry entry2 = children[i]; if (entry2.IsDirectory) { this.FillCategories(entry2, item2); } else { num++; } } if (num > 0) { item2.SubText = "(" + num + ")"; } }
private void RefreshList() { IndentedComboBox.Item selectedItem = this.categoryComboBox.SelectedItem; if (selectedItem != null) { Inventory.Entry entry = (Inventory.Entry)selectedItem.Tag; this.inventoryList.Entries = entry.Children; } }
private void UpdateItem(IndentedComboBox.Item item, IndentedComboBox.Item selectedItem, ref int index) { foreach (IndentedComboBox.Item current in item.GetChildren()) { if (current == selectedItem) { index = this.comboBox.Items.Count; } this.comboBox.Items.Add(current); this.UpdateItem(current, selectedItem, ref index); } }
private void RefreshList() { IndentedComboBox.Item selectedItem = this.categoryComboBox.SelectedItem; if (selectedItem != null) { Inventory.Entry entry = (Inventory.Entry)selectedItem.Tag; this.objectList.Entries = entry.Children; this.parentButton.Enabled = entry.Parent.IsValid; return; } this.parentButton.Enabled = false; }
public ParamObjectInventoryTree(ObjectInventory.Entry searchDirectory) { this.InitializeComponent(); this.label1.Text = Localizer.Localize(this.label1.Text); this.label2.Text = Localizer.Localize(this.label2.Text); this.label3.Text = Localizer.Localize(this.label3.Text); this.label4.Text = Localizer.Localize(this.label4.Text); this.FillCategories((ObjectInventory.Entry)ObjectInventory.Instance.Root, this.categoryComboBox.Root); this.m_SearchItem = new IndentedComboBox.Item(); this.m_SearchItem.Tag = searchDirectory; this.m_SearchItem.Image = searchDirectory.Icon; this.SearchCriteria = searchDirectory.DisplayName; this.categoryComboBox.Root.Add(this.m_SearchItem); this.categoryComboBox.UpdateItems(); }
public void UpdateItems() { this.comboBox.BeginUpdate(); IndentedComboBox.Item selectedItem = this.comboBox.SelectedItem as IndentedComboBox.Item; this.comboBox.Items.Clear(); int num = -1; this.UpdateItem(this.m_root, selectedItem, ref num); if (num == -1 && this.comboBox.Items.Count > 0) { num = 0; } this.comboBox.SelectedIndex = num; this.comboBox.EndUpdate(); this.comboBox.MaxDropDownItems = Math.Min(this.comboBox.Items.Count, 800 / this.comboBox.ItemHeight); }
public IndentedComboboxItemEventArgs(IndentedComboBox.Item item) { this.m_item = item; }
private void comboBox_DrawItem(object sender, DrawItemEventArgs e) { if (e.Index == -1) { return; } RectangleF rectangleF = e.Bounds; IndentedComboBox.Item item = this.comboBox.Items[e.Index] as IndentedComboBox.Item; SizeF sizeF = e.Graphics.MeasureString(item.Text, e.Font); SizeF sizeF2; if (!string.IsNullOrEmpty(item.SubText)) { sizeF2 = e.Graphics.MeasureString(item.SubText, this.m_subFont); } else { sizeF2 = default(SizeF); } bool flag = (e.State & DrawItemState.ComboBoxEdit) == DrawItemState.ComboBoxEdit; if (flag) { e.DrawBackground(); } else { int num = 4 + (item.Depth - 1) * 16; rectangleF.X += (float)num; rectangleF.Width -= (float)num; } if (item.Image != null) { e.Graphics.DrawImage(item.Image, new RectangleF(rectangleF.Location, new SizeF(16f, 16f))); rectangleF.X += 16f; } rectangleF.Width = sizeF.Width; if (!flag) { using (Brush brush = new SolidBrush(e.BackColor)) { e.Graphics.FillRectangle(brush, rectangleF); } } using (Brush brush2 = new SolidBrush(e.ForeColor)) { StringFormat stringFormat = new StringFormat(); stringFormat.LineAlignment = StringAlignment.Center; e.Graphics.DrawString(item.Text, e.Font, brush2, rectangleF, stringFormat); } if (!string.IsNullOrEmpty(item.SubText)) { rectangleF.X += rectangleF.Width; rectangleF.Width = sizeF2.Width; rectangleF.Y -= 1f; using (Brush brush3 = new SolidBrush(Color.DarkGray)) { StringFormat stringFormat2 = new StringFormat(); stringFormat2.LineAlignment = StringAlignment.Center; stringFormat2.Alignment = StringAlignment.Near; e.Graphics.DrawString(item.SubText, this.m_subFont, brush3, rectangleF, stringFormat2); } rectangleF.Y += 1f; } }
public void Add(IndentedComboBox.Item item) { this.m_childList.Add(item); item.Depth = this.Depth + 1; item.Owner = this.Owner; }