mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 15:46:18 +00:00
CHANGED: #1471 CDBViewBar is now part of the NELGUI library and is under the NLGUI namespace.
--HG-- branch : gui-refactoring
This commit is contained in:
parent
f049b68079
commit
6ac90d848c
9 changed files with 350 additions and 340 deletions
112
code/nel/include/nel/gui/dbview_bar.h
Normal file
112
code/nel/include/nel/gui/dbview_bar.h
Normal file
|
@ -0,0 +1,112 @@
|
|||
// 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 RZ_DBVIEW_BAR_H
|
||||
#define RZ_DBVIEW_BAR_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/gui/view_bitmap.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
||||
/**
|
||||
* class implementing a bitmap used as the front texture of a progress bar
|
||||
* the bitmap is drawn from _X to _W * _Range/_RangeMax
|
||||
* \author Nicolas Brigand
|
||||
* \author Nevrax France
|
||||
* \date 2002
|
||||
*/
|
||||
class CDBViewBar : public CViewBitmap
|
||||
{
|
||||
public:
|
||||
enum TViewBar { ViewBar_UltraMini, ViewBar_Mini, ViewBar_Normal, ViewBar_MiniThick };
|
||||
public:
|
||||
|
||||
/// Constructor
|
||||
CDBViewBar(const TCtorParam ¶m)
|
||||
: CViewBitmap(param),
|
||||
_Slot(TCtorParam())
|
||||
{
|
||||
_Color= NLMISC::CRGBA::White;
|
||||
_ValueInt= 0;
|
||||
_RangeInt = 255;
|
||||
_ReferenceInt= 0;
|
||||
_Type = ViewBar_Normal;
|
||||
}
|
||||
|
||||
void setType (TViewBar vb);
|
||||
|
||||
bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup);
|
||||
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
|
||||
virtual void updateCoords ();
|
||||
virtual void draw ();
|
||||
|
||||
/// Nbs: Values by Int are not used if the Links are setuped
|
||||
void setValue (sint32 r) { _ValueInt = r; }
|
||||
void setRange (sint32 r) { _RangeInt = r; }
|
||||
void setReference (sint32 r) { _ReferenceInt = r; }
|
||||
sint32 getValue () const { return _ValueInt; }
|
||||
sint32 getRange () const { return _RangeInt; }
|
||||
sint32 getReference () const { return _ReferenceInt; }
|
||||
|
||||
void setValueDbLink (const std::string &r);
|
||||
void setRangeDbLink (const std::string &r);
|
||||
void setReferenceDbLink (const std::string &r);
|
||||
std::string getValueDbLink () const;
|
||||
std::string getRangeDbLink () const;
|
||||
std::string getReferenceDbLink () const;
|
||||
|
||||
// Reflect ValueInt (ie not used if the link is setuped)
|
||||
REFLECT_EXPORT_START(CDBViewBar, CViewBitmap)
|
||||
REFLECT_SINT32 ("value", getValue, setValue);
|
||||
REFLECT_SINT32 ("range", getRange, setRange);
|
||||
REFLECT_SINT32 ("reference", getReference, setReference);
|
||||
REFLECT_STRING ("value_dblink", getValueDbLink, setValueDbLink);
|
||||
REFLECT_STRING ("range_dblink", getRangeDbLink, setRangeDbLink);
|
||||
REFLECT_STRING ("reference_dblink", getReferenceDbLink, setReferenceDbLink);
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
protected:
|
||||
|
||||
CViewBitmap _Slot;
|
||||
TViewBar _Type;
|
||||
sint32 _HBar;
|
||||
NLMISC::CRGBA _ColorNegative;
|
||||
|
||||
// Value of the progression in arbitrary units. should be integer
|
||||
CInterfaceProperty _Value;
|
||||
// Max range of the progression in arbitrary units. should be integer
|
||||
CInterfaceProperty _Range;
|
||||
// Reference of the progression (substracted from value and range).
|
||||
CInterfaceProperty _Reference;
|
||||
|
||||
/// Nbs: Values by Int are not used if the Links are setuped. NB: not overwritten by links
|
||||
sint32 _ValueInt;
|
||||
sint32 _RangeInt;
|
||||
sint32 _ReferenceInt;
|
||||
|
||||
void parseValProp(xmlNodePtr cur, CInterfaceProperty &dbProp, sint32 &intProp, const char *name);
|
||||
sint64 getCurrentValProp(const CInterfaceProperty &dbProp, sint32 intProp);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // RZ_DBVIEW_BAR_H
|
||||
|
||||
/* End of dbview_bar.h */
|
233
code/nel/src/gui/dbview_bar.cpp
Normal file
233
code/nel/src/gui/dbview_bar.cpp
Normal file
|
@ -0,0 +1,233 @@
|
|||
// 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/dbview_bar.h"
|
||||
#include "nel/misc/xml_auto_ptr.h"
|
||||
#include "nel/gui/interface_group.h"
|
||||
#include "nel/gui/widget_manager.h"
|
||||
#include "nel/gui/db_manager.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NL3D;
|
||||
using namespace NLMISC;
|
||||
|
||||
NLMISC_REGISTER_OBJECT(CViewBase, CDBViewBar, std::string, "bar");
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CDBViewBar::parseValProp(xmlNodePtr cur, CInterfaceProperty &dbProp, sint32 &intProp, const char *name)
|
||||
{
|
||||
CXMLAutoPtr prop((const char*) xmlGetProp( cur, (xmlChar*)name ));
|
||||
if (prop)
|
||||
{
|
||||
if ( isdigit(*prop.getDatas()) || *(prop.getDatas())=='-')
|
||||
fromString((const char*)prop, intProp);
|
||||
else
|
||||
dbProp.link(prop);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
bool CDBViewBar::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
||||
{
|
||||
if (!CViewBitmap::parse(cur, parentGroup))
|
||||
{
|
||||
string tmp = "cannot parse view:"+getId()+", parent:"+parentGroup->getId();
|
||||
nlinfo(tmp.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
CXMLAutoPtr prop;
|
||||
|
||||
// read value, range and reference
|
||||
parseValProp(cur, _Value, _ValueInt, "value");
|
||||
parseValProp(cur, _Range, _RangeInt, "range");
|
||||
parseValProp(cur, _Reference, _ReferenceInt, "reference");
|
||||
|
||||
// Get Visual props
|
||||
prop= (char*) xmlGetProp( cur, (xmlChar*)"color_negative" );
|
||||
_ColorNegative = CRGBA(0,0,0,0);
|
||||
if (prop)
|
||||
_ColorNegative = convertColor (prop);
|
||||
|
||||
// Bar Type
|
||||
_Type = ViewBar_Normal;
|
||||
|
||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"mini" );
|
||||
if (prop)
|
||||
if (convertBool(prop))
|
||||
setType(ViewBar_Mini);
|
||||
|
||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"ultra_mini" );
|
||||
if (prop)
|
||||
if (convertBool(prop))
|
||||
setType(ViewBar_UltraMini);
|
||||
|
||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"mini_thick" );
|
||||
if (prop)
|
||||
if (convertBool(prop))
|
||||
setType(ViewBar_MiniThick);
|
||||
|
||||
if (_Type == ViewBar_Normal)
|
||||
setType(ViewBar_Normal);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CDBViewBar::setType (TViewBar vb)
|
||||
{
|
||||
_Type = vb;
|
||||
switch(_Type)
|
||||
{
|
||||
case ViewBar_Normal: _Slot.setTexture ("w_slot_jauge_1.tga"); break;
|
||||
case ViewBar_Mini: _Slot.setTexture ("w_slot_jauge_1_mini.tga"); break;
|
||||
case ViewBar_UltraMini: _Slot.setTexture ("w_slot_jauge_1_umin.tga"); break;
|
||||
case ViewBar_MiniThick: _Slot.setTexture ("w_slot_jauge_1_tmin.tga"); break;
|
||||
}
|
||||
|
||||
_Slot.setPosRef (_PosRef);
|
||||
_Slot.setParentPosRef (_ParentPosRef);
|
||||
_Slot.setX (_X);
|
||||
_Slot.setY (_Y);
|
||||
|
||||
_Scale = true;
|
||||
switch(_Type)
|
||||
{
|
||||
case ViewBar_Normal: setTexture ("w_jauge_fill.tga"); break;
|
||||
case ViewBar_Mini: setTexture ("w_jauge_fill_mini.tga"); break;
|
||||
case ViewBar_UltraMini: setTexture ("w_jauge_fill_umin.tga"); break;
|
||||
case ViewBar_MiniThick: setTexture ("w_jauge_fill_tmin.tga"); break;
|
||||
}
|
||||
|
||||
// Get the Height Size.
|
||||
sint32 wBar;
|
||||
CViewRenderer::getInstance()->getTextureSizeFromId(_TextureId, wBar, _HBar);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CDBViewBar::updateCoords ()
|
||||
{
|
||||
if (_ParentPos == NULL)
|
||||
_Slot.setParentPos (_Parent);
|
||||
else
|
||||
_Slot.setParentPos (_ParentPos);
|
||||
_Slot.updateCoords();
|
||||
_W = _Slot.getW();
|
||||
_H = _Slot.getH();
|
||||
CViewBitmap::updateCoords();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
sint64 CDBViewBar::getCurrentValProp(const CInterfaceProperty &dbProp, sint32 intProp)
|
||||
{
|
||||
if(dbProp.getNodePtr())
|
||||
return dbProp.getSInt64();
|
||||
else
|
||||
return intProp;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CDBViewBar::draw ()
|
||||
{
|
||||
float wBar = (float)(_Slot.getWReal()-4);
|
||||
|
||||
sint64 value= getCurrentValProp(_Value, _ValueInt);
|
||||
sint64 range= getCurrentValProp(_Range, _RangeInt);
|
||||
sint64 reference= getCurrentValProp(_Reference, _ReferenceInt);
|
||||
|
||||
// remove the reference
|
||||
value-= reference;
|
||||
range-= reference;
|
||||
|
||||
// draw the bar
|
||||
CRGBA color = _Color;
|
||||
|
||||
if (range > 0)
|
||||
{
|
||||
float ratio= (float)value / range;
|
||||
if (_ColorNegative.A != 0 && ratio < 0.0f)
|
||||
{
|
||||
ratio = - ratio;
|
||||
color = _ColorNegative;
|
||||
}
|
||||
NLMISC::clamp(ratio, 0.f, 1.f);
|
||||
wBar *= ratio;
|
||||
}
|
||||
else
|
||||
wBar = 0;
|
||||
|
||||
_WReal = (sint32)wBar;
|
||||
|
||||
_Slot.draw();
|
||||
|
||||
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||
|
||||
color.A = (uint8)(((sint32)color.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
|
||||
|
||||
// compute the DeltaY: mean of dif.
|
||||
sint32 deltaY= (_H-_HBar)/2;
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, _XReal+2, _YReal+deltaY, _WReal, _HBar, 0, false, _TextureId, color);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CDBViewBar::setValueDbLink (const std::string &r)
|
||||
{
|
||||
CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(r,false);
|
||||
if (pNL != NULL) _Value.setNodePtr(pNL);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CDBViewBar::setRangeDbLink (const std::string &r)
|
||||
{
|
||||
CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(r,false);
|
||||
if (pNL != NULL) _Range.setNodePtr(pNL);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CDBViewBar::setReferenceDbLink (const std::string &r)
|
||||
{
|
||||
CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(r,false);
|
||||
if (pNL != NULL) _Reference.setNodePtr(pNL);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
string CDBViewBar::getValueDbLink () const
|
||||
{
|
||||
if (_Value.getNodePtr() == NULL) return "";
|
||||
return _Value.getNodePtr()->getFullName();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
string CDBViewBar::getRangeDbLink () const
|
||||
{
|
||||
if (_Range.getNodePtr() == NULL) return "";
|
||||
return _Range.getNodePtr()->getFullName();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
string CDBViewBar::getReferenceDbLink () const
|
||||
{
|
||||
if (_Reference.getNodePtr() == NULL) return "";
|
||||
return _Reference.getNodePtr()->getFullName();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
#include "../user_entity.h"
|
||||
#include "../entities.h"
|
||||
#include "dbgroup_combo_box.h"
|
||||
#include "dbview_bar.h"
|
||||
#include "nel/gui/dbview_bar.h"
|
||||
#include "../debug_client.h"
|
||||
#include "interface_3d_scene.h"
|
||||
#include "character_3d.h"
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "sbrick_manager.h"
|
||||
#include "sphrase_manager.h"
|
||||
#include "nel/gui/group_editbox.h"
|
||||
#include "dbview_bar.h"
|
||||
#include "nel/gui/dbview_bar.h"
|
||||
#include "skill_manager.h"
|
||||
#include "game_share/bot_chat_types.h"
|
||||
|
||||
|
|
|
@ -1,227 +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 "dbview_bar.h"
|
||||
#include "nel/misc/xml_auto_ptr.h"
|
||||
#include "nel/gui/interface_group.h"
|
||||
#include "nel/gui/widget_manager.h"
|
||||
#include "nel/gui/db_manager.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NL3D;
|
||||
using namespace NLMISC;
|
||||
|
||||
NLMISC_REGISTER_OBJECT(CViewBase, CDBViewBar, std::string, "bar");
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CDBViewBar::parseValProp(xmlNodePtr cur, CInterfaceProperty &dbProp, sint32 &intProp, const char *name)
|
||||
{
|
||||
CXMLAutoPtr prop((const char*) xmlGetProp( cur, (xmlChar*)name ));
|
||||
if (prop)
|
||||
{
|
||||
if ( isdigit(*prop.getDatas()) || *(prop.getDatas())=='-')
|
||||
fromString((const char*)prop, intProp);
|
||||
else
|
||||
dbProp.link(prop);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
bool CDBViewBar::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
||||
{
|
||||
if (!CViewBitmap::parse(cur, parentGroup))
|
||||
{
|
||||
string tmp = "cannot parse view:"+getId()+", parent:"+parentGroup->getId();
|
||||
nlinfo(tmp.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
CXMLAutoPtr prop;
|
||||
|
||||
// read value, range and reference
|
||||
parseValProp(cur, _Value, _ValueInt, "value");
|
||||
parseValProp(cur, _Range, _RangeInt, "range");
|
||||
parseValProp(cur, _Reference, _ReferenceInt, "reference");
|
||||
|
||||
// Get Visual props
|
||||
prop= (char*) xmlGetProp( cur, (xmlChar*)"color_negative" );
|
||||
_ColorNegative = CRGBA(0,0,0,0);
|
||||
if (prop)
|
||||
_ColorNegative = convertColor (prop);
|
||||
|
||||
// Bar Type
|
||||
_Type = ViewBar_Normal;
|
||||
|
||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"mini" );
|
||||
if (prop)
|
||||
if (convertBool(prop))
|
||||
setType(ViewBar_Mini);
|
||||
|
||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"ultra_mini" );
|
||||
if (prop)
|
||||
if (convertBool(prop))
|
||||
setType(ViewBar_UltraMini);
|
||||
|
||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"mini_thick" );
|
||||
if (prop)
|
||||
if (convertBool(prop))
|
||||
setType(ViewBar_MiniThick);
|
||||
|
||||
if (_Type == ViewBar_Normal)
|
||||
setType(ViewBar_Normal);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CDBViewBar::setType (TViewBar vb)
|
||||
{
|
||||
_Type = vb;
|
||||
switch(_Type)
|
||||
{
|
||||
case ViewBar_Normal: _Slot.setTexture ("w_slot_jauge_1.tga"); break;
|
||||
case ViewBar_Mini: _Slot.setTexture ("w_slot_jauge_1_mini.tga"); break;
|
||||
case ViewBar_UltraMini: _Slot.setTexture ("w_slot_jauge_1_umin.tga"); break;
|
||||
case ViewBar_MiniThick: _Slot.setTexture ("w_slot_jauge_1_tmin.tga"); break;
|
||||
}
|
||||
|
||||
_Slot.setPosRef (_PosRef);
|
||||
_Slot.setParentPosRef (_ParentPosRef);
|
||||
_Slot.setX (_X);
|
||||
_Slot.setY (_Y);
|
||||
|
||||
_Scale = true;
|
||||
switch(_Type)
|
||||
{
|
||||
case ViewBar_Normal: setTexture ("w_jauge_fill.tga"); break;
|
||||
case ViewBar_Mini: setTexture ("w_jauge_fill_mini.tga"); break;
|
||||
case ViewBar_UltraMini: setTexture ("w_jauge_fill_umin.tga"); break;
|
||||
case ViewBar_MiniThick: setTexture ("w_jauge_fill_tmin.tga"); break;
|
||||
}
|
||||
|
||||
// Get the Height Size.
|
||||
sint32 wBar;
|
||||
CViewRenderer::getInstance()->getTextureSizeFromId(_TextureId, wBar, _HBar);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CDBViewBar::updateCoords ()
|
||||
{
|
||||
if (_ParentPos == NULL)
|
||||
_Slot.setParentPos (_Parent);
|
||||
else
|
||||
_Slot.setParentPos (_ParentPos);
|
||||
_Slot.updateCoords();
|
||||
_W = _Slot.getW();
|
||||
_H = _Slot.getH();
|
||||
CViewBitmap::updateCoords();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
sint64 CDBViewBar::getCurrentValProp(const CInterfaceProperty &dbProp, sint32 intProp)
|
||||
{
|
||||
if(dbProp.getNodePtr())
|
||||
return dbProp.getSInt64();
|
||||
else
|
||||
return intProp;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CDBViewBar::draw ()
|
||||
{
|
||||
float wBar = (float)(_Slot.getWReal()-4);
|
||||
|
||||
sint64 value= getCurrentValProp(_Value, _ValueInt);
|
||||
sint64 range= getCurrentValProp(_Range, _RangeInt);
|
||||
sint64 reference= getCurrentValProp(_Reference, _ReferenceInt);
|
||||
|
||||
// remove the reference
|
||||
value-= reference;
|
||||
range-= reference;
|
||||
|
||||
// draw the bar
|
||||
CRGBA color = _Color;
|
||||
|
||||
if (range > 0)
|
||||
{
|
||||
float ratio= (float)value / range;
|
||||
if (_ColorNegative.A != 0 && ratio < 0.0f)
|
||||
{
|
||||
ratio = - ratio;
|
||||
color = _ColorNegative;
|
||||
}
|
||||
NLMISC::clamp(ratio, 0.f, 1.f);
|
||||
wBar *= ratio;
|
||||
}
|
||||
else
|
||||
wBar = 0;
|
||||
|
||||
_WReal = (sint32)wBar;
|
||||
|
||||
_Slot.draw();
|
||||
|
||||
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||
|
||||
color.A = (uint8)(((sint32)color.A*((sint32)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8);
|
||||
|
||||
// compute the DeltaY: mean of dif.
|
||||
sint32 deltaY= (_H-_HBar)/2;
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, _XReal+2, _YReal+deltaY, _WReal, _HBar, 0, false, _TextureId, color);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CDBViewBar::setValueDbLink (const std::string &r)
|
||||
{
|
||||
CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(r,false);
|
||||
if (pNL != NULL) _Value.setNodePtr(pNL);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CDBViewBar::setRangeDbLink (const std::string &r)
|
||||
{
|
||||
CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(r,false);
|
||||
if (pNL != NULL) _Range.setNodePtr(pNL);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void CDBViewBar::setReferenceDbLink (const std::string &r)
|
||||
{
|
||||
CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp(r,false);
|
||||
if (pNL != NULL) _Reference.setNodePtr(pNL);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
string CDBViewBar::getValueDbLink () const
|
||||
{
|
||||
if (_Value.getNodePtr() == NULL) return "";
|
||||
return _Value.getNodePtr()->getFullName();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
string CDBViewBar::getRangeDbLink () const
|
||||
{
|
||||
if (_Range.getNodePtr() == NULL) return "";
|
||||
return _Range.getNodePtr()->getFullName();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
string CDBViewBar::getReferenceDbLink () const
|
||||
{
|
||||
if (_Reference.getNodePtr() == NULL) return "";
|
||||
return _Reference.getNodePtr()->getFullName();
|
||||
}
|
|
@ -1,108 +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 RZ_DBVIEW_BAR_H
|
||||
#define RZ_DBVIEW_BAR_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/gui/view_bitmap.h"
|
||||
|
||||
/**
|
||||
* class implementing a bitmap used as the front texture of a progress bar
|
||||
* the bitmap is drawn from _X to _W * _Range/_RangeMax
|
||||
* \author Nicolas Brigand
|
||||
* \author Nevrax France
|
||||
* \date 2002
|
||||
*/
|
||||
class CDBViewBar : public CViewBitmap
|
||||
{
|
||||
public:
|
||||
enum TViewBar { ViewBar_UltraMini, ViewBar_Mini, ViewBar_Normal, ViewBar_MiniThick };
|
||||
public:
|
||||
|
||||
/// Constructor
|
||||
CDBViewBar(const TCtorParam ¶m)
|
||||
: CViewBitmap(param),
|
||||
_Slot(TCtorParam())
|
||||
{
|
||||
_Color= NLMISC::CRGBA::White;
|
||||
_ValueInt= 0;
|
||||
_RangeInt = 255;
|
||||
_ReferenceInt= 0;
|
||||
_Type = ViewBar_Normal;
|
||||
}
|
||||
|
||||
void setType (TViewBar vb);
|
||||
|
||||
bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup);
|
||||
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
|
||||
virtual void updateCoords ();
|
||||
virtual void draw ();
|
||||
|
||||
/// Nbs: Values by Int are not used if the Links are setuped
|
||||
void setValue (sint32 r) { _ValueInt = r; }
|
||||
void setRange (sint32 r) { _RangeInt = r; }
|
||||
void setReference (sint32 r) { _ReferenceInt = r; }
|
||||
sint32 getValue () const { return _ValueInt; }
|
||||
sint32 getRange () const { return _RangeInt; }
|
||||
sint32 getReference () const { return _ReferenceInt; }
|
||||
|
||||
void setValueDbLink (const std::string &r);
|
||||
void setRangeDbLink (const std::string &r);
|
||||
void setReferenceDbLink (const std::string &r);
|
||||
std::string getValueDbLink () const;
|
||||
std::string getRangeDbLink () const;
|
||||
std::string getReferenceDbLink () const;
|
||||
|
||||
// Reflect ValueInt (ie not used if the link is setuped)
|
||||
REFLECT_EXPORT_START(CDBViewBar, CViewBitmap)
|
||||
REFLECT_SINT32 ("value", getValue, setValue);
|
||||
REFLECT_SINT32 ("range", getRange, setRange);
|
||||
REFLECT_SINT32 ("reference", getReference, setReference);
|
||||
REFLECT_STRING ("value_dblink", getValueDbLink, setValueDbLink);
|
||||
REFLECT_STRING ("range_dblink", getRangeDbLink, setRangeDbLink);
|
||||
REFLECT_STRING ("reference_dblink", getReferenceDbLink, setReferenceDbLink);
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
protected:
|
||||
|
||||
CViewBitmap _Slot;
|
||||
TViewBar _Type;
|
||||
sint32 _HBar;
|
||||
NLMISC::CRGBA _ColorNegative;
|
||||
|
||||
// Value of the progression in arbitrary units. should be integer
|
||||
CInterfaceProperty _Value;
|
||||
// Max range of the progression in arbitrary units. should be integer
|
||||
CInterfaceProperty _Range;
|
||||
// Reference of the progression (substracted from value and range).
|
||||
CInterfaceProperty _Reference;
|
||||
|
||||
/// Nbs: Values by Int are not used if the Links are setuped. NB: not overwritten by links
|
||||
sint32 _ValueInt;
|
||||
sint32 _RangeInt;
|
||||
sint32 _ReferenceInt;
|
||||
|
||||
void parseValProp(xmlNodePtr cur, CInterfaceProperty &dbProp, sint32 &intProp, const char *name);
|
||||
sint64 getCurrentValProp(const CInterfaceProperty &dbProp, sint32 intProp);
|
||||
};
|
||||
|
||||
|
||||
#endif // RZ_DBVIEW_BAR_H
|
||||
|
||||
/* End of dbview_bar.h */
|
|
@ -26,7 +26,7 @@
|
|||
#include "nel/gui/view_text.h"
|
||||
#include "nel/gui/view_bitmap.h"
|
||||
#include "dbview_number.h"
|
||||
#include "dbview_bar.h"
|
||||
#include "nel/gui/dbview_bar.h"
|
||||
|
||||
#include "game_share/skills.h"
|
||||
#include "nel/misc/xml_auto_ptr.h"
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "view_radar.h"
|
||||
#include "view_pointer.h"
|
||||
// DBView (View linked to the database)
|
||||
#include "dbview_bar.h"
|
||||
#include "nel/gui/dbview_bar.h"
|
||||
#include "dbview_bar3.h"
|
||||
#include "dbview_number.h"
|
||||
#include "dbview_quantity.h"
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nel/gui/group_editbox.h"
|
||||
#include "nel/gui/group_tree.h"
|
||||
#include "nel/gui/reflect.h"
|
||||
#include "dbview_bar.h"
|
||||
#include "nel/gui/dbview_bar.h"
|
||||
#include "dbview_bar3.h"
|
||||
#include "nel/gui/ctrl_scroll_base.h"
|
||||
#include "nel/gui/ctrl_scroll.h"
|
||||
|
|
Loading…
Reference in a new issue