iOSEvents.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2013 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 MAC_CARB_EVENTS_H
  23. #define MAC_CARB_EVENTS_H
  24. /// Hides the mouse cursor when the mouse is locked, when we are in fullscreen
  25. /// mode, and when the cursor is inside the window bounds.
  26. /// Optionally takes the cursor location, in window local coords.
  27. //void iOSCheckHideCursor(S32 x=-1, S32 y=-1);
  28. /// Hides or shows the system mouse cursor, regardless of the mouse position,
  29. /// and tracks the hidden state.
  30. //void iOSSetHideCursor(bool shouldHide);
  31. /// Install event loop timer, replacing any existing event loop timer.
  32. /// This is useful for updating the sleep time
  33. void iOSRunEventLoopTimer(S32 intervalMs);
  34. /// Install event handlers on the current window & on the app.
  35. void iOSInstallCarbonEventHandlers(void);
  36. /// Remove all event handlers, except the alert event handlers.
  37. void iOSRemoveCarbonEventHandlers(void);
  38. /// Install event handlers for custom Torque inter-thread communication.
  39. /// This must be called before starting multithreaded execution in main().
  40. void iOSInstallTorqueCarbonEventHandlers(void);
  41. /// Handle an HICommand that comes from a native MacOSX menu.
  42. /// Returns false if the command can't be handled.
  43. bool iOSHandleMenuCommand(void* hiCommand);
  44. /// create an event of class kEventClassTorque, and send it to the main thread
  45. void iOSSendTorqueEventToMain( U32 eventKind, void* userData = NULL );
  46. /// event type for alerts. The event class is an arbitrary val, it must not collide w/ kEventApp* .
  47. const U32 kEventClassTorque = 'TORQ';
  48. const U32 kEventTorqueAlert = 1;
  49. const U32 kEventTorqueFadeInWindow = 2;
  50. const U32 kEventTorqueFadeOutWindow = 3;
  51. const U32 kEventTorqueReleaseWindow = 4;
  52. const U32 kEventTorqueShowMenuBar = 5;
  53. const U32 kEventTorqueModalDialog = 6;
  54. const U32 kEventTorqueDrawMenuBar = 7;
  55. const U32 kEventParamTorqueData = 'tDAT'; // typeVoidPtr void*
  56. //const U32 kEventParamTorqueSemaphorePtr = 'tSEM'; // typeVoidPtr void*
  57. //const U32 kEventParamTorqueDialogRef = 'tDRF'; // typeDialogRef DialogRef
  58. //const U32 kEventParamTorqueHitPtr = 'tHIT'; // typeVoidPtr U32*
  59. //const U32 typeDialogRef = 'dlog'; // oddly, not provided in Frameworks.
  60. // this command id is used for all dynamically created menus.
  61. const U32 kHICommandTorque = 'TORQ';
  62. #endif