private void CheckSelf(cef_keyboard_handler_t *self)
 {
     if (_self != self)
     {
         throw ExceptionBuilder.InvalidSelfReference();
     }
 }
예제 #2
0
        public CefKeyboardHandler()
        {
            cef_keyboard_handler_t *self = this.NativeInstance;

            self->on_pre_key_event = (void *)Marshal.GetFunctionPointerForDelegate(fnOnPreKeyEvent);
            self->on_key_event     = (void *)Marshal.GetFunctionPointerForDelegate(fnOnKeyEvent);
        }
 protected virtual void Dispose(bool disposing)
 {
     if (_self != null)
     {
         cef_keyboard_handler_t.Free(_self);
         _self = null;
     }
 }
예제 #4
0
 protected virtual void Dispose(bool disposing)
 {
     if (_self != null)
     {
         cef_keyboard_handler_t.Free(_self);
         _self = null;
     }
 }
예제 #5
0
 private void add_ref(cef_keyboard_handler_t *self)
 {
     lock (SyncRoot)
     {
         var result = ++_refct;
         if (result == 1)
         {
             lock (_roots) { _roots.Add((IntPtr)_self, this); }
         }
     }
 }
 private int release(cef_keyboard_handler_t *self)
 {
     lock (SyncRoot)
     {
         var result = --_refct;
         if (result == 0)
         {
             lock (_roots) { _roots.Remove((IntPtr)_self); }
         }
         return(result);
     }
 }
예제 #7
0
        public CefKeyboardHandler()
        {
            cef_keyboard_handler_t *self = this.NativeInstance;

                        #if NET_LESS_5_0
            self->on_pre_key_event = (void *)Marshal.GetFunctionPointerForDelegate(fnOnPreKeyEvent);
            self->on_key_event     = (void *)Marshal.GetFunctionPointerForDelegate(fnOnKeyEvent);
                        #else
            self->on_pre_key_event = (delegate * unmanaged[Stdcall] < cef_keyboard_handler_t *, cef_browser_t *, cef_key_event_t *, CefEventHandle, int *, int >) & OnPreKeyEventImpl;
            self->on_key_event     = (delegate * unmanaged[Stdcall] < cef_keyboard_handler_t *, cef_browser_t *, cef_key_event_t *, CefEventHandle, int >) & OnKeyEventImpl;
                        #endif
        }
예제 #8
0
        /// <summary>
        /// Called when the browser component receives a keyboard event. This method
        /// is called both before the event is passed to the renderer and after
        /// JavaScript in the page has had a chance to handle the event. |type| is the
        /// type of keyboard event, |code| is the windows scan-code for the event,
        /// |modifiers| is a set of bit- flags describing any pressed modifier keys and
        /// |isSystemKey| is true if Windows considers this a 'system key' message (see
        /// http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx). If
        /// |isAfterJavaScript| is true then JavaScript in the page has had a chance
        /// to handle the event and has chosen not to. Only RAWKEYDOWN, KEYDOWN and
        /// CHAR events will be sent with |isAfterJavaScript| set to true. Return
        /// true if the keyboard event was handled or false to allow continued handling
        /// of the event by the renderer.
        /// </summary>
        private int on_key_event(cef_keyboard_handler_t *self, cef_browser_t *browser, cef_handler_keyevent_type_t type, int code, int modifiers, int isSystemKey, int isAfterJavaScript)
        {
            ThrowIfObjectDisposed();

            var m_browser          = CefBrowser.From(browser);
            var m_type             = (CefHandlerKeyEventType)type;
            var m_isSystemKey      = isSystemKey != 0;
            var mIsAfterJavaScript = isAfterJavaScript != 0;

            var handled = this.OnKeyEvent(m_browser, m_type, code, (CefHandlerKeyEventModifiers)modifiers, m_isSystemKey, mIsAfterJavaScript);

            return(handled ? 1 : 0);
        }
        protected CefKeyboardHandler()
        {
            _self = cef_keyboard_handler_t.Alloc();

            _ds0 = new cef_keyboard_handler_t.add_ref_delegate(add_ref);
            _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0);
            _ds1 = new cef_keyboard_handler_t.release_delegate(release);
            _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1);
            _ds2 = new cef_keyboard_handler_t.get_refct_delegate(get_refct);
            _self->_base._get_refct = Marshal.GetFunctionPointerForDelegate(_ds2);
            _ds3 = new cef_keyboard_handler_t.on_pre_key_event_delegate(on_pre_key_event);
            _self->_on_pre_key_event = Marshal.GetFunctionPointerForDelegate(_ds3);
            _ds4 = new cef_keyboard_handler_t.on_key_event_delegate(on_key_event);
            _self->_on_key_event = Marshal.GetFunctionPointerForDelegate(_ds4);
        }
