示例#1
0
 public SpaceReservationManager(string name, int rank, SkiaTextView view)
 {
     this.Name     = name;
     this.Rank     = rank;
     _view         = view;
     _view.Closed += this.OnViewClosed;
 }
示例#2
0
        public PopupAgent(SkiaTextView textView, ISpaceReservationManager manager, ITrackingSpan visualSpan, PopupStyles style, Widget content)
        {
            if (textView == null)
            {
                throw new ArgumentNullException("textView");
            }
            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }
            if (visualSpan == null)
            {
                throw new ArgumentNullException("visualSpan");
            }
            if (((int)style & ~(0xff)) != 0)        //Union of all the legal style bits.
            {
                throw new ArgumentOutOfRangeException("style");
            }
            if (content == null)
            {
                throw new ArgumentNullException("content");
            }
            if ((style & PopupStyles.DismissOnMouseLeaveText) != 0 && (style & PopupStyles.DismissOnMouseLeaveTextOrContent) != 0)
            {
                throw new ArgumentException("Can't specify both PopupStyles.DismissOnMouseLeaveText and PopupStyles.DismissOnMouseLeaveTextOrContent", "style");
            }

            _textView   = textView;
            _manager    = manager;
            _visualSpan = visualSpan;
            _style      = style;

            var popupCache = textView.Properties.GetOrCreateSingletonProperty <Dictionary <WeakReferenceForDictionaryKey, PopupOrWindowContainer> >(
                () => new Dictionary <WeakReferenceForDictionaryKey, PopupOrWindowContainer>(MaxPopupCacheSize));

            if (!popupCache.TryGetValue(new WeakReferenceForDictionaryKey(content), out _popup))
            {
                // _popup = PopupOrWindowContainer.Create(content, _textView.VisualElement);

                if (popupCache.Count == MaxPopupCacheSize)
                {
                    popupCache.Clear();
                }
                popupCache.Add(new WeakReferenceForDictionaryKey(content), _popup);
            }
        }
示例#3
0
 public SpaceReservationStack(Dictionary <string, int> orderedManagerDefinitions, SkiaTextView view)
 {
     _orderedManagerDefinitions = orderedManagerDefinitions;
     _view = view;
 }