Пример #1
0
        protected virtual void OnDomFocus(object sender, EventArgs ea)
        {
            DomEventArgs e = new DomEventArgs(ea);

            if (!_browserDocumentLoaded)
            {
                return;
            }

            // Only handle DomFocus that occurs on a Element.
            // This is Important or it will mess with IME keyboard focus.
            if (e == null || e.Target == null || e.Target.CastToGeckoElement() == null)
            {
                return;
            }

            var content = _browser.Document.GetElementById("main");

            if (content != null)
            {
                if ((content is GeckoHtmlElement) && (!_inFocus))
                {
                    // The following is required because we get two in focus events every time this
                    // is entered.  This is normal for Gecko.  But I don't want to be constantly
                    // refocussing.
                    _inFocus = true;
                    EnsureFocusedGeckoControlHasInputFocus();
                    if (_browser != null)
                    {
                        _browser.SetInputFocus();
                    }
                    _focusElement = (GeckoHtmlElement)content;
                    ChangeFocus();
                }
            }
        }
Пример #2
0
		protected virtual void Closing()
		{
			this.Load -= _loadHandler;
			this.BackColorChanged -= _backColorChangedHandler;
			this.ForeColorChanged -= _foreColorChangedHandler;
			_focusElement = null;
			if (_timer != null)
			{
				_timer.Stop();
				_timer = null;
			}
			if (_browser != null)
			{
				_browser.DomKeyDown -= _domKeyDownHandler;
				_browser.DomKeyUp -= _domKeyUpHandler;
				_browser.DomFocus -= _domFocusHandler;
				_browser.DomBlur -= _domBlurHandler;
				_browser.DocumentCompleted -= _domDocumentCompletedHandler;
#if __MonoCS__
				_browser.DomClick -= _domClickHandler;
#endif
				_browser.Dispose();
				_browser = null;
			}
			_loadHandler = null;
			_domKeyDownHandler = null;
			_domKeyUpHandler = null;
			_domFocusHandler = null;
			_domDocumentCompletedHandler = null;
#if __MonoCS__
			_domClickHandler = null;
#endif
		}
Пример #3
0
		protected virtual void OnDomFocus(object sender, EventArgs ea)
		{
			DomEventArgs e = new DomEventArgs(ea);
			if (!_browserDocumentLoaded)
			{
				return;
			}

			// Only handle DomFocus that occurs on a Element.
			// This is Important or it will mess with IME keyboard focus.
			if (e == null || e.Target == null || e.Target.CastToGeckoElement () == null)
			{
				return;
			}

			var content = _browser.Document.GetElementById("main");
			if (content != null)
			{
				if ((content is GeckoHtmlElement) && (!_inFocus))
				{
					// The following is required because we get two in focus events every time this
					// is entered.  This is normal for Gecko.  But I don't want to be constantly
					// refocussing.
					_inFocus = true;
					EnsureFocusedGeckoControlHasInputFocus();
					if (_browser != null)
					{
						_browser.SetInputFocus();
					}
					_focusElement = (GeckoHtmlElement)content;
					ChangeFocus();
				}
			}
		}