Esempio n. 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;
 }
Esempio n. 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;
 }
Esempio n. 3
0
    public static IPopupImpl Wrap(IPopupImpl impl)
    {
#if DEBUG
        if (impl is ValidatingToplevelImpl)
        {
            return(impl);
        }
        return(new ValidatingPopupImpl(impl));
#else
        return(impl);
#endif
    }
Esempio n. 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);
        }
Esempio n. 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();
        }
Esempio n. 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);
        }
Esempio n. 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();
        }
Esempio n. 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;
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PopupRoot"/> class.
 /// </summary>
 public PopupRoot(TopLevel parent, IPopupImpl impl)
     : this(parent, impl, null)
 {
 }
Esempio n. 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;
 }
Esempio n. 11
0
 public ValidatingPopupImpl(IPopupImpl impl) : base(impl)
 {
     _impl = impl;
 }