Example #1
0
        public ITextViewMargin GetTextViewMargin(string marginName)
        {
            if (string.Compare(marginName, _marginName, StringComparison.OrdinalIgnoreCase) == 0)
            {
                return(this);
            }
            else
            {
                foreach (var marginData in _currentMargins)
                {
                    ITextViewMargin result = marginData.Item2.GetTextViewMargin(marginName);
                    if (result != null)
                    {
                        return(result);
                    }
                }
            }

            return(null);
        }
        /// <summary>
        /// Creates a <see cref="ScrollbarMargin"/> for a given <see cref="IWpfTextView"/>.
        /// </summary>
        /// <param name="textView">The <see cref="IWpfTextView"/> to attach the margin to.</param>
        /// <param name="marginContainer">Margin container. Is defined in the <see cref="ScrollbarMarginFactory"/> by the <see cref="MarginContainerAttribute"/>.</param>
        /// <param name="marginCore">The class which receives, processes and provides necessary data for <see cref="ScrollbarMargin"/>.</param>
        public ScrollbarMargin(IWpfTextView textView, IWpfTextViewMargin marginContainer, MarginCore marginCore)
        {
            Debug.WriteLine("Entering constructor.", MarginName);

            _textView   = textView;
            _marginCore = marginCore;

            InitializeLayout();

            ITextViewMargin scrollBarMargin = marginContainer.GetTextViewMargin(PredefinedMarginNames.VerticalScrollBar);

            // ReSharper disable once SuspiciousTypeConversion.Global - scrollBarMargin is IVerticalScrollBar.
            _scrollBar = (IVerticalScrollBar)scrollBarMargin;

            marginCore.MarginRedraw += OnMarginCoreMarginRedraw;

            if (marginCore.IsActivated)
            {
                DrawMargins(marginCore.GetChangedLines());
            }
        }
        public IOverviewTipFactory GetOverviewTipFactory(IOverviewMargin overviewMargin, IWpfTextView view)
        {
            ITextViewMargin margin = overviewMargin as ITextViewMargin;

            return(margin != null ? (margin.GetTextViewMargin(StructureMargin.Name) as IOverviewTipFactory) : null);
        }
Example #4
0
        public IOverviewTipFactory GetOverviewTipFactory(IOverviewMargin overviewMargin, IWpfTextView view)
        {
            ITextViewMargin margin = overviewMargin as ITextViewMargin;

            return(margin != null ? (margin.GetTextViewMargin(PredefinedOverviewMarginNames.OverviewMark) as IOverviewTipFactory) : null);
        }