Line data Source code
1 : /* Copyright (C) 2025 Wildfire Games. 2 : * This file is part of 0 A.D. 3 : * 4 : * 0 A.D. is free software: you can redistribute it and/or modify 5 : * it under the terms of the GNU General Public License as published by 6 : * the Free Software Foundation, either version 2 of the License, or 7 : * (at your option) any later version. 8 : * 9 : * 0 A.D. is distributed in the hope that it will be useful, 10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 : * GNU General Public License for more details. 13 : * 14 : * You should have received a copy of the GNU General Public License 15 : * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. 16 : */ 17 : 18 : #include "precompiled.h" 19 : 20 : #include "gui/CGUI.h" 21 : #include "gui/ObjectTypes/CButton.h" 22 : #include "gui/ObjectTypes/CChart.h" 23 : #include "gui/ObjectTypes/CCheckBox.h" 24 : #include "gui/ObjectTypes/CDropDown.h" 25 : #include "gui/ObjectTypes/CGUIDummyObject.h" 26 : #include "gui/ObjectTypes/CHotkeyPicker.h" 27 : #include "gui/ObjectTypes/CImage.h" 28 : #include "gui/ObjectTypes/CInput.h" 29 : #include "gui/ObjectTypes/CList.h" 30 : #include "gui/ObjectTypes/CMiniMap.h" 31 : #include "gui/ObjectTypes/COList.h" 32 : #include "gui/ObjectTypes/CProgressBar.h" 33 : #include "gui/ObjectTypes/CRadioButton.h" 34 : #include "gui/ObjectTypes/CSlider.h" 35 : #include "gui/ObjectTypes/CScrollPanel.h" 36 : #include "gui/ObjectTypes/CText.h" 37 : #include "gui/ObjectTypes/CTooltip.h" 38 : #include "gui/Scripting/JSInterface_GUIProxy.h" 39 : #include "ps/CStr.h" 40 : 41 : #include <memory> 42 : #include <unordered_map> 43 : #include <utility> 44 : 45 : class IGUIObject; 46 : 47 19 : void CGUI::AddObjectTypes() 48 : { 49 19 : m_ProxyData.insert(JSI_GUIProxy<IGUIObject>::CreateData(*m_ScriptInterface)); 50 19 : m_ProxyData.insert(JSI_GUIProxy<CText>::CreateData(*m_ScriptInterface)); 51 19 : m_ProxyData.insert(JSI_GUIProxy<CList>::CreateData(*m_ScriptInterface)); 52 19 : m_ProxyData.insert(JSI_GUIProxy<CDropDown>::CreateData(*m_ScriptInterface)); 53 19 : m_ProxyData.insert(JSI_GUIProxy<CMiniMap>::CreateData(*m_ScriptInterface)); 54 19 : m_ProxyData.insert(JSI_GUIProxy<CButton>::CreateData(*m_ScriptInterface)); 55 19 : m_ProxyData.insert(JSI_GUIProxy<CScrollPanel>::CreateData(*m_ScriptInterface)); 56 : 57 19 : AddObjectType("button", &CButton::ConstructObject); 58 19 : AddObjectType("chart", &CChart::ConstructObject); 59 19 : AddObjectType("checkbox", &CCheckBox::ConstructObject); 60 19 : AddObjectType("dropdown", &CDropDown::ConstructObject); 61 19 : AddObjectType("empty", &CGUIDummyObject::ConstructObject); 62 19 : AddObjectType("hotkeypicker", &CHotkeyPicker::ConstructObject); 63 19 : AddObjectType("image", &CImage::ConstructObject); 64 19 : AddObjectType("input", &CInput::ConstructObject); 65 19 : AddObjectType("list", &CList::ConstructObject); 66 19 : AddObjectType("minimap", &CMiniMap::ConstructObject); 67 19 : AddObjectType("olist", &COList::ConstructObject); 68 19 : AddObjectType("progressbar", &CProgressBar::ConstructObject); 69 19 : AddObjectType("radiobutton", &CRadioButton::ConstructObject); 70 19 : AddObjectType("slider", &CSlider::ConstructObject); 71 19 : AddObjectType("text", &CText::ConstructObject); 72 19 : AddObjectType("tooltip", &CTooltip::ConstructObject); 73 19 : AddObjectType("scrollpanel", &CScrollPanel::ConstructObject); 74 19 : }