Esempio n. 1
0
 /// <summary>
 /// Handles the LostFocus event of the <see cref="GameBase.RenderWindow"/>.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 void rw_LostFocus(object sender, EventArgs e)
 {
     if (LostFocus != null)
     {
         LostFocus.Raise(this, e);
     }
 }
Esempio n. 2
0
        protected override void OnShown()
        {
            var lol = new WindowDelegate();

            Window.Delegate = lol;

            lol.ResizeRequested += (s, e) => {
                ResizeRequested?.Invoke(this, EventArgs.Empty);
            };

            lol.MovedRequested += (s, e) => {
                MovedRequested?.Invoke(this, EventArgs.Empty);
            };

            lol.LostFocus += (s, e) => {
                LostFocus?.Invoke(this, EventArgs.Empty);
            };

            lol.BecomeMainWindow += (s, e) => {
                OnBecomeMainWindow(this, EventArgs.Empty);
            };

            lol.BecomeKeyWindow += (sender, e) => {
                GotFocus?.Invoke(this, EventArgs.Empty);
            };

            base.OnShown();
        }
 private void ViewImpl_FocusChange(object sender, FocusChangeEventArgs e)
 {
     if (!e.HasFocus)
     {
         LostFocus?.Invoke();
     }
 }
Esempio n. 4
0
 private void SetInternalElement(Element value)
 {
     _internalElement             = value;
     InternalJQElement            = new JQElement(_internalElement);
     InternalJQElement.Click     += (sender, args) => Click?.Invoke(this, args);
     InternalJQElement.Focus     += (sender, args) => Focus?.Invoke(this, args);
     InternalJQElement.LostFocus += (sender, args) => LostFocus?.Invoke(this, args);
 }
 void NotifyLostFocus()
 {
     if (hasFocus)
     {
         hasFocus = false;
         LostFocus?.Invoke(this, EventArgs.Empty);
     }
 }
Esempio n. 6
0
 protected override IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
 {
     if (msg == (uint)UnmanagedMethods.WindowsMessage.WM_KILLFOCUS)
     {
         LostFocus?.Invoke();
     }
     return(base.WndProc(hWnd, msg, wParam, lParam));
 }
Esempio n. 7
0
 public void LoseFocus()
 {
     LostFocus.Raise(this, EventArgs.Empty);
     if (_useGenericInteractionIndicators)
     {
         _interactionIndicatorRend.sprite = null;
         _interactionIndicatorPS.Stop();
     }
 }
Esempio n. 8
0
        internal static void OnFocusChanged(Control control, FocusState focusState)
        {
            if (focusState == FocusState.Unfocused)
            {
                if (control == _focusedElement)
                {
                    _focusedElement = null;

                    if (LostFocus != null)
                    {
                        void OnLostFocus()
                        {
                            // we replay all "lost focus" events
                            LostFocus?.Invoke(null, new FocusManagerLostFocusEventArgs {
                                OldFocusedElement = control
                            });
                        }

                        control.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, OnLostFocus);                         // event is rescheduled, as on UWP
                    }
                }
            }
            else             // Focused
            {
                if (_focusedElement != control)
                {
                    (_focusedElement as Control)?.Unfocus();
                    _focusedElement = control;

                    if (GotFocus != null)
                    {
                        void OnGotFocus()
                        {
                            if (_focusedElement == control)                             // still focused
                            {
                                // we play the gotfocus event only on last/winning control
                                GotFocus?.Invoke(null, new FocusManagerGotFocusEventArgs {
                                    NewFocusedElement = control
                                });
                            }
                        }

                        control.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, OnGotFocus);                         // event is rescheduled, as on UWP
                    }
                }

                _fallbackFocusedElement = control;

#if __ANDROID__
                // Forcefully try to bring the control into view when keyboard is open to accommodate adjust nothing mode
                if (InputPane.GetForCurrentView().Visible)
                {
                    control.StartBringIntoView();
                }
#endif
            }
        }
Esempio n. 9
0
        private void OnPickerClosed(object sender, EventArgs e)
        {
            var window = sender as TimePickerWindow;

            if (window != null)
            {
                Remove(window);
                LostFocus?.Invoke(this, EventArgs.Empty);
            }
        }
