guiFrameSetCtrl_ScriptBinding.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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(GuiFrameSetCtrl, GuiControl)
  23. /*! Splits the frame with the frameID given into two frames with one on top and one on bottom. The existing control will move to the first frame.
  24. @param frameID The frameID that should be split.
  25. @return (int frameID1/int frameID2) The resulting two frameIDs seperated by a space.
  26. */
  27. ConsoleMethodWithDocs(GuiFrameSetCtrl, createVerticalSplit, ConsoleString, 3, 3, (int frameID))
  28. {
  29. Point2I point = object->splitFrame(dAtoi(argv[2]), true);
  30. char* retBuffer = Con::getReturnBuffer(64);
  31. dSprintf(retBuffer, 64, "%d %d", point.x, point.y);
  32. return retBuffer;
  33. }
  34. /*! Splits the frame with the frameID given into two frames with one on the left and one on the right. The existing control will move to the first frame.
  35. @param frameID The frameID that should be split.
  36. @return (int frameID1/int frameID2) The resulting two frameIDs seperated by a space.
  37. */
  38. ConsoleMethodWithDocs(GuiFrameSetCtrl, createHorizontalSplit, ConsoleString, 3, 3, (int frameID))
  39. {
  40. Point2I point = object->splitFrame(dAtoi(argv[2]), false);
  41. char* retBuffer = Con::getReturnBuffer(64);
  42. dSprintf(retBuffer, 64, "%d %d", point.x, point.y);
  43. return retBuffer;
  44. }
  45. /*! This anchors a frame and unachors it's twin. An anchored frame tries to stay the same size when its parent resizes. It can still be resized by the user.
  46. @param frameID The frameID that should be anchored.
  47. @return No return value.
  48. */
  49. ConsoleMethodWithDocs(GuiFrameSetCtrl, anchorFrame, ConsoleVoid, 3, 3, (int frameID))
  50. {
  51. object->anchorFrame(dAtoi(argv[2]));
  52. }
  53. /*! Sets the width or height of a frame depending on if its parent is split horizontally or vertically.
  54. @param frameID The frameID that should be set.
  55. @param size The size in pixels to set the width or height to.
  56. @return No return value.
  57. */
  58. ConsoleMethodWithDocs(GuiFrameSetCtrl, setFrameSize, ConsoleVoid, 4, 4, (int frameID, int size))
  59. {
  60. object->setFrameSize(dAtoi(argv[2]), dAtoi(argv[3]));
  61. }
  62. ConsoleMethodGroupEndWithDocs(GuiFrameSetCtrl)