Manual_UI.cpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #include "../Precompiled.h"
  4. #include "../AngelScript/APITemplates.h"
  5. #include "../AngelScript/Manual_UI.h"
  6. namespace Urho3D
  7. {
  8. // This function is called before ASRegisterGenerated()
  9. void ASRegisterManualFirst_UI(asIScriptEngine* engine)
  10. {
  11. }
  12. // ========================================================================================
  13. // template <class T> T* Context::GetSubsystem() const | File: ../Core/Context.h
  14. static UI* GetUI()
  15. {
  16. return GetScriptContext()->GetSubsystem<UI>();
  17. }
  18. // This function is called after ASRegisterGenerated()
  19. void ASRegisterManualLast_UI(asIScriptEngine* engine)
  20. {
  21. // template <class T> T* Context::GetSubsystem() const | File: ../Core/Context.h
  22. engine->RegisterGlobalFunction("UI@+ get_ui()", AS_FUNCTION(GetUI), AS_CALL_CDECL);
  23. }
  24. // ========================================================================================
  25. // SharedPtr<UIElement> UI::LoadLayout(Deserializer& source, XMLFile* styleFile = nullptr) | File: ../UI/UI.h
  26. UIElement* UI_LoadLayout_File(File* file, UI* ptr)
  27. {
  28. if (file)
  29. {
  30. SharedPtr<UIElement> root = ptr->LoadLayout(*file);
  31. if (root)
  32. root->AddRef();
  33. return root.Get();
  34. }
  35. else
  36. return nullptr;
  37. }
  38. // SharedPtr<UIElement> UI::LoadLayout(Deserializer& source, XMLFile* styleFile = nullptr) | File: ../UI/UI.h
  39. UIElement* UI_LoadLayout_VectorBuffer(VectorBuffer& buffer, UI* ptr)
  40. {
  41. SharedPtr<UIElement> root = ptr->LoadLayout(buffer);
  42. if (root)
  43. root->AddRef();
  44. return root.Get();
  45. }
  46. // SharedPtr<UIElement> UI::LoadLayout(Deserializer& source, XMLFile* styleFile = nullptr) | File: ../UI/UI.h
  47. UIElement* UI_LoadLayout_File_Style(File* file, XMLFile* styleFile, UI* ptr)
  48. {
  49. if (file)
  50. {
  51. SharedPtr<UIElement> root = ptr->LoadLayout(*file, styleFile);
  52. if (root)
  53. root->AddRef();
  54. return root.Get();
  55. }
  56. else
  57. return nullptr;
  58. }
  59. // SharedPtr<UIElement> UI::LoadLayout(Deserializer& source, XMLFile* styleFile = nullptr) | File: ../UI/UI.h
  60. UIElement* UI_LoadLayout_VectorBuffer_Style(VectorBuffer& buffer, XMLFile* styleFile, UI* ptr)
  61. {
  62. SharedPtr<UIElement> root = ptr->LoadLayout(buffer, styleFile);
  63. if (root)
  64. root->AddRef();
  65. return root.Get();
  66. }
  67. // bool UI::SaveLayout(Serializer& dest, UIElement* element) | File: ../UI/UI.h
  68. bool UI_SaveLayout_File(File* file, UIElement* element, UI* ptr)
  69. {
  70. return file && ptr->SaveLayout(*file, element);
  71. }
  72. // bool UI::SaveLayout(Serializer& dest, UIElement* element) | File: ../UI/UI.h
  73. bool UI_SaveLayout_VectorBuffer(VectorBuffer& buffer, UIElement* element, UI* ptr)
  74. {
  75. return ptr->SaveLayout(buffer, element);
  76. }
  77. // const Vector<UIElement*> UI::GetDragElements() | File: ../UI/UI.h
  78. CScriptArray* UI_GetDragElements(UI* ptr)
  79. {
  80. return VectorToHandleArray(ptr->GetDragElements(), "const Array<UIElement@>@");
  81. }
  82. // void UI::SetFocusElement(UIElement* element, bool byKey = false) | File: ../UI/UI.h
  83. void UI_SetFocusElement(UIElement* element, UI* ptr)
  84. {
  85. ptr->SetFocusElement(element);
  86. }
  87. }