protected CefMenuModelDelegate() { _self = cef_menu_model_delegate_t.Alloc(); _ds0 = new cef_menu_model_delegate_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_menu_model_delegate_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_menu_model_delegate_t.has_one_ref_delegate(has_one_ref); _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_menu_model_delegate_t.execute_command_delegate(execute_command); _self->_execute_command = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_menu_model_delegate_t.mouse_outside_menu_delegate(mouse_outside_menu); _self->_mouse_outside_menu = Marshal.GetFunctionPointerForDelegate(_ds4); _ds5 = new cef_menu_model_delegate_t.unhandled_open_submenu_delegate(unhandled_open_submenu); _self->_unhandled_open_submenu = Marshal.GetFunctionPointerForDelegate(_ds5); _ds6 = new cef_menu_model_delegate_t.unhandled_close_submenu_delegate(unhandled_close_submenu); _self->_unhandled_close_submenu = Marshal.GetFunctionPointerForDelegate(_ds6); _ds7 = new cef_menu_model_delegate_t.menu_will_show_delegate(menu_will_show); _self->_menu_will_show = Marshal.GetFunctionPointerForDelegate(_ds7); _ds8 = new cef_menu_model_delegate_t.menu_closed_delegate(menu_closed); _self->_menu_closed = Marshal.GetFunctionPointerForDelegate(_ds8); _ds9 = new cef_menu_model_delegate_t.format_label_delegate(format_label); _self->_format_label = Marshal.GetFunctionPointerForDelegate(_ds9); }
private void CheckSelf(cef_menu_model_delegate_t *self) { if (_self != self) { throw ExceptionBuilder.InvalidSelfReference(); } }
private void menu_will_show(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model) { CheckSelf(self); var m_menuModel = CefMenuModel.FromNative(menu_model); MenuWillShow(m_menuModel); }
protected virtual void Dispose(bool disposing) { if (_self != null) { cef_menu_model_delegate_t.Free(_self); _self = null; } }
private void menu_closed(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model) { CheckSelf(self); var m_menuModel = CefMenuModel.FromNative(menu_model); MenuClosed(m_menuModel); }
private void execute_command(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model, int command_id, CefEventFlags event_flags) { CheckSelf(self); var m_menuModel = CefMenuModel.FromNative(menu_model); ExecuteCommand(m_menuModel, command_id, event_flags); }
private void unhandled_close_submenu(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model, int is_rtl) { CheckSelf(self); var m_menuModel = CefMenuModel.FromNative(menu_model); UnhandledCloseSubmenu(m_menuModel, is_rtl != 0); }
private void mouse_outside_menu(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model, cef_point_t *screen_point) { CheckSelf(self); var m_menuModel = CefMenuModel.FromNative(menu_model); var m_screenPoint = new CefPoint(screen_point->x, screen_point->y); MouseOutsideMenu(m_menuModel, m_screenPoint); }
private void add_ref(cef_menu_model_delegate_t *self) { lock (SyncRoot) { var result = ++_refct; if (result == 1) { lock (_roots) { _roots.Add((IntPtr)_self, this); } } } }
private static unsafe void ExecuteCommandImpl(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model, int command_id, CefEventFlags event_flags) { var instance = GetInstance((IntPtr)self) as CefMenuModelDelegate; if (instance == null || ((ICefMenuModelDelegatePrivate)instance).AvoidExecuteCommand()) { ReleaseIfNonNull((cef_base_ref_counted_t *)menu_model); return; } instance.ExecuteCommand(CefMenuModel.Wrap(CefMenuModel.Create, menu_model), command_id, event_flags); }
private static unsafe void UnhandledCloseSubmenuImpl(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model, int is_rtl) { var instance = GetInstance((IntPtr)self) as CefMenuModelDelegate; if (instance == null || ((ICefMenuModelDelegatePrivate)instance).AvoidUnhandledCloseSubmenu()) { ReleaseIfNonNull((cef_base_ref_counted_t *)menu_model); return; } instance.UnhandledCloseSubmenu(CefMenuModel.Wrap(CefMenuModel.Create, menu_model), is_rtl != 0); }
private static unsafe void MenuClosedImpl(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model) { var instance = GetInstance((IntPtr)self) as CefMenuModelDelegate; if (instance == null || ((ICefMenuModelDelegatePrivate)instance).AvoidMenuClosed()) { ReleaseIfNonNull((cef_base_ref_counted_t *)menu_model); return; } instance.MenuClosed(CefMenuModel.Wrap(CefMenuModel.Create, menu_model)); }
private static unsafe void MouseOutsideMenuImpl(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model, cef_point_t *screen_point) { var instance = GetInstance((IntPtr)self) as CefMenuModelDelegate; if (instance == null || ((ICefMenuModelDelegatePrivate)instance).AvoidMouseOutsideMenu()) { ReleaseIfNonNull((cef_base_ref_counted_t *)menu_model); return; } instance.MouseOutsideMenu(CefMenuModel.Wrap(CefMenuModel.Create, menu_model), *(CefPoint *)screen_point); }
public CefMenuModelDelegate() { cef_menu_model_delegate_t *self = this.NativeInstance; self->execute_command = (void *)Marshal.GetFunctionPointerForDelegate(fnExecuteCommand); self->mouse_outside_menu = (void *)Marshal.GetFunctionPointerForDelegate(fnMouseOutsideMenu); self->unhandled_open_submenu = (void *)Marshal.GetFunctionPointerForDelegate(fnUnhandledOpenSubmenu); self->unhandled_close_submenu = (void *)Marshal.GetFunctionPointerForDelegate(fnUnhandledCloseSubmenu); self->menu_will_show = (void *)Marshal.GetFunctionPointerForDelegate(fnMenuWillShow); self->menu_closed = (void *)Marshal.GetFunctionPointerForDelegate(fnMenuClosed); self->format_label = (void *)Marshal.GetFunctionPointerForDelegate(fnFormatLabel); }
private int release(cef_menu_model_delegate_t *self) { lock (SyncRoot) { var result = --_refct; if (result == 0) { lock (_roots) { _roots.Remove((IntPtr)_self); } return(1); } return(0); } }
protected CefMenuModelDelegate() { _self = cef_menu_model_delegate_t.Alloc(); _ds0 = new cef_menu_model_delegate_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_menu_model_delegate_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_menu_model_delegate_t.has_one_ref_delegate(has_one_ref); _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_menu_model_delegate_t.execute_command_delegate(execute_command); _self->_execute_command = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_menu_model_delegate_t.menu_will_show_delegate(menu_will_show); _self->_menu_will_show = Marshal.GetFunctionPointerForDelegate(_ds4); }
private int format_label(cef_menu_model_delegate_t *self, cef_menu_model_t *menu_model, cef_string_t *label) { CheckSelf(self); var m_menuModel = CefMenuModel.FromNative(menu_model); var m_label = cef_string_t.ToString(label); if (FormatLabel(m_menuModel, ref m_label)) { cef_string_t.Copy(m_label, label); return(1); } else { return(0); } }
public CefMenuModelDelegate() { cef_menu_model_delegate_t *self = this.NativeInstance; #if NET_LESS_5_0 self->execute_command = (void *)Marshal.GetFunctionPointerForDelegate(fnExecuteCommand); self->mouse_outside_menu = (void *)Marshal.GetFunctionPointerForDelegate(fnMouseOutsideMenu); self->unhandled_open_submenu = (void *)Marshal.GetFunctionPointerForDelegate(fnUnhandledOpenSubmenu); self->unhandled_close_submenu = (void *)Marshal.GetFunctionPointerForDelegate(fnUnhandledCloseSubmenu); self->menu_will_show = (void *)Marshal.GetFunctionPointerForDelegate(fnMenuWillShow); self->menu_closed = (void *)Marshal.GetFunctionPointerForDelegate(fnMenuClosed); self->format_label = (void *)Marshal.GetFunctionPointerForDelegate(fnFormatLabel); #else self->execute_command = (delegate * unmanaged[Stdcall] < cef_menu_model_delegate_t *, cef_menu_model_t *, int, CefEventFlags, void >) & ExecuteCommandImpl; self->mouse_outside_menu = (delegate * unmanaged[Stdcall] < cef_menu_model_delegate_t *, cef_menu_model_t *, cef_point_t *, void >) & MouseOutsideMenuImpl; self->unhandled_open_submenu = (delegate * unmanaged[Stdcall] < cef_menu_model_delegate_t *, cef_menu_model_t *, int, void >) & UnhandledOpenSubmenuImpl; self->unhandled_close_submenu = (delegate * unmanaged[Stdcall] < cef_menu_model_delegate_t *, cef_menu_model_t *, int, void >) & UnhandledCloseSubmenuImpl; self->menu_will_show = (delegate * unmanaged[Stdcall] < cef_menu_model_delegate_t *, cef_menu_model_t *, void >) & MenuWillShowImpl; self->menu_closed = (delegate * unmanaged[Stdcall] < cef_menu_model_delegate_t *, cef_menu_model_t *, void >) & MenuClosedImpl; self->format_label = (delegate * unmanaged[Stdcall] < cef_menu_model_delegate_t *, cef_menu_model_t *, cef_string_t *, int >) & FormatLabelImpl; #endif }
private int has_at_least_one_ref(cef_menu_model_delegate_t *self) { lock (SyncRoot) { return(_refct != 0 ? 1 : 0); } }
public CefMenuModelDelegate(cef_menu_model_delegate_t *instance) : base((cef_base_ref_counted_t *)instance) { }
internal static void Free(cef_menu_model_delegate_t *ptr) { Marshal.FreeHGlobal((IntPtr)ptr); }
private int has_one_ref(cef_menu_model_delegate_t *self) { lock (SyncRoot) { return(_refct == 1 ? 1 : 0); } }