/// <summary> /// Handler called every time a state is unassigned in the controller. /// </summary> /// <param name="operation">Details of the operation performed.</param> private protected override void OnStateUnassigned(WriteableAssignmentOperation operation) { base.OnStateUnassigned(operation); IFocusOptionalNodeState State = ((FocusAssignmentOperation)operation).State; Debug.Assert(State != null); Debug.Assert(StateViewTable.ContainsKey(State)); }
/// <summary> /// Get the location in the source code corresponding to this focus. /// </summary> /// <param name="node">The node in the source code upon return.</param> /// <param name="frame">The frame in the template associated to <paramref name="node"/> that indicates where in the node is the focus upon return.</param> public virtual void GetLocationInSourceCode(out Node node, out IFocusFrame frame) { node = null; frame = null; // We might be reading the focus of a node that has just been unassigned, so don't assert that IsAssigned == true. IFocusOptionalNodeState AsOptionalNodeState = CellView.StateView.State as IFocusOptionalNodeState; if (AsOptionalNodeState == null || AsOptionalNodeState.ParentInner.IsAssigned) { node = CellView.StateView.State.Node; frame = CellView.Frame; } }
/// <summary> /// Updates the focus chain with cells in the tree. /// </summary> /// <param name="focusChain">The list of focusable cell views found in the tree.</param> /// <param name="focusedNode">The currently focused node.</param> /// <param name="focusedFrame">The currently focused frame in the template associated to <paramref name="focusedNode"/>.</param> /// <param name="matchingFocus">The focus in <paramref name="focusChain"/> that match <paramref name="focusedNode"/> and <paramref name="focusedFrame"/> upon return.</param> public virtual void UpdateFocusChain(IFocusFocusList focusChain, INode focusedNode, IFocusFrame focusedFrame, ref IFocusFocus matchingFocus) { IFocusDiscreteContentFocus NewFocus = CreateFocus(); focusChain.Add(NewFocus); if (focusedFrame == Frame) { IFocusOptionalNodeState AsOptionalNodeState = StateView.State as IFocusOptionalNodeState; Debug.Assert(AsOptionalNodeState == null || AsOptionalNodeState.ParentInner.IsAssigned); if (focusedNode == StateView.State.Node) { Debug.Assert(matchingFocus == null); matchingFocus = NewFocus; } } }
/// <summary> /// Initializes a new instance of the <see cref="FocusOptionalNodeStateView"/> class. /// </summary> /// <param name="controllerView">The controller view to which this object belongs.</param> /// <param name="state">The optional node state.</param> public FocusOptionalNodeStateView(FocusControllerView controllerView, IFocusOptionalNodeState state) : base(controllerView, state) { }