private void CheckSelf(cef_focus_handler_t *self) { if (_self != self) { throw ExceptionBuilder.InvalidSelfReference(); } }
/// <summary> /// Called when the browser component is about to loose focus. For /// instance, if focus was on the last HTML element and the user pressed /// the TAB key. |next| will be true if the browser is giving focus to /// the next component and false if the browser is giving focus to the /// previous component. /// </summary> private void on_take_focus(cef_focus_handler_t *self, cef_browser_t *browser, int next) { ThrowIfObjectDisposed(); var m_browser = CefBrowser.From(browser); this.OnTakeFocus(m_browser, next != 0); }
private void on_got_focus(cef_focus_handler_t *self, cef_browser_t *browser) { CheckSelf(self); var m_browser = CefBrowser.FromNative(browser); OnGotFocus(m_browser); }
public CefFocusHandler() { cef_focus_handler_t *self = this.NativeInstance; self->on_take_focus = (void *)Marshal.GetFunctionPointerForDelegate(fnOnTakeFocus); self->on_set_focus = (void *)Marshal.GetFunctionPointerForDelegate(fnOnSetFocus); self->on_got_focus = (void *)Marshal.GetFunctionPointerForDelegate(fnOnGotFocus); }
protected virtual void Dispose(bool disposing) { if (_self != null) { cef_focus_handler_t.Free(_self); _self = null; } }
private void on_take_focus(cef_focus_handler_t *self, cef_browser_t *browser, int next) { CheckSelf(self); var m_browser = CefBrowser.FromNative(browser); OnTakeFocus(m_browser, next != 0); }
private int on_set_focus(cef_focus_handler_t *self, cef_browser_t *browser, CefFocusSource source) { CheckSelf(self); var m_browser = CefBrowser.FromNative(browser); return(OnSetFocus(m_browser, source) ? 1 : 0); }
/// <summary> /// Called when the browser component is requesting focus. |source| indicates /// where the focus request is originating from. Return false to allow the /// focus to be set or true to cancel setting the focus. /// </summary> private int on_set_focus(cef_focus_handler_t *self, cef_browser_t *browser, cef_handler_focus_source_t source) { ThrowIfObjectDisposed(); var mBrowser = CefBrowser.From(browser); var handled = this.OnSetFocus(mBrowser, (CefHandlerFocusSource)source); return(handled ? 1 : 0); }
private static unsafe void OnTakeFocusImpl(cef_focus_handler_t *self, cef_browser_t *browser, int next) { var instance = GetInstance((IntPtr)self) as CefFocusHandler; if (instance == null || ((ICefFocusHandlerPrivate)instance).AvoidOnTakeFocus()) { ReleaseIfNonNull((cef_base_ref_counted_t *)browser); return; } instance.OnTakeFocus(CefBrowser.Wrap(CefBrowser.Create, browser), next != 0); }
private void add_ref(cef_focus_handler_t *self) { lock (SyncRoot) { var result = ++_refct; if (result == 1) { lock (_roots) { _roots.Add((IntPtr)_self, this); } } } }
private int release(cef_focus_handler_t *self) { lock (SyncRoot) { var result = --_refct; if (result == 0) { lock (_roots) { _roots.Remove((IntPtr)_self); } } return(result); } }
public CefFocusHandler() { cef_focus_handler_t *self = this.NativeInstance; #if NET_LESS_5_0 self->on_take_focus = (void *)Marshal.GetFunctionPointerForDelegate(fnOnTakeFocus); self->on_set_focus = (void *)Marshal.GetFunctionPointerForDelegate(fnOnSetFocus); self->on_got_focus = (void *)Marshal.GetFunctionPointerForDelegate(fnOnGotFocus); #else self->on_take_focus = (delegate * unmanaged[Stdcall] < cef_focus_handler_t *, cef_browser_t *, int, void >) & OnTakeFocusImpl; self->on_set_focus = (delegate * unmanaged[Stdcall] < cef_focus_handler_t *, cef_browser_t *, CefFocusSource, int >) & OnSetFocusImpl; self->on_got_focus = (delegate * unmanaged[Stdcall] < cef_focus_handler_t *, cef_browser_t *, void >) & OnGotFocusImpl; #endif }
/// <summary> /// Called when a new node in the the browser gets focus. The |node| /// value may be empty if no specific node has gained focus. The node /// object passed to this method represents a snapshot of the DOM at the /// time this method is executed. DOM objects are only valid for the /// scope of this method. Do not keep references to or attempt to access /// any DOM objects outside the scope of this method. /// </summary> private void on_focused_node_changed(cef_focus_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_domnode_t *node) { ThrowIfObjectDisposed(); var mBrowser = CefBrowser.From(browser); var mFrame = CefFrame.From(frame); var mNode = CefDomNode.FromOrDefault(node); // TODO: DOM nodes context this.OnFocusedNodeChanged(mBrowser, mFrame, mNode); if (mNode != null) { mNode.Dispose(); } }
protected CefFocusHandler() { _self = cef_focus_handler_t.Alloc(); _ds0 = new cef_focus_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_focus_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_focus_handler_t.has_one_ref_delegate(has_one_ref); _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_focus_handler_t.on_take_focus_delegate(on_take_focus); _self->_on_take_focus = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_focus_handler_t.on_set_focus_delegate(on_set_focus); _self->_on_set_focus = Marshal.GetFunctionPointerForDelegate(_ds4); _ds5 = new cef_focus_handler_t.on_got_focus_delegate(on_got_focus); _self->_on_got_focus = Marshal.GetFunctionPointerForDelegate(_ds5); }
protected CefFocusHandler() { _self = cef_focus_handler_t.Alloc(); _ds0 = new cef_focus_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_focus_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_focus_handler_t.get_refct_delegate(get_refct); _self->_base._get_refct = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_focus_handler_t.on_take_focus_delegate(on_take_focus); _self->_on_take_focus = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_focus_handler_t.on_set_focus_delegate(on_set_focus); _self->_on_set_focus = Marshal.GetFunctionPointerForDelegate(_ds4); _ds5 = new cef_focus_handler_t.on_got_focus_delegate(on_got_focus); _self->_on_got_focus = Marshal.GetFunctionPointerForDelegate(_ds5); }
private int get_refct(cef_focus_handler_t *self) { return(_refct); }
private void on_take_focus(cef_focus_handler_t *self, cef_browser_t *browser, int next) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefFocusHandler.OnTakeFocus }
/// <summary> /// Called when the browser component is about to loose focus. For instance, if /// focus was on the last HTML element and the user pressed the TAB key. |next| /// will be true if the browser is giving focus to the next component and false /// if the browser is giving focus to the previous component. /// </summary> // protected abstract void OnTakeFocus(cef_browser_t* browser, int next); private int on_set_focus(cef_focus_handler_t *self, cef_browser_t *browser, CefFocusSource source) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefFocusHandler.OnSetFocus }
private int has_at_least_one_ref(cef_focus_handler_t *self) { lock (SyncRoot) { return(_refct != 0 ? 1 : 0); } }
private int has_one_ref(cef_focus_handler_t *self) { lock (SyncRoot) { return(_refct == 1 ? 1 : 0); } }
/// <summary> /// Called when the browser component is requesting focus. |source| indicates /// where the focus request is originating from. Return false to allow the /// focus to be set or true to cancel setting the focus. /// </summary> // protected abstract int OnSetFocus(cef_browser_t* browser, CefFocusSource source); private void on_got_focus(cef_focus_handler_t *self, cef_browser_t *browser) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefFocusHandler.OnGotFocus }
internal static void Free(cef_focus_handler_t *ptr) { Marshal.FreeHGlobal((IntPtr)ptr); }
public CefFocusHandler(cef_focus_handler_t *instance) : base((cef_base_ref_counted_t *)instance) { }