CHANGED: #1471 CDBGroupSelectNumber is now part of the NELGUI library and is under the NLGUI namespace. Also had to add a workaround so that the linker doesn't drop the seemingly unused code from the library. Thanks goes to Kaetami for that!
--HG-- branch : gui-refactoringhg/feature/sse2
parent
cabff5c8e5
commit
9cb78fe4f5
@ -0,0 +1,96 @@
|
||||
// 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_DBGROUP_SELECT_NUMBER_H
|
||||
#define NL_DBGROUP_SELECT_NUMBER_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/gui/interface_group.h"
|
||||
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
class CCtrlBaseButton;
|
||||
class CViewText;
|
||||
class CViewBitmap;
|
||||
|
||||
// ***************************************************************************
|
||||
/**
|
||||
* Widget to select a number
|
||||
* \author Lionel Berenguier
|
||||
* \author Nevrax France
|
||||
* \date 2002
|
||||
*/
|
||||
class CDBGroupSelectNumber : public CInterfaceGroup
|
||||
{
|
||||
public:
|
||||
|
||||
/// Constructor
|
||||
CDBGroupSelectNumber(const TCtorParam ¶m);
|
||||
~CDBGroupSelectNumber();
|
||||
|
||||
/// 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);
|
||||
|
||||
// mod interface
|
||||
void changeValue(sint delta);
|
||||
|
||||
sint32 getMinValue () const { return _MinValue; }
|
||||
void setMinValue (sint32 m) { _MinValue = m; }
|
||||
sint32 getMaxValue () const { return _MaxValue; }
|
||||
void setMaxValue (sint32 m) { _MaxValue = m; }
|
||||
|
||||
sint32 getCurrentValue () const { return _Number.getSInt32(); }
|
||||
void setCurrentValue (sint32 val) { _Number.setSInt32(val); }
|
||||
|
||||
REFLECT_EXPORT_START(CDBGroupSelectNumber, CInterfaceGroup)
|
||||
REFLECT_SINT32("min", getMinValue, setMinValue);
|
||||
REFLECT_SINT32("max", getMaxValue, setMaxValue);
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
protected:
|
||||
|
||||
// sint32
|
||||
CInterfaceProperty _Number;
|
||||
bool _LoopMode;
|
||||
sint _MinValue;
|
||||
sint _MaxValue;
|
||||
sint _DeltaMultiplier;
|
||||
|
||||
// Children
|
||||
CViewBitmap *_SlotNumber;
|
||||
CViewText *_TextNumber;
|
||||
CCtrlBaseButton *_ButtonUp;
|
||||
CCtrlBaseButton *_ButtonDown;
|
||||
|
||||
private:
|
||||
|
||||
void setup();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NL_DBGROUP_SELECT_NUMBER_H
|
||||
|
||||
/* End of dbgroup_select_number.h */
|
@ -0,0 +1,234 @@
|
||||
// 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/dbgroup_select_number.h"
|
||||
#include "nel/gui/view_text.h"
|
||||
#include "nel/gui/view_bitmap.h"
|
||||
#include "nel/gui/ctrl_button.h"
|
||||
#include "nel/gui/interface_property.h"
|
||||
#include "nel/gui/action_handler.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NL3D;
|
||||
using namespace NLMISC;
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupSelectNumber, std::string, "select_number");
|
||||
|
||||
// ***************************************************************************
|
||||
CDBGroupSelectNumber::CDBGroupSelectNumber(const TCtorParam ¶m) :
|
||||
CInterfaceGroup(param)
|
||||
{
|
||||
_SlotNumber= NULL;
|
||||
_TextNumber= NULL;
|
||||
_ButtonUp= NULL;
|
||||
_ButtonDown= NULL;
|
||||
_LoopMode= true;
|
||||
_MinValue= 0;
|
||||
_MaxValue= 9;
|
||||
_DeltaMultiplier= 1;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
CDBGroupSelectNumber::~CDBGroupSelectNumber()
|
||||
{
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDBGroupSelectNumber::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
||||
{
|
||||
if(!CInterfaceGroup::parse(cur, parentGroup))
|
||||
return false;
|
||||
|
||||
// read params
|
||||
CXMLAutoPtr ptr;
|
||||
ptr = xmlGetProp (cur, (xmlChar*)"value");
|
||||
if ( ptr )
|
||||
_Number.link ( ptr );
|
||||
else
|
||||
{
|
||||
nlinfo ("no value in %s", _Id.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Loop, min and max
|
||||
_LoopMode= false;
|
||||
ptr= xmlGetProp (cur, (xmlChar*)"loop");
|
||||
if(ptr) _LoopMode= convertBool(ptr);
|
||||
_MinValue = 0;
|
||||
ptr= xmlGetProp (cur, (xmlChar*)"min");
|
||||
if(ptr) fromString((const char*)ptr, _MinValue);
|
||||
_MaxValue = 0;
|
||||
ptr= xmlGetProp (cur, (xmlChar*)"max");
|
||||
if(ptr) fromString((const char*)ptr, _MaxValue);
|
||||
ptr= xmlGetProp (cur, (xmlChar*)"delta");
|
||||
if(ptr) fromString((const char*)ptr, _DeltaMultiplier);
|
||||
|
||||
// set min val in DB
|
||||
_Number.setSInt32(_MinValue);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDBGroupSelectNumber::setup()
|
||||
{
|
||||
if (_SlotNumber != NULL)
|
||||
return;
|
||||
|
||||
// bind to the controls.
|
||||
_SlotNumber= dynamic_cast<CViewBitmap*>(CInterfaceGroup::getView("slot_number"));
|
||||
_TextNumber= dynamic_cast<CViewText*>(CInterfaceGroup::getView("number"));
|
||||
_ButtonUp= dynamic_cast<CCtrlBaseButton*>(CInterfaceGroup::getCtrl("arrow_up"));
|
||||
_ButtonDown= dynamic_cast<CCtrlBaseButton*>(CInterfaceGroup::getCtrl("arrow_down"));
|
||||
|
||||
// checks
|
||||
if(_SlotNumber==NULL)
|
||||
nlwarning("Interface: SelectNumberGroup: bitmap 'slot_number' missing or bad type");
|
||||
if(_TextNumber==NULL)
|
||||
nlwarning("Interface: SelectNumberGroup: text view 'number' missing or bad type");
|
||||
if(_ButtonUp==NULL)
|
||||
nlwarning("Interface: SelectNumberGroup: button 'arrow_up' missing or bad type");
|
||||
if(_ButtonDown==NULL)
|
||||
nlwarning("Interface: SelectNumberGroup: button 'arrow_down' missing or bad type");
|
||||
if(_SlotNumber==NULL || _TextNumber==NULL || _ButtonUp==NULL || _ButtonDown==NULL)
|
||||
return;
|
||||
|
||||
// actions
|
||||
_ButtonUp->setActionOnLeftClick("sn_up");
|
||||
_ButtonDown->setActionOnLeftClick("sn_down");
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDBGroupSelectNumber::updateCoords ()
|
||||
{
|
||||
setup();
|
||||
CInterfaceGroup::updateCoords();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CDBGroupSelectNumber::checkCoords()
|
||||
{
|
||||
if(_TextNumber)
|
||||
_TextNumber->setText( toString(_Number.getSInt32()) );
|
||||
CInterfaceGroup::checkCoords();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDBGroupSelectNumber::draw ()
|
||||
{
|
||||
CInterfaceGroup::draw();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDBGroupSelectNumber::clearViews ()
|
||||
{
|
||||
CInterfaceGroup::clearViews();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDBGroupSelectNumber::handleEvent (const NLGUI::CEventDescriptor &event)
|
||||
{
|
||||
if (event.getType() == NLGUI::CEventDescriptor::mouse)
|
||||
{
|
||||
const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event;
|
||||
if (isIn(eventDesc.getX(), eventDesc.getY()))
|
||||
{
|
||||
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mousewheel)
|
||||
{
|
||||
changeValue (eventDesc.getWheel());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CInterfaceGroup::handleEvent(event)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDBGroupSelectNumber::changeValue(sint delta)
|
||||
{
|
||||
delta*= _DeltaMultiplier;
|
||||
|
||||
// get DB and add
|
||||
sint32 val= _Number.getSInt32();
|
||||
val+= delta;
|
||||
|
||||
// Loop or clamp
|
||||
if(_LoopMode)
|
||||
{
|
||||
sint32 dval= _MaxValue+1 - _MinValue;
|
||||
if (dval <= 0)
|
||||
{
|
||||
val = 0;
|
||||
return;
|
||||
}
|
||||
val -= _MinValue;
|
||||
val = val% dval; val = (val+dval)% dval;
|
||||
val += _MinValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
clamp(val, _MinValue, _MaxValue);
|
||||
}
|
||||
|
||||
// set in DB
|
||||
_Number.setSInt32(val);
|
||||
if(_TextNumber)
|
||||
_TextNumber->setText( toString(_Number.getSInt32()) );
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// Actions Handlers
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
class CSNUp : public IActionHandler
|
||||
{
|
||||
public:
|
||||
virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */)
|
||||
{
|
||||
CDBGroupSelectNumber *pSN = dynamic_cast<CDBGroupSelectNumber*>(pCaller->getParent());
|
||||
if (pSN == NULL) return;
|
||||
pSN->changeValue(+1);
|
||||
}
|
||||
};
|
||||
REGISTER_ACTION_HANDLER (CSNUp, "sn_up");
|
||||
|
||||
// ***************************************************************************
|
||||
class CSNDown : public IActionHandler
|
||||
{
|
||||
public:
|
||||
virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */)
|
||||
{
|
||||
CDBGroupSelectNumber *pSN = dynamic_cast<CDBGroupSelectNumber*>(pCaller->getParent());
|
||||
if (pSN == NULL) return;
|
||||
pSN->changeValue(-1);
|
||||
}
|
||||
};
|
||||
REGISTER_ACTION_HANDLER (CSNDown, "sn_down");
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
#include "nel/gui/dbview_bar3.h"
|
||||
#include "nel/gui/dbview_number.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
/// Necessary so the linker doesn't drop the code of these classes from the library
|
||||
void LinkHack()
|
||||
{
|
||||
CDBViewBar3::forceLink();
|
||||
CDBViewNumber::forceLink();
|
||||
}
|
||||
}
|
@ -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 "stdpch.h"
|
||||
|
||||
|
||||
#include "dbgroup_select_number.h"
|
||||
#include "nel/gui/view_text.h"
|
||||
#include "nel/gui/view_bitmap.h"
|
||||
#include "nel/gui/ctrl_button.h"
|
||||
#include "nel/gui/interface_property.h"
|
||||
#include "interface_manager.h"
|
||||
#include "nel/gui/action_handler.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace NL3D;
|
||||
using namespace NLMISC;
|
||||
|
||||
NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupSelectNumber, std::string, "select_number");
|
||||
|
||||
// ***************************************************************************
|
||||
CDBGroupSelectNumber::CDBGroupSelectNumber(const TCtorParam ¶m)
|
||||
: CInterfaceGroup(param)
|
||||
{
|
||||
_SlotNumber= NULL;
|
||||
_TextNumber= NULL;
|
||||
_ButtonUp= NULL;
|
||||
_ButtonDown= NULL;
|
||||
_LoopMode= true;
|
||||
_MinValue= 0;
|
||||
_MaxValue= 9;
|
||||
_DeltaMultiplier= 1;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
CDBGroupSelectNumber::~CDBGroupSelectNumber()
|
||||
{
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDBGroupSelectNumber::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
||||
{
|
||||
if(!CInterfaceGroup::parse(cur, parentGroup))
|
||||
return false;
|
||||
|
||||
// read params
|
||||
CXMLAutoPtr ptr;
|
||||
ptr = xmlGetProp (cur, (xmlChar*)"value");
|
||||
if ( ptr )
|
||||
_Number.link ( ptr );
|
||||
else
|
||||
{
|
||||
nlinfo ("no value in %s", _Id.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Loop, min and max
|
||||
_LoopMode= false;
|
||||
ptr= xmlGetProp (cur, (xmlChar*)"loop");
|
||||
if(ptr) _LoopMode= convertBool(ptr);
|
||||
_MinValue = 0;
|
||||
ptr= xmlGetProp (cur, (xmlChar*)"min");
|
||||
if(ptr) fromString((const char*)ptr, _MinValue);
|
||||
_MaxValue = 0;
|
||||
ptr= xmlGetProp (cur, (xmlChar*)"max");
|
||||
if(ptr) fromString((const char*)ptr, _MaxValue);
|
||||
ptr= xmlGetProp (cur, (xmlChar*)"delta");
|
||||
if(ptr) fromString((const char*)ptr, _DeltaMultiplier);
|
||||
|
||||
// set min val in DB
|
||||
_Number.setSInt32(_MinValue);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDBGroupSelectNumber::setup()
|
||||
{
|
||||
if (_SlotNumber != NULL)
|
||||
return;
|
||||
|
||||
// bind to the controls.
|
||||
_SlotNumber= dynamic_cast<CViewBitmap*>(CInterfaceGroup::getView("slot_number"));
|
||||
_TextNumber= dynamic_cast<CViewText*>(CInterfaceGroup::getView("number"));
|
||||
_ButtonUp= dynamic_cast<CCtrlBaseButton*>(CInterfaceGroup::getCtrl("arrow_up"));
|
||||
_ButtonDown= dynamic_cast<CCtrlBaseButton*>(CInterfaceGroup::getCtrl("arrow_down"));
|
||||
|
||||
// checks
|
||||
if(_SlotNumber==NULL)
|
||||
nlwarning("Interface: SelectNumberGroup: bitmap 'slot_number' missing or bad type");
|
||||
if(_TextNumber==NULL)
|
||||
nlwarning("Interface: SelectNumberGroup: text view 'number' missing or bad type");
|
||||
if(_ButtonUp==NULL)
|
||||
nlwarning("Interface: SelectNumberGroup: button 'arrow_up' missing or bad type");
|
||||
if(_ButtonDown==NULL)
|
||||
nlwarning("Interface: SelectNumberGroup: button 'arrow_down' missing or bad type");
|
||||
if(_SlotNumber==NULL || _TextNumber==NULL || _ButtonUp==NULL || _ButtonDown==NULL)
|
||||
return;
|
||||
|
||||
// actions
|
||||
_ButtonUp->setActionOnLeftClick("sn_up");
|
||||
_ButtonDown->setActionOnLeftClick("sn_down");
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDBGroupSelectNumber::updateCoords ()
|
||||
{
|
||||
setup();
|
||||
CInterfaceGroup::updateCoords();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CDBGroupSelectNumber::checkCoords()
|
||||
{
|
||||
if(_TextNumber)
|
||||
_TextNumber->setText( toString(_Number.getSInt32()) );
|
||||
CInterfaceGroup::checkCoords();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDBGroupSelectNumber::draw ()
|
||||
{
|
||||
CInterfaceGroup::draw();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDBGroupSelectNumber::clearViews ()
|
||||
{
|
||||
CInterfaceGroup::clearViews();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDBGroupSelectNumber::handleEvent (const NLGUI::CEventDescriptor &event)
|
||||
{
|
||||
if (event.getType() == NLGUI::CEventDescriptor::mouse)
|
||||
{
|
||||
const NLGUI::CEventDescriptorMouse &eventDesc = (const NLGUI::CEventDescriptorMouse &)event;
|
||||
if (isIn(eventDesc.getX(), eventDesc.getY()))
|
||||
{
|
||||
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mousewheel)
|
||||
{
|
||||
changeValue (eventDesc.getWheel());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CInterfaceGroup::handleEvent(event)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
void CDBGroupSelectNumber::changeValue(sint delta)
|
||||
{
|
||||
delta*= _DeltaMultiplier;
|
||||
|
||||
// get DB and add
|
||||
sint32 val= _Number.getSInt32();
|
||||
val+= delta;
|
||||
|
||||
// Loop or clamp
|
||||
if(_LoopMode)
|
||||
{
|
||||
sint32 dval= _MaxValue+1 - _MinValue;
|
||||
if (dval <= 0)
|
||||
{
|
||||
val = 0;
|
||||
return;
|
||||
}
|
||||
val -= _MinValue;
|
||||
val = val% dval; val = (val+dval)% dval;
|
||||
val += _MinValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
clamp(val, _MinValue, _MaxValue);
|
||||
}
|
||||
|
||||
// set in DB
|
||||
_Number.setSInt32(val);
|
||||
if(_TextNumber)
|
||||
_TextNumber->setText( toString(_Number.getSInt32()) );
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// Actions Handlers
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
class CSNUp : public IActionHandler
|
||||
{
|
||||
public:
|
||||
virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */)
|
||||
{
|
||||
CDBGroupSelectNumber *pSN = dynamic_cast<CDBGroupSelectNumber*>(pCaller->getParent());
|
||||
if (pSN == NULL) return;
|
||||
pSN->changeValue(+1);
|
||||
}
|
||||
};
|
||||
REGISTER_ACTION_HANDLER (CSNUp, "sn_up");
|
||||
|
||||
// ***************************************************************************
|
||||
class CSNDown : public IActionHandler
|
||||
{
|
||||
public:
|
||||
virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */)
|
||||
{
|
||||
CDBGroupSelectNumber *pSN = dynamic_cast<CDBGroupSelectNumber*>(pCaller->getParent());
|
||||
if (pSN == NULL) return;
|
||||
pSN->changeValue(-1);
|
||||
}
|
||||
};
|
||||
REGISTER_ACTION_HANDLER (CSNDown, "sn_down");
|
||||
|
@ -1,98 +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_DBGROUP_SELECT_NUMBER_H
|
||||
#define NL_DBGROUP_SELECT_NUMBER_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/gui/interface_group.h"
|
||||
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
class CCtrlBaseButton;
|
||||
class CViewText;
|
||||
class CViewBitmap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
/**
|
||||
* Widget to select a number
|
||||
* \author Lionel Berenguier
|
||||
* \author Nevrax France
|
||||
* \date 2002
|
||||
*/
|
||||
class CDBGroupSelectNumber : public CInterfaceGroup
|
||||
{
|
||||
public:
|
||||
|
||||
/// Constructor
|
||||
CDBGroupSelectNumber(const TCtorParam ¶m);
|
||||
~CDBGroupSelectNumber();
|
||||
|
||||
/// 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);
|
||||
|
||||
// mod interface
|
||||
void changeValue(sint delta);
|
||||
|
||||
sint32 getMinValue () const { return _MinValue; }
|
||||
void setMinValue (sint32 m) { _MinValue = m; }
|
||||
sint32 getMaxValue () const { return _MaxValue; }
|
||||
void setMaxValue (sint32 m) { _MaxValue = m; }
|
||||
|
||||
sint32 getCurrentValue () const { return _Number.getSInt32(); }
|
||||
void setCurrentValue (sint32 val) { _Number.setSInt32(val); }
|
||||
|
||||
REFLECT_EXPORT_START(CDBGroupSelectNumber, CInterfaceGroup)
|
||||
REFLECT_SINT32("min", getMinValue, setMinValue);
|
||||
REFLECT_SINT32("max", getMaxValue, setMaxValue);
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
protected:
|
||||
|
||||
// sint32
|
||||
CInterfaceProperty _Number;
|
||||
bool _LoopMode;
|
||||
sint _MinValue;
|
||||
sint _MaxValue;
|
||||
sint _DeltaMultiplier;
|
||||
|
||||
// Children
|
||||
CViewBitmap *_SlotNumber;
|
||||
CViewText *_TextNumber;
|
||||
CCtrlBaseButton *_ButtonUp;
|
||||
CCtrlBaseButton *_ButtonDown;
|
||||
|
||||
private:
|
||||
|
||||
void setup();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // NL_DBGROUP_SELECT_NUMBER_H
|
||||
|
||||
/* End of dbgroup_select_number.h */
|
Loading…
Reference in New Issue