/// <summary>
 /// Initializes the feature overloads and bodies.
 /// </summary>
 /// <param name="context">The initialization context.</param>
 public override void InitOverloadsAndBodies(ICSharpContext context)
 {
     foreach (ICommandOverload Overload in Source.OverloadList)
     {
         ICSharpCommandOverload NewOverload = CSharpCommandOverload.Create(context, Overload, this, Owner);
         OverloadList.Add(NewOverload);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the CallTipClickEventArgs class.
 /// </summary>
 /// <param name="callTipArrow"></param>
 /// <param name="currentIndex"></param>
 /// <param name="newIndex"></param>
 /// <param name="overloadList"></param>
 /// <param name="highlightStart"></param>
 /// <param name="highlightEnd"></param>
 public CallTipClickEventArgs(CallTipArrow callTipArrow, int currentIndex, int newIndex, OverloadList overloadList, int highlightStart, int highlightEnd)
 {
     _callTipArrow = callTipArrow;
     _currentIndex = currentIndex;
     _newIndex = newIndex;
     _overloadList = overloadList;
     _highlightStart = highlightStart;
     _highlightEnd = highlightEnd;
 }
Beispiel #3
0
        /// <summary>
        /// Adds an overload to this command. An executable command needs to have at least one overload.
        /// </summary>
        /// <param name="overload">Overload to add to this command.</param>
        /// <returns>This builder.</returns>
        public CommandBuilder WithOverload(CommandOverloadBuilder overload)
        {
            if (OverloadArgumentSets.Contains(overload.ArgumentSet))
            {
                throw new DuplicateOverloadException(Name, overload.Arguments.Select(x => x.Type).ToList(), overload.ArgumentSet);
            }

            OverloadArgumentSets.Add(overload.ArgumentSet);
            OverloadList.Add(overload);

            return(this);
        }
Beispiel #4
0
        // TODO: Add a constructor that accepts Delegate[].

        /// <summary>
        /// Creates a new LuaOverloadMethod with the given choices.
        /// </summary>
        /// <param name="E">The current environment.</param>
        /// <param name="name">The name of the method, used for errors.</param>
        /// <param name="methods">The method choices, cannot be null.</param>
        /// <param name="targets">The targets for the methods, cannot be null.</param>
        /// <exception cref="System.ArgumentNullException">If methods or targets is null.</exception>
        /// <exception cref="System.ArgumentException">If the length of methods
        /// is not equal to that of targets.</exception>
        public LuaOverloadFunction(string name, IEnumerable <MethodInfo> methods,
                                   IEnumerable <object> targets)
            : base(name)
        {
            _methods = new OverloadList <Tuple <MethodInfo, object> >();
            _methods.AddRange(methods.Zip(targets, (a, b) => Tuple.Create(a, b)), m => {
                var temp = m.Item1.GetCustomAttribute <OverloadAttribute>(false);
                if (temp != null)
                {
                    return(temp.Index);
                }
                else
                {
                    return(null);
                }
            });
        }
Beispiel #5
0
 /// <summary>
 ///     Shows the calltip with overloads
 /// </summary>
 /// <param name="overloadList">List of overloads to be displayed see <see cref="OverLoadList"/></param>
 /// <param name="startIndex">The index of the initial overload to display</param>
 /// <param name="highlightStart">Start posision of the part of the message that should be selected</param>
 /// <param name="highlightEnd">End posision of the part of the message that should be selected</param>
 /// <remarks>
 ///     ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the
 ///     up and down arrows and cycles through the list of overloads in response to mouse clicks.
 ///     The current document position will be used
 /// </remarks>
 public void ShowOverload(OverloadList overloadList, uint startIndex, int highlightStart, int highlightEnd)
 {
     ShowOverload(overloadList, -1, startIndex, highlightStart, highlightEnd);
 }
Beispiel #6
0
 /// <summary>
 ///     Shows the calltip with overloads
 /// </summary>
 /// <param name="overloadList">List of overloads to be displayed see <see cref="OverLoadList"/></param>
 /// <param name="startIndex">The index of the initial overload to display</param>
 /// <remarks>
 ///     ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the
 ///     up and down arrows and cycles through the list of overloads in response to mouse clicks.
 ///     The current document position will be used with no highlight
 /// </remarks>
 public void ShowOverload(OverloadList overloadList, uint startIndex)
 {
     ShowOverload(overloadList, -1, startIndex, -1, -1);
 }
Beispiel #7
0
 /// <summary>
 ///     Shows the calltip with overloads
 /// </summary>
 /// <param name="overloadList">List of overloads to be displayed see <see cref="OverLoadList"/></param>
 /// <param name="position">The document position where the calltip should be displayed</param>
 /// <param name="startIndex">The index of the initial overload to display</param>
 /// <param name="highlightStart">Start posision of the part of the message that should be selected</param>
 /// <param name="highlightEnd">End posision of the part of the message that should be selected</param>
 /// <remarks>
 ///     ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the
 ///     up and down arrows and cycles through the list of overloads in response to mouse clicks.
 /// </remarks>
 public void ShowOverload(OverloadList overloadList, int position, uint startIndex, int highlightStart, int highlightEnd)
 {
     _lastPos = position;
     _overloadList = overloadList;
     unchecked
     {
         _overloadList.CurrentIndex = (int)startIndex;
     }
     _highlightEnd = highlightEnd;
     _highlightStart = highlightStart;
     ShowOverloadInternal();
 }
Beispiel #8
0
 /// <summary>
 ///     Shows the calltip with overloads
 /// </summary>
 /// <param name="overloadList">List of overloads to be displayed see <see cref="OverLoadList"/></param>
 /// <param name="position">The document position where the calltip should be displayed</param>
 /// <param name="highlightStart">Start posision of the part of the message that should be selected</param>
 /// <param name="highlightEnd">End posision of the part of the message that should be selected</param>
 /// <remarks>
 ///     ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the
 ///     up and down arrows and cycles through the list of overloads in response to mouse clicks.
 ///     The overload startIndex will be 0
 /// </remarks>
 public void ShowOverload(OverloadList overloadList, int position, int highlightStart, int highlightEnd)
 {
     ShowOverload(overloadList, position, 0, highlightStart, highlightEnd);
 }
Beispiel #9
0
 /// <summary>
 ///     Shows the calltip with overloads
 /// </summary>
 /// <param name="overloadList">List of overloads to be displayed see <see cref="OverLoadList"/></param>
 /// <param name="position">The document position where the calltip should be displayed</param>
 /// <remarks>
 ///     ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the
 ///     up and down arrows and cycles through the list of overloads in response to mouse clicks.
 ///     The overload startIndex will be 0 with no Highlight
 /// </remarks>
 public void ShowOverload(OverloadList overloadList, int position)
 {
     ShowOverload(overloadList, position, 0, -1, -1);
 }
Beispiel #10
0
 /// <summary>
 ///     Shows the calltip with overloads
 /// </summary>
 /// <param name="overloadList">List of overloads to be displayed see <see cref="OverLoadList"/></param>
 /// <param name="highlightStart">Start posision of the part of the message that should be selected</param>
 /// <param name="highlightEnd">End posision of the part of the message that should be selected</param>
 /// <remarks>
 ///     ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the
 ///     up and down arrows and cycles through the list of overloads in response to mouse clicks.
 ///     The current document position will be used starting at position 0
 /// </remarks>
 public void ShowOverload(OverloadList overloadList, int highlightStart, int highlightEnd)
 {
     ShowOverload(overloadList, -1, 0, highlightStart, highlightEnd);
 }
Beispiel #11
0
 /// <summary>
 ///     Shows the calltip with overloads
 /// </summary>
 /// <param name="overloadList">List of overloads to be displayed see <see cref="OverLoadList"/></param>
 /// <remarks>
 ///     ShowOverload automatically handles displaying a calltip with a list of overloads. It automatically shows the
 ///     up and down arrows and cycles through the list of overloads in response to mouse clicks.
 ///     The current document position will be used starting at position 0 with no highlight
 /// </remarks>
 public void ShowOverload(OverloadList overloadList)
 {
     ShowOverload(overloadList, -1, 0, -1, -1);
 }
Beispiel #12
0
        /// <summary>
        ///     Displays a calltip without overloads
        /// </summary>
        /// <param name="message">The calltip message to be displayed</param>
        /// <param name="position">The document position to show the calltip</param>
        /// <param name="highlightStart">Start posision of the part of the message that should be selected</param>
        /// <param name="highlightEnd">End posision of the part of the message that should be selected</param>
        public void Show(string message, int position, int highlightStart, int highlightEnd)
        {
            _lastPos = position;
            if (position < 0)
                position = NativeScintilla.GetCurrentPos();

            _overloadList = null;
            _message = message;
            NativeScintilla.CallTipShow(position, message);
            HighlightStart = highlightStart;
            HighlightEnd = highlightEnd;
        }