From ab8b296adc72d7449f52f6c36458138bafe64207 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Fri, 22 Jun 2012 06:48:19 +0200 Subject: [PATCH] CHANGED: #1471 CGroupList is now part of NELGUI library, and is under NLGUI namespace. --- code/nel/include/nel/gui/group_list.h | 262 ++++ code/nel/include/nel/gui/interface_element.h | 5 +- code/nel/src/gui/group_list.cpp | 1158 +++++++++++++++++ code/ryzom/client/src/client_chat_manager.cpp | 2 +- .../client/src/interface_v3/chat_displayer.h | 2 +- .../client/src/interface_v3/chat_window.h | 3 +- .../src/interface_v3/group_container.cpp | 2 +- .../client/src/interface_v3/group_container.h | 2 +- .../client/src/interface_v3/group_header.h | 2 +- .../client/src/interface_v3/group_html.cpp | 2 +- .../client/src/interface_v3/group_html.h | 2 +- .../client/src/interface_v3/group_list.cpp | 1152 ---------------- .../client/src/interface_v3/group_list.h | 258 ---- .../client/src/interface_v3/group_menu.h | 2 +- .../src/interface_v3/group_quick_help.cpp | 2 +- .../src/interface_v3/group_scrolltext.cpp | 2 +- .../src/interface_v3/group_scrolltext.h | 3 +- .../src/interface_v3/interface_manager.cpp | 2 +- .../src/interface_v3/interface_manager.h | 2 +- .../src/interface_v3/interface_parser.cpp | 2 +- .../src/interface_v3/interface_parser.h | 2 +- .../client/src/interface_v3/macrocmd_key.cpp | 2 +- .../src/interface_v3/macrocmd_manager.cpp | 2 +- .../client/src/interface_v3/people_list.cpp | 2 +- .../register_interface_elements.cpp | 3 +- code/ryzom/client/src/libwww.h | 3 +- code/ryzom/client/src/net_manager.cpp | 2 +- code/ryzom/client/src/r2/editor.cpp | 2 +- 28 files changed, 1446 insertions(+), 1439 deletions(-) create mode 100644 code/nel/include/nel/gui/group_list.h create mode 100644 code/nel/src/gui/group_list.cpp delete mode 100644 code/ryzom/client/src/interface_v3/group_list.cpp delete mode 100644 code/ryzom/client/src/interface_v3/group_list.h diff --git a/code/nel/include/nel/gui/group_list.h b/code/nel/include/nel/gui/group_list.h new file mode 100644 index 000000000..f7a2263e2 --- /dev/null +++ b/code/nel/include/nel/gui/group_list.h @@ -0,0 +1,262 @@ +// 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 NL_GROUP_LIST_H +#define NL_GROUP_LIST_H + +#include "nel/misc/types_nl.h" +#include "nel/gui/group_frame.h" +#include "nel/gui/view_text.h" + +namespace NLGUI +{ + + // ---------------------------------------------------------------------------- + class CGroupList : public CInterfaceGroup + { + public: + enum EAlign + { + Bottom = 0, + Top, + Left, + Right + }; + + ///constructor + CGroupList(const TCtorParam ¶m); + + // dtor + ~CGroupList(); + /** + * add a child element to the group at the last position + * 'order' of the element is set to the last order + 1 + * \param child : pointer to the child element + */ + void addChild (CViewBase* child, bool deleteOnRemove=true); + + + /** add a child before the element at the given index. + * 'order' of the element is set to 0 + * \return true if there was enough room for that child + */ + bool addChildAtIndex(CViewBase *child, uint index, bool deleteOnRemove = true); + + /** + * add a text child element to the group, using the text template + * \param line : text to be added + * \param color : text color + */ + void addTextChild (const ucstring& line,const NLMISC::CRGBA &textColor, bool multiLine = true); + + /** + * add a text child element to the group, using the text template + * \param line : text to be added + */ + void addTextChild (const ucstring& line, bool multiLine = true); + + /// Same as adding a text child but the text will be taken from the string manager + void addTextChildID (uint32 id, bool multiLine = true); + // the same, but with id taken from the database + void addTextChildID (const std::string &dbPath, bool multiLine = true); + + + bool delChild (CViewBase* child, bool noWarning=false, bool forceDontDelete = false); + + bool delChild(uint index, bool forceDontDelete = false); + + CViewBase *getChild(uint index) const { return _Elements[index].Element; } + int luaGetChild(CLuaState &ls); + + void deleteAllChildren(); + + void removeHead(); + + // Get the number of children + uint getNumChildren() const { return (uint)_Elements.size(); } + + // Get the number of active children + uint getNumActiveChildren() const; + + /** + * set the template that will be used to add text; + * \templ : a CViewText object. Only its font size, color and shadow are required. + */ + void setTextTemplate(const CViewText& templ); + + /** + * set the template that will be used to add text; + * \templ : a CViewText object. Only its font size, color and shadow are required. + */ + CViewText * getTextTemplatePtr() + { + return &_Templ; + } + + /** + * parse the element and initalize it + * \paral cur : pointer to the node describing this element + * \param parentGroup : the parent group of this element + * \return true if success + */ + virtual bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup); + //virtual uint32 getMemory(); + /** + * init or reset the children element coords. Orverloaded from CInterfaceGroup because we begin with the last inserted element here + */ + virtual void updateCoords(); + + virtual void draw(); + + virtual bool handleEvent (const NLGUI::CEventDescriptor& eventDesc); + + virtual void clearViews(); + virtual void clearControls(); + virtual void clearGroups(); + + void setSpace (sint32 s) { _Space = s; } + + virtual CInterfaceElement* getElement (const std::string &id) + { return CInterfaceGroup::getElement (id); } + + sint32 getNbElement() { return (sint32)_Elements.size(); } + sint32 getSpace() { return _Space; } + + void setDynamicDisplaySize (bool dds) { _DynamicDisplaySize = dds; } + bool getDynamicDisplaySize() { return _DynamicDisplaySize; } + + void forceSizeW (sint32 newSizeW); + void forceSizeH (sint32 newSizeH); + + void setMinW(sint32 minW); + void setMinH(sint32 minH); + sint32 getMinW() const {return _MinW;} + sint32 getMinH() const {return _MinH;} + + // set the rank for the element at the given index (used to reinsert container after they have been turned into popups) + void setOrder(uint index, uint order) { _Elements[index].Order = order; } + uint getOrder(uint index) const { return _Elements[index].Order; } + + // get element of index or -1 if not found + sint32 getElementIndex(CViewBase* child) const; + int luaGetElementIndex(CLuaState &ls); + + // swap 2 entries in the list (and also their orders) + void swapChildren(uint index1, uint index2); + int luaUpChild(CLuaState &ls); + int luaDownChild(CLuaState &ls); + + // deleteOnRemove flag + void setDelOnRemove(uint index, bool delOnRemove); + bool getDelOnRemove(uint index) const; + + // children number + void setChildrenNb(sint32 /* val */){} + sint32 getChildrenNb() const {return (sint32)_Elements.size();} + + int luaAddChild(CLuaState &ls); + int luaAddChildAtIndex(CLuaState &ls); + int luaDetachChild(CLuaState &ls); + int luaClear(CLuaState &ls); // synonimous for deleteAllChildren + int luaAddTextChild(CLuaState &ls); + int luaAddColoredTextChild(CLuaState &ls); + int luaDelChild(CLuaState &ls); + + REFLECT_EXPORT_START(CGroupList, CInterfaceGroup) + REFLECT_LUA_METHOD("addTextChild", luaAddTextChild) + REFLECT_LUA_METHOD("addColoredTextChild", luaAddColoredTextChild) + REFLECT_LUA_METHOD("addChild", luaAddChild); + REFLECT_LUA_METHOD("addChildAtIndex", luaAddChildAtIndex); + REFLECT_LUA_METHOD("detachChild", luaDetachChild); + REFLECT_LUA_METHOD("clear", luaClear); + REFLECT_LUA_METHOD("delChild", luaDelChild); + REFLECT_LUA_METHOD("upChild", luaUpChild); + REFLECT_LUA_METHOD("downChild", luaDownChild); + REFLECT_LUA_METHOD("getChild", luaGetChild); + REFLECT_LUA_METHOD("getElementIndex", luaGetElementIndex); + REFLECT_SINT32 ("childrenNb", getChildrenNb, setChildrenNb); + REFLECT_EXPORT_END + + + protected: + + //max number of elements + sint32 _MaxElements; + + // Where to add next element + EAlign _AddElt; + + // Where to align the newly added element + EAlign _Align; + + // Space between two elements in pixel + sint32 _Space; + + // Text template + CViewText _Templ; + + // Current id of the view + sint32 _IdCounter; + + // Used for context menu to display the same size as the whole content + bool _DynamicDisplaySize; + + // Do we have a color under the element pointed by the mouse + bool _Over; + + // If over is true so we have a color + NLMISC::CRGBA _OverColor; + + // Current elt over the pointer + sint32 _OverElt; + + struct CElementInfo + { + uint Order; // Used to sort the window by their insertion order. + // This is used to put back a window at the right place if it was turned into a popup. + CViewBase *Element; + bool EltDeleteOnRemove; + }; + friend struct CRemoveViewPred; + friend struct CRemoveCtrlPred; + friend struct CRemoveGroupPred; + + // The list is forced to be at least this size in updateCoords(). + sint32 _MinW; + sint32 _MinH; + + + // To conserve elements in the order they have been added + // (the element drawn are stored in _views, _contrlos or _childrengroups of cinterfacegroup + std::vector _Elements; + + private: + + void setHSGroup (CViewBase *child, EAlign addElt, EAlign align); + void setHSParent(CViewBase *view, EAlign addElt, EAlign align, uint space); + + }; + + +} + +#endif // NL_GROUP_LIST_H + +/* End of group_list.h */ + + diff --git a/code/nel/include/nel/gui/interface_element.h b/code/nel/include/nel/gui/interface_element.h index 380e81b5b..2dcf477f9 100644 --- a/code/nel/include/nel/gui/interface_element.h +++ b/code/nel/include/nel/gui/interface_element.h @@ -27,12 +27,11 @@ #include "nel/gui/reflect.h" #include "nel/gui/interface_common.h" -class CGroupList; class CGroupParagraph; namespace NLGUI { - + class CGroupList; class CInterfaceLink; class CInterfaceElement; class CInterfaceGroup; @@ -496,7 +495,7 @@ namespace NLGUI NLMISC::CRefPtr _ParentSize; // RefPtr in case of group destroyed in a parent group with posref on it // Friend Class - friend class ::CGroupList; + friend class CGroupList; friend class ::CGroupParagraph; // True if must modulate the global color with the view diff --git a/code/nel/src/gui/group_list.cpp b/code/nel/src/gui/group_list.cpp new file mode 100644 index 000000000..78860c5b6 --- /dev/null +++ b/code/nel/src/gui/group_list.cpp @@ -0,0 +1,1158 @@ +// 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/group_list.h" +#include "nel/gui/interface_element.h" +#include "nel/gui/view_bitmap.h" +#include "nel/gui/view_text_id.h" +#include "nel/gui/group_container_base.h" +#include "nel/gui/lua_ihm.h" +#include "nel/misc/xml_auto_ptr.h" +#include "nel/gui/widget_manager.h" +#include "nel/gui/view_pointer_base.h" +#include "nel/misc/i18n.h" + +using namespace std; +using namespace NLMISC; + +NLMISC_REGISTER_OBJECT(CViewBase, CGroupList, std::string, "list"); + +namespace NLGUI +{ + + // ---------------------------------------------------------------------------- + CGroupList::CGroupList(const TCtorParam ¶m) + : CInterfaceGroup(param), + _Templ(TCtorParam()) + { + _IdCounter = 0; + _MaxElements = 1024; + _AddElt = Bottom; + _Align = Left; + _Space = 0; + _DynamicDisplaySize = false; + _MinW= 0; + _MinH= 0; + _Over = false; + _OverColor = CRGBA(255, 255, 255, 32); + _OverElt = -1; + _IsGroupList = true; + } + + // ---------------------------------------------------------------------------- + void CGroupList::addChild (CViewBase* child, bool deleteOnRemove) + { + if (!child) + { + nlwarning(" : tried to add a NULL view"); + return; + } + + // Make sure there's room for the element + if ((sint32)_Elements.size() == _MaxElements) + { + removeHead(); + } + + // add child at last index + addChildAtIndex(child, (uint)_Elements.size(), deleteOnRemove); + if (_Elements.size() >= 2) + { + setOrder((uint)_Elements.size() - 1, getOrder((uint)_Elements.size() - 2) + 1); + } + } + + // ---------------------------------------------------------------------------- + CGroupList::~CGroupList() + { + deleteAllChildren(); + } + + // ---------------------------------------------------------------------------- + // Set Hotspot of the first element in reference to the group + void CGroupList::setHSGroup (CViewBase *child, EAlign addElt, EAlign align) + { + switch (addElt) + { + case Bottom: + if (align == Left) + { + child->_ParentPosRef = Hotspot_TL; + child->_PosRef = Hotspot_TL; + } + else // align == Right + { + child->_ParentPosRef = Hotspot_TR; + child->_PosRef = Hotspot_TR; + } + break; + case Left: + if (align == Top) + { + child->_ParentPosRef = Hotspot_TR; + child->_PosRef = Hotspot_TR; + } + else // align == Bottom + { + child->_ParentPosRef = Hotspot_BR; + child->_PosRef = Hotspot_BR; + } + break; + case Top: + if (align == Left) + { + child->_ParentPosRef = Hotspot_BL; + child->_PosRef = Hotspot_BL; + } + else // align == Right + { + child->_ParentPosRef = Hotspot_BR; + child->_PosRef = Hotspot_BR; + } + break; + case Right: + if (align == Top) + { + child->_ParentPosRef = Hotspot_TL; + child->_PosRef = Hotspot_TL; + } + else // align == Bottom + { + child->_ParentPosRef = Hotspot_BL; + child->_PosRef = Hotspot_BL; + } + break; + default: + nlassert(false); + break; + } + } + + // ---------------------------------------------------------------------------- + /** align an element towards its parent in the group + */ + void CGroupList::setHSParent(CViewBase *view, EAlign addElt, EAlign /* align */, uint space) + { + if ((addElt == Top) || (addElt == Bottom)) + { + if (addElt == Bottom) + { + if (_Align == Left) + view->_ParentPosRef = Hotspot_BL; + else // align == Right + view->_ParentPosRef = Hotspot_BR; + //view->_Y = -abs((sint32)space); + view->_Y = - (sint32)space; + } + else if (addElt == Top) + { + if (_Align == Left) + view->_ParentPosRef = Hotspot_TL; + else // align == Right + view->_ParentPosRef = Hotspot_TR; + // view->_Y = abs((sint32)space); + view->_Y = (sint32)space; + } + } + else + { + if (addElt == Left) + { + if (_Align == Top) + view->_ParentPosRef = Hotspot_TL; + else // align == Bottom + view->_ParentPosRef = Hotspot_BL; + //view->_X = -abs((sint32)space); + view->_X = -(sint32)space; + } + else if (addElt == Right) + { + if (_Align == Top) + view->_ParentPosRef = Hotspot_TR; + else // align == Bottom + view->_ParentPosRef = Hotspot_BR; + //view->_X = abs((sint32)space); + view->_X = (sint32)space; + } + } + } + + // ---------------------------------------------------------------------------- + bool CGroupList::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) + { + if (!CInterfaceGroup::parse(cur, parentGroup)) + return false; + + // Parse location. If these properties are not specified, set them to 0 + + CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"maxelements" )); + _MaxElements = 1024; + if (ptr) + { + if (!fromString((const char*)ptr, _MaxElements)) + { + nlwarning(" Can't parse the 'maxelements' field "); + } + } + + ptr = (char*) xmlGetProp( cur, (xmlChar*)"addelt" ); + _AddElt = Bottom; + if (ptr) + { + if (stricmp(ptr, "B") == 0) + _AddElt = Bottom; + else if (stricmp(ptr, "T") == 0) + _AddElt = Top; + else if (stricmp(ptr, "L") == 0) + _AddElt = Left; + else if (stricmp(ptr, "R") == 0) + _AddElt = Right; + } + + ptr = (char*) xmlGetProp( cur, (xmlChar*)"align" ); + _Align = Left; + if (ptr) + { + if (stricmp(ptr, "B") == 0) + _Align = Bottom; + else if (stricmp(ptr, "T") == 0) + _Align = Top; + else if (stricmp(ptr, "L") == 0) + _Align = Left; + else if (stricmp(ptr, "R") == 0) + _Align = Right; + } + + ptr = (char*) xmlGetProp( cur, (xmlChar*)"space" ); + _Space = 0; + if (ptr) + fromString((const char*)ptr, _Space); + + EAlign addElt = _AddElt; + // EAlign align = _Align; + _GroupSizeRef = _SizeRef; + if ((addElt == Top) || (addElt == Bottom)) + { + setMaxW (_W); + setMaxH(_H); + _H = 0; + _SizeRef = _SizeRef&(~2); + } + else + { + setMaxW (_W); + setMaxH (_H); + _W = 0; + _SizeRef = _SizeRef&(~1); + } + + ptr = (char*) xmlGetProp( cur, (xmlChar*)"over" ); + _Over = false; + if (ptr) _Over = convertBool(ptr); + + ptr = (char*) xmlGetProp( cur, (xmlChar*)"dynamic_display_size" ); + _DynamicDisplaySize = false; + if (ptr) _DynamicDisplaySize = convertBool(ptr); + + ptr = (char*) xmlGetProp( cur, (xmlChar*)"col_over" ); + _OverColor = CRGBA(255, 255, 255, 32); + if (ptr) _OverColor = convertColor(ptr); + + + // TEMPLATE TEXT SETUP + + // justification parameters + _Templ.parseTextOptions (cur); + + // initial text + ptr = (char*) xmlGetProp( cur, (xmlChar*)"hardtext" ); + if (ptr) + { + const char *propPtr = ptr; + ucstring Text = ucstring(propPtr); + if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i')) + Text = CI18N::get (propPtr); + + addTextChild(Text); + } + else + { + ptr = (char*) xmlGetProp( cur, (xmlChar*)"textid" ); + if (ptr) + { + uint32 textId; + fromString((const char*)ptr, textId); + addTextChildID(textId); + } + } + + return true; + } + + + + // ---------------------------------------------------------------------------- + void CGroupList::addTextChild(const ucstring& line, bool multiLine /*= true*/) + { + const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; + CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); + view->_Parent = this; + view->setMultiLine (multiLine); + view->setTextMode(_Templ.getTextMode()); + if (multiLine) view->setMultiLineSpace (_Space); + view->setText (line); + // Herit global-coloring + view->setModulateGlobalColor(getModulateGlobalColor()); + addChild(view); + invalidateCoords(); + } + + + + // ---------------------------------------------------------------------------- + void CGroupList::addTextChild(const ucstring& line, const CRGBA& textColor, bool multiLine /*= true*/) + { + const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; + CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); + view->_Parent = this; + view->setMultiLine (multiLine); + if (multiLine) view->setMultiLineSpace (_Space); + view->setText (line); + view->setColor (textColor); + // Herit global-coloring + view->setModulateGlobalColor(getModulateGlobalColor()); + addChild(view); + invalidateCoords(); + } + + // ---------------------------------------------------------------------------- + void CGroupList::addTextChildID (uint32 nID, bool multiLine) + { + const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; + CViewTextID *view= new CViewTextID (elid, nID, _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); + view->_Parent = this; + view->setMultiLine (multiLine); + if (multiLine) view->setMultiLineSpace (_Space); + // Herit global-coloring + view->setModulateGlobalColor(getModulateGlobalColor()); + addChild (view); + invalidateCoords(); + } + + // ---------------------------------------------------------------------------- + void CGroupList::addTextChildID(const std::string &dbPath, bool multiLine /*=true*/) + { + const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; + CViewTextID *view= new CViewTextID (elid, dbPath, _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); + view->_Parent = this; + view->setMultiLine (multiLine); + if (multiLine) view->setMultiLineSpace (_Space); + // Herit global-coloring + view->setModulateGlobalColor(getModulateGlobalColor()); + addChild (view); + invalidateCoords(); + } + + // ---------------------------------------------------------------------------- + bool CGroupList::delChild (CViewBase* childToDel, bool noWarning, bool forceDontDelete) + { + // Look for child + uint posChildToDel = 0; + for (posChildToDel = 0; posChildToDel < _Elements.size(); ++posChildToDel) + { + CElementInfo rEI = _Elements[posChildToDel]; + if (rEI.Element == childToDel) + break; + } + + if (posChildToDel == _Elements.size()) + { + if (!noWarning) + nlwarning("Can't del child %s, it does not exist in the list", childToDel->getId().c_str()); + return false; + } + return delChild(posChildToDel, forceDontDelete); + } + + // ---------------------------------------------------------------------------- + bool CGroupList::delChild(uint posChildToDel, bool forceDontDelete) + { + if (posChildToDel >= (uint) _Elements.size()) + { + nlwarning(" bad index"); + return false; + } + + CViewBase* childToDel = _Elements[posChildToDel].Element; + + childToDel->_Parent = NULL; + + bool elementMustBeDeleted = _Elements[posChildToDel].EltDeleteOnRemove && !forceDontDelete; + _Elements.erase (_Elements.begin()+posChildToDel); + // Remove from drawing + if (dynamic_cast(childToDel)) delGroup(static_cast(childToDel), !elementMustBeDeleted); + else if (dynamic_cast(childToDel)) delCtrl(static_cast(childToDel), !elementMustBeDeleted); + else delView(childToDel, !elementMustBeDeleted); + + // Bind the new first element + if (posChildToDel < _Elements.size()) + { + CViewBase *pVB = _Elements[posChildToDel].Element; + if (posChildToDel == 0) + { + pVB->_ParentPos = NULL; + setHSGroup (pVB, _AddElt, _Align); + if ((_AddElt == Top) || (_AddElt == Bottom)) + pVB->setY (0); + else + pVB->setX (0); + } + else + pVB->_ParentPos = _Elements[posChildToDel-1].Element; + } + return true; + } + + // ---------------------------------------------------------------------------- + void CGroupList::removeHead () + { + if (_Elements.empty()) + { + nlwarning(" Can't remove head, list is empty"); + return; + } + delChild (_Elements.begin()->Element); + /*CViewBase *pVB = _Elements.begin()->Element; + if ((_AddElt == Top) || (_AddElt == Bottom)) + { + sint32 shift = _H - (pVB->getH() + _Space); + _H = shift; + } + else + { + sint32 shift = _W - (pVB->getW() + _Space); + _W = shift; + } + + bool FirstElementMustBeDeleted = _Elements.begin()->EltDeleteOnRemove; + if (FirstElementMustBeDeleted) + delete pVB; + _Elements.erase (_Elements.begin()); + // Remove from drawing + for (vector::iterator itg = _ChildrenGroups.begin(); itg != _ChildrenGroups.end(); itg++) + if(*itg == pVB) + { + _ChildrenGroups.erase (itg); + break; + } + for (vector::iterator itc = _Controls.begin(); itc != _Controls.end(); itc++) + if(*itc == pVB) + { + _Controls.erase (itc); + break; + } + for (vector::iterator itv = _Views.begin(); itv != _Views.end(); itv++) + if(*itv == pVB) + { + _Views.erase (itv); + break; + } + delEltOrder (pVB); + + // Bind the new first element + pVB = _Elements.begin()->Element; + pVB->_ParentPos = NULL; + setHSGroup (pVB, _AddElt, _Align); + if ((_AddElt == Top) || (_AddElt == Bottom)) + pVB->setY (0); + else + pVB->setX (0);*/ + } + + // ---------------------------------------------------------------------------- + void CGroupList::setTextTemplate(const CViewText& templ) + { + _Templ = templ; + } + + + // ---------------------------------------------------------------------------- + void CGroupList::updateCoords() + { + if (!_Active) return; + // Handle if elements are not active + for (sint32 i = 0; i < ((sint32)_Elements.size()-1); ++i) + { + if (_Elements[i].Element->getActive()) + setHSParent(_Elements[i+1].Element, _AddElt, _Align, _Space); + else + setHSParent(_Elements[i+1].Element, _AddElt, _Align, 0); + } + + CInterfaceGroup::updateCoords(); + + sint32 nCurrentX = 0; // Current offset of an element + + EAlign addElt = _AddElt; + if ((addElt == Top) || (addElt == Bottom)) + { + // Calculate size + sint32 newH = 0, newW = 0; + bool bFirst = true; + + for (uint32 i = 0; i < _Elements.size(); ++i) + if (_Elements[i].Element->getActive()) + { + newH += _Elements[i].Element->getH(); + if (!bFirst) + newH += _Space; + bFirst = false; + nCurrentX += _Elements[i].Element->getX(); + newW = max (newW, _Elements[i].Element->getW()+(sint32)abs(nCurrentX)); + } + _W = max(newW, _MinW); + _H = max(newH, _MinH); + if (_DynamicDisplaySize) + { + _MaxW = _W; + _MaxH = _H; + } + if (_H < _MaxH) setOfsY(0); + } + else + { + sint32 newW = 0, newH = 0; + bool bFirst = true; + + for (uint32 i = 0; i < _Elements.size(); ++i) + if (_Elements[i].Element->getActive()) + { + newW += _Elements[i].Element->getW(); + if (!bFirst) + newW += _Space; + bFirst = false; + newH = max (newH, _Elements[i].Element->getH()); + } + _W = max(newW, _MinW); + _H = max(newH, _MinH); + if (_DynamicDisplaySize) + { + _MaxW = _W; + _MaxH = _H; + } + if (_W < _MaxW) setOfsX(0); + } + + CInterfaceElement::updateCoords(); + } + + // ---------------------------------------------------------------------------- + void CGroupList::draw () + { + // TEMP TEMP + //CViewRenderer &rVR = *CViewRenderer::getInstance(); + //rVR.drawRotFlipBitmap _RenderLayer, (_XReal, _YReal, _WReal, _HReal, 0, false, rVR.getBlankTextureId(), CRGBA(0, 255, 0, 255) ); + if (_Over) + { + CViewRenderer &rVR = *CViewRenderer::getInstance(); + + if (CWidgetManager::getInstance()->getModalWindow() == NULL) + { + sint32 x = CWidgetManager::getInstance()->getPointer()->getX(); + sint32 y = CWidgetManager::getInstance()->getPointer()->getY(); + + CInterfaceGroup *pIG = CWidgetManager::getInstance()->getWindowUnder(x, y); + CInterfaceGroup *pParent = this; + bool bFound = false; + while (pParent != NULL) + { + if (pParent == pIG) + { + bFound = true; + break; + } + pParent = pParent->getParent(); + } + + sint32 clipx, clipy, clipw, cliph; + getClip(clipx, clipy, clipw, cliph); + if ((x < clipx) || + (x > (clipx + clipw)) || + (y < clipy) || + (y > (clipy + cliph)) || !bFound) + { + _OverElt = -1; + } + else + { + for (uint32 i = 0; i < _Elements.size(); ++i) + if (_Elements[i].Element->getActive()) + { + CViewBase *pVB = _Elements[i].Element; + if ((x >= pVB->getXReal()) && + (x < (pVB->getXReal() + pVB->getWReal()))&& + (y >= pVB->getYReal()) && + (y < (pVB->getYReal() + pVB->getHReal()))) + { + _OverElt = i; + } + } + } + } + + if (_OverElt != -1) + { + // Find the first container + CInterfaceGroup *pIG = _Parent; + CGroupContainerBase *pGC = dynamic_cast(pIG); + while (pIG != NULL) + { + pIG = pIG->_Parent; + if (pIG == NULL) break; + if (dynamic_cast(pIG) != NULL) + pGC = dynamic_cast(pIG); + } + + bool bDisplayOverSelection = true; + if (pGC != NULL) + { + if (pGC->isGrayed()) + bDisplayOverSelection = false; + } + + if (bDisplayOverSelection) + { + CViewBase *pVB = _Elements[_OverElt].Element; + CRGBA col = _OverColor; + if(getModulateGlobalColor()) + { + col.modulateFromColor (_OverColor, CWidgetManager::getInstance()->getGlobalColorForContent()); + } + else + { + col= _OverColor; + col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8); + } + rVR.drawRotFlipBitmap (_RenderLayer, pVB->getXReal(), pVB->getYReal(), + pVB->getWReal(), pVB->getHReal(), 0, false, rVR.getBlankTextureId(), + col ); + } + + } + } + + CInterfaceGroup::draw (); + } + + // ---------------------------------------------------------------------------- + bool CGroupList::handleEvent (const NLGUI::CEventDescriptor& event) + { + if (!_Active) + return false; + + bool bReturn = CInterfaceGroup::handleEvent(event); + + if (event.getType() == NLGUI::CEventDescriptor::mouse) + { + const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event; + + _OverElt = -1; + if (!isIn(eventDesc.getX(), eventDesc.getY())) + return false; + + for (uint32 i = 0; i < _Elements.size(); ++i) + if (_Elements[i].Element->getActive()) + { + CViewBase *pVB = _Elements[i].Element; + if ((eventDesc.getX() >= pVB->getXReal()) && + (eventDesc.getX() < (pVB->getXReal() + pVB->getWReal()))&& + (eventDesc.getY() >= pVB->getYReal()) && + (eventDesc.getY() < (pVB->getYReal() + pVB->getHReal()))) + { + _OverElt = i; + } + } + } + + return bReturn; + } + + + + // predicate to remove a view from the list of element + struct CRemoveViewPred + { + bool operator()(const CGroupList::CElementInfo &info) const { return dynamic_cast(info.Element) != NULL; } + }; + + // predicate to remove a ctrl from the list of element + struct CRemoveCtrlPred + { + bool operator()(const CGroupList::CElementInfo &info) const { return dynamic_cast(info.Element) != NULL; } + }; + + // predicate to remove a group from the list of element + struct CRemoveGroupPred + { + bool operator()(const CGroupList::CElementInfo &info) const { return dynamic_cast(info.Element) != NULL; } + }; + + + // ---------------------------------------------------------------------------- + void CGroupList::clearViews() + { + _IdCounter = 0; + // remove views from the list of elements + _Elements.erase(std::remove_if(_Elements.begin(), _Elements.end(), CRemoveViewPred()), _Elements.end()); + CInterfaceGroup::clearViews(); + updateCoords(); + } + + // ---------------------------------------------------------------------------- + void CGroupList::clearControls() + { + _IdCounter = 0; + // remove views from the list of elements + _Elements.erase(std::remove_if(_Elements.begin(), _Elements.end(), CRemoveCtrlPred()), _Elements.end()); + CInterfaceGroup::clearControls(); + updateCoords(); + } + + // ---------------------------------------------------------------------------- + void CGroupList::clearGroups() + { + _IdCounter = 0; + // remove views from the list of elements + _Elements.erase(std::remove_if(_Elements.begin(), _Elements.end(), CRemoveGroupPred()), _Elements.end()); + CInterfaceGroup::clearGroups(); + updateCoords(); + } + + // ---------------------------------------------------------------------------- + void CGroupList::forceSizeW (sint32 newSizeW) + { + _W = newSizeW; + for (uint32 i = 0; i < _Elements.size(); ++i) + { + _Elements[i].Element->setW (_W); + _Elements[i].Element->CInterfaceElement::updateCoords(); + } + } + + // ---------------------------------------------------------------------------- + void CGroupList::forceSizeH (sint32 newSizeH) + { + _H = newSizeH; + for (uint32 i = 0; i < _Elements.size(); ++i) + { + _Elements[i].Element->setH (_H); + _Elements[i].Element->CInterfaceElement::updateCoords(); + } + } + + // ---------------------------------------------------------------------------- + void CGroupList::setMinW(sint32 minW) + { + _MinW= minW; + invalidateCoords(); + } + + // ---------------------------------------------------------------------------- + void CGroupList::setMinH(sint32 minH) + { + _MinH= minH; + invalidateCoords(); + } + + // ---------------------------------------------------------------------------- + bool CGroupList::addChildAtIndex(CViewBase *child, uint index, bool deleteOnRemove /*=true*/) + { + if (!child) + { + nlwarning(" : tried to add a NULL view"); + return false; + } + if (index > _Elements.size()) + { + return false; + } + child->_Parent = this; + child->_ParentPos = NULL; + child->_Active = true; + child->_X = 0; + child->_Y = 0; + child->_RenderLayer = this->_RenderLayer; + // Can't have sizeref on the coordinate corresponding to alignement + switch(_AddElt) + { + case Top: + case Bottom: + child->_SizeRef &= 1; // sizeref on w is permitted + break; + case Left: + case Right: + child->_SizeRef &= 2; // sizeref on h is permitted + break; + default: + nlwarning(" bad align"); + child->_SizeRef = 0; + break; + } + + child->_SizeDivW = 10; + child->_SizeDivH = 10; + + // Position the element according to the list alignement + setHSGroup (child, _AddElt, _Align); + + // update coords of the element (it may use child_resize_h or w) + //child->updateCoords(); + child->invalidateCoords(); + + // Update size + if ((_AddElt == Top) || (_AddElt == Bottom)) + { + // update the list size + sint32 newH = _H + child->getH(); + if (_Elements.size() > 0) + newH += _Space; + _H = newH; + + if ((_SizeRef&1) == 0) // No parent size reference in W + { + sint32 newW = max (_W, child->getW()); + _W = newW; + } + } + else + { + // Update the list coords + sint32 newW = _W + child->getW(); + if (_Elements.size() > 0) + newW += _Space; + _W = newW; + + if ((_SizeRef&2) == 0) // No parent size reference in H + { + sint32 newH = max (_H, child->getH()); + _H = newH; + } + } + + CElementInfo ei; + ei.Element = child; + ei.EltDeleteOnRemove = deleteOnRemove; + ei.Order = 0; + + if (index != 0) + { + // update alignement + setHSParent(child, _AddElt, _Align, _Space); + child->_ParentPos = _Elements[index - 1].Element; + } + _Elements.insert(_Elements.begin() + index, ei); + // link next element to this one + if (index < _Elements.size() - 1) + { + _Elements[index + 1].Element->_ParentPos = child; + setHSParent(_Elements[index + 1].Element, _AddElt, _Align, _Space); + } + + // Add this element for drawing + { + CInterfaceGroup *pIG = dynamic_cast(child); + if (pIG != NULL) + { + addGroup (pIG, (sint) index); + return true; + } + CCtrlBase *pCB = dynamic_cast(child); + if (pCB != NULL) + { + addCtrl (pCB, (sint) index); + return true; + } + CViewBase *pVB = dynamic_cast(child); + if (pVB != NULL) + { + addView (pVB, (sint) index); + return true; + } + nlstop; + return false; + } + return false; + } + + // ---------------------------------------------------------------------------- + sint32 CGroupList::getElementIndex(CViewBase* child) const + { + for(uint k = 0; k < _Elements.size(); ++k) + { + if (_Elements[k].Element == child) return k; + } + return -1; + } + + // ---------------------------------------------------------------------------- + int CGroupList::luaGetElementIndex(CLuaState &ls) + { + CLuaIHM::checkArgCount(ls, "getElementIndex", 1); + CViewBase * viewBase = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); + ls.push((double) getElementIndex(viewBase)); + return 1; + } + + // ---------------------------------------------------------------------------- + void CGroupList::swapChildren(uint index1, uint index2) + { + if (index1 >= _Elements.size() + || index2 >= _Elements.size()) + { + nlwarning(" bad indexes"); + return; + } + // prevent elements from being deleted + bool oldMustDelete1 = _Elements[index1].EltDeleteOnRemove; + bool oldMustDelete2 = _Elements[index2].EltDeleteOnRemove; + + uint order1 = _Elements[index1].Order; + uint order2 = _Elements[index2].Order; + + _Elements[index1].EltDeleteOnRemove = false; + _Elements[index2].EltDeleteOnRemove = false; + + CViewBase *v1 = _Elements[index1].Element; + CViewBase *v2 = _Elements[index2].Element; + + + if (index1 < index2) + { + delChild(index2); + delChild(index1); + addChildAtIndex(v2, index1, oldMustDelete2); + setOrder(index1, order2); + addChildAtIndex(v1, index2, oldMustDelete1); + setOrder(index2, order1); + } + else + { + delChild(index1); + delChild(index2); + addChildAtIndex(v1, index2, oldMustDelete1); + setOrder(index2, order1); + addChildAtIndex(v2, index1, oldMustDelete2); + setOrder(index1, order2); + } + } + + // ---------------------------------------------------------------------------- + int CGroupList::luaUpChild(CLuaState &ls) + { + CLuaIHM::checkArgCount(ls, "upChild", 1); + CViewBase * viewBase = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); + sint32 indexUpChild = getElementIndex(viewBase); + if(indexUpChild > 0) + { + swapChildren(indexUpChild, indexUpChild-1); + } + return 0; + } + + // ---------------------------------------------------------------------------- + int CGroupList::luaDownChild(CLuaState &ls) + { + CLuaIHM::checkArgCount(ls, "downChild", 1); + CViewBase * viewBase = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); + sint32 indexDownChild = getElementIndex(viewBase); + if(indexDownChild < (sint32) (_Elements.size()-1)) + { + swapChildren(indexDownChild, indexDownChild+1); + } + return 0; + } + + // ---------------------------------------------------------------------------- + int CGroupList::luaGetChild(CLuaState &ls) + { + const char *funcName = "getChild"; + CLuaIHM::checkArgCount(ls, funcName, 1); + CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); + sint index = (sint) ls.toNumber(1); + if(index < 0 || index >= (sint) _Elements.size()) + { + CLuaIHM::fails(ls, "getChild : trying to access element %d in list '%s', which has %d elements", + index, getId().c_str(), (int) _Elements.size()); + } + CLuaIHM::pushUIOnStack(ls, getChild((uint) index)); + return 1; + } + + // ---------------------------------------------------------------------------- + void CGroupList::deleteAllChildren() + { + uint numChildren = getNbElement(); + for(uint k = 0; k < numChildren; ++k) + { + delChild(numChildren - 1 - k); // delete in reverse order to avoid unnecessary vector copies + } + } + + // ---------------------------------------------------------------------------- + uint CGroupList::getNumActiveChildren() const + { + uint numChildren = 0; + for(uint k = 0; k < _Elements.size(); ++k) + { + if (_Elements[k].Element->getActive()) ++numChildren; + } + return numChildren; + } + + // ---------------------------------------------------------------------------- + void CGroupList::setDelOnRemove(uint index, bool delOnRemove) + { + if (index >= _Elements.size()) + { + nlwarning("bad index"); + return; + } + _Elements[index].EltDeleteOnRemove = delOnRemove; + } + + // ---------------------------------------------------------------------------- + bool CGroupList::getDelOnRemove(uint index) const + { + if (index >= _Elements.size()) + { + nlwarning("bad index"); + return false; + } + return _Elements[index].EltDeleteOnRemove; + } + + + // ---------------------------------------------------------------------------- + int CGroupList::luaAddTextChild(CLuaState &ls) + { + CLuaIHM::checkArgCount(ls, "addTextChild", 1); + ucstring text; + if(CLuaIHM::pop(ls, text)) + { + addTextChild(text); + } + return 0; + } + + // ---------------------------------------------------------------------------- + int CGroupList::luaAddColoredTextChild(CLuaState &ls) + { + const char *funcName = "addColoredTextChild"; + CLuaIHM::checkArgCount(ls, funcName, 5); + CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); + CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER); + CLuaIHM::checkArgType(ls, funcName, 3, LUA_TNUMBER); + CLuaIHM::checkArgType(ls, funcName, 4, LUA_TNUMBER); + CLuaIHM::checkArgType(ls, funcName, 5, LUA_TNUMBER); + string text = ls.toString(1); + ucstring ucText; + ucText.fromUtf8(text); + + uint r = (uint) ls.toNumber(2); + uint g = (uint) ls.toNumber(3); + uint b = (uint) ls.toNumber(4); + uint a = (uint) ls.toNumber(5); + + addTextChild(ucText, CRGBA(r, g, b, a)); + + return 0; + } + + // ---------------------------------------------------------------------------- + int CGroupList::luaAddChild(CLuaState &ls) + { + const char *funcName = "addChild"; + CLuaIHM::checkArgCount(ls, funcName, 1); + CViewBase *vb = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); + if (!vb) + { + CLuaIHM::fails(ls, "%s requires a view, group or control", funcName); + } + else + { + addChild(vb); + } + return 0; + } + + // ---------------------------------------------------------------------------- + int CGroupList::luaAddChildAtIndex(CLuaState &ls) + { + const char *funcName = "addChildAtIndex"; + CLuaIHM::checkArgCount(ls, funcName, 2); + CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER); + CViewBase *vb = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); + if (!vb) + { + CLuaIHM::fails(ls, "%s requires a view, group or control", funcName); + } + else + { + addChildAtIndex(vb, (uint) ls.toNumber(2)); + } + return 0; + } + + // ---------------------------------------------------------------------------- + int CGroupList::luaDetachChild(CLuaState &ls) + { + const char *funcName = "detachChild"; + CLuaIHM::checkArgCount(ls, funcName, 1); + CViewBase *vb = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); + if (!vb) + { + nlwarning("%s requires a view, group or control", funcName); + ls.push(false); + } + else + { + ls.push(delChild(vb, false, true)); + } + return 1; + } + + // ---------------------------------------------------------------------------- + int CGroupList::luaDelChild(CLuaState &ls) + { + CLuaIHM::checkArgCount(ls, "CGroupList::delChild", 1); + CViewBase *vb = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); + if (vb) delChild(vb); + updateCoords(); + return 0; + } + + + + // ---------------------------------------------------------------------------- + int CGroupList::luaClear(CLuaState &ls) + { + CLuaIHM::checkArgCount(ls, "clear", 0); + deleteAllChildren(); + return 0; + } + +} + diff --git a/code/ryzom/client/src/client_chat_manager.cpp b/code/ryzom/client/src/client_chat_manager.cpp index 1ebbb53f2..85038deea 100644 --- a/code/ryzom/client/src/client_chat_manager.cpp +++ b/code/ryzom/client/src/client_chat_manager.cpp @@ -23,7 +23,7 @@ #include "client_chat_manager.h" #include "net_manager.h" -#include "interface_v3/group_list.h" +#include "nel/gui/group_list.h" #include "interface_v3/interface_manager.h" #include "interface_v3/people_interraction.h" #include "string_manager_client.h" diff --git a/code/ryzom/client/src/interface_v3/chat_displayer.h b/code/ryzom/client/src/interface_v3/chat_displayer.h index 9c8120223..fc87ba9cb 100644 --- a/code/ryzom/client/src/interface_v3/chat_displayer.h +++ b/code/ryzom/client/src/interface_v3/chat_displayer.h @@ -20,7 +20,7 @@ #define NL_CHAT_DISPLAYER_H #include "nel/misc/displayer.h" -#include "group_list.h" +#include "nel/gui/group_list.h" #include "interface_manager.h" #include "nel/misc/mutex.h" diff --git a/code/ryzom/client/src/interface_v3/chat_window.h b/code/ryzom/client/src/interface_v3/chat_window.h index 285116998..da6179fd8 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.h +++ b/code/ryzom/client/src/interface_v3/chat_window.h @@ -29,6 +29,7 @@ namespace NLGUI { class CCtrlBase; class CViewText; + class CGroupList; } class CChatWindow; @@ -206,7 +207,7 @@ protected: std::vector _FreeTellers; - void getAssociatedSubWindow(CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, class CGroupList *&gl, class CCtrlTabButton *&tab); + void getAssociatedSubWindow(CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, NLGUI::CGroupList *&gl, class CCtrlTabButton *&tab); void updateFreeTellerHeader(CGroupContainer &ft); private: diff --git a/code/ryzom/client/src/interface_v3/group_container.cpp b/code/ryzom/client/src/interface_v3/group_container.cpp index 8e397bcfc..0b103d511 100644 --- a/code/ryzom/client/src/interface_v3/group_container.cpp +++ b/code/ryzom/client/src/interface_v3/group_container.cpp @@ -31,7 +31,7 @@ #include "nel/gui/view_text_id.h" #include "nel/gui/lua_ihm.h" -#include "group_list.h" +#include "nel/gui/group_list.h" #include "nel/gui/ctrl_button.h" #include "nel/gui/ctrl_scroll.h" #include "nel/gui/view_text.h" diff --git a/code/ryzom/client/src/interface_v3/group_container.h b/code/ryzom/client/src/interface_v3/group_container.h index 26a1b3a45..aa1ac8018 100644 --- a/code/ryzom/client/src/interface_v3/group_container.h +++ b/code/ryzom/client/src/interface_v3/group_container.h @@ -30,6 +30,7 @@ namespace NLGUI class CCtrlScroll; class CViewText; class CViewBitmap; + class CGroupList; } class COptionsContainerInsertion; @@ -37,7 +38,6 @@ class COptionsContainerMove; class CGroupContainer; class CInterfaceManager; class COptionsLayer; -class CGroupList; // *************************************************************************** /** diff --git a/code/ryzom/client/src/interface_v3/group_header.h b/code/ryzom/client/src/interface_v3/group_header.h index 248c9585a..113130d1d 100644 --- a/code/ryzom/client/src/interface_v3/group_header.h +++ b/code/ryzom/client/src/interface_v3/group_header.h @@ -18,7 +18,7 @@ #define CL_GROUP_HEADER_H -#include "group_list.h" +#include "nel/gui/group_list.h" class CGroupHeaderEntry; diff --git a/code/ryzom/client/src/interface_v3/group_html.cpp b/code/ryzom/client/src/interface_v3/group_html.cpp index 77d4c422d..3f10224c5 100644 --- a/code/ryzom/client/src/interface_v3/group_html.cpp +++ b/code/ryzom/client/src/interface_v3/group_html.cpp @@ -29,7 +29,7 @@ extern "C" #include "../libwww.h" #include "group_html.h" -#include "group_list.h" +#include "nel/gui/group_list.h" #include "group_container.h" #include "view_link.h" #include "nel/gui/ctrl_scroll.h" diff --git a/code/ryzom/client/src/interface_v3/group_html.h b/code/ryzom/client/src/interface_v3/group_html.h index 963c0f07f..a0a4b7d7d 100644 --- a/code/ryzom/client/src/interface_v3/group_html.h +++ b/code/ryzom/client/src/interface_v3/group_html.h @@ -41,9 +41,9 @@ namespace NLGUI { class CCtrlButton; class CCtrlScroll; + class CGroupList; } -class CGroupList; class CDBGroupComboBox; class CGroupParagraph; diff --git a/code/ryzom/client/src/interface_v3/group_list.cpp b/code/ryzom/client/src/interface_v3/group_list.cpp deleted file mode 100644 index 3db145367..000000000 --- a/code/ryzom/client/src/interface_v3/group_list.cpp +++ /dev/null @@ -1,1152 +0,0 @@ -// 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 "group_list.h" -#include "nel/gui/interface_element.h" -#include "nel/gui/view_bitmap.h" -#include "nel/gui/view_text_id.h" -#include "nel/gui/group_container_base.h" -#include "nel/gui/lua_ihm.h" -#include "nel/misc/xml_auto_ptr.h" -#include "nel/gui/widget_manager.h" -#include "nel/gui/view_pointer_base.h" - -using namespace std; -using namespace NLMISC; - -NLMISC_REGISTER_OBJECT(CViewBase, CGroupList, std::string, "list"); - -// ---------------------------------------------------------------------------- -CGroupList::CGroupList(const TCtorParam ¶m) -: CInterfaceGroup(param), - _Templ(TCtorParam()) -{ - _IdCounter = 0; - _MaxElements = 1024; - _AddElt = Bottom; - _Align = Left; - _Space = 0; - _DynamicDisplaySize = false; - _MinW= 0; - _MinH= 0; - _Over = false; - _OverColor = CRGBA(255, 255, 255, 32); - _OverElt = -1; - _IsGroupList = true; -} - -// ---------------------------------------------------------------------------- -void CGroupList::addChild (CViewBase* child, bool deleteOnRemove) -{ - if (!child) - { - nlwarning(" : tried to add a NULL view"); - return; - } - - // Make sure there's room for the element - if ((sint32)_Elements.size() == _MaxElements) - { - removeHead(); - } - - // add child at last index - addChildAtIndex(child, (uint)_Elements.size(), deleteOnRemove); - if (_Elements.size() >= 2) - { - setOrder((uint)_Elements.size() - 1, getOrder((uint)_Elements.size() - 2) + 1); - } -} - -// ---------------------------------------------------------------------------- -CGroupList::~CGroupList() -{ - deleteAllChildren(); -} - -// ---------------------------------------------------------------------------- -// Set Hotspot of the first element in reference to the group -void CGroupList::setHSGroup (CViewBase *child, EAlign addElt, EAlign align) -{ - switch (addElt) - { - case Bottom: - if (align == Left) - { - child->_ParentPosRef = Hotspot_TL; - child->_PosRef = Hotspot_TL; - } - else // align == Right - { - child->_ParentPosRef = Hotspot_TR; - child->_PosRef = Hotspot_TR; - } - break; - case Left: - if (align == Top) - { - child->_ParentPosRef = Hotspot_TR; - child->_PosRef = Hotspot_TR; - } - else // align == Bottom - { - child->_ParentPosRef = Hotspot_BR; - child->_PosRef = Hotspot_BR; - } - break; - case Top: - if (align == Left) - { - child->_ParentPosRef = Hotspot_BL; - child->_PosRef = Hotspot_BL; - } - else // align == Right - { - child->_ParentPosRef = Hotspot_BR; - child->_PosRef = Hotspot_BR; - } - break; - case Right: - if (align == Top) - { - child->_ParentPosRef = Hotspot_TL; - child->_PosRef = Hotspot_TL; - } - else // align == Bottom - { - child->_ParentPosRef = Hotspot_BL; - child->_PosRef = Hotspot_BL; - } - break; - default: - nlassert(false); - break; - } -} - -// ---------------------------------------------------------------------------- -/** align an element towards its parent in the group - */ -void CGroupList::setHSParent(CViewBase *view, EAlign addElt, EAlign /* align */, uint space) -{ - if ((addElt == Top) || (addElt == Bottom)) - { - if (addElt == Bottom) - { - if (_Align == Left) - view->_ParentPosRef = Hotspot_BL; - else // align == Right - view->_ParentPosRef = Hotspot_BR; - //view->_Y = -abs((sint32)space); - view->_Y = - (sint32)space; - } - else if (addElt == Top) - { - if (_Align == Left) - view->_ParentPosRef = Hotspot_TL; - else // align == Right - view->_ParentPosRef = Hotspot_TR; - // view->_Y = abs((sint32)space); - view->_Y = (sint32)space; - } - } - else - { - if (addElt == Left) - { - if (_Align == Top) - view->_ParentPosRef = Hotspot_TL; - else // align == Bottom - view->_ParentPosRef = Hotspot_BL; - //view->_X = -abs((sint32)space); - view->_X = -(sint32)space; - } - else if (addElt == Right) - { - if (_Align == Top) - view->_ParentPosRef = Hotspot_TR; - else // align == Bottom - view->_ParentPosRef = Hotspot_BR; - //view->_X = abs((sint32)space); - view->_X = (sint32)space; - } - } -} - -// ---------------------------------------------------------------------------- -bool CGroupList::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) -{ - if (!CInterfaceGroup::parse(cur, parentGroup)) - return false; - - // Parse location. If these properties are not specified, set them to 0 - - CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"maxelements" )); - _MaxElements = 1024; - if (ptr) - { - if (!fromString((const char*)ptr, _MaxElements)) - { - nlwarning(" Can't parse the 'maxelements' field "); - } - } - - ptr = (char*) xmlGetProp( cur, (xmlChar*)"addelt" ); - _AddElt = Bottom; - if (ptr) - { - if (stricmp(ptr, "B") == 0) - _AddElt = Bottom; - else if (stricmp(ptr, "T") == 0) - _AddElt = Top; - else if (stricmp(ptr, "L") == 0) - _AddElt = Left; - else if (stricmp(ptr, "R") == 0) - _AddElt = Right; - } - - ptr = (char*) xmlGetProp( cur, (xmlChar*)"align" ); - _Align = Left; - if (ptr) - { - if (stricmp(ptr, "B") == 0) - _Align = Bottom; - else if (stricmp(ptr, "T") == 0) - _Align = Top; - else if (stricmp(ptr, "L") == 0) - _Align = Left; - else if (stricmp(ptr, "R") == 0) - _Align = Right; - } - - ptr = (char*) xmlGetProp( cur, (xmlChar*)"space" ); - _Space = 0; - if (ptr) - fromString((const char*)ptr, _Space); - - EAlign addElt = _AddElt; -// EAlign align = _Align; - _GroupSizeRef = _SizeRef; - if ((addElt == Top) || (addElt == Bottom)) - { - setMaxW (_W); - setMaxH(_H); - _H = 0; - _SizeRef = _SizeRef&(~2); - } - else - { - setMaxW (_W); - setMaxH (_H); - _W = 0; - _SizeRef = _SizeRef&(~1); - } - - ptr = (char*) xmlGetProp( cur, (xmlChar*)"over" ); - _Over = false; - if (ptr) _Over = convertBool(ptr); - - ptr = (char*) xmlGetProp( cur, (xmlChar*)"dynamic_display_size" ); - _DynamicDisplaySize = false; - if (ptr) _DynamicDisplaySize = convertBool(ptr); - - ptr = (char*) xmlGetProp( cur, (xmlChar*)"col_over" ); - _OverColor = CRGBA(255, 255, 255, 32); - if (ptr) _OverColor = convertColor(ptr); - - - // TEMPLATE TEXT SETUP - - // justification parameters - _Templ.parseTextOptions (cur); - - // initial text - ptr = (char*) xmlGetProp( cur, (xmlChar*)"hardtext" ); - if (ptr) - { - const char *propPtr = ptr; - ucstring Text = ucstring(propPtr); - if ((strlen(propPtr)>2) && (propPtr[0] == 'u') && (propPtr[1] == 'i')) - Text = CI18N::get (propPtr); - - addTextChild(Text); - } - else - { - ptr = (char*) xmlGetProp( cur, (xmlChar*)"textid" ); - if (ptr) - { - uint32 textId; - fromString((const char*)ptr, textId); - addTextChildID(textId); - } - } - - return true; -} - - - -// ---------------------------------------------------------------------------- -void CGroupList::addTextChild(const ucstring& line, bool multiLine /*= true*/) -{ - const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; - CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); - view->_Parent = this; - view->setMultiLine (multiLine); - view->setTextMode(_Templ.getTextMode()); - if (multiLine) view->setMultiLineSpace (_Space); - view->setText (line); - // Herit global-coloring - view->setModulateGlobalColor(getModulateGlobalColor()); - addChild(view); - invalidateCoords(); -} - - - -// ---------------------------------------------------------------------------- -void CGroupList::addTextChild(const ucstring& line, const CRGBA& textColor, bool multiLine /*= true*/) -{ - const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; - CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); - view->_Parent = this; - view->setMultiLine (multiLine); - if (multiLine) view->setMultiLineSpace (_Space); - view->setText (line); - view->setColor (textColor); - // Herit global-coloring - view->setModulateGlobalColor(getModulateGlobalColor()); - addChild(view); - invalidateCoords(); -} - -// ---------------------------------------------------------------------------- -void CGroupList::addTextChildID (uint32 nID, bool multiLine) -{ - const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; - CViewTextID *view= new CViewTextID (elid, nID, _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); - view->_Parent = this; - view->setMultiLine (multiLine); - if (multiLine) view->setMultiLineSpace (_Space); - // Herit global-coloring - view->setModulateGlobalColor(getModulateGlobalColor()); - addChild (view); - invalidateCoords(); -} - -// ---------------------------------------------------------------------------- -void CGroupList::addTextChildID(const std::string &dbPath, bool multiLine /*=true*/) -{ - const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; - CViewTextID *view= new CViewTextID (elid, dbPath, _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); - view->_Parent = this; - view->setMultiLine (multiLine); - if (multiLine) view->setMultiLineSpace (_Space); - // Herit global-coloring - view->setModulateGlobalColor(getModulateGlobalColor()); - addChild (view); - invalidateCoords(); -} - -// ---------------------------------------------------------------------------- -bool CGroupList::delChild (CViewBase* childToDel, bool noWarning, bool forceDontDelete) -{ - // Look for child - uint posChildToDel = 0; - for (posChildToDel = 0; posChildToDel < _Elements.size(); ++posChildToDel) - { - CElementInfo rEI = _Elements[posChildToDel]; - if (rEI.Element == childToDel) - break; - } - - if (posChildToDel == _Elements.size()) - { - if (!noWarning) - nlwarning("Can't del child %s, it does not exist in the list", childToDel->getId().c_str()); - return false; - } - return delChild(posChildToDel, forceDontDelete); -} - -// ---------------------------------------------------------------------------- -bool CGroupList::delChild(uint posChildToDel, bool forceDontDelete) -{ - if (posChildToDel >= (uint) _Elements.size()) - { - nlwarning(" bad index"); - return false; - } - - CViewBase* childToDel = _Elements[posChildToDel].Element; - - childToDel->_Parent = NULL; - - bool elementMustBeDeleted = _Elements[posChildToDel].EltDeleteOnRemove && !forceDontDelete; - _Elements.erase (_Elements.begin()+posChildToDel); - // Remove from drawing - if (dynamic_cast(childToDel)) delGroup(static_cast(childToDel), !elementMustBeDeleted); - else if (dynamic_cast(childToDel)) delCtrl(static_cast(childToDel), !elementMustBeDeleted); - else delView(childToDel, !elementMustBeDeleted); - - // Bind the new first element - if (posChildToDel < _Elements.size()) - { - CViewBase *pVB = _Elements[posChildToDel].Element; - if (posChildToDel == 0) - { - pVB->_ParentPos = NULL; - setHSGroup (pVB, _AddElt, _Align); - if ((_AddElt == Top) || (_AddElt == Bottom)) - pVB->setY (0); - else - pVB->setX (0); - } - else - pVB->_ParentPos = _Elements[posChildToDel-1].Element; - } - return true; -} - -// ---------------------------------------------------------------------------- -void CGroupList::removeHead () -{ - if (_Elements.empty()) - { - nlwarning(" Can't remove head, list is empty"); - return; - } - delChild (_Elements.begin()->Element); - /*CViewBase *pVB = _Elements.begin()->Element; - if ((_AddElt == Top) || (_AddElt == Bottom)) - { - sint32 shift = _H - (pVB->getH() + _Space); - _H = shift; - } - else - { - sint32 shift = _W - (pVB->getW() + _Space); - _W = shift; - } - - bool FirstElementMustBeDeleted = _Elements.begin()->EltDeleteOnRemove; - if (FirstElementMustBeDeleted) - delete pVB; - _Elements.erase (_Elements.begin()); - // Remove from drawing - for (vector::iterator itg = _ChildrenGroups.begin(); itg != _ChildrenGroups.end(); itg++) - if(*itg == pVB) - { - _ChildrenGroups.erase (itg); - break; - } - for (vector::iterator itc = _Controls.begin(); itc != _Controls.end(); itc++) - if(*itc == pVB) - { - _Controls.erase (itc); - break; - } - for (vector::iterator itv = _Views.begin(); itv != _Views.end(); itv++) - if(*itv == pVB) - { - _Views.erase (itv); - break; - } - delEltOrder (pVB); - - // Bind the new first element - pVB = _Elements.begin()->Element; - pVB->_ParentPos = NULL; - setHSGroup (pVB, _AddElt, _Align); - if ((_AddElt == Top) || (_AddElt == Bottom)) - pVB->setY (0); - else - pVB->setX (0);*/ -} - -// ---------------------------------------------------------------------------- -void CGroupList::setTextTemplate(const CViewText& templ) -{ - _Templ = templ; -} - - -// ---------------------------------------------------------------------------- -void CGroupList::updateCoords() -{ - if (!_Active) return; - // Handle if elements are not active - for (sint32 i = 0; i < ((sint32)_Elements.size()-1); ++i) - { - if (_Elements[i].Element->getActive()) - setHSParent(_Elements[i+1].Element, _AddElt, _Align, _Space); - else - setHSParent(_Elements[i+1].Element, _AddElt, _Align, 0); - } - - CInterfaceGroup::updateCoords(); - - sint32 nCurrentX = 0; // Current offset of an element - - EAlign addElt = _AddElt; - if ((addElt == Top) || (addElt == Bottom)) - { - // Calculate size - sint32 newH = 0, newW = 0; - bool bFirst = true; - - for (uint32 i = 0; i < _Elements.size(); ++i) - if (_Elements[i].Element->getActive()) - { - newH += _Elements[i].Element->getH(); - if (!bFirst) - newH += _Space; - bFirst = false; - nCurrentX += _Elements[i].Element->getX(); - newW = max (newW, _Elements[i].Element->getW()+(sint32)abs(nCurrentX)); - } - _W = max(newW, _MinW); - _H = max(newH, _MinH); - if (_DynamicDisplaySize) - { - _MaxW = _W; - _MaxH = _H; - } - if (_H < _MaxH) setOfsY(0); - } - else - { - sint32 newW = 0, newH = 0; - bool bFirst = true; - - for (uint32 i = 0; i < _Elements.size(); ++i) - if (_Elements[i].Element->getActive()) - { - newW += _Elements[i].Element->getW(); - if (!bFirst) - newW += _Space; - bFirst = false; - newH = max (newH, _Elements[i].Element->getH()); - } - _W = max(newW, _MinW); - _H = max(newH, _MinH); - if (_DynamicDisplaySize) - { - _MaxW = _W; - _MaxH = _H; - } - if (_W < _MaxW) setOfsX(0); - } - - CInterfaceElement::updateCoords(); -} - -// ---------------------------------------------------------------------------- -void CGroupList::draw () -{ - // TEMP TEMP - //CViewRenderer &rVR = *CViewRenderer::getInstance(); - //rVR.drawRotFlipBitmap _RenderLayer, (_XReal, _YReal, _WReal, _HReal, 0, false, rVR.getBlankTextureId(), CRGBA(0, 255, 0, 255) ); - if (_Over) - { - CViewRenderer &rVR = *CViewRenderer::getInstance(); - - if (CWidgetManager::getInstance()->getModalWindow() == NULL) - { - sint32 x = CWidgetManager::getInstance()->getPointer()->getX(); - sint32 y = CWidgetManager::getInstance()->getPointer()->getY(); - - CInterfaceGroup *pIG = CWidgetManager::getInstance()->getWindowUnder(x, y); - CInterfaceGroup *pParent = this; - bool bFound = false; - while (pParent != NULL) - { - if (pParent == pIG) - { - bFound = true; - break; - } - pParent = pParent->getParent(); - } - - sint32 clipx, clipy, clipw, cliph; - getClip(clipx, clipy, clipw, cliph); - if ((x < clipx) || - (x > (clipx + clipw)) || - (y < clipy) || - (y > (clipy + cliph)) || !bFound) - { - _OverElt = -1; - } - else - { - for (uint32 i = 0; i < _Elements.size(); ++i) - if (_Elements[i].Element->getActive()) - { - CViewBase *pVB = _Elements[i].Element; - if ((x >= pVB->getXReal()) && - (x < (pVB->getXReal() + pVB->getWReal()))&& - (y >= pVB->getYReal()) && - (y < (pVB->getYReal() + pVB->getHReal()))) - { - _OverElt = i; - } - } - } - } - - if (_OverElt != -1) - { - // Find the first container - CInterfaceGroup *pIG = _Parent; - CGroupContainerBase *pGC = dynamic_cast(pIG); - while (pIG != NULL) - { - pIG = pIG->_Parent; - if (pIG == NULL) break; - if (dynamic_cast(pIG) != NULL) - pGC = dynamic_cast(pIG); - } - - bool bDisplayOverSelection = true; - if (pGC != NULL) - { - if (pGC->isGrayed()) - bDisplayOverSelection = false; - } - - if (bDisplayOverSelection) - { - CViewBase *pVB = _Elements[_OverElt].Element; - CRGBA col = _OverColor; - if(getModulateGlobalColor()) - { - col.modulateFromColor (_OverColor, CWidgetManager::getInstance()->getGlobalColorForContent()); - } - else - { - col= _OverColor; - col.A = (uint8)(((sint32)col.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8); - } - rVR.drawRotFlipBitmap (_RenderLayer, pVB->getXReal(), pVB->getYReal(), - pVB->getWReal(), pVB->getHReal(), 0, false, rVR.getBlankTextureId(), - col ); - } - - } - } - - CInterfaceGroup::draw (); -} - -// ---------------------------------------------------------------------------- -bool CGroupList::handleEvent (const NLGUI::CEventDescriptor& event) -{ - if (!_Active) - return false; - - bool bReturn = CInterfaceGroup::handleEvent(event); - - if (event.getType() == NLGUI::CEventDescriptor::mouse) - { - const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event; - - _OverElt = -1; - if (!isIn(eventDesc.getX(), eventDesc.getY())) - return false; - - for (uint32 i = 0; i < _Elements.size(); ++i) - if (_Elements[i].Element->getActive()) - { - CViewBase *pVB = _Elements[i].Element; - if ((eventDesc.getX() >= pVB->getXReal()) && - (eventDesc.getX() < (pVB->getXReal() + pVB->getWReal()))&& - (eventDesc.getY() >= pVB->getYReal()) && - (eventDesc.getY() < (pVB->getYReal() + pVB->getHReal()))) - { - _OverElt = i; - } - } - } - - return bReturn; -} - - - -// predicate to remove a view from the list of element -struct CRemoveViewPred -{ - bool operator()(const CGroupList::CElementInfo &info) const { return dynamic_cast(info.Element) != NULL; } -}; - -// predicate to remove a ctrl from the list of element -struct CRemoveCtrlPred -{ - bool operator()(const CGroupList::CElementInfo &info) const { return dynamic_cast(info.Element) != NULL; } -}; - -// predicate to remove a group from the list of element -struct CRemoveGroupPred -{ - bool operator()(const CGroupList::CElementInfo &info) const { return dynamic_cast(info.Element) != NULL; } -}; - - -// ---------------------------------------------------------------------------- -void CGroupList::clearViews() -{ - _IdCounter = 0; - // remove views from the list of elements - _Elements.erase(std::remove_if(_Elements.begin(), _Elements.end(), CRemoveViewPred()), _Elements.end()); - CInterfaceGroup::clearViews(); - updateCoords(); -} - -// ---------------------------------------------------------------------------- -void CGroupList::clearControls() -{ - _IdCounter = 0; - // remove views from the list of elements - _Elements.erase(std::remove_if(_Elements.begin(), _Elements.end(), CRemoveCtrlPred()), _Elements.end()); - CInterfaceGroup::clearControls(); - updateCoords(); -} - -// ---------------------------------------------------------------------------- -void CGroupList::clearGroups() -{ - _IdCounter = 0; - // remove views from the list of elements - _Elements.erase(std::remove_if(_Elements.begin(), _Elements.end(), CRemoveGroupPred()), _Elements.end()); - CInterfaceGroup::clearGroups(); - updateCoords(); -} - -// ---------------------------------------------------------------------------- -void CGroupList::forceSizeW (sint32 newSizeW) -{ - _W = newSizeW; - for (uint32 i = 0; i < _Elements.size(); ++i) - { - _Elements[i].Element->setW (_W); - _Elements[i].Element->CInterfaceElement::updateCoords(); - } -} - -// ---------------------------------------------------------------------------- -void CGroupList::forceSizeH (sint32 newSizeH) -{ - _H = newSizeH; - for (uint32 i = 0; i < _Elements.size(); ++i) - { - _Elements[i].Element->setH (_H); - _Elements[i].Element->CInterfaceElement::updateCoords(); - } -} - -// ---------------------------------------------------------------------------- -void CGroupList::setMinW(sint32 minW) -{ - _MinW= minW; - invalidateCoords(); -} - -// ---------------------------------------------------------------------------- -void CGroupList::setMinH(sint32 minH) -{ - _MinH= minH; - invalidateCoords(); -} - -// ---------------------------------------------------------------------------- -bool CGroupList::addChildAtIndex(CViewBase *child, uint index, bool deleteOnRemove /*=true*/) -{ - if (!child) - { - nlwarning(" : tried to add a NULL view"); - return false; - } - if (index > _Elements.size()) - { - return false; - } - child->_Parent = this; - child->_ParentPos = NULL; - child->_Active = true; - child->_X = 0; - child->_Y = 0; - child->_RenderLayer = this->_RenderLayer; - // Can't have sizeref on the coordinate corresponding to alignement - switch(_AddElt) - { - case Top: - case Bottom: - child->_SizeRef &= 1; // sizeref on w is permitted - break; - case Left: - case Right: - child->_SizeRef &= 2; // sizeref on h is permitted - break; - default: - nlwarning(" bad align"); - child->_SizeRef = 0; - break; - } - - child->_SizeDivW = 10; - child->_SizeDivH = 10; - - // Position the element according to the list alignement - setHSGroup (child, _AddElt, _Align); - - // update coords of the element (it may use child_resize_h or w) - //child->updateCoords(); - child->invalidateCoords(); - - // Update size - if ((_AddElt == Top) || (_AddElt == Bottom)) - { - // update the list size - sint32 newH = _H + child->getH(); - if (_Elements.size() > 0) - newH += _Space; - _H = newH; - - if ((_SizeRef&1) == 0) // No parent size reference in W - { - sint32 newW = max (_W, child->getW()); - _W = newW; - } - } - else - { - // Update the list coords - sint32 newW = _W + child->getW(); - if (_Elements.size() > 0) - newW += _Space; - _W = newW; - - if ((_SizeRef&2) == 0) // No parent size reference in H - { - sint32 newH = max (_H, child->getH()); - _H = newH; - } - } - - CElementInfo ei; - ei.Element = child; - ei.EltDeleteOnRemove = deleteOnRemove; - ei.Order = 0; - - if (index != 0) - { - // update alignement - setHSParent(child, _AddElt, _Align, _Space); - child->_ParentPos = _Elements[index - 1].Element; - } - _Elements.insert(_Elements.begin() + index, ei); - // link next element to this one - if (index < _Elements.size() - 1) - { - _Elements[index + 1].Element->_ParentPos = child; - setHSParent(_Elements[index + 1].Element, _AddElt, _Align, _Space); - } - - // Add this element for drawing - { - CInterfaceGroup *pIG = dynamic_cast(child); - if (pIG != NULL) - { - addGroup (pIG, (sint) index); - return true; - } - CCtrlBase *pCB = dynamic_cast(child); - if (pCB != NULL) - { - addCtrl (pCB, (sint) index); - return true; - } - CViewBase *pVB = dynamic_cast(child); - if (pVB != NULL) - { - addView (pVB, (sint) index); - return true; - } - nlstop; - return false; - } - return false; -} - -// ---------------------------------------------------------------------------- -sint32 CGroupList::getElementIndex(CViewBase* child) const -{ - for(uint k = 0; k < _Elements.size(); ++k) - { - if (_Elements[k].Element == child) return k; - } - return -1; -} - -// ---------------------------------------------------------------------------- -int CGroupList::luaGetElementIndex(CLuaState &ls) -{ - CLuaIHM::checkArgCount(ls, "getElementIndex", 1); - CViewBase * viewBase = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); - ls.push((double) getElementIndex(viewBase)); - return 1; -} - -// ---------------------------------------------------------------------------- -void CGroupList::swapChildren(uint index1, uint index2) -{ - if (index1 >= _Elements.size() - || index2 >= _Elements.size()) - { - nlwarning(" bad indexes"); - return; - } - // prevent elements from being deleted - bool oldMustDelete1 = _Elements[index1].EltDeleteOnRemove; - bool oldMustDelete2 = _Elements[index2].EltDeleteOnRemove; - - uint order1 = _Elements[index1].Order; - uint order2 = _Elements[index2].Order; - - _Elements[index1].EltDeleteOnRemove = false; - _Elements[index2].EltDeleteOnRemove = false; - - CViewBase *v1 = _Elements[index1].Element; - CViewBase *v2 = _Elements[index2].Element; - - - if (index1 < index2) - { - delChild(index2); - delChild(index1); - addChildAtIndex(v2, index1, oldMustDelete2); - setOrder(index1, order2); - addChildAtIndex(v1, index2, oldMustDelete1); - setOrder(index2, order1); - } - else - { - delChild(index1); - delChild(index2); - addChildAtIndex(v1, index2, oldMustDelete1); - setOrder(index2, order1); - addChildAtIndex(v2, index1, oldMustDelete2); - setOrder(index1, order2); - } -} - -// ---------------------------------------------------------------------------- -int CGroupList::luaUpChild(CLuaState &ls) -{ - CLuaIHM::checkArgCount(ls, "upChild", 1); - CViewBase * viewBase = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); - sint32 indexUpChild = getElementIndex(viewBase); - if(indexUpChild > 0) - { - swapChildren(indexUpChild, indexUpChild-1); - } - return 0; -} - -// ---------------------------------------------------------------------------- -int CGroupList::luaDownChild(CLuaState &ls) -{ - CLuaIHM::checkArgCount(ls, "downChild", 1); - CViewBase * viewBase = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); - sint32 indexDownChild = getElementIndex(viewBase); - if(indexDownChild < (sint32) (_Elements.size()-1)) - { - swapChildren(indexDownChild, indexDownChild+1); - } - return 0; -} - -// ---------------------------------------------------------------------------- -int CGroupList::luaGetChild(CLuaState &ls) -{ - const char *funcName = "getChild"; - CLuaIHM::checkArgCount(ls, funcName, 1); - CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - sint index = (sint) ls.toNumber(1); - if(index < 0 || index >= (sint) _Elements.size()) - { - CLuaIHM::fails(ls, "getChild : trying to access element %d in list '%s', which has %d elements", - index, getId().c_str(), (int) _Elements.size()); - } - CLuaIHM::pushUIOnStack(ls, getChild((uint) index)); - return 1; -} - -// ---------------------------------------------------------------------------- -void CGroupList::deleteAllChildren() -{ - uint numChildren = getNbElement(); - for(uint k = 0; k < numChildren; ++k) - { - delChild(numChildren - 1 - k); // delete in reverse order to avoid unnecessary vector copies - } -} - -// ---------------------------------------------------------------------------- -uint CGroupList::getNumActiveChildren() const -{ - uint numChildren = 0; - for(uint k = 0; k < _Elements.size(); ++k) - { - if (_Elements[k].Element->getActive()) ++numChildren; - } - return numChildren; -} - -// ---------------------------------------------------------------------------- -void CGroupList::setDelOnRemove(uint index, bool delOnRemove) -{ - if (index >= _Elements.size()) - { - nlwarning("bad index"); - return; - } - _Elements[index].EltDeleteOnRemove = delOnRemove; -} - -// ---------------------------------------------------------------------------- -bool CGroupList::getDelOnRemove(uint index) const -{ - if (index >= _Elements.size()) - { - nlwarning("bad index"); - return false; - } - return _Elements[index].EltDeleteOnRemove; -} - - -// ---------------------------------------------------------------------------- -int CGroupList::luaAddTextChild(CLuaState &ls) -{ - CLuaIHM::checkArgCount(ls, "addTextChild", 1); - ucstring text; - if(CLuaIHM::pop(ls, text)) - { - addTextChild(text); - } - return 0; -} - -// ---------------------------------------------------------------------------- -int CGroupList::luaAddColoredTextChild(CLuaState &ls) -{ - const char *funcName = "addColoredTextChild"; - CLuaIHM::checkArgCount(ls, funcName, 5); - CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); - CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER); - CLuaIHM::checkArgType(ls, funcName, 3, LUA_TNUMBER); - CLuaIHM::checkArgType(ls, funcName, 4, LUA_TNUMBER); - CLuaIHM::checkArgType(ls, funcName, 5, LUA_TNUMBER); - string text = ls.toString(1); - ucstring ucText; - ucText.fromUtf8(text); - - uint r = (uint) ls.toNumber(2); - uint g = (uint) ls.toNumber(3); - uint b = (uint) ls.toNumber(4); - uint a = (uint) ls.toNumber(5); - - addTextChild(ucText, CRGBA(r, g, b, a)); - - return 0; -} - -// ---------------------------------------------------------------------------- -int CGroupList::luaAddChild(CLuaState &ls) -{ - const char *funcName = "addChild"; - CLuaIHM::checkArgCount(ls, funcName, 1); - CViewBase *vb = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); - if (!vb) - { - CLuaIHM::fails(ls, "%s requires a view, group or control", funcName); - } - else - { - addChild(vb); - } - return 0; -} - -// ---------------------------------------------------------------------------- -int CGroupList::luaAddChildAtIndex(CLuaState &ls) -{ - const char *funcName = "addChildAtIndex"; - CLuaIHM::checkArgCount(ls, funcName, 2); - CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER); - CViewBase *vb = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); - if (!vb) - { - CLuaIHM::fails(ls, "%s requires a view, group or control", funcName); - } - else - { - addChildAtIndex(vb, (uint) ls.toNumber(2)); - } - return 0; -} - -// ---------------------------------------------------------------------------- -int CGroupList::luaDetachChild(CLuaState &ls) -{ - const char *funcName = "detachChild"; - CLuaIHM::checkArgCount(ls, funcName, 1); - CViewBase *vb = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); - if (!vb) - { - nlwarning("%s requires a view, group or control", funcName); - ls.push(false); - } - else - { - ls.push(delChild(vb, false, true)); - } - return 1; -} - -// ---------------------------------------------------------------------------- -int CGroupList::luaDelChild(CLuaState &ls) -{ - CLuaIHM::checkArgCount(ls, "CGroupList::delChild", 1); - CViewBase *vb = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); - if (vb) delChild(vb); - updateCoords(); - return 0; -} - - - -// ---------------------------------------------------------------------------- -int CGroupList::luaClear(CLuaState &ls) -{ - CLuaIHM::checkArgCount(ls, "clear", 0); - deleteAllChildren(); - return 0; -} - diff --git a/code/ryzom/client/src/interface_v3/group_list.h b/code/ryzom/client/src/interface_v3/group_list.h deleted file mode 100644 index 94b5d5b7f..000000000 --- a/code/ryzom/client/src/interface_v3/group_list.h +++ /dev/null @@ -1,258 +0,0 @@ -// 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 NL_GROUP_LIST_H -#define NL_GROUP_LIST_H - -#include "nel/misc/types_nl.h" -#include "nel/gui/group_frame.h" -#include "nel/gui/view_text.h" - - -// ---------------------------------------------------------------------------- -class CGroupList : public CInterfaceGroup -{ -public: - enum EAlign - { - Bottom = 0, - Top, - Left, - Right - }; - - ///constructor - CGroupList(const TCtorParam ¶m); - - // dtor - ~CGroupList(); - /** - * add a child element to the group at the last position - * 'order' of the element is set to the last order + 1 - * \param child : pointer to the child element - */ - void addChild (CViewBase* child, bool deleteOnRemove=true); - - - /** add a child before the element at the given index. - * 'order' of the element is set to 0 - * \return true if there was enough room for that child - */ - bool addChildAtIndex(CViewBase *child, uint index, bool deleteOnRemove = true); - - /** - * add a text child element to the group, using the text template - * \param line : text to be added - * \param color : text color - */ - void addTextChild (const ucstring& line,const NLMISC::CRGBA &textColor, bool multiLine = true); - - /** - * add a text child element to the group, using the text template - * \param line : text to be added - */ - void addTextChild (const ucstring& line, bool multiLine = true); - - /// Same as adding a text child but the text will be taken from the string manager - void addTextChildID (uint32 id, bool multiLine = true); - // the same, but with id taken from the database - void addTextChildID (const std::string &dbPath, bool multiLine = true); - - - bool delChild (CViewBase* child, bool noWarning=false, bool forceDontDelete = false); - - bool delChild(uint index, bool forceDontDelete = false); - - CViewBase *getChild(uint index) const { return _Elements[index].Element; } - int luaGetChild(CLuaState &ls); - - void deleteAllChildren(); - - void removeHead(); - - // Get the number of children - uint getNumChildren() const { return (uint)_Elements.size(); } - - // Get the number of active children - uint getNumActiveChildren() const; - - /** - * set the template that will be used to add text; - * \templ : a CViewText object. Only its font size, color and shadow are required. - */ - void setTextTemplate(const CViewText& templ); - - /** - * set the template that will be used to add text; - * \templ : a CViewText object. Only its font size, color and shadow are required. - */ - CViewText * getTextTemplatePtr() - { - return &_Templ; - } - - /** - * parse the element and initalize it - * \paral cur : pointer to the node describing this element - * \param parentGroup : the parent group of this element - * \return true if success - */ - virtual bool parse (xmlNodePtr cur, CInterfaceGroup * parentGroup); - //virtual uint32 getMemory(); - /** - * init or reset the children element coords. Orverloaded from CInterfaceGroup because we begin with the last inserted element here - */ - virtual void updateCoords(); - - virtual void draw(); - - virtual bool handleEvent (const NLGUI::CEventDescriptor& eventDesc); - - virtual void clearViews(); - virtual void clearControls(); - virtual void clearGroups(); - - void setSpace (sint32 s) { _Space = s; } - - virtual CInterfaceElement* getElement (const std::string &id) - { return CInterfaceGroup::getElement (id); } - - sint32 getNbElement() { return (sint32)_Elements.size(); } - sint32 getSpace() { return _Space; } - - void setDynamicDisplaySize (bool dds) { _DynamicDisplaySize = dds; } - bool getDynamicDisplaySize() { return _DynamicDisplaySize; } - - void forceSizeW (sint32 newSizeW); - void forceSizeH (sint32 newSizeH); - - void setMinW(sint32 minW); - void setMinH(sint32 minH); - sint32 getMinW() const {return _MinW;} - sint32 getMinH() const {return _MinH;} - - // set the rank for the element at the given index (used to reinsert container after they have been turned into popups) - void setOrder(uint index, uint order) { _Elements[index].Order = order; } - uint getOrder(uint index) const { return _Elements[index].Order; } - - // get element of index or -1 if not found - sint32 getElementIndex(CViewBase* child) const; - int luaGetElementIndex(CLuaState &ls); - - // swap 2 entries in the list (and also their orders) - void swapChildren(uint index1, uint index2); - int luaUpChild(CLuaState &ls); - int luaDownChild(CLuaState &ls); - - // deleteOnRemove flag - void setDelOnRemove(uint index, bool delOnRemove); - bool getDelOnRemove(uint index) const; - - // children number - void setChildrenNb(sint32 /* val */){} - sint32 getChildrenNb() const {return (sint32)_Elements.size();} - - int luaAddChild(CLuaState &ls); - int luaAddChildAtIndex(CLuaState &ls); - int luaDetachChild(CLuaState &ls); - int luaClear(CLuaState &ls); // synonimous for deleteAllChildren - int luaAddTextChild(CLuaState &ls); - int luaAddColoredTextChild(CLuaState &ls); - int luaDelChild(CLuaState &ls); - - REFLECT_EXPORT_START(CGroupList, CInterfaceGroup) - REFLECT_LUA_METHOD("addTextChild", luaAddTextChild) - REFLECT_LUA_METHOD("addColoredTextChild", luaAddColoredTextChild) - REFLECT_LUA_METHOD("addChild", luaAddChild); - REFLECT_LUA_METHOD("addChildAtIndex", luaAddChildAtIndex); - REFLECT_LUA_METHOD("detachChild", luaDetachChild); - REFLECT_LUA_METHOD("clear", luaClear); - REFLECT_LUA_METHOD("delChild", luaDelChild); - REFLECT_LUA_METHOD("upChild", luaUpChild); - REFLECT_LUA_METHOD("downChild", luaDownChild); - REFLECT_LUA_METHOD("getChild", luaGetChild); - REFLECT_LUA_METHOD("getElementIndex", luaGetElementIndex); - REFLECT_SINT32 ("childrenNb", getChildrenNb, setChildrenNb); - REFLECT_EXPORT_END - - -protected: - - //max number of elements - sint32 _MaxElements; - - // Where to add next element - EAlign _AddElt; - - // Where to align the newly added element - EAlign _Align; - - // Space between two elements in pixel - sint32 _Space; - - // Text template - CViewText _Templ; - - // Current id of the view - sint32 _IdCounter; - - // Used for context menu to display the same size as the whole content - bool _DynamicDisplaySize; - - // Do we have a color under the element pointed by the mouse - bool _Over; - - // If over is true so we have a color - NLMISC::CRGBA _OverColor; - - // Current elt over the pointer - sint32 _OverElt; - - struct CElementInfo - { - uint Order; // Used to sort the window by their insertion order. - // This is used to put back a window at the right place if it was turned into a popup. - CViewBase *Element; - bool EltDeleteOnRemove; - }; - friend struct CRemoveViewPred; - friend struct CRemoveCtrlPred; - friend struct CRemoveGroupPred; - - // The list is forced to be at least this size in updateCoords(). - sint32 _MinW; - sint32 _MinH; - - - // To conserve elements in the order they have been added - // (the element drawn are stored in _views, _contrlos or _childrengroups of cinterfacegroup - std::vector _Elements; - -private: - - void setHSGroup (CViewBase *child, EAlign addElt, EAlign align); - void setHSParent(CViewBase *view, EAlign addElt, EAlign align, uint space); - -}; - - -#endif // NL_GROUP_LIST_H - -/* End of group_list.h */ - - diff --git a/code/ryzom/client/src/interface_v3/group_menu.h b/code/ryzom/client/src/interface_v3/group_menu.h index 4b4298ab7..8ab8708e3 100644 --- a/code/ryzom/client/src/interface_v3/group_menu.h +++ b/code/ryzom/client/src/interface_v3/group_menu.h @@ -29,10 +29,10 @@ namespace NLGUI { class CCtrlScroll; class CViewBitmap; + class CGroupList; } class CGroupMenu; -class CGroupList; /** diff --git a/code/ryzom/client/src/interface_v3/group_quick_help.cpp b/code/ryzom/client/src/interface_v3/group_quick_help.cpp index 108d07a9b..1419a203a 100644 --- a/code/ryzom/client/src/interface_v3/group_quick_help.cpp +++ b/code/ryzom/client/src/interface_v3/group_quick_help.cpp @@ -22,7 +22,7 @@ #include "stdpch.h" #include "group_quick_help.h" -#include "group_list.h" +#include "nel/gui/group_list.h" #include "group_paragraph.h" #include "../libwww.h" #include "interface_manager.h" diff --git a/code/ryzom/client/src/interface_v3/group_scrolltext.cpp b/code/ryzom/client/src/interface_v3/group_scrolltext.cpp index ea8409475..b58569313 100644 --- a/code/ryzom/client/src/interface_v3/group_scrolltext.cpp +++ b/code/ryzom/client/src/interface_v3/group_scrolltext.cpp @@ -21,7 +21,7 @@ #include "stdpch.h" #include "group_scrolltext.h" -#include "group_list.h" +#include "nel/gui/group_list.h" #include "nel/gui/view_text.h" #include "nel/gui/ctrl_scroll.h" #include "nel/gui/ctrl_button.h" diff --git a/code/ryzom/client/src/interface_v3/group_scrolltext.h b/code/ryzom/client/src/interface_v3/group_scrolltext.h index cfedb76bc..88fc2c6cb 100644 --- a/code/ryzom/client/src/interface_v3/group_scrolltext.h +++ b/code/ryzom/client/src/interface_v3/group_scrolltext.h @@ -27,10 +27,9 @@ namespace NLGUI { class CCtrlBaseButton; class CCtrlScroll; + class CGroupList; } -class CGroupList; - // Can be used to build a chat window or anything that displays sequences of strings /** * Widget to have a resizable scrolltext and its scrollbar diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index e9fbab649..ab028fc3e 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -60,7 +60,7 @@ // DBCtrl #include "dbctrl_sheet.h" // Group -#include "group_list.h" +#include "nel/gui/group_list.h" #include "group_menu.h" #include "group_container.h" #include "nel/gui/group_modal.h" diff --git a/code/ryzom/client/src/interface_v3/interface_manager.h b/code/ryzom/client/src/interface_v3/interface_manager.h index 46e0d9cac..f0099a46b 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.h +++ b/code/ryzom/client/src/interface_v3/interface_manager.h @@ -25,7 +25,7 @@ #include "nel/3d/u_text_context.h" #include "nel/gui/interface_group.h" #include "nel/gui/interface_link.h" -#include "group_list.h" +#include "nel/gui/group_list.h" #include "nel/gui/view_base.h" #include "view_pointer.h" diff --git a/code/ryzom/client/src/interface_v3/interface_parser.cpp b/code/ryzom/client/src/interface_v3/interface_parser.cpp index 35df296c3..62a38eace 100644 --- a/code/ryzom/client/src/interface_v3/interface_parser.cpp +++ b/code/ryzom/client/src/interface_v3/interface_parser.cpp @@ -65,7 +65,7 @@ #include "group_career.h" #include "nel/gui/group_modal.h" #include "group_modal_get_key.h" -#include "group_list.h" +#include "nel/gui/group_list.h" #include "nel/gui/group_tree.h" #include "group_menu.h" #include "group_container.h" diff --git a/code/ryzom/client/src/interface_v3/interface_parser.h b/code/ryzom/client/src/interface_v3/interface_parser.h index 0e74c503b..91f23427c 100644 --- a/code/ryzom/client/src/interface_v3/interface_parser.h +++ b/code/ryzom/client/src/interface_v3/interface_parser.h @@ -36,10 +36,10 @@ namespace NLGUI class CInterfaceOptions; class CInterfaceLink; class CCtrlBase; + class CGroupList; } class CGroupContainer; -class CGroupList; class CInterfaceAnim; class CViewPointer; class CBrickJob; diff --git a/code/ryzom/client/src/interface_v3/macrocmd_key.cpp b/code/ryzom/client/src/interface_v3/macrocmd_key.cpp index 7ffe97d27..1bec84943 100644 --- a/code/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/code/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -26,7 +26,7 @@ #include "nel/gui/action_handler.h" #include "nel/gui/ctrl_button.h" #include "group_editbox.h" -#include "group_list.h" +#include "nel/gui/group_list.h" #include "dbgroup_combo_box.h" #include "group_container.h" #include "group_modal_get_key.h" diff --git a/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp b/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp index e66fc16d7..96a5145d0 100644 --- a/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp +++ b/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp @@ -27,7 +27,7 @@ #include "dbctrl_sheet.h" #include "nel/gui/ctrl_button.h" #include "group_editbox.h" -#include "group_list.h" +#include "nel/gui/group_list.h" #include "dbgroup_combo_box.h" #include "group_container.h" #include "group_modal_get_key.h" diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index 46a08234a..1d2be1faa 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -19,7 +19,7 @@ #include "stdpch.h" #include "people_list.h" #include "group_container.h" -#include "group_list.h" +#include "nel/gui/group_list.h" #include "nel/gui/view_bitmap.h" #include "interface_manager.h" #include "nel/gui/action_handler.h" 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 bdde30aa9..3a2d7f7b1 100644 --- a/code/ryzom/client/src/interface_v3/register_interface_elements.cpp +++ b/code/ryzom/client/src/interface_v3/register_interface_elements.cpp @@ -31,7 +31,7 @@ #include "nel/gui/group_frame.h" #include "nel/gui/group_container_base.h" #include "group_container.h" -#include "group_list.h" +#include "nel/gui/group_list.h" #include "dbgroup_select_number.h" #include "nel/gui/ctrl_button.h" #include "nel/gui/ctrl_text_button.h" @@ -45,7 +45,6 @@ #include "nel/gui/reflect.h" #include "dbview_bar.h" #include "dbview_bar3.h" -#include "group_list.h" #include "nel/gui/ctrl_scroll_base.h" #include "nel/gui/ctrl_scroll.h" #include "dbgroup_combo_box.h" diff --git a/code/ryzom/client/src/libwww.h b/code/ryzom/client/src/libwww.h index b82a75534..aa3f6b424 100644 --- a/code/ryzom/client/src/libwww.h +++ b/code/ryzom/client/src/libwww.h @@ -29,10 +29,9 @@ namespace NLGUI { class CCtrlBaseButton; class CCtrlScroll; + class CGroupList; } -class CGroupList; - // *************************************************************************** // Init the libwww diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index e1e91377f..03a10aec4 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -39,7 +39,7 @@ #include "game_share/combat_flying_text.h" #include "game_share/shard_names.h" // Client. -#include "interface_v3/group_list.h" +#include "nel/gui/group_list.h" #include "interface_v3/interface_manager.h" #include "net_manager.h" #include "client_cfg.h" diff --git a/code/ryzom/client/src/r2/editor.cpp b/code/ryzom/client/src/r2/editor.cpp index 29300c975..54b498858 100644 --- a/code/ryzom/client/src/r2/editor.cpp +++ b/code/ryzom/client/src/r2/editor.cpp @@ -54,7 +54,7 @@ using namespace NLGUI; #include "../cursor_functions.h" #include "../entities.h" #include "../events_listener.h" -#include "../interface_v3/group_list.h" +#include "nel/gui/group_list.h" #include "nel/gui/event_descriptor.h" #include "nel/gui/group_tree.h" #include "../client_cfg.h"