// Copyright (c) 2008-2023 the Urho3D project // License: MIT #pragma once #include "../UI/Font.h" #include "../UI/ListView.h" #include "../UI/DropDownList.h" #include "../UI/FileSelector.h" #include "../UI/UI.h" namespace Urho3D { // bool Font::SaveXML(Serializer& dest, int pointSize, bool usedGlyphs = false, const String& indentation = "\t") | File: ../UI/Font.h template bool Font_SaveXML_File(File* file, int pointSize, bool usedGlyphs, const String& indentation, T* ptr) { return ptr->SaveXML(*file, pointSize, usedGlyphs, indentation); } // bool Font::SaveXML(Serializer& dest, int pointSize, bool usedGlyphs = false, const String& indentation = "\t") | File: ../UI/Font.h template bool Font_SaveXML_VectorBuffer(VectorBuffer& buffer, int pointSize, bool usedGlyphs, const String& indentation, T* ptr) { return ptr->SaveXML(buffer, pointSize, usedGlyphs, indentation); } // bool Font::SaveXML(Serializer& dest, int pointSize, bool usedGlyphs = false, const String& indentation = "\t") | File: ../UI/Font.h template bool Font_SaveXML_FileName(const String& fileName, int pointSize, bool usedGlyphs, const String& indentation, T* ptr) { if (fileName.Empty()) return false; File file(ptr->GetContext(), fileName, FILE_WRITE); return ptr->SaveXML(file, pointSize, usedGlyphs, indentation); } #define REGISTER_MEMBERS_MANUAL_PART_Font() \ /* bool Font::SaveXML(Serializer& dest, int pointSize, bool usedGlyphs = false, const String& indentation = "\t") | File: ../UI/Font.h */ \ engine->RegisterObjectMethod(className, "bool SaveXML(File@+, int, bool usedGlyphs = false, const String&in indentation = \"\t\")", AS_FUNCTION_OBJLAST(Font_SaveXML_File), AS_CALL_CDECL_OBJLAST); \ engine->RegisterObjectMethod(className, "bool SaveXML(VectorBuffer&, int, bool usedGlyphs = false, const String&in indentation = \"\t\")", AS_FUNCTION_OBJLAST(Font_SaveXML_VectorBuffer), AS_CALL_CDECL_OBJLAST); \ engine->RegisterObjectMethod(className, "bool SaveXML(const String&in, int, bool usedGlyphs = false, const String&in indentation = \"\t\")", AS_FUNCTION_OBJLAST(Font_SaveXML_FileName), AS_CALL_CDECL_OBJLAST); // ======================================================================================== #define REGISTER_CLASS_MANUAL_PART_UIElement() \ RegisterNamedObjectConstructor(engine, "UIElement"); // bool UIElement::LoadXML(Deserializer& source) | File: ../UI/UIElement.h template bool UIElement_LoadXML_File(File* file, T* ptr) { return file && ptr->LoadXML(*file); } // bool UIElement::LoadXML(Deserializer& source) | File: ../UI/UIElement.h template bool UIElement_LoadXML_VectorBuffer(VectorBuffer& buffer, T* ptr) { return ptr->LoadXML(buffer); } // bool UIElement::LoadXML(const XMLElement& source) override | File: ../UI/UIElement.h template bool UIElement_LoadXML_XMLFile(XMLFile* file, XMLFile* styleFile, T* ptr) { if (file) { XMLElement rootElem = file->GetRoot("element"); return rootElem && ptr->LoadXML(rootElem, styleFile); } else return false; } // virtual UIElement* UIElement::LoadChildXML(const XMLElement& childElem, XMLFile* styleFile) | File: ../UI/UIElement.h template UIElement* UIElement_LoadChildXML(XMLFile* file, XMLFile* styleFile, T* ptr) { if (!file) return nullptr; XMLElement rootElem = file->GetRoot("element"); if (rootElem) return ptr->LoadChildXML(rootElem, styleFile); else return nullptr; } // bool UIElement::SaveXML(Serializer& dest, const String& indentation = "\t") const | File: ../UI/UIElement.h template bool UIElement_SaveXML_File(File* file, const String& indentation, T* ptr) { return file && ptr->SaveXML(*file, indentation); } // bool UIElement::SaveXML(Serializer& dest, const String& indentation = "\t") const | File: ../UI/UIElement.h template bool UIElement_SaveXML_VectorBuffer(VectorBuffer& buffer, const String& indentation, T* ptr) { return ptr->SaveXML(buffer, indentation); } // void UIElement::RemoveChildAtIndex(unsigned index) | File: ../UI/UIElement.h template void UIElement_RemoveChild(unsigned index, T* ptr) { ptr->RemoveChildAtIndex(index); } // bool UIElement::SetStyle(const String& styleName, XMLFile* file = nullptr) | File: ../UI/UIElement.h template void UIElement_SetStyle(const String& styleName, T* ptr) { if (styleName.Empty()) ptr->SetStyleAuto(); else ptr->SetStyle(styleName); } // unsigned UIElement::GetNumChildren(bool recursive = false) const | File: ../UI/UIElement.h template unsigned UIElement_GetNumChildren_NonRecursive(T* ptr) { return ptr->GetNumChildren(false); } // unsigned UIElement::GetNumChildren(bool recursive = false) const | File: ../UI/UIElement.h template unsigned UIElement_GetNumChildren_Recursive(T* ptr) { return ptr->GetNumChildren(true); } // void UIElement::SetParent(UIElement* parent, i32 index = ENDPOS) | File: ../UI/UIElement.h template void UIElement_SetParent(UIElement* parent, T* ptr) { ptr->SetParent(parent); } // XMLFile* UIElement::GetDefaultStyle(bool recursiveUp = true) const | File: ../UI/UIElement.h template XMLFile* UIElement_GetDefaultStyle(T* ptr) { return ptr->GetDefaultStyle(); } // const VariantMap& UIElement::GetVars() const | File: ../UI/UIElement.h template VariantMap& UIElement_GetVars(T* ptr) { return const_cast(ptr->GetVars()); } #define REGISTER_MEMBERS_MANUAL_PART_UIElement() \ /* bool UIElement::LoadXML(Deserializer& source) | File: ../UI/UIElement.h */ \ engine->RegisterObjectMethod(className, "bool LoadXML(File@+)", AS_FUNCTION_OBJLAST(UIElement_LoadXML_File), AS_CALL_CDECL_OBJLAST); \ engine->RegisterObjectMethod(className, "bool LoadXML(VectorBuffer&)", AS_FUNCTION_OBJLAST(UIElement_LoadXML_VectorBuffer), AS_CALL_CDECL_OBJLAST); \ \ /* bool UIElement::LoadXML(const XMLElement& source) override | File: ../UI/UIElement.h */ \ engine->RegisterObjectMethod(className, "bool LoadXML(XMLFile@+, XMLFile@+)", AS_FUNCTION_OBJLAST(UIElement_LoadXML_XMLFile), AS_CALL_CDECL_OBJLAST); \ \ /* virtual UIElement* UIElement::LoadChildXML(const XMLElement& childElem, XMLFile* styleFile) | File: ../UI/UIElement.h */ \ engine->RegisterObjectMethod(className, "UIElement@+ LoadChildXML(XMLFile@+, XMLFile@+)", AS_FUNCTION_OBJLAST(UIElement_LoadChildXML), AS_CALL_CDECL_OBJLAST); \ \ /* bool UIElement::SaveXML(Serializer& dest, const String& indentation = "\t") const | File: ../UI/UIElement.h */ \ engine->RegisterObjectMethod(className, "bool SaveXML(File@+, const String&in indentation = \"\t\")", AS_FUNCTION_OBJLAST(UIElement_SaveXML_File), AS_CALL_CDECL_OBJLAST); \ engine->RegisterObjectMethod(className, "bool SaveXML(VectorBuffer&, const String&in indentation = \"\t\")", AS_FUNCTION_OBJLAST(UIElement_SaveXML_VectorBuffer), AS_CALL_CDECL_OBJLAST); \ \ /* void UIElement::RemoveChildAtIndex(unsigned index) | File: ../UI/UIElement.h */ \ engine->RegisterObjectMethod(className, "void RemoveChild(uint)", AS_FUNCTION_OBJLAST(UIElement_RemoveChild), AS_CALL_CDECL_OBJLAST); \ \ /* bool UIElement::SetStyle(const String& styleName, XMLFile* file = nullptr) | File: ../UI/UIElement.h */ \ engine->RegisterObjectMethod(className, "void set_style(const String&in)", AS_FUNCTION_OBJLAST(UIElement_SetStyle), AS_CALL_CDECL_OBJLAST); \ \ /* unsigned UIElement::GetNumChildren(bool recursive = false) const | File: ../UI/UIElement.h */ \ engine->RegisterObjectMethod(className, "uint get_numChildren() const", AS_FUNCTION_OBJLAST(UIElement_GetNumChildren_NonRecursive), AS_CALL_CDECL_OBJLAST); \ engine->RegisterObjectMethod(className, "uint get_numAllChildren() const", AS_FUNCTION_OBJLAST(UIElement_GetNumChildren_Recursive), AS_CALL_CDECL_OBJLAST); \ \ /* void UIElement::SetParent(UIElement* parent, i32 index = ENDPOS) | File: ../UI/UIElement.h */ \ engine->RegisterObjectMethod(className, "void set_parent(UIElement@+)", AS_FUNCTION_OBJLAST(UIElement_SetParent), AS_CALL_CDECL_OBJLAST); \ \ /* XMLFile* UIElement::GetDefaultStyle(bool recursiveUp = true) const | File: ../UI/UIElement.h */ \ engine->RegisterObjectMethod(className, "XMLFile@+ get_defaultStyle() const", AS_FUNCTION_OBJLAST(UIElement_GetDefaultStyle), AS_CALL_CDECL_OBJLAST); \ \ /* const VariantMap& UIElement::GetVars() const | File: ../UI/UIElement.h */ \ engine->RegisterObjectMethod(className, "VariantMap& get_vars()", AS_FUNCTION_OBJLAST(UIElement_GetVars), AS_CALL_CDECL_OBJLAST); // ======================================================================================== // SharedPtr UI::LoadLayout(Deserializer& source, XMLFile* styleFile = nullptr) | File: ../UI/UI.h template UIElement* UI_LoadLayout_File(File* file, UI* ptr) { if (file) { SharedPtr root = ptr->LoadLayout(*file); if (root) root->AddRef(); return root.Get(); } else return nullptr; } // SharedPtr UI::LoadLayout(Deserializer& source, XMLFile* styleFile = nullptr) | File: ../UI/UI.h template UIElement* UI_LoadLayout_VectorBuffer(VectorBuffer& buffer, UI* ptr) { SharedPtr root = ptr->LoadLayout(buffer); if (root) root->AddRef(); return root.Get(); } // SharedPtr UI::LoadLayout(Deserializer& source, XMLFile* styleFile = nullptr) | File: ../UI/UI.h template UIElement* UI_LoadLayout_File_Style(File* file, XMLFile* styleFile, UI* ptr) { if (file) { SharedPtr root = ptr->LoadLayout(*file, styleFile); if (root) root->AddRef(); return root.Get(); } else return nullptr; } // SharedPtr UI::LoadLayout(Deserializer& source, XMLFile* styleFile = nullptr) | File: ../UI/UI.h template UIElement* UI_LoadLayout_VectorBuffer_Style(VectorBuffer& buffer, XMLFile* styleFile, UI* ptr) { SharedPtr root = ptr->LoadLayout(buffer, styleFile); if (root) root->AddRef(); return root.Get(); } // bool UI::SaveLayout(Serializer& dest, UIElement* element) | File: ../UI/UI.h template bool UI_SaveLayout_File(File* file, UIElement* element, UI* ptr) { return file && ptr->SaveLayout(*file, element); } // bool UI::SaveLayout(Serializer& dest, UIElement* element) | File: ../UI/UI.h template bool UI_SaveLayout_VectorBuffer(VectorBuffer& buffer, UIElement* element, UI* ptr) { return ptr->SaveLayout(buffer, element); } // const Vector UI::GetDragElements() | File: ../UI/UI.h template CScriptArray* UI_GetDragElements(UI* ptr) { return VectorToHandleArray(ptr->GetDragElements(), "const Array@"); } // void UI::SetFocusElement(UIElement* element, bool byKey = false) | File: ../UI/UI.h template void UI_SetFocusElement(UIElement* element, UI* ptr) { ptr->SetFocusElement(element); } #define REGISTER_MEMBERS_MANUAL_PART_UI() \ /* SharedPtr UI::LoadLayout(Deserializer& source, XMLFile* styleFile = nullptr) | File: ../UI/UI.h */ \ engine->RegisterObjectMethod(className, "UIElement@ LoadLayout(File@+)", AS_FUNCTION_OBJLAST(UI_LoadLayout_File), AS_CALL_CDECL_OBJLAST); \ engine->RegisterObjectMethod(className, "UIElement@ LoadLayout(File@+, XMLFile@+)", AS_FUNCTION_OBJLAST(UI_LoadLayout_File_Style), AS_CALL_CDECL_OBJLAST); \ engine->RegisterObjectMethod(className, "UIElement@ LoadLayout(VectorBuffer&)", AS_FUNCTION_OBJLAST(UI_LoadLayout_VectorBuffer), AS_CALL_CDECL_OBJLAST); \ engine->RegisterObjectMethod(className, "UIElement@ LoadLayout(VectorBuffer&, XMLFile@+)", AS_FUNCTION_OBJLAST(UI_LoadLayout_VectorBuffer_Style), AS_CALL_CDECL_OBJLAST); \ \ /* bool UI::SaveLayout(Serializer& dest, UIElement* element) | File: ../UI/UI.h */ \ engine->RegisterObjectMethod(className, "bool SaveLayout(File@+, UIElement@+)", AS_FUNCTION_OBJLAST(UI_SaveLayout_File), AS_CALL_CDECL_OBJLAST); \ engine->RegisterObjectMethod(className, "bool SaveLayout(VectorBuffer&, UIElement@+)", AS_FUNCTION_OBJLAST(UI_SaveLayout_VectorBuffer), AS_CALL_CDECL_OBJLAST); \ \ /* const Vector UI::GetDragElements() | File: ../UI/UI.h */ \ engine->RegisterObjectMethod(className, "const Array@ GetDragElements()", AS_FUNCTION_OBJLAST(UI_GetDragElements), AS_CALL_CDECL_OBJLAST); \ \ /* void UI::SetFocusElement(UIElement* element, bool byKey = false) | File: ../UI/UI.h */ \ engine->RegisterObjectMethod(className, "void set_focusElement(UIElement@+)", AS_FUNCTION_OBJLAST(UI_SetFocusElement), AS_CALL_CDECL_OBJLAST); // ======================================================================================== #define REGISTER_CLASS_MANUAL_PART_BorderImage() \ RegisterNamedObjectConstructor(engine, "BorderImage"); #define REGISTER_CLASS_MANUAL_PART_Button() \ RegisterNamedObjectConstructor