コード例 #1
0
        public LocateObjectData LocateObject(object obj, ObjectStyle style, int locateOptions)
        {
            LocateObjectData result = default(LocateObjectData);

            if (style == ObjectStyle.TrackingObject)
            {
                RowCol rowCol = (RowCol)obj;
                result.Row     = rowCol.Row;
                result.Column  = rowCol.Col;
                result.Options = 1;
            }
            else
            {
                if (style == ObjectStyle.ExpandedBranch)
                {
                    OperationParameterTree parameterTreeAdapter  = (OperationParameterTree)obj;
                    OperationParameterTree parameterTreeAdapter2 = parameterTreeAdapter.m_Parent;
                    result.Row = -1;
                    for (int i = 0; i < parameterTreeAdapter2.m_Children.Length; i++)
                    {
                        if (parameterTreeAdapter2.m_Children[i] == parameterTreeAdapter)
                        {
                            result.Row = i;
                        }
                    }

                    result.Column  = 0;
                    result.Options = result.Row == m_RelativeRow ? 0 : 1;
                }
            }
            return(result);
        }
コード例 #2
0
ファイル: SimpleListShifter.cs プロジェクト: ozialien/NORMA
                    public LocateObjectData LocateObject(object obj, ObjectStyle style, int locateOptions)
                    {
                        LocateObjectData data = myBaseBranch.LocateObject(obj, style, locateOptions);

                        if (data.Row != VirtualTreeConstant.NullIndex)
                        {
                            data.Row -= myFirstItem;
                        }
                        return(data);
                    }
コード例 #3
0
        /// <summary>
        ///     Each node in the tree can have an associated tracking object used to identify it.
        ///     The branch can override this method to return the row index corresponding to the given
        ///     object.
        /// </summary>
        /// <param name="locateData">
        ///     If the object is a direct child of this branch, set locateData.Options = TrackingObjectAction.ThisLevel.
        ///     If the object is deeper in the tree, the branch should set it to TrackingObjectAction.NextLevel,
        ///     locateData.Row should be set to the row where the search should continue.
        /// </param>
        /// <param name="tracked">Object to track</param>
        protected virtual LocateObjectData LocateTrackingObject(object tracked, LocateObjectData locateData)
        {
            // base implementation handles searching in this branch, but searching
            // deeper in the tree requires knowledge not available
            // in the base class.
            locateData.Row = -1;

            locateData.Row = GetIndexForElement(tracked);

            locateData.Options = locateData.Row >= 0 ? (int)TrackingObjectAction.ThisLevel : (int)TrackingObjectAction.NotTracked;

            return(locateData);
        }
コード例 #4
0
        LocateObjectData IBranch.LocateObject(object obj, ObjectStyle style, int locateOptions)
        {
            var locateData = new LocateObjectData();

            locateData.Row = -1;
            foreach (IBranch branch in _branchList)
            {
                locateData = branch.LocateObject(obj, style, locateOptions);
                if (locateData.Row != -1)
                {
                    return(locateData);
                }
            }

            return(locateData);
        }
コード例 #5
0
        /// <summary>
        ///     IBranch interface implementation.
        /// </summary>
        public LocateObjectData /* IBranch */ LocateObject(object obj, ObjectStyle style, int locateOptions)
        {
            var locateData = new LocateObjectData(-1, 0, 0);

            switch (style)
            {
            case ObjectStyle.ExpandedBranch:
            case ObjectStyle.SubItemExpansion:
                locateData.Options = (int)BranchLocationAction.DiscardBranch;
                break;

            case ObjectStyle.TrackingObject:
                locateData = LocateTrackingObject(obj, locateData);
                break;
            }
            return(locateData);
        }
コード例 #6
0
 /// <summary>
 ///     Compare two LocateObjectData structures
 /// </summary>
 /// <param name="operand1">Left operand</param>
 /// <param name="operand2">Right operand</param>
 /// <returns>true if operands are equal</returns>
 public static bool Compare(LocateObjectData operand1, LocateObjectData operand2)
 {
     return(operand1.myColumn == operand2.myColumn && operand1.myRow == operand2.myRow && operand1.myOptions == operand2.myOptions);
 }
コード例 #7
0
 /// <summary>
 ///     Compare two LocateObjectData structures
 /// </summary>
 /// <param name="operand1">Left operand</param>
 /// <param name="operand2">Right operand</param>
 /// <returns>true if operands are equal</returns>
 public static bool Compare(LocateObjectData operand1, LocateObjectData operand2)
 {
     return operand1.myColumn == operand2.myColumn && operand1.myRow == operand2.myRow && operand1.myOptions == operand2.myOptions;
 }