2
0

guiDragAndDropCtrl_ScriptBinding.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. ConsoleMethodGroupBeginWithDocs(GuiDragAndDropCtrl, GuiControl)
  23. /*! Simulates a cursor down event on the control with an optional offset to be used when tracking the cursor.
  24. @param x The horizontal offset from the top left corner of the control. Defaults to 0.
  25. @param y The vertical offset from the top left corner of the control. Defaults to 0.
  26. @return No return value.
  27. */
  28. ConsoleMethodWithDocs(GuiDragAndDropCtrl, startDragging, ConsoleVoid, 2, 4, "( [S32 x], [S32 y] )")
  29. {
  30. Point2I offset = Point2I(0, 0);
  31. if (argc > 2)
  32. {
  33. offset.x = dAtoi(argv[2]);
  34. }
  35. if (argc > 3)
  36. {
  37. offset.y = dAtoi(argv[3]);
  38. }
  39. object->startDragging(offset);
  40. }
  41. ConsoleMethodGroupEndWithDocs(GuiDragAndDropCtrl)