예제 #10
0
 protected CefKeyboardHandler()
 {
     _self = cef_keyboard_handler_t.Alloc();
 
     _ds0 = new cef_keyboard_handler_t.add_ref_delegate(add_ref);
     _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0);
     _ds1 = new cef_keyboard_handler_t.release_delegate(release);
     _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1);
     _ds2 = new cef_keyboard_handler_t.has_one_ref_delegate(has_one_ref);
     _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2);
     _ds3 = new cef_keyboard_handler_t.on_pre_key_event_delegate(on_pre_key_event);
     _self->_on_pre_key_event = Marshal.GetFunctionPointerForDelegate(_ds3);
     _ds4 = new cef_keyboard_handler_t.on_key_event_delegate(on_key_event);
     _self->_on_key_event = Marshal.GetFunctionPointerForDelegate(_ds4);
 }
예제 #11
0
        private int on_key_event(cef_keyboard_handler_t *self, cef_browser_t *browser, cef_key_event_t * @event, IntPtr os_event)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);
            var m_event   = CefKeyEvent.FromNative(@event);
            // TODO: wrap cef_event_handle_t (os_event)
            IntPtr m_os_event = IntPtr.Zero;

            if (os_event != IntPtr.Zero)
            {
            }

            var result = OnKeyEvent(m_browser, m_event, m_os_event);

            return(result ? 1 : 0);
        }
 private int get_refct(cef_keyboard_handler_t *self)
 {
     return(_refct);
 }
예제 #13
0
 private int has_one_ref(cef_keyboard_handler_t *self)
 {
     lock (SyncRoot) { return(_refct == 1 ? 1 : 0); }
 }
예제 #14
0
 public CefKeyboardHandler(cef_keyboard_handler_t *instance)
     : base((cef_base_ref_counted_t *)instance)
 {
 }
예제 #15
0
 internal static void Free(cef_keyboard_handler_t *ptr)
 {
     Marshal.FreeHGlobal((IntPtr)ptr);
 }
예제 #16
0
 private int has_at_least_one_ref(cef_keyboard_handler_t *self)
 {
     lock (SyncRoot) { return(_refct != 0 ? 1 : 0); }
 }
예제 #17
0
        /// <summary>
        /// Called before a keyboard event is sent to the renderer. |event| contains
        /// information about the keyboard event. |os_event| is the operating system
        /// event message, if any. Return true if the event was handled or false
        /// otherwise. If the event will be handled in OnKeyEvent() as a keyboard
        /// shortcut set |is_keyboard_shortcut| to true and return false.
        /// </summary>
        // protected abstract int OnPreKeyEvent(cef_browser_t* browser, cef_key_event_t* @event, IntPtr os_event, int* is_keyboard_shortcut);

        private int on_key_event(cef_keyboard_handler_t *self, cef_browser_t *browser, cef_key_event_t * @event, IntPtr os_event)
        {
            CheckSelf(self);
            throw new NotImplementedException(); // TODO: CefKeyboardHandler.OnKeyEvent
        }