From 63f7fa81e9ee1b880d246ffca9531995e04429d6 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 14 Jul 2012 05:16:09 +0200 Subject: [PATCH] CHANGED: #1471 it's a good idea to register GUI widget classes with the reflection system if we want to use them! --HG-- branch : gui-refactoring --- code/nel/include/nel/gui/reflect_register.h | 31 +++++++ code/nel/src/gui/reflect_register.cpp | 92 +++++++++++++++++++ code/nel/src/gui/widget_manager.cpp | 3 + .../register_interface_elements.cpp | 79 +--------------- 4 files changed, 127 insertions(+), 78 deletions(-) create mode 100644 code/nel/include/nel/gui/reflect_register.h create mode 100644 code/nel/src/gui/reflect_register.cpp diff --git a/code/nel/include/nel/gui/reflect_register.h b/code/nel/include/nel/gui/reflect_register.h new file mode 100644 index 000000000..0d86cf262 --- /dev/null +++ b/code/nel/include/nel/gui/reflect_register.h @@ -0,0 +1,31 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#ifndef REFLECT_REG_H +#define REFLECT_REG_H + +namespace NLGUI +{ + class CReflectableRegister + { + public: + static void registerClasses(); + }; +} + + +#endif diff --git a/code/nel/src/gui/reflect_register.cpp b/code/nel/src/gui/reflect_register.cpp new file mode 100644 index 000000000..19eeb08a6 --- /dev/null +++ b/code/nel/src/gui/reflect_register.cpp @@ -0,0 +1,92 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "nel/gui/reflect_register.h" + +#include "nel/gui/interface_element.h" +#include "nel/gui/view_base.h" +#include "nel/gui/view_text.h" +#include "nel/gui/view_text_id.h" +#include "nel/gui/view_bitmap.h" +#include "nel/gui/group_submenu_base.h" +#include "nel/gui/group_menu.h" +#include "nel/gui/ctrl_base.h" +#include "nel/gui/interface_group.h" +#include "nel/gui/group_frame.h" +#include "nel/gui/group_container_base.h" +#include "nel/gui/group_container.h" +#include "nel/gui/group_list.h" +#include "nel/gui/dbgroup_select_number.h" +#include "nel/gui/ctrl_button.h" +#include "nel/gui/ctrl_text_button.h" +#include "nel/gui/ctrl_col_pick.h" +#include "nel/gui/ctrl_draggable.h" +#include "nel/gui/group_editbox_base.h" +#include "nel/gui/group_editbox.h" +#include "nel/gui/group_tree.h" +#include "nel/gui/reflect.h" +#include "nel/gui/dbview_bar.h" +#include "nel/gui/dbview_bar3.h" +#include "nel/gui/ctrl_scroll_base.h" +#include "nel/gui/ctrl_scroll.h" +#include "nel/gui/dbgroup_combo_box.h" +#include "nel/gui/group_tab.h" +#include "nel/gui/group_html.h" +#include "nel/gui/group_header.h" + +namespace NLGUI +{ + void CReflectableRegister::registerClasses() + { + REGISTER_REFLECTABLE_CLASS(CInterfaceElement, CReflectable); + REGISTER_REFLECTABLE_CLASS(CViewBase, CInterfaceElement); + REGISTER_REFLECTABLE_CLASS(CViewText, CViewBase); + REGISTER_REFLECTABLE_CLASS(CViewTextID, CViewText); + REGISTER_REFLECTABLE_CLASS(CViewBitmap, CViewBase); + REGISTER_REFLECTABLE_CLASS(CViewTextMenu, CViewText); + REGISTER_REFLECTABLE_CLASS(CDBViewBar, CViewBitmap); + REGISTER_REFLECTABLE_CLASS(CDBViewBar3, CViewBitmap); + REGISTER_REFLECTABLE_CLASS(CCtrlBase, CViewBase); + REGISTER_REFLECTABLE_CLASS(CCtrlBaseButton, CCtrlBase); + REGISTER_REFLECTABLE_CLASS(CCtrlButton, CCtrlBaseButton); + REGISTER_REFLECTABLE_CLASS(CCtrlTextButton, CCtrlBaseButton); + REGISTER_REFLECTABLE_CLASS(CCtrlColPick, CCtrlBase); + REGISTER_REFLECTABLE_CLASS(CCtrlDraggable, CCtrlBase); + REGISTER_REFLECTABLE_CLASS(CInterfaceGroup, CCtrlBase); + REGISTER_REFLECTABLE_CLASS(CGroupFrame, CInterfaceGroup); + REGISTER_REFLECTABLE_CLASS(CGroupModal, CGroupFrame); + REGISTER_REFLECTABLE_CLASS(CGroupContainerBase, CInterfaceGroup); + REGISTER_REFLECTABLE_CLASS(CGroupContainer, CGroupContainerBase); + REGISTER_REFLECTABLE_CLASS(CDBGroupSelectNumber, CInterfaceGroup); + REGISTER_REFLECTABLE_CLASS(CGroupEditBoxBase, CInterfaceGroup); + REGISTER_REFLECTABLE_CLASS(CGroupEditBox, CGroupEditBoxBase); + REGISTER_REFLECTABLE_CLASS(CGroupTree, CInterfaceGroup); + REGISTER_REFLECTABLE_CLASS(CDBGroupComboBox, CInterfaceGroup); + REGISTER_REFLECTABLE_CLASS(CCtrlScrollBase, CCtrlBase); + REGISTER_REFLECTABLE_CLASS(CCtrlScroll, CCtrlScrollBase); + REGISTER_REFLECTABLE_CLASS(CGroupMenu, CGroupModal); + REGISTER_REFLECTABLE_CLASS(CGroupSubMenuBase, CGroupFrame); + REGISTER_REFLECTABLE_CLASS(CGroupSubMenu, CGroupSubMenuBase); + REGISTER_REFLECTABLE_CLASS(CGroupTab, CInterfaceGroup); + REGISTER_REFLECTABLE_CLASS(CGroupScrollText, CInterfaceGroup); + REGISTER_REFLECTABLE_CLASS(CGroupHTML, CGroupScrollText); + REGISTER_REFLECTABLE_CLASS(CGroupTree::SNode, CReflectable); + REGISTER_REFLECTABLE_CLASS(CGroupList, CInterfaceGroup); + REGISTER_REFLECTABLE_CLASS(CGroupHeader, CGroupList); + } +} + + diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 0c91d98f3..4cee9f340 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -30,6 +30,7 @@ #include "nel/gui/interface_anim.h" #include "nel/gui/proc.h" #include "nel/gui/interface_expr.h" +#include "nel/gui/reflect_register.h" #include "nel/misc/events.h" namespace NLGUI @@ -3092,6 +3093,8 @@ namespace NLGUI CWidgetManager::CWidgetManager() { + CReflectableRegister::registerClasses(); + parser = IParser::createParser(); _Pointer = NULL; diff --git a/code/ryzom/client/src/interface_v3/register_interface_elements.cpp b/code/ryzom/client/src/interface_v3/register_interface_elements.cpp index 4947d251e..f1f88e94e 100644 --- a/code/ryzom/client/src/interface_v3/register_interface_elements.cpp +++ b/code/ryzom/client/src/interface_v3/register_interface_elements.cpp @@ -15,96 +15,27 @@ // along with this program. If not, see . - -#include "stdpch.h" -#include "nel/gui/interface_element.h" #include "interface_3d_scene.h" -#include "nel/gui/view_base.h" -#include "nel/gui/view_text.h" -#include "nel/gui/view_text_id.h" -#include "nel/gui/view_bitmap.h" #include "view_radar.h" -#include "nel/gui/group_submenu_base.h" -#include "nel/gui/group_menu.h" -#include "nel/gui/ctrl_base.h" -#include "nel/gui/interface_group.h" -#include "nel/gui/group_frame.h" -#include "nel/gui/group_container_base.h" -#include "nel/gui/group_container.h" -#include "nel/gui/group_list.h" -#include "nel/gui/dbgroup_select_number.h" -#include "nel/gui/ctrl_button.h" -#include "nel/gui/ctrl_text_button.h" -#include "nel/gui/ctrl_col_pick.h" -#include "nel/gui/ctrl_draggable.h" #include "dbctrl_sheet.h" #include "dbgroup_list_sheet.h" -#include "nel/gui/group_editbox_base.h" -#include "nel/gui/group_editbox.h" -#include "nel/gui/group_tree.h" -#include "nel/gui/reflect.h" -#include "nel/gui/dbview_bar.h" -#include "nel/gui/dbview_bar3.h" -#include "nel/gui/ctrl_scroll_base.h" -#include "nel/gui/ctrl_scroll.h" -#include "nel/gui/dbgroup_combo_box.h" -#include "nel/gui/group_tab.h" -#include "nel/gui/group_html.h" -#include "nel/gui/group_header.h" #include "sphrase_manager.h" -// #include "../r2/displayer_visual.h" #include "../r2/displayer_visual_entity.h" #include "../r2/displayer_visual_group.h" #include "../r2/instance.h" #include "../r2/tool.h" #include "../r2/tool_pick.h" - #include "view_pointer_ryzom.h" - - +#include "nel/gui/reflect_register.h" void registerInterfaceElements() { CViewPointerRyzom::forceLinking(); - REGISTER_REFLECTABLE_CLASS(CInterfaceElement, CReflectable); - REGISTER_REFLECTABLE_CLASS(CViewBase, CInterfaceElement); - REGISTER_REFLECTABLE_CLASS(CViewText, CViewBase); - REGISTER_REFLECTABLE_CLASS(CViewTextID, CViewText); - REGISTER_REFLECTABLE_CLASS(CViewBitmap, CViewBase); REGISTER_REFLECTABLE_CLASS(CViewRadar, CViewBase); - REGISTER_REFLECTABLE_CLASS(CViewTextMenu, CViewText); - REGISTER_REFLECTABLE_CLASS(CDBViewBar, CViewBitmap); - REGISTER_REFLECTABLE_CLASS(CDBViewBar3, CViewBitmap); - REGISTER_REFLECTABLE_CLASS(CCtrlBase, CViewBase); - REGISTER_REFLECTABLE_CLASS(CCtrlBaseButton, CCtrlBase); - REGISTER_REFLECTABLE_CLASS(CCtrlButton, CCtrlBaseButton); - REGISTER_REFLECTABLE_CLASS(CCtrlTextButton, CCtrlBaseButton); - REGISTER_REFLECTABLE_CLASS(CCtrlColPick, CCtrlBase); - REGISTER_REFLECTABLE_CLASS(CCtrlDraggable, CCtrlBase); REGISTER_REFLECTABLE_CLASS(CDBCtrlSheet, CCtrlDraggable); - REGISTER_REFLECTABLE_CLASS(CInterfaceGroup, CCtrlBase); - REGISTER_REFLECTABLE_CLASS(CGroupFrame, CInterfaceGroup); - REGISTER_REFLECTABLE_CLASS(CGroupModal, CGroupFrame); - REGISTER_REFLECTABLE_CLASS(CGroupContainerBase, CInterfaceGroup); - REGISTER_REFLECTABLE_CLASS(CGroupContainer, CGroupContainerBase); - REGISTER_REFLECTABLE_CLASS(CDBGroupSelectNumber, CInterfaceGroup); REGISTER_REFLECTABLE_CLASS(IListSheetBase, CInterfaceGroup); - REGISTER_REFLECTABLE_CLASS(CGroupEditBoxBase, CInterfaceGroup); - REGISTER_REFLECTABLE_CLASS(CGroupEditBox, CGroupEditBoxBase); - REGISTER_REFLECTABLE_CLASS(CGroupTree, CInterfaceGroup); - REGISTER_REFLECTABLE_CLASS(CDBGroupComboBox, CInterfaceGroup); - REGISTER_REFLECTABLE_CLASS(CCtrlScrollBase, CCtrlBase); - REGISTER_REFLECTABLE_CLASS(CCtrlScroll, CCtrlScrollBase); - REGISTER_REFLECTABLE_CLASS(CGroupMenu, CGroupModal) - REGISTER_REFLECTABLE_CLASS(CGroupSubMenuBase, CGroupFrame) - REGISTER_REFLECTABLE_CLASS(CGroupSubMenu, CGroupSubMenuBase) - REGISTER_REFLECTABLE_CLASS(CGroupTab, CInterfaceGroup) - REGISTER_REFLECTABLE_CLASS(CGroupScrollText, CInterfaceGroup) - REGISTER_REFLECTABLE_CLASS(CGroupHTML, CGroupScrollText) - - REGISTER_REFLECTABLE_CLASS(CInterface3DScene, CInterfaceGroup); REGISTER_REFLECTABLE_CLASS(CInterface3DCharacter, CInterfaceElement); REGISTER_REFLECTABLE_CLASS(CInterface3DIG, CInterfaceElement); @@ -112,12 +43,6 @@ void registerInterfaceElements() REGISTER_REFLECTABLE_CLASS(CInterface3DCamera, CInterfaceElement); REGISTER_REFLECTABLE_CLASS(CInterface3DLight, CInterfaceElement); REGISTER_REFLECTABLE_CLASS(CInterface3DFX, CInterfaceElement); - - REGISTER_REFLECTABLE_CLASS(CGroupTree::SNode, CReflectable); - REGISTER_REFLECTABLE_CLASS(CGroupList, CInterfaceGroup); - REGISTER_REFLECTABLE_CLASS(CGroupHeader, CGroupList); - - REGISTER_REFLECTABLE_CLASS(R2::CInstance, CReflectable); REGISTER_REFLECTABLE_CLASS(R2::CDisplayerBase, CReflectable); REGISTER_REFLECTABLE_CLASS(R2::CDisplayerVisual, R2::CDisplayerBase); @@ -125,9 +50,7 @@ void registerInterfaceElements() REGISTER_REFLECTABLE_CLASS(R2::CDisplayerVisualGroup, R2::CDisplayerVisual); REGISTER_REFLECTABLE_CLASS(R2::CTool, CReflectable); REGISTER_REFLECTABLE_CLASS(R2::CToolPick, R2::CTool); - REGISTER_REFLECTABLE_CLASS(CSPhraseComAdpater, CReflectable); - }