public MouseHook(MouseCallback mouseCallback) { this.mouseHookProcDel = mouseEventCall; this.mouseCallback = mouseCallback; Hook(); }
/// <summary> /// 裁切选中图片 /// </summary> /// <param name="path">图片路径</param> public void PicCut(String path) { img = new Mat(path, ImreadModes.Color); Cv2.ImShow("chosenImg", img); //Cv2.SetMouseCallback("img", img_MouseDown); MyMouseCallback = new MouseCallback(img_MouseDown); Cv2.MoveWindow("chosenImg", 800, 400); Cv2.SetMouseCallback("chosenImg", MyMouseCallback); Cv2.WaitKey(0); Cv2.DestroyWindow("chosenImg"); Cv2.DestroyAllWindows(); }
/// <summary> /// Sets the callback function for mouse events occuring within the specified window. /// </summary> /// <param name="windowName">Name of the window. </param> /// <param name="onMouse">Reference to the function to be called every time mouse event occurs in the specified window. </param> /// <param name="userData"></param> public static void SetMouseCallback(string windowName, MouseCallback onMouse, IntPtr userData = default) { if (string.IsNullOrEmpty(windowName)) { throw new ArgumentNullException(nameof(windowName)); } if (onMouse == null) { throw new ArgumentNullException(nameof(onMouse)); } NativeMethods.HandleException( NativeMethods.highgui_setMouseCallback(windowName, onMouse, userData)); }
public DriverReplacement(Guid deviceGuid, string devicePath, RemoteCallback remoteCallback, KeyboardCallback keyboardCallback, MouseCallback mouseCallback) : base(deviceGuid, devicePath, remoteCallback, keyboardCallback, mouseCallback) { if (devicePath.IndexOf(VidSMK, StringComparison.OrdinalIgnoreCase) != -1 || devicePath.IndexOf(VidTopseed, StringComparison.OrdinalIgnoreCase) != -1) { _deviceType = DeviceType.SmkTopseed; } else { _deviceType = DeviceType.Microsoft; } }
protected Driver(Guid deviceGuid, string devicePath, RemoteCallback remoteCallback, KeyboardCallback keyboardCallback, MouseCallback mouseCallback) { if (String.IsNullOrEmpty(devicePath)) { throw new ArgumentNullException("devicePath"); } _deviceGuid = deviceGuid; _devicePath = devicePath; _remoteCallback = remoteCallback; _keyboardCallback = keyboardCallback; _mouseCallback = mouseCallback; }
internal CallbackBinder(Callback callback) { this.OnWidgetLoaded = new CallbackVoid(callback.OnWidgetLoaded); this.OnStateChange = new CallbackOnStateChange(callback.OnStateChange); this.OnProgress = new CallbackOnProgress(callback.OnProgress); this.OnLocationChanged = new CallbackOnLocationChanged(callback.OnLocationChanged); this.OnStatusChange = new CallbackOnStatusChange(callback.OnStatusChange); this.OnSecurityChange = new CallbackOnSecurityChange(callback.OnSecurityChange); this.OnKeyDown = new KeyCallback(callback.OnClientDomKeyDown); this.OnKeyUp = new KeyCallback(callback.OnClientDomKeyUp); this.OnKeyPress = new KeyCallback(callback.OnClientDomKeyPress); this.OnMouseDown = new MouseCallback(callback.OnClientMouseDown); this.OnMouseUp = new MouseCallback(callback.OnClientMouseUp); this.OnMouseClick = new MouseCallback(callback.OnClientMouseClick); this.OnMouseDoubleClick = new MouseCallback(callback.OnClientMouseDoubleClick); this.OnMouseOver = new MouseCallback(callback.OnClientMouseOver); this.OnMouseOut = new MouseCallback(callback.OnClientMouseOut); this.OnActivate = new Callback2(callback.OnClientActivate); this.OnFocus = new Callback2(callback.OnClientFocus); this.OnBlur = new Callback2(callback.OnClientBlur); this.OnAlert = new CallbackPtrPtr(callback.OnAlert); this.OnAlertCheck = new CallbackOnAlertCheck(callback.OnAlertCheck); this.OnConfirm = new CallbackOnConfirm(callback.OnConfirm); this.OnConfirmCheck = new CallbackOnConfirmCheck(callback.OnConfirmCheck); this.OnConfirmEx = new CallbackOnConfirmEx(callback.OnConfirmEx); this.OnPrompt = new CallbackOnPrompt(callback.OnPrompt); this.OnPromptUsernameAndPassword = new CallbackOnPromptUsernameAndPassword(callback.OnPromptUsernameAndPassword); this.OnPromptPassword = new CallbackOnPromptPassword(callback.OnPromptPassword); this.OnSelect = new CallbackOnSelect(callback.OnSelect); this.OnLoad = new CallbackVoid(callback.OnLoad); this.OnUnload = new CallbackVoid(callback.OnUnload); this.OnShowContextMenu = new CallbackOnShowContextMenu(callback.OnShowContextMenu); this.OnGeneric = new CallbackWString(callback.OnGeneric); }
private static void DetectMCE(int[] timingData, KeyboardCallback keyboardCallback, MouseCallback mouseCallback) { // Mouse: 0 0001 xxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Keyboard: 0 0100 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx const int HalfBit_None = 0; const int HalfBit_Zero = 1; const int HalfBit_One = 2; for (int i = 0; i < timingData.Length; i++) { int duration = Math.Abs(timingData[i]); bool pulse = (timingData[i] > 0); #region Working data ... if (MCE_Data.State != MceKeyboardDetectState.Header) { switch (MCE_Data.HalfBit) { #region HalfBit_None case HalfBit_None: if (IsBetween(duration, 100, 450)) { MCE_Data.HalfBit = (pulse ? HalfBit_One : HalfBit_Zero); } else if (IsBetween(duration, 500, 800)) { //Trace.WriteLine("Bad bit sequence double {0}", pulse); MCE_Data.HalfBit = (pulse ? HalfBit_One : HalfBit_Zero); //MCE_Data = new MceDetectionData(); return; } else { // Over Length duration (Treat as a Zero bit) //Trace.WriteLine("Bad duration {0}", duration); MCE_Data.Working <<= 1; MCE_Data.Bit--; } break; #endregion HalfBit_None #region HalfBit_Zero case HalfBit_Zero: if (IsBetween(duration, 100, 450)) { if (pulse) { MCE_Data.Working <<= 1; MCE_Data.Bit--; MCE_Data.HalfBit = HalfBit_None; } else { //Trace.WriteLine("Bad bit sequence 00"); MCE_Data = new MceDetectionData(); //return; } } else if (IsBetween(duration, 500, 800)) { if (pulse) { MCE_Data.Working <<= 1; MCE_Data.Bit--; MCE_Data.HalfBit = HalfBit_One; } else { //Trace.WriteLine("Bad bit sequence 00 0"); MCE_Data = new MceDetectionData(); //return; } } else { //Trace.WriteLine("Bad duration {0}", duration); if (MCE_Data.Bit == 1) { MCE_Data.Working <<= 1; //MceKeyboard_Data.Working |= 1; MCE_Data.Bit--; MCE_Data.HalfBit = HalfBit_None; //i--; } else { MCE_Data = new MceDetectionData(); } //return; } break; #endregion HalfBit_Zero #region HalfBit_One case HalfBit_One: if (IsBetween(duration, 100, 450)) { if (!pulse) { MCE_Data.Working <<= 1; MCE_Data.Working |= 1; MCE_Data.Bit--; MCE_Data.HalfBit = HalfBit_None; } else { //Trace.WriteLine("Bad bit sequence 11"); MCE_Data = new MceDetectionData(); //return; } } else if (IsBetween(duration, 500, 800)) { if (!pulse) { MCE_Data.Working <<= 1; MCE_Data.Working |= 1; MCE_Data.Bit--; MCE_Data.HalfBit = HalfBit_Zero; } else { //Trace.WriteLine("Bad bit sequence 11 1"); MCE_Data = new MceDetectionData(); //return; } } else { //Trace.WriteLine("Bad duration {0}", duration); if (MCE_Data.Bit == 1) { MCE_Data.Working <<= 1; MCE_Data.Working |= 1; MCE_Data.Bit--; MCE_Data.HalfBit = HalfBit_None; //i--; } else { MCE_Data = new MceDetectionData(); //return; } } break; #endregion HalfBit_One } } #endregion Working data ... switch (MCE_Data.State) { #region Header case MceKeyboardDetectState.Header: if (pulse && IsBetween(duration, 2600, 3300)) { MCE_Data.State = MceKeyboardDetectState.CodeType; MCE_Data.Type = 0; MCE_Data.Bit = 5; MCE_Data.Working = 0; } break; #endregion Header #region CodeType case MceKeyboardDetectState.CodeType: if (MCE_Data.Bit == 0) { MCE_Data.Type = MCE_Data.Working; if (MCE_Data.Type == MceKeyboard) { MCE_Data.State = MceKeyboardDetectState.KeyboardIgnore; MCE_Data.Bit = 16; MCE_Data.Working = 0; } else if (MCE_Data.Type == MceMouse) { MCE_Data.State = MceKeyboardDetectState.MouseIgnore; MCE_Data.Bit = 8; MCE_Data.Working = 0; } else { //Trace.WriteLine("KB: Invalid Type {0}", MceKeyboard_Data.Type); return; } } break; #endregion CodeType #region Keyboard #region KeyboardIgnore case MceKeyboardDetectState.KeyboardIgnore: if (MCE_Data.Bit == 0) { MCE_Data.State = MceKeyboardDetectState.KeyCode; MCE_Data.Bit = 8; MCE_Data.Working = 0; } break; #endregion KeyboardIgnore #region KeyCode case MceKeyboardDetectState.KeyCode: if (MCE_Data.Bit == 0) { MCE_Data.KeyCode = MCE_Data.Working; MCE_Data.State = MceKeyboardDetectState.Modifiers; MCE_Data.Bit = 8; MCE_Data.Working = 0; } break; #endregion KeyCode #region Modifiers case MceKeyboardDetectState.Modifiers: if (MCE_Data.Bit == 0) { MCE_Data.Modifiers = MCE_Data.Working; keyboardCallback(MCE_Data.KeyCode, MCE_Data.Modifiers); MCE_Data = new MceDetectionData(); } break; #endregion Modifiers #endregion Keyboard #region Mouse #region MouseIgnore case MceKeyboardDetectState.MouseIgnore: if (MCE_Data.Bit == 0) { MCE_Data.State = MceKeyboardDetectState.DeltaY; MCE_Data.Bit = 7; MCE_Data.Working = 0; } break; #endregion MouseIgnore #region DeltaY case MceKeyboardDetectState.DeltaY: if (MCE_Data.Bit == 0) { MCE_Data.DeltaY = ScaleMouseDelta((int) MCE_Data.Working); MCE_Data.State = MceKeyboardDetectState.DeltaX; MCE_Data.Bit = 7; MCE_Data.Working = 0; } break; #endregion DeltaY #region DeltaX case MceKeyboardDetectState.DeltaX: if (MCE_Data.Bit == 0) { MCE_Data.DeltaX = ScaleMouseDelta((int) MCE_Data.Working); MCE_Data.State = MceKeyboardDetectState.Right; MCE_Data.Bit = 1; MCE_Data.Working = 0; } break; #endregion DeltaX #region Right case MceKeyboardDetectState.Right: if (MCE_Data.Bit == 0) { MCE_Data.Right = (MCE_Data.Working == 1); MCE_Data.State = MceKeyboardDetectState.Left; MCE_Data.Bit = 1; MCE_Data.Working = 0; } break; #endregion Right #region Left case MceKeyboardDetectState.Left: if (MCE_Data.Bit == 0) { MCE_Data.Left = (MCE_Data.Working == 1); MCE_Data.State = MceKeyboardDetectState.Checksum; MCE_Data.Bit = 5; MCE_Data.Working = 0; } break; #endregion Left #region Checksum case MceKeyboardDetectState.Checksum: if (MCE_Data.Bit == 0) { mouseCallback(MCE_Data.DeltaX, MCE_Data.DeltaY, MCE_Data.Right, MCE_Data.Left); MCE_Data = new MceDetectionData(); } break; #endregion Checksum #endregion Mouse } if (MCE_Data.Bit < 0) MCE_Data = new MceDetectionData(); } }
/// <summary> /// Decode timing data to discover IR Protocol and packet payload. /// </summary> /// <param name="timingData">Input timing data.</param> /// <param name="remoteCallback">Method to call when Remote button decoded.</param> /// <param name="keyboardCallback">Method to call when Keyboard event decoded.</param> /// <param name="mouseCallback">Method to call when Mouse event decoded.</param> public static void DecodeIR(int[] timingData, RemoteCallback remoteCallback, KeyboardCallback keyboardCallback, MouseCallback mouseCallback) { if (timingData == null) return; try { DetectDaewoo(timingData, remoteCallback); //DetectITT(timingData, remoteCallback); DetectJVC(timingData, remoteCallback); DetectMatsushita(timingData, remoteCallback); DetectMitsubishi(timingData, remoteCallback); DetectNEC(timingData, remoteCallback); DetectNRC17(timingData, remoteCallback); DetectPanasonic(timingData, remoteCallback); DetectRC5(timingData, remoteCallback); DetectRC6(timingData, remoteCallback); DetectRCA(timingData, remoteCallback); //DetectRCMM(timingData, remoteCallback); DetectRECS80(timingData, remoteCallback); //DetectSharp(timingData, remoteCallback); DetectSIRC(timingData, remoteCallback); DetectToshiba(timingData, remoteCallback); //DetectXSAT(timingData, remoteCallback); DetectMCE(timingData, keyboardCallback, mouseCallback); //DetectIMon(timingData, keyboardCallback, mouseCallback); } #if TRACE catch (Exception ex) { Trace.WriteLine(ex.ToString()); #else catch { #endif Daewoo_Data = new RemoteDetectionData(); JVC_Data = new RemoteDetectionData(); Matsushita_Data = new RemoteDetectionData(); Mitsubishi_Data = new RemoteDetectionData(); NEC_Data = new RemoteDetectionData(); NRC17_Data = new RemoteDetectionData(); Panasonic_Data = new RemoteDetectionData(); RC5_Data = new RemoteDetectionData(); RC6_Data = new RemoteDetectionData(); RCA_Data = new RemoteDetectionData(); RECS80_Data = new RemoteDetectionData(); SIRC_Data = new RemoteDetectionData(); Toshiba_Data = new RemoteDetectionData(); MCE_Data = new MceDetectionData(); } }
private void FireMouseCallback(MouseCallback data) { ThreadPool.QueueUserWorkItem(threadProc => _mouseCallback(data.Id, data.Code, data.State, data.X, data.Y, data.Info)); }
protected Driver(Guid deviceGuid, string devicePath, RemoteCallback remoteCallback, KeyboardCallback keyboardCallback, MouseCallback mouseCallback) { if (String.IsNullOrEmpty(devicePath)) throw new ArgumentNullException("devicePath"); _deviceGuid = deviceGuid; _devicePath = devicePath; _remoteCallback = remoteCallback; _keyboardCallback = keyboardCallback; _mouseCallback = mouseCallback; }
/** * パラメータに変化があった場合に呼び出されるメソッドを登録する */ public void SetMouseCallback(MouseCallback callback) { mouseInfoUpdater += callback; }
/// <summary> /// Creates a low-level mouse hook and hooks it. /// </summary> public LowLevelMouseHook(MouseCallback callback) : this() { this.MouseIntercepted = callback; StartHook(); }
public void SetMouseCallback(MouseCallback callback) { State.MouseFunction = callback; }
private static extern void __glutMouseFunc(MouseCallback func);
public DriverVista(Guid deviceGuid, string devicePath, RemoteCallback remoteCallback, KeyboardCallback keyboardCallback, MouseCallback mouseCallback) : base(deviceGuid, devicePath, remoteCallback, keyboardCallback, mouseCallback) { }
static bool ImGui_ImplGlfw_Init(Window window, bool installCallbacks) { windowHandle = window; time = 0.0f; ImGuiIOPtr io = ImGui.GetIO(); io.BackendFlags |= ImGuiBackendFlags.HasMouseCursors; io.BackendFlags |= ImGuiBackendFlags.HasSetMousePos; //io.BackendPlatformName = "imgui_impl_glfw"; io.KeyMap[(int)ImGuiKey.Tab] = (int)Keys.Tab; io.KeyMap[(int)ImGuiKey.LeftArrow] = (int)Keys.Left; io.KeyMap[(int)ImGuiKey.RightArrow] = (int)Keys.Right; io.KeyMap[(int)ImGuiKey.UpArrow] = (int)Keys.Up; io.KeyMap[(int)ImGuiKey.DownArrow] = (int)Keys.Down; io.KeyMap[(int)ImGuiKey.PageUp] = (int)Keys.PageUp; io.KeyMap[(int)ImGuiKey.PageDown] = (int)Keys.PageDown; io.KeyMap[(int)ImGuiKey.Home] = (int)Keys.Home; io.KeyMap[(int)ImGuiKey.End] = (int)Keys.End; io.KeyMap[(int)ImGuiKey.Insert] = (int)Keys.Insert; io.KeyMap[(int)ImGuiKey.Delete] = (int)Keys.Delete; io.KeyMap[(int)ImGuiKey.Backspace] = (int)Keys.Backspace; io.KeyMap[(int)ImGuiKey.Space] = (int)Keys.Space; io.KeyMap[(int)ImGuiKey.Enter] = (int)Keys.Enter; io.KeyMap[(int)ImGuiKey.Escape] = (int)Keys.Escape; io.KeyMap[(int)ImGuiKey.KeyPadEnter] = (int)Keys.NumpadEnter; io.KeyMap[(int)ImGuiKey.A] = (int)Keys.A; io.KeyMap[(int)ImGuiKey.C] = (int)Keys.C; io.KeyMap[(int)ImGuiKey.V] = (int)Keys.V; io.KeyMap[(int)ImGuiKey.X] = (int)Keys.X; io.KeyMap[(int)ImGuiKey.Y] = (int)Keys.Y; io.KeyMap[(int)ImGuiKey.Z] = (int)Keys.Z; // io.SetClipboardTextFn = ImGui_ImplGlfw_SetClipboardText; // io.GetClipboardTextFn = ImGui_ImplGlfw_GetClipboardText; // io.ClipboardUserData = g_Window; //#if defined(_WIN32) // io.ImeWindowHandle = (void*)glfwGetWin32Window(g_Window); //#endif ErrorCallback prev_error_callback = Glfw.SetErrorCallback(null); mouseCursors[(int)ImGuiMouseCursor.Arrow] = Glfw.CreateStandardCursor(CursorType.Arrow); mouseCursors[(int)ImGuiMouseCursor.TextInput] = Glfw.CreateStandardCursor(CursorType.Beam); mouseCursors[(int)ImGuiMouseCursor.ResizeNS] = Glfw.CreateStandardCursor(CursorType.ResizeVertical); mouseCursors[(int)ImGuiMouseCursor.ResizeEW] = Glfw.CreateStandardCursor(CursorType.ResizeHorizontal); mouseCursors[(int)ImGuiMouseCursor.Hand] = Glfw.CreateStandardCursor(CursorType.Hand); // if GLFW_HAS_NEW_CURSORS //mouseCursors[(int)ImGuiMouseCursor.ResizeAll] = GLFW.Glfw.CreateStandardCursor(GLFW.CursorType. GLFW_RESIZE_ALL_CURSOR); //mouseCursors[(int)ImGuiMouseCursor.ResizeNESW] = GLFW.Glfw.CreateStandardCursor(GLFW.CursorType. GLFW_RESIZE_NESW_CURSOR); //mouseCursors[(int)ImGuiMouseCursor.ResizeNWSE] = GLFW.Glfw.CreateStandardCursor(GLFW.CursorType. GLFW_RESIZE_NWSE_CURSOR); //mouseCursors[(int)ImGuiMouseCursor.NotAllowed] = GLFW.Glfw.CreateStandardCursor(GLFW.CursorType. GLFW_NOT_ALLOWED_CURSOR); mouseCursors[(int)ImGuiMouseCursor.ResizeAll] = Glfw.CreateStandardCursor(CursorType.Arrow); mouseCursors[(int)ImGuiMouseCursor.ResizeNESW] = Glfw.CreateStandardCursor(CursorType.Arrow); mouseCursors[(int)ImGuiMouseCursor.ResizeNWSE] = Glfw.CreateStandardCursor(CursorType.Arrow); mouseCursors[(int)ImGuiMouseCursor.NotAllowed] = Glfw.CreateStandardCursor(CursorType.Arrow); Glfw.SetErrorCallback(prev_error_callback); prevUserCallbackMousebutton = null; prevUserCallbackScroll = null; prevUserCallbackKey = null; prevUserCallbackChar = null; if (installCallbacks) { installedCallbacks = true; prevUserCallbackMousebutton = Glfw.SetMouseButtonCallback(windowHandle, mousebuttonCallbackHolder = ImGui_ImplGlfw_MouseButtonCallback); prevUserCallbackScroll = Glfw.SetScrollCallback(windowHandle, scrollCallbackHolder = ImGui_ImplGlfw_ScrollCallback); prevUserCallbackKey = Glfw.SetKeyCallback(windowHandle, keyCallbackHolder = ImGui_ImplGlfw_KeyCallback); prevUserCallbackChar = Glfw.SetCharCallback(windowHandle, charCallbackHolder = ImGui_ImplGlfw_CharCallback); } return(true); }
internal CallbackBinder (Callback callback) { this.OnWidgetLoaded = new CallbackVoid (callback.OnWidgetLoaded); this.OnStateChange = new CallbackOnStateChange (callback.OnStateChange); this.OnProgress = new CallbackOnProgress (callback.OnProgress); this.OnLocationChanged = new CallbackOnLocationChanged (callback.OnLocationChanged); this.OnStatusChange = new CallbackOnStatusChange (callback.OnStatusChange); this.OnSecurityChange = new CallbackOnSecurityChange (callback.OnSecurityChange); this.OnKeyDown = new KeyCallback (callback.OnClientDomKeyDown); this.OnKeyUp = new KeyCallback (callback.OnClientDomKeyUp); this.OnKeyPress = new KeyCallback (callback.OnClientDomKeyPress); this.OnMouseDown = new MouseCallback (callback.OnClientMouseDown); this.OnMouseUp = new MouseCallback (callback.OnClientMouseUp); this.OnMouseClick = new MouseCallback (callback.OnClientMouseClick); this.OnMouseDoubleClick = new MouseCallback (callback.OnClientMouseDoubleClick); this.OnMouseOver = new MouseCallback (callback.OnClientMouseOver); this.OnMouseOut = new MouseCallback (callback.OnClientMouseOut); this.OnActivate = new Callback2 (callback.OnClientActivate); this.OnFocus = new Callback2 (callback.OnClientFocus); this.OnBlur = new Callback2 (callback.OnClientBlur); this.OnAlert = new CallbackPtrPtr (callback.OnAlert); this.OnAlertCheck = new CallbackOnAlertCheck (callback.OnAlertCheck); this.OnConfirm = new CallbackOnConfirm (callback.OnConfirm); this.OnConfirmCheck = new CallbackOnConfirmCheck (callback.OnConfirmCheck); this.OnConfirmEx = new CallbackOnConfirmEx (callback.OnConfirmEx); this.OnPrompt = new CallbackOnPrompt (callback.OnPrompt); this.OnPromptUsernameAndPassword = new CallbackOnPromptUsernameAndPassword (callback.OnPromptUsernameAndPassword); this.OnPromptPassword = new CallbackOnPromptPassword (callback.OnPromptPassword); this.OnSelect = new CallbackOnSelect (callback.OnSelect); this.OnLoad = new CallbackVoid (callback.OnLoad); this.OnUnload = new CallbackVoid (callback.OnUnload); this.OnShowContextMenu = new CallbackOnShowContextMenu (callback.OnShowContextMenu); this.OnGeneric = new CallbackWString (callback.OnGeneric); }
public MouseHooker(MouseCallback callback) { mc = callback; }
/// <summary> /// Sets the mouse callback for the current window. /// </summary> /// <param name="func"> /// The new mouse callback function. See <see cref="MouseCallback" />. /// </param> /// <remarks> /// <para> /// <b>glutMouseFunc</b> sets the mouse callback for the current window. When a /// user presses and releases mouse buttons in the window, each press and each /// release generates a mouse callback. The <i>button</i> parameter is one of /// <see cref="GLUT_LEFT_BUTTON" />, <see cref="GLUT_MIDDLE_BUTTON" />, or /// <see cref="GLUT_RIGHT_BUTTON" />. For systems with only two mouse buttons, it /// may not be possible to generate the <i>GLUT_MIDDLE_BUTTON</i> callback. For /// systems with a single mouse button, it may be possible to generate only a /// <i>GLUT_LEFT_BUTTON</i> callback. The <i>state</i> parameter is either /// <see cref="GLUT_UP" /> or <see cref="GLUT_DOWN" /> indicating whether the /// callback was due to a release or press respectively. The <i>x</i> and /// <i>y</i> callback parameters indicate the window relative coordinates when the /// mouse button state changed. If a <i>GLUT_DOWN</i> callback for a specific /// button is triggered, the program can assume a <i>GLUT_UP</i> callback for the /// same button will be generated (assuming the window still has a mouse callback /// registered) when the mouse button is released even if the mouse has moved /// outside the window. /// </para> /// <para> /// If a menu is attached to a button for a window, mouse callbacks will not be /// generated for that button. /// </para> /// <para> /// During a mouse callback, <see cref="glutGetModifiers" /> may be called to /// determine the state of modifier keys when the mouse event generating the /// callback occurred. /// </para> /// <para> /// Passing <c>null</c> to <b>glutMouseFunc</b> disables the generation of mouse /// callbacks. /// </para> /// </remarks> /// <seealso cref="MouseCallback" /> /// <seealso cref="glutGetModifiers" /> // GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y)); public static void glutMouseFunc([In] MouseCallback func) { mouseCallback = func; __glutMouseFunc(mouseCallback); }
public static extern ExceptionStatus highgui_setMouseCallback(string winName, [MarshalAs(UnmanagedType.FunctionPtr)] MouseCallback onMouse, IntPtr userData);
/// <summary> /// Assigns a callback for mouse events. /// </summary> /// <param name="onMouse"> /// The callback method that will handle mouse events of this named window. /// </param> public void SetMouseCallback(MouseCallback onMouse) { mouseCallback = (evt, x, y, flags, param) => onMouse(evt, x, y, flags); NativeMethods.cvSetMouseCallback(name, mouseCallback, IntPtr.Zero); }
internal static extern void SetMouseCallback(MouseCallback callback);
public DriverReplacement(Guid deviceGuid, string devicePath, RemoteCallback remoteCallback, KeyboardCallback keyboardCallback, MouseCallback mouseCallback) : base(deviceGuid, devicePath, remoteCallback, keyboardCallback, mouseCallback) { if (devicePath.IndexOf(VidSMK, StringComparison.OrdinalIgnoreCase) != -1 || devicePath.IndexOf(VidTopseed, StringComparison.OrdinalIgnoreCase) != -1) _deviceType = DeviceType.SmkTopseed; else _deviceType = DeviceType.Microsoft; }