Esempio n. 10
0
        internal void OnLostFocus()
        {
            if (hoveredControl != null)
            {
                hoveredControl.selected = false;
                hoveredControl.RaiseOnLostFocus(EventArgs.Empty);
            }

            LostFocus?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 11
0
 public override void OnWindowFocusChanged(bool hasWindowFocus)
 {
     base.OnWindowFocusChanged(hasWindowFocus);
     if (!_focused || !hasWindowFocus)
     {
         return;
     }
     _focused = false;
     LostFocus?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 12
0
 public override void Dispose()
 {
     _aggregator.Unsubscribe(Entity);
     MouseEnter?.Dispose();
     MouseLeave?.Dispose();
     MouseMove?.Dispose();
     MouseClicked?.Dispose();
     MouseDoubleClicked?.Dispose();
     MouseDown?.Dispose();
     MouseUp?.Dispose();
     LostFocus?.Dispose();
     base.Dispose();
 }
Esempio n. 13
0
        void Initialize()
        {
            window.DidResize += (s, e) => {
                ResizeRequested?.Invoke(this, EventArgs.Empty);
            };

            window.DidMove += (s, e) => {
                MovedRequested?.Invoke(this, EventArgs.Empty);
            };

            window.DidResignKey += (s, e) => {
                LostFocus?.Invoke(this, EventArgs.Empty);
            };
        }
Esempio n. 14
0
        public WindowsMediaPlayer()
        {
            InitializeComponent();

            // Editor doesn't keep player settings.
            Player.settings.volume   = 100;
            Player.uiMode            = "full";
            Player.enableContextMenu = false;
            Player.stretchToFit      = true;
            // LostFocus only gets triggered by the COM component.
            Player.LostFocus += (sender, e) => {
                LostFocus?.Invoke(sender, e);
            };
        }
Esempio n. 15
0
        internal void OnLostFocus()
        {
            if (hoveredControl != null)
            {
                hoveredControl.selected = false;
                hoveredControl.RaiseOnLostFocus(EventArgs.Empty);
                hoveredControl = null;

                Control.lastSelected = null;
            }

            if (LostFocus != null)
            {
                LostFocus.Invoke(this, EventArgs.Empty);
            }
        }
Esempio n. 16
0
        private void Element_LostFocus(object sender, RoutedEventArgs e)
        {
            UIElement element = sender as UIElement;

            if (element == null)
            {
                return;
            }
            hasFocus = false;
            var task = element.Dispatcher.RunIdleAsync((args) => {
                if (!hasFocus)
                {
                    LostFocus?.Invoke(this);
                }
            });
        }
Esempio n. 17
0
        public virtual void ClearFocus()
        {
            if (!Focused)
            {
                return;
            }

            Focused = false;
            FlushMaterials();
            LostFocus?.Invoke(this, this);

            if (CursorAnimationTimer < 0)
            {
                Engine.Core.State.PauseTimer(CursorAnimationTimer);
            }
        }
Esempio n. 18
0
        /// <summary>
        /// コンストラクタ。
        /// </summary>
        public CanvasContext(TextEditorControl control)
        {
            _control = control;
            _control.HandleCreated += (_, __) =>
            {
                _control.Resize     += (s, e) => Resize?.Invoke(new Size2D(_control.ClientSize.Width, _control.ClientSize.Height));
                _control.GotFocus   += (s, e) => GotFocus?.Invoke();
                _control.LostFocus  += (s, e) => LostFocus?.Invoke();
                _control.Paint      += (s, e) => RenderFrame?.Invoke(new RenderingContext(e.Graphics));
                _control.MouseDown  += (s, e) => MouseDown?.Invoke(ToMouseEventInfo(e));
                _control.MouseUp    += (s, e) => MouseUp?.Invoke(ToMouseEventInfo(e));
                _control.MouseMove  += (s, e) => MouseMove?.Invoke(ToMouseEventInfo(e));
                _control.MouseWheel += (s, e) => MouseWheel?.Invoke(ToMouseEventInfo(e));

                Created?.Invoke(new Size2D(_control.ClientSize.Width, _control.ClientSize.Height));
            };
        }
Esempio n. 19
0
        private static void RaiseLostFocusEvent(object oldFocus)
        {
            void OnLostFocus()
            {
                if (oldFocus is UIElement uiElement)
                {
                    uiElement.RaiseEvent(UIElement.LostFocusEvent, new RoutedEventArgs(uiElement));
                }

                // we replay all "lost focus" events
                LostFocus?.Invoke(null, new FocusManagerLostFocusEventArgs {
                    OldFocusedElement = oldFocus as DependencyObject
                });
            }

            CoreDispatcher.Main.RunAsync(CoreDispatcherPriority.Normal, OnLostFocus);             // event is rescheduled, as on UWP
        }
Esempio n. 20
0
        private void ChildControl_LostFocus(object sender, EventArgs e)
        {
            // 当控件失去焦点时判断新获得焦点的控件是不是当前监听器下同一组的控件
            // 如果同属一组,则不回调控件焦点丢失的事件委托



            Debug.WriteLine($"[{this.GetType().ToString()}]ChildControl_LostFocus - sender:{((Control)sender).Name}");

            // 回调事件
            LostFocus?.Invoke(sender, e);

            // 修改获得焦点时的记录
            isOnFocus = false;

            // 失去焦点后,除了要自身响应焦点事件外,还需要通知所有FocusListener
            //FocusListenManager.Broadcast(FocusEvent.Lost, this, (Control)sender);
        }
Esempio n. 21
0
 void window_RootKeyChangeFocus(Widget source, EventArgs e)
 {
     if (((RootFocusEventArgs)e).Focus)
     {
         layoutManager.ActiveWindow = this;
         if (GotFocus != null)
         {
             GotFocus.Invoke(this, EventArgs.Empty);
         }
     }
     else
     {
         if (LostFocus != null)
         {
             LostFocus.Invoke(this, EventArgs.Empty);
         }
     }
 }
Esempio n. 22
0
        /// <summary>
        /// コンストラクタ。
        /// </summary>
        public CanvasContext(TextEditorComponent textEditorComponent, IJSInProcessRuntime jsRuntime, JSEvent jsEvent)
        {
            _textEditorComponent = textEditorComponent;
            _jsRuntime           = jsRuntime;

            _textEditorComponent.Created += size =>
            {
                jsEvent.RegisterActionListener("TextEditorComponent.resize", args => Resize?.Invoke(ToSize(args)));
                jsEvent.RegisterActionListener("TextEditorComponent.mousedown", args => MouseDown?.Invoke(ToMouseState(args)));
                jsEvent.RegisterActionListener("TextEditorComponent.mouseup", args => MouseUp?.Invoke(ToMouseState(args)));
                jsEvent.RegisterActionListener("TextEditorComponent.mousemove", args => MouseMove?.Invoke(ToMouseState(args)));
                jsEvent.RegisterActionListener("TextEditorComponent.mousewheel", args => MouseWheel?.Invoke(ToMouseState(args)));
                jsEvent.RegisterActionListener("TextEditorComponent.render", _ => RenderFrame?.Invoke(new RenderingContext(_textEditorComponent)));
                jsEvent.RegisterActionListener("InputMethod.focusin", args => GotFocus?.Invoke());
                jsEvent.RegisterActionListener("InputMethod.focusout", args => LostFocus?.Invoke());

                Created?.Invoke(size);
            };
        }
Esempio n. 23
0
        public override void DidEndEditing(NSNotification notification)
        {
            base.DidEndEditing(notification);

            if (ignoreEndEditing)
            {
                ignoreEndEditing = false;
                return;
            }

            PlaceholderAttributedString = MakePlaceholderString(PlaceholderText);

            nint value = ((NSNumber)notification.UserInfo.ValueForKey((NSString)"NSTextMovement")).LongValue;

            if (value == (nint)(long)NSTextMovement.Tab)
            {
                Window.MakeFirstResponder(null);
                LostFocus?.Invoke(this, EventArgs.Empty);
                return;
            }

            if (value == (nint)(long)NSTextMovement.Return)
            {
                if (SelectionActivated != null)
                {
                    SelectionActivated(this, null);
                }
                return;
            }

            // This means we've reached a focus loss event.
            var replacedWith = notification.UserInfo.ValueForKey((NSString)"_NSFirstResponderReplacingFieldEditor");

            if (replacedWith != this && LostFocus != null)
            {
                LostFocus(this, null);
            }
        }
Esempio n. 24
0
        protected override void OnShown()
        {
            Window.DidResize += (s, e) => {
                ResizeRequested?.Invoke(this, EventArgs.Empty);
            };

            Window.DidMove += (s, e) => {
                MovedRequested?.Invoke(this, EventArgs.Empty);
            };

            Window.DidResignKey += (s, e) => {
                LostFocus?.Invoke(this, EventArgs.Empty);
            };

            Window.DidBecomeMain += (s, e) => {
                OnBecomeMainWindow(this, EventArgs.Empty);
            };

            Window.DidBecomeKey += (sender, e) => {
            };

            base.OnShown();
        }
Esempio n. 25
0
 internal void RaiseLostFocus(RoutedEventArgs args) => LostFocus?.Invoke(this, args);
Esempio n. 26
0
 public void FireLostFocus()
 {
     LostFocus.Fire(this);
 }
Esempio n. 27
0
 protected internal virtual void OnLostFocus(EventArgs e)
 {
     LostFocus?.Invoke(this, e);
 }
Esempio n. 28
0
 internal void Internal_OnLostFocus()
 {
     LostFocus?.Invoke();
     GUI.OnLostFocus();
 }
Esempio n. 29
0
 protected override void OnLostFocus(RoutedEventArgs e) => LostFocus?.Invoke();
Esempio n. 30
0
 protected internal virtual void OnLostFocus(LostFocusEventArgs args)
 {
     LostFocus?.Invoke(this, args);
 }