public DynamicList(CollectionWithEvents<DynamicListColumn> columns, CollectionWithEvents<DynamicListRow> rows) { inUpdate = true; if (columns == null) throw new ArgumentNullException("columns"); if (rows == null) throw new ArgumentNullException("rows"); this.columns = columns; this.rows = rows; // we have to register our events on the existing items foreach (DynamicListColumn column in columns) { OnColumnAdded(null, new CollectionItemEventArgs<DynamicListColumn>(column)); } foreach (DynamicListRow row in rows) { OnRowAdded(null, new CollectionItemEventArgs<DynamicListRow>(row)); } columns.Added += OnColumnAdded; columns.Removed += OnColumnRemoved; rows.Added += OnRowAdded; rows.Removed += OnRowRemoved; this.BackColor = DefaultBackColor; this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.Selectable, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); inUpdate = false; RecalculateColumnWidths(); }
public DynamicList(CollectionWithEvents<DynamicListColumn> columns, CollectionWithEvents<DynamicListRow> rows) { this.oldVisible = false; this.allowedControls = new List<Control>(); this.removedControls = new List<Control>(); this.scrollOffset = 0; this.lineMarginY = 0; this.inUpdate = true; if (columns == null) { throw new ArgumentNullException("columns"); } if (rows == null) { throw new ArgumentNullException("rows"); } this.columns = columns; this.rows = rows; foreach (DynamicListColumn column in columns) { this.OnColumnAdded(null, new CollectionItemEventArgs<DynamicListColumn>(column)); } foreach (DynamicListRow row in rows) { this.OnRowAdded(null, new CollectionItemEventArgs<DynamicListRow>(row)); } columns.Added += new EventHandler<CollectionItemEventArgs<DynamicListColumn>>(this.OnColumnAdded); columns.Removed += new EventHandler<CollectionItemEventArgs<DynamicListColumn>>(this.OnColumnRemoved); rows.Added += new EventHandler<CollectionItemEventArgs<DynamicListRow>>(this.OnRowAdded); rows.Removed += new EventHandler<CollectionItemEventArgs<DynamicListRow>>(this.OnRowRemoved); this.BackColor = DefaultBackColor; base.SetStyle(ControlStyles.UserPaint, true); base.SetStyle(ControlStyles.Selectable, true); base.SetStyle(ControlStyles.AllPaintingInWmPaint, true); base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.inUpdate = false; this.RecalculateColumnWidths(); }
/// <summary> /// Sets the codeWindowHost up for a new blank snippet file and then /// checks if any data is being exported from another codeWindowHost /// </summary> private void InitializeNewSnippet() { // until someone change the file, we can consider it not dirty as // the user would be annoyed if we prompt him to save an empty file isDirty = false; isFileNew = true; //load from the export object LoadDataFromExport(); object captionValue; //get caption and make it title without its extension EditorFrame.GetProperty((int) __VSFPROPID.VSFPROPID_OwnerCaption, out captionValue); ActiveSnippet.Title = SnippetTitle = Path.GetFileNameWithoutExtension(captionValue.ToString()); //add titles to snippet titles property var titles = new CollectionWithEvents<string>(); titles.Add(SnippetTitle); SnippetTitles = titles; SnippetAuthor = SnippetDesignerPackage.VSRegisteredName; //make sure title is in snippets data memory PushFieldsIntoActiveSnippet(); }
/// <summary> /// Creates a container control with its own children list. /// Methods ContainerControl.Add and ContainerControl.Remove /// can be used to add or remove child controls. /// </summary> public ContainerControl() : base() { ChildrenCollection = new CollectionWithEvents <Control>(); Children = ChildrenCollection; }
private static void AddToCollection(IContent content, CollectionWithEvents <IContent> coll) { coll.Add(content); }
/// <summary> /// Creates a container control with its own children list. /// Methods ContainerControl.Add and ContainerControl.Remove /// can be used to add or remove child controls. /// </summary> public ContainerControl() : base() { ChildrenCollection = new CollectionWithEvents<Control>(); Children = ChildrenCollection; }