CHANGED: #1471 CGroupList is now part of NELGUI library, and is under NLGUI namespace.

This commit is contained in:
dfighter1985 2012-06-22 06:48:19 +02:00
parent 3bba3af4ab
commit ab8b296adc
28 changed files with 1446 additions and 1439 deletions

View file

@ -0,0 +1,262 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#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 &param);
// 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<CElementInfo> _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 */

View file

@ -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<CInterfaceElement> _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

File diff suppressed because it is too large Load diff

View file

@ -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"

View file

@ -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"

View file

@ -29,6 +29,7 @@ namespace NLGUI
{
class CCtrlBase;
class CViewText;
class CGroupList;
}
class CChatWindow;
@ -206,7 +207,7 @@ protected:
std::vector<CGroupContainer*> _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:

View file

@ -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"

View file

@ -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;
// ***************************************************************************
/**

View file

@ -18,7 +18,7 @@
#define CL_GROUP_HEADER_H
#include "group_list.h"
#include "nel/gui/group_list.h"
class CGroupHeaderEntry;

View file

@ -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"

View file

@ -41,9 +41,9 @@ namespace NLGUI
{
class CCtrlButton;
class CCtrlScroll;
class CGroupList;
}
class CGroupList;
class CDBGroupComboBox;
class CGroupParagraph;

File diff suppressed because it is too large Load diff

View file

@ -1,258 +0,0 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#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 &param);
// 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<CElementInfo> _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 */

View file

@ -29,10 +29,10 @@ namespace NLGUI
{
class CCtrlScroll;
class CViewBitmap;
class CGroupList;
}
class CGroupMenu;
class CGroupList;
/**

View file

@ -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"

View file

@ -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"

View file

@ -27,9 +27,8 @@ namespace NLGUI
{
class CCtrlBaseButton;
class CCtrlScroll;
}
class CGroupList;
}
// Can be used to build a chat window or anything that displays sequences of strings
/**

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -36,10 +36,10 @@ namespace NLGUI
class CInterfaceOptions;
class CInterfaceLink;
class CCtrlBase;
class CGroupList;
}
class CGroupContainer;
class CGroupList;
class CInterfaceAnim;
class CViewPointer;
class CBrickJob;

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -29,9 +29,8 @@ namespace NLGUI
{
class CCtrlBaseButton;
class CCtrlScroll;
}
class CGroupList;
}
// ***************************************************************************

View file

@ -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"

View file

@ -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"