Manual_UI.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. //
  2. // Copyright (c) 2008-2020 the Urho3D project.
  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 deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // 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 FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include "../UI/Font.h"
  24. #include "../UI/ListView.h"
  25. #include "../UI/DropDownList.h"
  26. #include "../UI/FileSelector.h"
  27. #include "../UI/UI.h"
  28. namespace Urho3D
  29. {
  30. // bool Font::SaveXML(Serializer &dest, int pointSize, bool usedGlyphs=false, const String &indentation="\t") | File: ../UI/Font.h
  31. bool FontSaveXMLVectorBuffer(VectorBuffer& buffer, int pointSize, bool usedGlyphs, const String& indentation, Font* ptr);
  32. // bool Font::SaveXML(Serializer &dest, int pointSize, bool usedGlyphs=false, const String &indentation="\t") | File: ../UI/Font.h
  33. bool FontSaveXML(const String& fileName, int pointSize, bool usedGlyphs, const String& indentation, Font* ptr);
  34. // bool Font::SaveXML(Serializer &dest, int pointSize, bool usedGlyphs=false, const String &indentation="\t") | File: ../UI/Font.h
  35. bool FontSaveXMLFile(File* file, int pointSize, bool usedGlyphs, const String& indentation, Font* ptr);
  36. #define REGISTER_MANUAL_PART_Font(T, className) \
  37. /* bool Font::SaveXML(Serializer &dest, int pointSize, bool usedGlyphs=false, const String &indentation="\t") | File: ../UI/Font.h */ \
  38. engine->RegisterObjectMethod(className, "bool SaveXML(File@+, int, bool usedGlyphs = false, const String&in indentation = \"\t\")", asFUNCTION(FontSaveXMLFile), asCALL_CDECL_OBJLAST); \
  39. /* bool Font::SaveXML(Serializer &dest, int pointSize, bool usedGlyphs=false, const String &indentation="\t") | File: ../UI/Font.h */ \
  40. engine->RegisterObjectMethod(className, "bool SaveXML(VectorBuffer&, int, bool usedGlyphs = false, const String&in indentation = \"\t\")", asFUNCTION(FontSaveXMLVectorBuffer), asCALL_CDECL_OBJLAST); \
  41. /* bool Font::SaveXML(Serializer &dest, int pointSize, bool usedGlyphs=false, const String &indentation="\t") | File: ../UI/Font.h */ \
  42. engine->RegisterObjectMethod(className, "bool SaveXML(const String&in, int, bool usedGlyphs = false, const String&in indentation = \"\t\")", asFUNCTION(FontSaveXML), asCALL_CDECL_OBJLAST);
  43. // ========================================================================================
  44. // bool UIElement::LoadXML(Deserializer &source) | File: ../UI/UIElement.h
  45. bool UIElementLoadXML(File* file, UIElement* ptr);
  46. // bool UIElement::LoadXML(Deserializer &source) | File: ../UI/UIElement.h
  47. bool UIElementLoadXMLVectorBuffer(VectorBuffer& buffer, UIElement* ptr);
  48. // bool UIElement::LoadXML(Deserializer &source) | File: ../UI/UIElement.h
  49. bool UIElementLoadXML(XMLFile* file, XMLFile* styleFile, UIElement* ptr);
  50. // virtual UIElement* UIElement::LoadChildXML(const XMLElement &childElem, XMLFile *styleFile) | File: ../UI/UIElement.h
  51. UIElement* UIElementLoadChildXML(XMLFile* file, XMLFile* styleFile, UIElement* ptr);
  52. // bool UIElement::SaveXML(Serializer &dest, const String &indentation="\t") const | File: ../UI/UIElement.h
  53. bool UIElementSaveXML(File* file, const String& indentation, UIElement* ptr);
  54. // bool UIElement::SaveXML(Serializer &dest, const String &indentation="\t") const | File: ../UI/UIElement.h
  55. bool UIElementSaveXMLVectorBuffer(VectorBuffer& buffer, const String& indentation, UIElement* ptr);
  56. // void UIElement::RemoveChildAtIndex(unsigned index) | File: ../UI/UIElement.h
  57. void UIElementRemoveChild(unsigned index, UIElement* ptr);
  58. // bool UIElement::SetStyle(const String &styleName, XMLFile *file=nullptr) | File: ../UI/UIElement.h
  59. void UIElementSetStyle(const String& styleName, UIElement* ptr);
  60. // unsigned UIElement::GetNumChildren(bool recursive=false) const | File: ../UI/UIElement.h
  61. unsigned UIElementGetNumChildrenNonRecursive(UIElement* ptr);
  62. // unsigned UIElement::GetNumChildren(bool recursive=false) const | File: ../UI/UIElement.h
  63. unsigned UIElementGetNumChildrenRecursive(UIElement* ptr);
  64. // void UIElement::SetParent(UIElement *parent, unsigned index=M_MAX_UNSIGNED) | File: ../UI/UIElement.h
  65. void UIElementSetParent(UIElement* parent, UIElement* ptr);
  66. // XMLFile* UIElement::GetDefaultStyle(bool recursiveUp=true) const | File: ../UI/UIElement.h
  67. XMLFile* UIElementGetDefaultStyle(UIElement* ptr);
  68. // const VariantMap& UIElement::GetVars() const | File: ../UI/UIElement.h
  69. VariantMap& UIElementGetVars(UIElement* ptr);
  70. // TODO: Check LoadXML 3 versions and SaveXML 3 versions
  71. #define REGISTER_MANUAL_PART_UIElement(T, className) \
  72. RegisterNamedObjectConstructor<T>(engine, className); \
  73. /* bool UIElement::LoadXML(Deserializer &source) | File: ../UI/UIElement.h */ \
  74. /*engine->RegisterObjectMethod(className, "bool LoadXML(File@+)", asFUNCTIONPR(UIElementLoadXML, (File*, UIElement*), bool), asCALL_CDECL_OBJLAST); */\
  75. /* bool UIElement::LoadXML(Deserializer &source) | File: ../UI/UIElement.h */ \
  76. engine->RegisterObjectMethod(className, "bool LoadXML(VectorBuffer&)", asFUNCTIONPR(UIElementLoadXMLVectorBuffer, (VectorBuffer&, UIElement*), bool), asCALL_CDECL_OBJLAST); \
  77. /* bool UIElement::LoadXML(Deserializer &source) | File: ../UI/UIElement.h */ \
  78. /*engine->RegisterObjectMethod(className, "bool LoadXML(XMLFile@+, XMLFile@+)", asFUNCTIONPR(UIElementLoadXML, (XMLFile*, XMLFile*, UIElement*), bool), asCALL_CDECL_OBJLAST); */\
  79. /* virtual UIElement* UIElement::LoadChildXML(const XMLElement &childElem, XMLFile *styleFile) | File: ../UI/UIElement.h */ \
  80. engine->RegisterObjectMethod(className, "UIElement@+ LoadChildXML(XMLFile@+, XMLFile@+)", asFUNCTION(UIElementLoadChildXML), asCALL_CDECL_OBJLAST); \
  81. /* bool UIElement::SaveXML(Serializer &dest, const String &indentation="\t") const | File: ../UI/UIElement.h */ \
  82. /*engine->RegisterObjectMethod(className, "bool SaveXML(File@+, const String&in indentation = \"\t\")", asFUNCTION(UIElementSaveXML), asCALL_CDECL_OBJLAST); */\
  83. /* bool UIElement::SaveXML(Serializer &dest, const String &indentation="\t") const | File: ../UI/UIElement.h */ \
  84. engine->RegisterObjectMethod(className, "bool SaveXML(VectorBuffer&, const String&in indentation = \"\t\")", asFUNCTION(UIElementSaveXMLVectorBuffer), asCALL_CDECL_OBJLAST); \
  85. /* void UIElement::RemoveChildAtIndex(unsigned index) | File: ../UI/UIElement.h */ \
  86. engine->RegisterObjectMethod(className, "void RemoveChild(uint)", asFUNCTIONPR(UIElementRemoveChild, (unsigned, UIElement*), void), asCALL_CDECL_OBJLAST); \
  87. /* bool UIElement::SetStyle(const String &styleName, XMLFile *file=nullptr) | File: ../UI/UIElement.h */ \
  88. engine->RegisterObjectMethod(className, "void set_style(const String&in)", asFUNCTION(UIElementSetStyle), asCALL_CDECL_OBJLAST); \
  89. /* unsigned UIElement::GetNumChildren(bool recursive=false) const | File: ../UI/UIElement.h */ \
  90. engine->RegisterObjectMethod(className, "uint get_numChildren() const", asFUNCTION(UIElementGetNumChildrenNonRecursive), asCALL_CDECL_OBJLAST); \
  91. /* unsigned UIElement::GetNumChildren(bool recursive=false) const | File: ../UI/UIElement.h */ \
  92. engine->RegisterObjectMethod(className, "uint get_numAllChildren() const", asFUNCTION(UIElementGetNumChildrenRecursive), asCALL_CDECL_OBJLAST); \
  93. /* void UIElement::SetParent(UIElement *parent, unsigned index=M_MAX_UNSIGNED) | File: ../UI/UIElement.h */ \
  94. engine->RegisterObjectMethod(className, "void set_parent(UIElement@+)", asFUNCTION(UIElementSetParent), asCALL_CDECL_OBJLAST); \
  95. /* XMLFile* UIElement::GetDefaultStyle(bool recursiveUp=true) const | File: ../UI/UIElement.h */ \
  96. engine->RegisterObjectMethod(className, "XMLFile@+ get_defaultStyle() const", asFUNCTION(UIElementGetDefaultStyle), asCALL_CDECL_OBJLAST); \
  97. /* const VariantMap& UIElement::GetVars() const | File: ../UI/UIElement.h */ \
  98. engine->RegisterObjectMethod(className, "VariantMap& get_vars()", asFUNCTION(UIElementGetVars), asCALL_CDECL_OBJLAST);
  99. // ========================================================================================
  100. // SharedPtr<UIElement> UI::LoadLayout(Deserializer &source, XMLFile *styleFile=nullptr) | File: ../UI/UI.h
  101. UIElement* UILoadLayoutFromFile(File* file, UI* ptr);
  102. // SharedPtr<UIElement> UI::LoadLayout(Deserializer &source, XMLFile *styleFile=nullptr) | File: ../UI/UI.h
  103. UIElement* UILoadLayoutFromVectorBuffer(VectorBuffer& buffer, UI* ptr);
  104. // SharedPtr<UIElement> UI::LoadLayout(Deserializer &source, XMLFile *styleFile=nullptr) | File: ../UI/UI.h
  105. UIElement* UILoadLayoutFromFileWithStyle(File* file, XMLFile* styleFile, UI* ptr);
  106. // SharedPtr<UIElement> UI::LoadLayout(Deserializer &source, XMLFile *styleFile=nullptr) | File: ../UI/UI.h
  107. UIElement* UILoadLayoutFromVectorBufferWithStyle(VectorBuffer& buffer, XMLFile* styleFile, UI* ptr);
  108. // bool UI::SaveLayout(Serializer &dest, UIElement *element) | File: ../UI/UI.h
  109. bool UISaveLayout(File* file, UIElement* element, UI* ptr);
  110. // bool UI::SaveLayout(Serializer &dest, UIElement *element) | File: ../UI/UI.h
  111. bool UISaveLayoutVectorBuffer(VectorBuffer& buffer, UIElement* element, UI* ptr);
  112. // const Vector<UIElement*> UI::GetDragElements() | File: ../UI/UI.h
  113. CScriptArray* UIGetDragElements(UI* ptr);
  114. // void UI::SetFocusElement(UIElement *element, bool byKey=false) | File: ../UI/UI.h
  115. void UISetFocusElement(UIElement* element, UI* ptr);
  116. #define REGISTER_MANUAL_PART_UI(T, className) \
  117. /* SharedPtr<UIElement> UI::LoadLayout(Deserializer &source, XMLFile *styleFile=nullptr) | File: ../UI/UI.h */ \
  118. engine->RegisterObjectMethod(className, "UIElement@ LoadLayout(File@+)", asFUNCTION(UILoadLayoutFromFile), asCALL_CDECL_OBJLAST); \
  119. /* SharedPtr<UIElement> UI::LoadLayout(Deserializer &source, XMLFile *styleFile=nullptr) | File: ../UI/UI.h */ \
  120. engine->RegisterObjectMethod(className, "UIElement@ LoadLayout(File@+, XMLFile@+)", asFUNCTION(UILoadLayoutFromFileWithStyle), asCALL_CDECL_OBJLAST); \
  121. /* SharedPtr<UIElement> UI::LoadLayout(Deserializer &source, XMLFile *styleFile=nullptr) | File: ../UI/UI.h */ \
  122. engine->RegisterObjectMethod(className, "UIElement@ LoadLayout(VectorBuffer&)", asFUNCTION(UILoadLayoutFromVectorBuffer), asCALL_CDECL_OBJLAST); \
  123. /* SharedPtr<UIElement> UI::LoadLayout(Deserializer &source, XMLFile *styleFile=nullptr) | File: ../UI/UI.h */ \
  124. engine->RegisterObjectMethod(className, "UIElement@ LoadLayout(VectorBuffer&, XMLFile@+)", asFUNCTION(UILoadLayoutFromVectorBufferWithStyle), asCALL_CDECL_OBJLAST); \
  125. /* bool UI::SaveLayout(Serializer &dest, UIElement *element) | File: ../UI/UI.h */ \
  126. engine->RegisterObjectMethod(className, "bool SaveLayout(File@+, UIElement@+)", asFUNCTION(UISaveLayout), asCALL_CDECL_OBJLAST); \
  127. /* bool UI::SaveLayout(Serializer &dest, UIElement *element) | File: ../UI/UI.h */ \
  128. engine->RegisterObjectMethod(className, "bool SaveLayout(VectorBuffer&, UIElement@+)", asFUNCTION(UISaveLayoutVectorBuffer), asCALL_CDECL_OBJLAST); \
  129. /* const Vector<UIElement*> UI::GetDragElements() | File: ../UI/UI.h */ \
  130. engine->RegisterObjectMethod(className, "const Array<UIElement@>@ GetDragElements()", asFUNCTION(UIGetDragElements), asCALL_CDECL_OBJLAST); \
  131. /* void UI::SetFocusElement(UIElement *element, bool byKey=false) | File: ../UI/UI.h */ \
  132. engine->RegisterObjectMethod(className, "void set_focusElement(UIElement@+)", asFUNCTION(UISetFocusElement), asCALL_CDECL_OBJLAST);
  133. }