public SledTreeListViewEditor( string name, string image, string[] columns, TreeListView.Style style, StandardControlGroup controlGroup) : base(style) { TreeListView.Name = name; foreach (var column in columns) { TreeListView.Columns.Add(new TreeListView.Column(column)); } { var theImage = (!string.IsNullOrEmpty(image) && ResourceUtil.GetImageList16().Images.ContainsKey(image)) ? ResourceUtil.GetImageList16().Images[image] : null; m_controlInfo = new ControlInfo( TreeListView.Name, TreeListView.Name, controlGroup, theImage); } }
/// <summary> /// Constructor</summary> /// <param name="style">TreeListView style</param> protected TreeListViewEditor(TreeListView.Style style) { m_treeListView = new TreeListView(style); m_treeListView.Control.KeyDown += ControlKeyDown; m_treeListView.Control.KeyPress += ControlKeyPress; m_treeListView.Control.KeyUp += ControlKeyUp; m_treeListView.Control.MouseClick += ControlMouseClick; m_treeListView.Control.MouseDoubleClick += ControlMouseDoubleClick; m_treeListView.Control.MouseDown += ControlMouseDown; m_treeListView.Control.MouseUp += ControlMouseUp; m_treeListView.DragOver += TreeListViewDragOver; m_treeListView.DragDrop += TreeListViewDragDrop; m_treeListView.NodeDrag += TreeListViewNodeDrag; m_treeListViewAdapter = new TreeListViewAdapter(m_treeListView); }
/// <summary> /// Constructor that configures TreeListView. Creates and registers control it populates with desired buttons /// that have the handler method BtnClick().</summary> /// <param name="name">Name of editor</param> /// <param name="style">TreeListView style</param> /// <param name="flags">Flags indicating which buttons appear for this editor</param> /// <param name="contextRegistry">Context registry</param> /// <param name="settingsService">Settings service</param> /// <param name="controlHostService">Control host service</param> public CommonEditor( string name, TreeListView.Style style, Buttons flags, IContextRegistry contextRegistry, ISettingsService settingsService, IControlHostService controlHostService) : base(style) { m_contextRegistry = contextRegistry; TreeListView.Name = name; TreeListView.NodeExpandedChanged += TreeListViewNodeExpandedChanged; { var owner = string.Format( "{0}-{1}-TreeListView", this, TreeListView.Name); settingsService.RegisterSettings( owner, new BoundPropertyDescriptor( TreeListView, () => TreeListView.PersistedSettings, SettingsDisplayName, SettingsCategory, SettingsDescription)); } { // // Create custom control to contain any // data creation buttons + TreeListView // m_uberControl = new UserControl { Dock = DockStyle.Fill }; int x = 2, y = 2; var buttonHeight = -1; if ((flags & Buttons.AddFlat) == Buttons.AddFlat) { var btn = CreateButton(AddFlatText, ref x, ref y, ref buttonHeight); btn.Tag = Buttons.AddFlat; btn.Click += BtnClick; m_uberControl.Controls.Add(btn); } if ((flags & Buttons.AddHierarchical) == Buttons.AddHierarchical) { var btn = CreateButton(AddHierarchicalText, ref x, ref y, ref buttonHeight); btn.Tag = Buttons.AddHierarchical; btn.Click += BtnClick; m_uberControl.Controls.Add(btn); } if ((flags & Buttons.AddVirtual) == Buttons.AddVirtual) { var btn = CreateButton(AddVirtualText, ref x, ref y, ref buttonHeight); btn.Tag = Buttons.AddVirtual; btn.Click += BtnClick; m_uberControl.Controls.Add(btn); } if ((flags & Buttons.Reload) == Buttons.Reload) { var btn = CreateButton(ReloadText, ref x, ref y, ref buttonHeight); btn.Tag = Buttons.Reload; btn.Click += BtnClick; m_uberControl.Controls.Add(btn); } if ((flags & Buttons.ExpandAll) == Buttons.ExpandAll) { var btn = CreateButton(ExpandAllText, ref x, ref y, ref buttonHeight); btn.Tag = Buttons.ExpandAll; btn.Click += BtnClick; m_uberControl.Controls.Add(btn); } if ((flags & Buttons.CollapseAll) == Buttons.CollapseAll) { var btn = CreateButton(CollapseAllText, ref x, ref y, ref buttonHeight); btn.Tag = Buttons.CollapseAll; btn.Click += BtnClick; m_uberControl.Controls.Add(btn); } if ((flags & Buttons.RemoveItem) == Buttons.RemoveItem) { var btn = CreateButton(RemoveItemText, ref x, ref y, ref buttonHeight); btn.Tag = Buttons.RemoveItem; btn.Click += BtnClick; m_uberControl.Controls.Add(btn); } if ((flags & Buttons.ModifySelected) == Buttons.ModifySelected) { var btn = CreateButton(ModifySelectedText, ref x, ref y, ref buttonHeight); btn.Tag = Buttons.ModifySelected; btn.Click += BtnClick; m_uberControl.Controls.Add(btn); } if ((flags & Buttons.SelectAll) == Buttons.SelectAll) { var btn = CreateButton(SelectAllText, ref x, ref y, ref buttonHeight); btn.Tag = Buttons.SelectAll; btn.Click += BtnClick; m_uberControl.Controls.Add(btn); } if ((flags & Buttons.RecursiveCheckBoxes) == Buttons.RecursiveCheckBoxes) { var btn = CreateButton(RecursiveCheckBoxesOffText, ref x, ref y, ref buttonHeight); btn.Tag = Buttons.RecursiveCheckBoxes; btn.Click += BtnClick; m_uberControl.Controls.Add(btn); } { TreeListView.Control.Location = new Point(0, buttonHeight + 2); TreeListView.Control.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom; TreeListView.Control.Width = m_uberControl.Width; TreeListView.Control.Height = m_uberControl.Height - buttonHeight - 2; m_uberControl.Controls.Add(TreeListView); } var info = new ControlInfo( TreeListView.Name, TreeListView.Name + " - TreeListView", StandardControlGroup.CenterPermanent); controlHostService.RegisterControl( m_uberControl, info, this); } }