///<summary> /// Determines if the block or any of its children has focus. ///</summary> /// <remarks> /// Reverse iteration: from deepest block (Focus) ---> root /// on the way to the root iterator is being compared with "this" /// </remarks> ///<returns> /// true if the subtree starting with this block has focus ///</returns> public bool IsFocusInsideControl(Control toCheck) { Control Current = FocusControl; while (Current != null) { if (Current == toCheck) return true; Current = Current.Parent; } return false; }
public bool SetFocus(Control newFocus) { bool result = false; //using (RedrawAccumulator r = new RedrawAccumulator(this, false)) { result = SetFocusButDontScroll(newFocus); if (result) { ScrollTo(mFocusControl); //r.ShouldRedrawAtTheEnd = true; } } return result; }
protected override void OnCollapseChanged(Control itemChanged) { this.DisplayContextHelp(); }
protected override void OnDeactivated(Control control) { base.OnDeactivated(control); RecacheCompletion(); }
void TreeViewNodeControl_CollapseChanged(Control itemChanged) { this.CollapseButton.Toggle(); }
protected override void OnDeactivated(Control control) { base.OnDeactivated(control); if (Completion.HostBlock == this) { Completion.HideCompletionList(); } }
private void UnsubscribeItem(Control childControl) { childControl.SizeChanged -= Child_SizeChanged; }
private void Children_ElementReplaced(Control oldControl, Control newControl) { UnsubscribeItem(oldControl); SubscribeItem(newControl); OnSizeChanged(); }
private void Children_ElementRemoved(Control childControl) { UnsubscribeItem(childControl); OnSizeChanged(); }
private void Children_ElementAdded(Control childControl) { SubscribeItem(childControl); OnSizeChanged(); }
/// <summary> /// Removes an existing control from this CompositeControl. /// </summary> /// <remarks> /// CompositeControl isn't resized if SuspendLayout == true. /// </remarks> /// <param name="newShape">Control to add to this collection.</param> public void Remove(Control controlToRemove) { if (ChildrenCollection != null) { ChildrenCollection.Remove(controlToRemove); controlToRemove.Root = null; controlToRemove.Parent = null; } }
public void Prepend(Control newControl) { if (ChildrenCollection != null) { ChildrenCollection.Prepend(newControl); newControl.Parent = this; newControl.Root = this.Root; } }
public void ScrollTo(Control TopLeft) { RaiseScrollTo(TopLeft.Bounds); }
protected void RaiseControlDeactivated(Control control) { if (ControlDeactivated != null) { ControlDeactivated(control); } }
private bool SetFocusButDontScroll(Control newFocus) { if (newFocus == null || !newFocus.CanGetFocus || newFocus == mFocusControl ) { return false; } if (mFocusControl != null) { mFocusControl.OnDeactivate(); } mFocusControl = newFocus; mFocusControl.OnActivate(); DefaultKeyHandler = mFocusControl; return true; }