winDispatch.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _WINDOWMANAGER_WIN32_WINDISPATCH_H_
  23. #define _WINDOWMANAGER_WIN32_WINDISPATCH_H_
  24. //
  25. // *** This header requires that Window.h be included before this.
  26. //
  27. /// Some events must be processed immediately, and others can or should be
  28. /// processed later. This enum allows us to distinguish between the two
  29. /// types.
  30. enum DispatchType {
  31. DelayedDispatch,
  32. ImmediateDispatch,
  33. };
  34. /// Dispatch the event into the journaling system.
  35. ///
  36. /// Dispatch Win32 events into the journaling system. To avoid problems
  37. /// with journaling, events should normally use the DelayedDispatch type.
  38. ///
  39. /// Delayed events are pushed onto a queue for later processing by DispatchNext().
  40. void Dispatch(DispatchType,HWND hWnd,UINT message,WPARAM wparam,WPARAM lparam);
  41. /// Remove messages from the event queue, matching a msg value range or hWnd
  42. ///
  43. /// If no filter is specified, either HWND or MessageRange, nothing will be removed
  44. /// You may not match HWND and MsgRange both, currently.
  45. ///
  46. /// Message Range is calculated as follows.
  47. /// @li Both Begin and End are specified as message values, ex WM_MOUSEMOVE
  48. /// @li Specifying an identical set of begin/end will remove all messages matching that message value (WM_MOUSEMOVE)
  49. /// @li If you specify a range it will remove from that beginning value through the end value
  50. ///
  51. /// @note : The range is useful because on windows messages declared such that you can filter a block of
  52. /// messages just by specifying the beginning value and end.
  53. /// ex. WM_MOUSEFIRST,WM_MOUSELAST range will match all mouse messages.
  54. ///
  55. /// @param hWnd The HWND to filter by, this cannot be combined with a msg range filter currently
  56. /// @param msgBegin The beginning msg value to filter from
  57. /// @param msgEnd The ending msg value to filter to
  58. void RemoveMessages(HWND hWnd,UINT msgBegin,UINT msgEnd );
  59. /// Dispatch the next event in the delayed dispatch queue.
  60. /// This function should be called outside of any journaled calls.
  61. /// Returns true if an event was dispatched.
  62. bool DispatchNext();
  63. /// Remove events related to the window from the dispatch queue.
  64. void DispatchRemove(HWND hWnd);
  65. #endif