mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-05 23:09:04 +00:00
CHANGED: #1471 CGroupScrollText is now part of the NELGUI library and is under the NLGUI namespace.
--HG-- branch : gui-refactoring
This commit is contained in:
parent
b1f9abd903
commit
d4d4041895
6 changed files with 330 additions and 325 deletions
86
code/nel/include/nel/gui/group_scrolltext.h
Normal file
86
code/nel/include/nel/gui/group_scrolltext.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
// 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 CL_GROUP_SCROLLTEXT_H
|
||||
#define CL_GROUP_SCROLLTEXT_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/gui/interface_group.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
class CCtrlBaseButton;
|
||||
class CCtrlScroll;
|
||||
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
|
||||
* \author Nicolas Vizerie
|
||||
* \author Nevrax France
|
||||
* \date 2002
|
||||
*/
|
||||
class CGroupScrollText : public CInterfaceGroup
|
||||
{
|
||||
public:
|
||||
/// Constructor
|
||||
CGroupScrollText(const TCtorParam ¶m);
|
||||
~CGroupScrollText();
|
||||
|
||||
/// CInterfaceGroup Interface
|
||||
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
||||
virtual void updateCoords ();
|
||||
virtual void checkCoords ();
|
||||
virtual void draw ();
|
||||
virtual void clearViews ();
|
||||
virtual bool handleEvent (const NLGUI::CEventDescriptor &eventDesc);
|
||||
|
||||
// get the list associated to this group
|
||||
CGroupList *getList() const { return _List; }
|
||||
|
||||
// Get the scroll bar
|
||||
CCtrlScroll *getScrollBar() const { return _ScrollBar; }
|
||||
|
||||
// from CCtrlBase
|
||||
virtual void elementCaptured(CCtrlBase *capturedElement);
|
||||
|
||||
|
||||
REFLECT_EXPORT_START(CGroupScrollText, CInterfaceGroup)
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
private:
|
||||
CGroupList *_List;
|
||||
CCtrlScroll *_ScrollBar;
|
||||
CCtrlBaseButton *_ButtonAdd;
|
||||
CCtrlBaseButton *_ButtonSub;
|
||||
bool _Settuped;
|
||||
bool _InvertScrollBar;
|
||||
sint32 _ListHeight;
|
||||
protected:
|
||||
void setup();
|
||||
void updateScrollBar();
|
||||
public:
|
||||
// private use for action handlers
|
||||
sint32 _StartHeight;
|
||||
sint64 _EllapsedTime;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
242
code/nel/src/gui/group_scrolltext.cpp
Normal file
242
code/nel/src/gui/group_scrolltext.cpp
Normal file
|
@ -0,0 +1,242 @@
|
|||
// 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/>.
|
||||
|
||||
#include "nel/gui/group_scrolltext.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"
|
||||
#include "nel/gui/action_handler.h"
|
||||
#include "nel/misc/i18n.h"
|
||||
#include "nel/gui/widget_manager.h"
|
||||
|
||||
NLMISC_REGISTER_OBJECT(CViewBase, CGroupScrollText, std::string, "scroll_text");
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
||||
//========================================================================
|
||||
CGroupScrollText::CGroupScrollText(const TCtorParam ¶m) :
|
||||
CInterfaceGroup(param),
|
||||
_List(NULL),
|
||||
_ScrollBar(NULL),
|
||||
_ButtonAdd(NULL),
|
||||
_ButtonSub(NULL),
|
||||
_Settuped(false),
|
||||
_InvertScrollBar(true),
|
||||
_ListHeight(0),
|
||||
_StartHeight(0),
|
||||
_EllapsedTime(0)
|
||||
{
|
||||
_IsGroupScrollText = true;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
CGroupScrollText::~CGroupScrollText()
|
||||
{
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
bool CGroupScrollText::parse(xmlNodePtr cur,CInterfaceGroup *parentGroup)
|
||||
{
|
||||
if(!CInterfaceGroup::parse(cur, parentGroup))
|
||||
return false;
|
||||
CXMLAutoPtr ptr;
|
||||
|
||||
// invert scroll bar?
|
||||
ptr = xmlGetProp (cur, (xmlChar*)"invert_scroll_bar");
|
||||
if(ptr) _InvertScrollBar= convertBool(ptr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CGroupScrollText::updateCoords()
|
||||
{
|
||||
CInterfaceGroup::updateCoords();
|
||||
if (!_Settuped) setup();
|
||||
updateScrollBar();
|
||||
// re-update of scrollbar
|
||||
if(_ScrollBar)
|
||||
_ScrollBar->updateCoords();
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CGroupScrollText::updateScrollBar()
|
||||
{
|
||||
if (_List && _ScrollBar)
|
||||
{
|
||||
if (_List->getHReal() < _List->getMaxHReal())
|
||||
{
|
||||
_ScrollBar->setActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ScrollBar->setActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CGroupScrollText::checkCoords ()
|
||||
{
|
||||
// update scrollbar if necessary
|
||||
if (_List)
|
||||
{
|
||||
if (_List->getH() != _ListHeight) // see if the scrollbar should be updated
|
||||
{
|
||||
invalidateCoords();
|
||||
_ListHeight = _List->getH();
|
||||
}
|
||||
}
|
||||
CInterfaceGroup::checkCoords();
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CGroupScrollText::draw()
|
||||
{
|
||||
CInterfaceGroup::draw();
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CGroupScrollText::clearViews()
|
||||
{
|
||||
CInterfaceGroup::clearViews();
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
bool CGroupScrollText::handleEvent(const NLGUI::CEventDescriptor &event)
|
||||
{
|
||||
if (event.getType() == NLGUI::CEventDescriptor::mouse)
|
||||
{
|
||||
const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event;
|
||||
//
|
||||
if (_List && _ScrollBar)
|
||||
{
|
||||
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mousewheel)
|
||||
{
|
||||
if (isIn(eventDesc.getX(), eventDesc.getY()))
|
||||
{
|
||||
sint32 h = _List->getMaxHReal() / 2;
|
||||
if (h == 0) h = 1;
|
||||
_ScrollBar->moveTargetY(- eventDesc.getWheel() * h);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CInterfaceGroup::handleEvent(event)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CGroupScrollText::setup()
|
||||
{
|
||||
// bind to the controls
|
||||
_ScrollBar = dynamic_cast<CCtrlScroll *>(CInterfaceGroup::getCtrl("scroll_bar"));
|
||||
_ButtonAdd = dynamic_cast<CCtrlBaseButton *>(CInterfaceGroup::getCtrl("button_add"));
|
||||
_ButtonSub = dynamic_cast<CCtrlBaseButton *>(CInterfaceGroup::getCtrl("button_sub"));
|
||||
_List = dynamic_cast<CGroupList *>(CInterfaceGroup::getGroup("text_list"));
|
||||
|
||||
if(_ScrollBar == NULL)
|
||||
nlwarning("<setup> scroll bar 'scroll_bar' missing or bad type.(%s)",this->_Id.c_str());
|
||||
// Add and sub button are not required
|
||||
/*
|
||||
if(buttonAdd == NULL)
|
||||
nlwarning("Interface: CGroupScrollText: button 'button_add' missing or bad type");
|
||||
if(buttonSub == NULL)
|
||||
nlwarning("Interface: CGroupScrollText: button 'button_sub' missing or bad type");
|
||||
*/
|
||||
if(_List == NULL)
|
||||
nlwarning("<setup> group list 'text_list' missing or bad type");
|
||||
|
||||
// actions
|
||||
if (_ButtonAdd) _ButtonAdd->setActionOnClockTick("gst_add");
|
||||
if (_ButtonSub) _ButtonSub->setActionOnClockTick("gst_sub");
|
||||
|
||||
// bind the scrollbar to the list
|
||||
if (_ScrollBar)
|
||||
{
|
||||
_ScrollBar->setTarget(_List);
|
||||
//_ScrollBar->setInverted(_InvertScrollBar);
|
||||
}
|
||||
_Settuped = true;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CGroupScrollText::elementCaptured(CCtrlBase *capturedElement)
|
||||
{
|
||||
if (capturedElement == _ButtonAdd || capturedElement == _ButtonSub)
|
||||
{
|
||||
// reset the counters for increase
|
||||
_EllapsedTime = 0;
|
||||
_StartHeight = getH();
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// Actions Handlers
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
class CSTUp : public IActionHandler
|
||||
{
|
||||
public:
|
||||
virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */)
|
||||
{
|
||||
const CWidgetManager::SInterfaceTimes × = CWidgetManager::getInstance()->getInterfaceTimes();
|
||||
|
||||
CGroupScrollText *pST = dynamic_cast<CGroupScrollText*>(pCaller->getParent());
|
||||
if (pST == NULL) return;
|
||||
if (pST->getList() == NULL) return;
|
||||
// get the font height from the text template of the list
|
||||
const CViewText *vt = pST->getList()->getTextTemplatePtr();
|
||||
if (!vt) return;
|
||||
pST->_EllapsedTime += times.frameDiffMs;
|
||||
// pST->setH(std::min((sint32) pST->getMaxHeight(), (sint32) (pST->_StartHeight + pST->_EllapsedTime / 9)));
|
||||
pST->setH((sint32) (pST->_StartHeight + pST->_EllapsedTime / 9));
|
||||
pST->invalidateCoords();
|
||||
}
|
||||
};
|
||||
REGISTER_ACTION_HANDLER (CSTUp, "gst_add");
|
||||
|
||||
// ***************************************************************************
|
||||
class CSTDown : public IActionHandler
|
||||
{
|
||||
public:
|
||||
virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */)
|
||||
{
|
||||
const CWidgetManager::SInterfaceTimes × = CWidgetManager::getInstance()->getInterfaceTimes();
|
||||
|
||||
CGroupScrollText *pST = dynamic_cast<CGroupScrollText*>(pCaller->getParent());
|
||||
if (pST == NULL) return;
|
||||
if (pST->getList() == NULL) return;
|
||||
// get the font height from the text template of the list
|
||||
const CViewText *vt = pST->getList()->getTextTemplatePtr();
|
||||
if (!vt) return;
|
||||
pST->_EllapsedTime += times.frameDiffMs;
|
||||
// pST->setH(std::max((sint32) pST->getMinHeight(), (sint32) (pST->_StartHeight - pST->_EllapsedTime / 9)));
|
||||
pST->setH((sint32) (pST->_StartHeight - pST->_EllapsedTime / 9));
|
||||
pST->invalidateCoords();
|
||||
}
|
||||
};
|
||||
REGISTER_ACTION_HANDLER (CSTDown, "gst_sub");
|
||||
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/gui/interface_group.h"
|
||||
#include "group_scrolltext.h"
|
||||
#include "nel/gui/group_scrolltext.h"
|
||||
#include "nel/gui/group_tree.h"
|
||||
#include "nel/gui/ctrl_button.h"
|
||||
#include "group_table.h"
|
||||
|
|
|
@ -1,237 +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/>.
|
||||
|
||||
#include "group_scrolltext.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"
|
||||
#include "nel/gui/action_handler.h"
|
||||
#include "nel/misc/i18n.h"
|
||||
#include "nel/gui/widget_manager.h"
|
||||
|
||||
NLMISC_REGISTER_OBJECT(CViewBase, CGroupScrollText, std::string, "scroll_text");
|
||||
|
||||
//========================================================================
|
||||
CGroupScrollText::CGroupScrollText(const TCtorParam ¶m) :
|
||||
CInterfaceGroup(param),
|
||||
_List(NULL),
|
||||
_ScrollBar(NULL),
|
||||
_ButtonAdd(NULL),
|
||||
_ButtonSub(NULL),
|
||||
_Settuped(false),
|
||||
_InvertScrollBar(true),
|
||||
_ListHeight(0),
|
||||
_StartHeight(0),
|
||||
_EllapsedTime(0)
|
||||
{
|
||||
_IsGroupScrollText = true;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
CGroupScrollText::~CGroupScrollText()
|
||||
{
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
bool CGroupScrollText::parse(xmlNodePtr cur,CInterfaceGroup *parentGroup)
|
||||
{
|
||||
if(!CInterfaceGroup::parse(cur, parentGroup))
|
||||
return false;
|
||||
CXMLAutoPtr ptr;
|
||||
|
||||
// invert scroll bar?
|
||||
ptr = xmlGetProp (cur, (xmlChar*)"invert_scroll_bar");
|
||||
if(ptr) _InvertScrollBar= convertBool(ptr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CGroupScrollText::updateCoords()
|
||||
{
|
||||
CInterfaceGroup::updateCoords();
|
||||
if (!_Settuped) setup();
|
||||
updateScrollBar();
|
||||
// re-update of scrollbar
|
||||
if(_ScrollBar)
|
||||
_ScrollBar->updateCoords();
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CGroupScrollText::updateScrollBar()
|
||||
{
|
||||
if (_List && _ScrollBar)
|
||||
{
|
||||
if (_List->getHReal() < _List->getMaxHReal())
|
||||
{
|
||||
_ScrollBar->setActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ScrollBar->setActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CGroupScrollText::checkCoords ()
|
||||
{
|
||||
// update scrollbar if necessary
|
||||
if (_List)
|
||||
{
|
||||
if (_List->getH() != _ListHeight) // see if the scrollbar should be updated
|
||||
{
|
||||
invalidateCoords();
|
||||
_ListHeight = _List->getH();
|
||||
}
|
||||
}
|
||||
CInterfaceGroup::checkCoords();
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CGroupScrollText::draw()
|
||||
{
|
||||
CInterfaceGroup::draw();
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CGroupScrollText::clearViews()
|
||||
{
|
||||
CInterfaceGroup::clearViews();
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
bool CGroupScrollText::handleEvent(const NLGUI::CEventDescriptor &event)
|
||||
{
|
||||
if (event.getType() == NLGUI::CEventDescriptor::mouse)
|
||||
{
|
||||
const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event;
|
||||
//
|
||||
if (_List && _ScrollBar)
|
||||
{
|
||||
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mousewheel)
|
||||
{
|
||||
if (isIn(eventDesc.getX(), eventDesc.getY()))
|
||||
{
|
||||
sint32 h = _List->getMaxHReal() / 2;
|
||||
if (h == 0) h = 1;
|
||||
_ScrollBar->moveTargetY(- eventDesc.getWheel() * h);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CInterfaceGroup::handleEvent(event)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CGroupScrollText::setup()
|
||||
{
|
||||
// bind to the controls
|
||||
_ScrollBar = dynamic_cast<CCtrlScroll *>(CInterfaceGroup::getCtrl("scroll_bar"));
|
||||
_ButtonAdd = dynamic_cast<CCtrlBaseButton *>(CInterfaceGroup::getCtrl("button_add"));
|
||||
_ButtonSub = dynamic_cast<CCtrlBaseButton *>(CInterfaceGroup::getCtrl("button_sub"));
|
||||
_List = dynamic_cast<CGroupList *>(CInterfaceGroup::getGroup("text_list"));
|
||||
|
||||
if(_ScrollBar == NULL)
|
||||
nlwarning("<setup> scroll bar 'scroll_bar' missing or bad type.(%s)",this->_Id.c_str());
|
||||
// Add and sub button are not required
|
||||
/*
|
||||
if(buttonAdd == NULL)
|
||||
nlwarning("Interface: CGroupScrollText: button 'button_add' missing or bad type");
|
||||
if(buttonSub == NULL)
|
||||
nlwarning("Interface: CGroupScrollText: button 'button_sub' missing or bad type");
|
||||
*/
|
||||
if(_List == NULL)
|
||||
nlwarning("<setup> group list 'text_list' missing or bad type");
|
||||
|
||||
// actions
|
||||
if (_ButtonAdd) _ButtonAdd->setActionOnClockTick("gst_add");
|
||||
if (_ButtonSub) _ButtonSub->setActionOnClockTick("gst_sub");
|
||||
|
||||
// bind the scrollbar to the list
|
||||
if (_ScrollBar)
|
||||
{
|
||||
_ScrollBar->setTarget(_List);
|
||||
//_ScrollBar->setInverted(_InvertScrollBar);
|
||||
}
|
||||
_Settuped = true;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
void CGroupScrollText::elementCaptured(CCtrlBase *capturedElement)
|
||||
{
|
||||
if (capturedElement == _ButtonAdd || capturedElement == _ButtonSub)
|
||||
{
|
||||
// reset the counters for increase
|
||||
_EllapsedTime = 0;
|
||||
_StartHeight = getH();
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// Actions Handlers
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
class CSTUp : public IActionHandler
|
||||
{
|
||||
public:
|
||||
virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */)
|
||||
{
|
||||
const CWidgetManager::SInterfaceTimes × = CWidgetManager::getInstance()->getInterfaceTimes();
|
||||
|
||||
CGroupScrollText *pST = dynamic_cast<CGroupScrollText*>(pCaller->getParent());
|
||||
if (pST == NULL) return;
|
||||
if (pST->getList() == NULL) return;
|
||||
// get the font height from the text template of the list
|
||||
const CViewText *vt = pST->getList()->getTextTemplatePtr();
|
||||
if (!vt) return;
|
||||
pST->_EllapsedTime += times.frameDiffMs;
|
||||
// pST->setH(std::min((sint32) pST->getMaxHeight(), (sint32) (pST->_StartHeight + pST->_EllapsedTime / 9)));
|
||||
pST->setH((sint32) (pST->_StartHeight + pST->_EllapsedTime / 9));
|
||||
pST->invalidateCoords();
|
||||
}
|
||||
};
|
||||
REGISTER_ACTION_HANDLER (CSTUp, "gst_add");
|
||||
|
||||
// ***************************************************************************
|
||||
class CSTDown : public IActionHandler
|
||||
{
|
||||
public:
|
||||
virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */)
|
||||
{
|
||||
const CWidgetManager::SInterfaceTimes × = CWidgetManager::getInstance()->getInterfaceTimes();
|
||||
|
||||
CGroupScrollText *pST = dynamic_cast<CGroupScrollText*>(pCaller->getParent());
|
||||
if (pST == NULL) return;
|
||||
if (pST->getList() == NULL) return;
|
||||
// get the font height from the text template of the list
|
||||
const CViewText *vt = pST->getList()->getTextTemplatePtr();
|
||||
if (!vt) return;
|
||||
pST->_EllapsedTime += times.frameDiffMs;
|
||||
// pST->setH(std::max((sint32) pST->getMinHeight(), (sint32) (pST->_StartHeight - pST->_EllapsedTime / 9)));
|
||||
pST->setH((sint32) (pST->_StartHeight - pST->_EllapsedTime / 9));
|
||||
pST->invalidateCoords();
|
||||
}
|
||||
};
|
||||
REGISTER_ACTION_HANDLER (CSTDown, "gst_sub");
|
||||
|
|
@ -1,86 +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 CL_GROUP_SCROLLTEXT_H
|
||||
#define CL_GROUP_SCROLLTEXT_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/gui/interface_group.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
class CCtrlBaseButton;
|
||||
class CCtrlScroll;
|
||||
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
|
||||
* \author Nicolas Vizerie
|
||||
* \author Nevrax France
|
||||
* \date 2002
|
||||
*/
|
||||
class CGroupScrollText : public CInterfaceGroup
|
||||
{
|
||||
public:
|
||||
/// Constructor
|
||||
CGroupScrollText(const TCtorParam ¶m);
|
||||
~CGroupScrollText();
|
||||
|
||||
/// CInterfaceGroup Interface
|
||||
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
||||
virtual void updateCoords ();
|
||||
virtual void checkCoords ();
|
||||
virtual void draw ();
|
||||
virtual void clearViews ();
|
||||
virtual bool handleEvent (const NLGUI::CEventDescriptor &eventDesc);
|
||||
|
||||
// get the list associated to this group
|
||||
CGroupList *getList() const { return _List; }
|
||||
|
||||
// Get the scroll bar
|
||||
CCtrlScroll *getScrollBar() const { return _ScrollBar; }
|
||||
|
||||
// from CCtrlBase
|
||||
virtual void elementCaptured(CCtrlBase *capturedElement);
|
||||
|
||||
|
||||
REFLECT_EXPORT_START(CGroupScrollText, CInterfaceGroup)
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
private:
|
||||
CGroupList *_List;
|
||||
CCtrlScroll *_ScrollBar;
|
||||
CCtrlBaseButton *_ButtonAdd;
|
||||
CCtrlBaseButton *_ButtonSub;
|
||||
bool _Settuped;
|
||||
bool _InvertScrollBar;
|
||||
sint32 _ListHeight;
|
||||
protected:
|
||||
void setup();
|
||||
void updateScrollBar();
|
||||
public:
|
||||
// private use for action handlers
|
||||
sint32 _StartHeight;
|
||||
sint64 _EllapsedTime;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -69,7 +69,7 @@
|
|||
#include "nel/gui/group_tree.h"
|
||||
#include "group_menu.h"
|
||||
#include "nel/gui/group_container.h"
|
||||
#include "group_scrolltext.h"
|
||||
#include "nel/gui/group_scrolltext.h"
|
||||
#include "nel/gui/group_editbox.h"
|
||||
#include "group_skills.h"
|
||||
#include "group_html_forum.h"
|
||||
|
|
Loading…
Reference in a new issue