Пример #1
0
 public WindowDecorator(ITopLevelImpl tl)
 {
     _tl         = tl;
     _window     = tl as IWindowImpl;
     _popup      = tl as IPopupImpl;
     _tl.Input   = OnInput;
     _tl.Paint   = OnPaint;
     _tl.Resized = OnResized;
 }
Пример #2
0
 public WindowDecorator(ITopLevelImpl tl)
 {
     _tl = tl;
     _window = tl as IWindowImpl;
     _popup = tl as IPopupImpl;
     _tl.Input = OnInput;
     _tl.Paint = OnPaint;
     _tl.Resized = OnResized;
 }
Пример #3
0
    public static IPopupImpl Wrap(IPopupImpl impl)
    {
#if DEBUG
        if (impl is ValidatingToplevelImpl)
        {
            return(impl);
        }
        return(new ValidatingPopupImpl(impl));
#else
        return(impl);
#endif
    }
Пример #4
0
        private PopupRoot CreateTarget(TopLevel popupParent, IPopupImpl impl = null)
        {
            impl ??= popupParent.PlatformImpl.CreatePopup();

            var result = new PopupRoot(popupParent, impl)
            {
                Template = new FuncControlTemplate <PopupRoot>((parent, scope) =>
                                                               new ContentPresenter
                {
                    Name = "PART_ContentPresenter",
                    [!ContentPresenter.ContentProperty] = parent[!PopupRoot.ContentProperty],
                }.RegisterInNameScope(scope)),
            };

            result.ApplyTemplate();

            return(result);
        }
Пример #5
0
        /// <summary>
        /// Creates a new CompletionWindowBase.
        /// </summary>
        public CompletionWindowBase(TextArea textArea, IPopupImpl impl) : base(textArea.GetVisualRoot() as Window, impl)
        {
            PopupImpl = impl;

            TextArea      = textArea ?? throw new ArgumentNullException(nameof(textArea));
            _parentWindow = textArea.GetVisualRoot() as Window;

            // TODO: owner
            //this.Owner = parentWindow;

            AddHandler(PointerReleasedEvent, OnMouseUp, handledEventsToo: true);

            StartOffset = EndOffset = TextArea.Caret.Offset;

            // TODO: these events do not fire on PopupRoot
            Deactivated += OnDeactivated;
            //Closed += (sender, args) => DetachEvents();

            AttachEvents();

            Initailize();
        }
Пример #6
0
        public MainWindow()
        {
            InitializeComponent();
            this.AttachDevTools();

            _textEditor                 = this.FindControl <TextEditor>("Editor");
            _textEditor.Background      = Brushes.Transparent;
            _textEditor.ShowLineNumbers = true;
            //_textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");
            _textEditor.TextArea.TextEntered        += textEditor_TextArea_TextEntered;
            _textEditor.TextArea.TextEntering       += textEditor_TextArea_TextEntering;
            _textEditor.TextArea.IndentationStrategy = new Indentation.CSharp.CSharpIndentationStrategy();

            _addControlBtn        = this.FindControl <Button>("addControlBtn");
            _addControlBtn.Click += _addControlBtn_Click;

            _clearControlBtn        = this.FindControl <Button>("clearControlBtn");
            _clearControlBtn.Click += _clearControlBtn_Click;;

            _textEditor.TextArea.TextView.ElementGenerators.Add(_generator);

            impl = PlatformManager.CreateWindow().CreatePopup();

            this.AddHandler(PointerWheelChangedEvent, (o, i) =>
            {
                if (i.KeyModifiers != KeyModifiers.Control)
                {
                    return;
                }
                if (i.Delta.Y > 0)
                {
                    _textEditor.FontSize++;
                }
                else
                {
                    _textEditor.FontSize = _textEditor.FontSize > 1 ? _textEditor.FontSize - 1 : 1;
                }
            }, RoutingStrategies.Bubble, true);
        }
Пример #7
0
        public MainWindow()
        {
            InitializeComponent();
            this.AttachDevTools();

            _textEditor                 = this.FindControl <TextEditor>("Editor");
            _textEditor.Background      = Brushes.Transparent;
            _textEditor.ShowLineNumbers = true;
            //_textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");
            _textEditor.TextArea.TextEntered        += textEditor_TextArea_TextEntered;
            _textEditor.TextArea.TextEntering       += textEditor_TextArea_TextEntering;
            _textEditor.TextArea.IndentationStrategy = new Indentation.CSharp.CSharpIndentationStrategy();

            _addControlBtn        = this.FindControl <Button>("addControlBtn");
            _addControlBtn.Click += _addControlBtn_Click;

            _clearControlBtn        = this.FindControl <Button>("clearControlBtn");
            _clearControlBtn.Click += _clearControlBtn_Click;;

            _textEditor.TextArea.TextView.ElementGenerators.Add(_generator);

            impl = PlatformManager.CreateWindow().CreatePopup();
        }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PopupRoot"/> class.
 /// </summary>
 /// <param name="parent">The popup parent.</param>
 /// <param name="impl">The popup implementation.</param>
 /// <param name="dependencyResolver">
 /// The dependency resolver to use. If null the default dependency resolver will be used.
 /// </param>
 public PopupRoot(TopLevel parent, IPopupImpl impl, IAvaloniaDependencyResolver dependencyResolver)
     : base(impl, dependencyResolver)
 {
     _parent = parent;
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PopupRoot"/> class.
 /// </summary>
 public PopupRoot(TopLevel parent, IPopupImpl impl)
     : this(parent, impl, null)
 {
 }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PopupRoot"/> class.
 /// </summary>
 /// <param name="parent">The popup parent.</param>
 /// <param name="impl">The popup implementation.</param>
 /// <param name="dependencyResolver">
 /// The dependency resolver to use. If null the default dependency resolver will be used.
 /// </param>
 public PopupRoot(TopLevel parent, IPopupImpl impl, IAvaloniaDependencyResolver dependencyResolver)
     : base(ValidatingPopupImpl.Wrap(impl), dependencyResolver)
 {
     _parent = parent;
 }
Пример #11
0
 public ValidatingPopupImpl(IPopupImpl impl) : base(impl)
 {
     _impl = impl;
 }