// ############################################################################### // ### M E T H O D S // ############################################################################### #region Methods /// <summary> Add a widget specific action registration. </summary> /// <param name="widget"> The widget to register the action for. <see cref="System.IntPtr"/> </param> /// <param name="eventType"> The event type to register the action for. <see cref="X11.XEventName"/> </param> /// <param name="action"> The action to execute. <see cref="XtActionProc"/> </param> /// <returns> The managed code to native code marshalable generic action procedure. <see cref="System.IntPtr"/> </returns> public static IntPtr Add(IntPtr widget, X11.XEventName eventType, XtActionProc action) { ActionKey actionKey = new ActionKey(widget, eventType); if (_list.ContainsKey(actionKey)) { Console.WriteLine(CLASS_NAME + "::Add() WARNING: ActionProc already registered for widget. Perform refresh."); _list[actionKey] = action; } else { _list.Add(actionKey, action); } return(_actionPtr); }
/// <summary> The initializing constructor. </summary> /// <param name="widget"> The widget this key is associated to. <see cref="System.IntPtr"/> </param> /// <param name="eventType"> The event type this key is associated to. <see cref="X11.XEventName"/> </param> public ActionKey(IntPtr widget, X11.XEventName eventType) { Widget = widget; EventType = eventType; }
/// <summary> Remove a widget specific action registration. </summary> /// <param name="widget"> The widget to unregister the action for. <see cref="IntPtr"/> </param> /// <param name="eventType"> The event type to unregister the action for. <see cref="X11.XEventName"/> </param> public static void Remove(IntPtr widget, X11.XEventName eventType) { ActionKey actionKey = new ActionKey(widget, eventType); _list.Remove(actionKey); }