/// <summary> /// Adds a <see cref='OpenLiveWriter.Controls.LightweightControl'/> with the specified value to the /// <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> . /// </summary> /// <param name='value'>The <see cref='OpenLiveWriter.Controls.LightweightControl'/> to add.</param> /// <returns>The index at which the new element was inserted.</returns> /// <seealso cref='OpenLiveWriter.Controls.LightweightControlCollection.AddRange'/> public int Add(LightweightControl value) { // Add. int index = List.Add(value); // Set the lightweight control container of the lightweight control to the owner of // this lightweight control collection. value.LightweightControlContainerControl = owner; // Force the lightweight control to apply layout logic to child controls. value.PerformLayout(); // Force the owner of this lightweight control collection to apply layout logic to child controls. owner.PerformLayout(); // Return index. return index; }
/// <summary> /// Clears the lightweight control collection. /// </summary> public new void Clear() { // Make a working copy of the lightweight control list. LightweightControl[] lightweightControls = new LightweightControl[Count]; CopyTo(lightweightControls, 0); // Remove each lightweight control. foreach (LightweightControl lightweightControl in lightweightControls) { lightweightControl.LightweightControlContainerControl = null; lightweightControl.Dispose(); } // Force the owner to apply layout logic to child controls. owner.PerformLayout(); }
private bool IsControlVisible(LightweightControl control) { bool visible = _control.Visible; //Control ILightweightControlContainerControl parent = control.LightweightControlContainerControl; while (visible && parent != null) { if (parent is LightweightControl) { LightweightControl lwcParent = (LightweightControl)parent; visible = lwcParent.Visible; parent = lwcParent.LightweightControlContainerControl; } else if (parent is Control) { visible = ((Control)parent).Visible; parent = null; } } return visible; }
public virtual bool VisitLightweightControl(LightweightControl control) { return false; }
/// <summary> /// <para>Copies the elements of an array to the end of the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/>.</para> /// </summary> /// <param name='value'>An array of type <see cref='OpenLiveWriter.Controls.LightweightControl'/> containing the objects to add to the collection.</param> /// <seealso cref='OpenLiveWriter.Controls.LightweightControlCollection.Add'/> public void AddRange(LightweightControl[] value) { for (int i = 0; i < value.Length; i++) this.Add(value[i]); }
/// <summary> /// Initializes a new instance of <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> containing any array of <see cref='OpenLiveWriter.Controls.LightweightControl'/> objects. /// </summary> /// <param name='value'> /// A array of <see cref='OpenLiveWriter.Controls.LightweightControl'/> objects with which to intialize the collection /// </param> public LightweightControlCollection(LightweightControl[] value) { AddRange(value); }
/// <summary> /// Removes a specific <see cref='OpenLiveWriter.Controls.LightweightControl'/> from the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> . /// </summary> /// <param name='value'>The <see cref='OpenLiveWriter.Controls.LightweightControl'/> to remove from the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> .</param> /// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception> public void Remove(LightweightControl value) { // Remove the lightweight control. List.Remove(value); // Set the lightweight control container of the lightweight control. value.LightweightControlContainerControl = null; // Force the owner of this lightweight control collection to apply layout logic to child controls. owner.PerformLayout(); }
/// <summary> /// Returns the index of a <see cref='OpenLiveWriter.Controls.LightweightControl'/> in the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/>. /// </summary> /// <param name='value'>The <see cref='OpenLiveWriter.Controls.LightweightControl'/> to locate.</param> /// <returns>The index of the <see cref='OpenLiveWriter.Controls.LightweightControl'/> of <paramref name='value'/> in the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/>, if found; otherwise, -1.</returns> /// <seealso cref='OpenLiveWriter.Controls.LightweightControlCollection.Contains'/> public int IndexOf(LightweightControl value) { return List.IndexOf(value); }
/// <summary> /// Update the drag-and-drop lightweight control. Detects whether the drag-and-drop /// lightweight control has changed, and raises the appropriate events, if it has. /// </summary> /// <param name="e">A MouseEventArgs containing the event data.</param> private void UpdateDragDropLightweightControl(DragEventArgs e) { // Find the drag-and-drop lightweight control at the mouse position. LightweightControl lightweightControl = GetDragDropLightweightControlAtClientPoint(PointToClient(new Point(e.X, e.Y))); // If the drag-and-drop lightweight control is changing, make the change. if (lightweightControl != dragDropLightweightControl) { // If we have a drag-and-drop lightweight control, raise its OnDragLeave event. // Otherwise, call the base class's method to raise the OnDragLeave event on // this control. if (dragDropLightweightControl != null) dragDropLightweightControl.RaiseDragOutside(EventArgs.Empty); else OnDragOutside(EventArgs.Empty); // Set the drag-and-drop lightweight control. dragDropLightweightControl = lightweightControl; e.Effect = DragDropEffects.None; // If we have a drag-and-drop lightweight control, raise its DragEnter event. // Otherwise, call the base class's method to raise the DragEnter event on this // control. if (dragDropLightweightControl != null) dragDropLightweightControl.RaiseDragInside(e); else OnDragInside(e); } }
public void AddFocusableControl(LightweightControl control) { _focusAndAccessibilityController.AddControl(control); }
public void AddFocusableControls(LightweightControl[] controls) { foreach (LightweightControl control in controls) { AddFocusableControl(control); } }
internal void NotifyControlFocused(LightweightControl control) { if (_focusAndAccessibilityController != null) _focusAndAccessibilityController.NotifyFocusedControlChanged(); }
/// <summary> /// Initializes a new instance of the ObjectStoreEventArgs class. /// </summary> /// <param name="lightweightControl">The LightweightControl.</param> public LightweightControlEventArgs(LightweightControl lightweightControl) { this.lightweightControl = lightweightControl; }
public override bool VisitLightweightControl(LightweightControl control) { return control.Focused; }
public override bool VisitLightweightControl(LightweightControl control) { if (!control.Visible || !control.TabStop) return false; if (control.Parent != null) { if (!control.Parent.Focused) control.Parent.Focus(); if (control.Parent is LightweightControlContainerControl) (control.Parent as LightweightControlContainerControl).ActiveControl = null; } bool focused = control.Focus(); return focused; }
/// <summary> /// Gets a value indicating whether the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> contains the specified <see cref='OpenLiveWriter.Controls.LightweightControl'/>. /// </summary> /// <param name='value'>The <see cref='OpenLiveWriter.Controls.LightweightControl'/> to locate.</param> /// <returns><see langword='true'/> if the <see cref='OpenLiveWriter.Controls.LightweightControl'/> is contained in the collection; otherwise, <see langword='false'/>.</returns> /// <seealso cref='OpenLiveWriter.Controls.LightweightControlCollection.IndexOf'/> public bool Contains(LightweightControl value) { return List.Contains(value); }
/// <summary> /// Copies the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the specified index. /// </summary> /// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> .</para></param> /// <param name='index'>The index in <paramref name='array'/> where copying begins.</param> /// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> is greater than the available space between <paramref name='arrayIndex'/> and the end of <paramref name='array'/>.</para></exception> /// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception> /// <exception cref='System.ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception> /// <seealso cref='System.Array'/> public void CopyTo(LightweightControl[] array, int index) { List.CopyTo(array, index); }
/// <summary> /// Translates the specified MouseEventArgs for the specified lightweight control. /// </summary> /// <param name="e">MouseEventArgs to translate.</param> /// <returns>Translated MouseEventArgs.</returns> private MouseEventArgs TranslateMouseEventArgsForLightweightControl(MouseEventArgs e, LightweightControl lightweightControl) { // Map the client point to a virtual point. Point virtualPoint = lightweightControl.PointToVirtualClient(new Point(e.X, e.Y)); // Return a new MouseEventArgs with the translated point. return new MouseEventArgs(e.Button, e.Clicks, virtualPoint.X, virtualPoint.Y, e.Delta); }
/// <summary> /// Inserts a <see cref='OpenLiveWriter.Controls.LightweightControl'/> into the <see cref='OpenLiveWriter.Controls.LightweightControlCollection'/> at the specified index. /// </summary> /// <param name='index'>The zero-based index where <paramref name='value'/> should be inserted.</param> /// <param name=' value'>The <see cref='OpenLiveWriter.Controls.LightweightControl'/> to insert.</param> /// <seealso cref='OpenLiveWriter.Controls.LightweightControlCollection.Add'/> public void Insert(int index, LightweightControl value) { // Insert. List.Insert(index, value); // Set the lightweight control container of the lightweight control to the owner of // this lightweight control collection. value.LightweightControlContainerControl = owner; // Force the lightweight control to apply layout logic to child controls. value.PerformLayout(); // Force the owner of this lightweight control collection to apply layout logic to child controls. owner.PerformLayout(); }
/// <summary> /// Raises the DragDrop event. /// </summary> /// <param name="e">A DragEventArgs that contains the event data.</param> protected override void OnDragDrop(DragEventArgs e) { // Stop drag-and-drop auto-scroll. StopDragDropAutoScroll(); // If we have a drag-and-drop lightweight control, raise its DragDrop event. // Otherwise, call the base class's method to raise the DragDrop event on this // control. if (dragDropLightweightControl != null) { // Raise the DragDrop event on the drag-and-drop lightweight control. dragDropLightweightControl.RaiseDragDrop(e); // Clear the drag-and-drop lightweight control. dragDropLightweightControl = null; } else base.OnDragDrop(e); }
/// <summary> /// Brings the lightweight control to the front of the z-order. /// </summary> /// <param name="value"></param> public void BringToFront(LightweightControl value) { // Remove the lightweight control from the list. List.Remove(value); // Add the lightweight control back to the list, now as the front control in the z-order. List.Add(value); // Force the owner of this lightweight control collection to apply layout logic to child controls. owner.PerformLayout(); }
/// <summary> /// Raises the DragEnter event. /// </summary> /// <param name="e">A DragEventArgs that contains the event data.</param> protected override void OnDragEnter(DragEventArgs e) { // Call the base class's method so that registered delegates receive the event. base.OnDragEnter(e); // Find the drag-and-drop lightweight control at the mouse position. LightweightControl lightweightControl = GetDragDropLightweightControlAtClientPoint(PointToClient(new Point(e.X, e.Y))); // If there is a drag-and-drop lightweight control at the mouse position, the event // is for it. Otherwise, it's for this control. if (lightweightControl != null) { // Set the drag-and-drop lightweight control and raise its DragEnter event. dragDropLightweightControl = lightweightControl; e.Effect = DragDropEffects.None; dragDropLightweightControl.RaiseDragInside(e); } }
/// <summary> /// Raises the DragLeave event. /// </summary> /// <param name="e">A DragEventArgs that contains the event data.</param> protected override void OnDragLeave(EventArgs e) { // Stop drag-and-drop auto-scroll. StopDragDropAutoScroll(); base.OnDragLeave(e); // If we have a drag-and-drop lightweight control, raise its DragLeave event, and // then clear it. Otherwise, call the base class's method to raise the DragLeave // event on this control. if (dragDropLightweightControl != null) { dragDropLightweightControl.RaiseDragOutside(e); dragDropLightweightControl = null; } else base.OnDragLeave(e); // Raise the DragOutside event. OnDragOutside(EventArgs.Empty); }
public LightweightControlAccessibleObject(LightweightControl control) { _control = control; }
/// <summary> /// Clears the workspace column pane. /// </summary> private void Clear() { // If there's a control or a lightweight control, remove it. if (control != null) { control.Parent = null; control.Dispose(); control = null; } else if (lightweightControl != null) { lightweightControl.LightweightControlContainerControl = null; lightweightControl.Dispose(); lightweightControl = null; } // Poof! We're invisible. Visible = false; }
/// <summary> /// Add a control to the list of accessible controls. /// </summary> /// <param name="control"></param> public void AddControl(LightweightControl control) { Debug.Assert(!_controls.Contains(control)); _controls.Add(control); }