CHANGED: #1471 CCtrlButton is now under the NLGUI namespace.

This commit is contained in:
dfighter1985 2012-06-16 00:49:40 +02:00
parent 84fe4773fb
commit 892a8131ca
6 changed files with 352 additions and 337 deletions

View file

@ -25,17 +25,16 @@
namespace NLGUI
{
class CEventDescriptor;
}
/**
/**
* <Class description>
* \author Nicolas Brigand
* \author Nevrax France
* \date 2002
*/
class CCtrlButton : public CCtrlBaseButton
{
public:
class CCtrlButton : public CCtrlBaseButton
{
public:
/// Constructor
CCtrlButton(const TCtorParam &param) : CCtrlBaseButton(param)
@ -84,18 +83,19 @@ public:
REFLECT_BOOL("scale", getScale, setScale);
REFLECT_EXPORT_END
protected:
protected:
CViewRenderer::CTextureId _TextureIdNormal;
CViewRenderer::CTextureId _TextureIdPushed;
CViewRenderer::CTextureId _TextureIdOver;
private:
private:
bool _Scale;
sint32 _Align; /// 1st bit - Left/Right (0/1) 2nd bit - Bottom/Top (0/1)
};
};
}
#endif // RZ_CTRL_BUTTON_H

View file

@ -14,9 +14,6 @@
// 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/ctrl_button.h"
#include "nel/misc/xml_auto_ptr.h"
#include "nel/gui/widget_manager.h"
@ -29,9 +26,12 @@ using namespace NL3D;
NLMISC_REGISTER_OBJECT(CViewBase, CCtrlButton, std::string, "button");
// ----------------------------------------------------------------------------
bool CCtrlButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
namespace NLGUI
{
// ----------------------------------------------------------------------------
bool CCtrlButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
{
CXMLAutoPtr prop;
//try to get props that can be inherited from groups
//if a property is not defined, try to find it in the parent group.
@ -97,11 +97,11 @@ bool CCtrlButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
return true;
}
}
// ----------------------------------------------------------------------------
void CCtrlButton::draw ()
{
// ----------------------------------------------------------------------------
void CCtrlButton::draw ()
{
sint32 nTxId = -1;
CRGBA color;
@ -149,7 +149,7 @@ void CCtrlButton::draw ()
break;
case RadioButton:
{
// CViewPointer &rIP = *CInterfaceManager::getInstance()->getPointer();
// CViewPointer &rIP = *CInterfaceManager::getInstance()->getPointer();
// Init the radio button
initRBRef();
@ -238,12 +238,12 @@ void CCtrlButton::draw ()
_TextureIdOver,
color );
}
}
}
// ----------------------------------------------------------------------------
void CCtrlButton::updateCoords()
{
// ----------------------------------------------------------------------------
void CCtrlButton::updateCoords()
{
if (!_Scale)
{
CViewRenderer &rVR = *CViewRenderer::getInstance();
@ -253,81 +253,81 @@ void CCtrlButton::updateCoords()
_H = txh;
}
CViewBase::updateCoords();
}
}
// ----------------------------------------------------------------------------
void CCtrlButton::setTexture(const std::string&name)
{
// CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = *CViewRenderer::getInstance();
// ----------------------------------------------------------------------------
void CCtrlButton::setTexture(const std::string&name)
{
// CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureIdNormal.setTexture(name.c_str());
}
}
// ----------------------------------------------------------------------------
void CCtrlButton::setTexturePushed(const std::string&name)
{
// CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = *CViewRenderer::getInstance();
// ----------------------------------------------------------------------------
void CCtrlButton::setTexturePushed(const std::string&name)
{
// CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureIdPushed.setTexture(name.c_str());
}
}
// ----------------------------------------------------------------------------
void CCtrlButton::setTextureOver(const std::string&name)
{
// CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = *CViewRenderer::getInstance();
// ----------------------------------------------------------------------------
void CCtrlButton::setTextureOver(const std::string&name)
{
// CInterfaceManager *pIM = CInterfaceManager::getInstance();
// CViewRenderer &rVR = *CViewRenderer::getInstance();
_TextureIdOver.setTexture(name.c_str());
}
}
// ----------------------------------------------------------------------------
std::string CCtrlButton::getTexture() const
{
// ----------------------------------------------------------------------------
std::string CCtrlButton::getTexture() const
{
CViewRenderer &rVR = *CViewRenderer::getInstance();
return rVR.getTextureNameFromId(_TextureIdNormal);
}
}
// ----------------------------------------------------------------------------
std::string CCtrlButton::getTexturePushed() const
{
// ----------------------------------------------------------------------------
std::string CCtrlButton::getTexturePushed() const
{
CViewRenderer &rVR = *CViewRenderer::getInstance();
return rVR.getTextureNameFromId(_TextureIdPushed);
}
}
// ----------------------------------------------------------------------------
std::string CCtrlButton::getTextureOver() const
{
// ----------------------------------------------------------------------------
std::string CCtrlButton::getTextureOver() const
{
CViewRenderer &rVR = *CViewRenderer::getInstance();
return rVR.getTextureNameFromId(_TextureIdOver);
}
}
// ***************************************************************************
sint32 CCtrlButton::getMaxUsedW() const
{
// ***************************************************************************
sint32 CCtrlButton::getMaxUsedW() const
{
sint32 txw, txh;
CViewRenderer &rVR = *CViewRenderer::getInstance();
rVR.getTextureSizeFromId (_TextureIdNormal, txw, txh);
return txw;
}
}
// ***************************************************************************
sint32 CCtrlButton::getMinUsedW() const
{
// ***************************************************************************
sint32 CCtrlButton::getMinUsedW() const
{
return getMaxUsedW();
}
}
// ***************************************************************************
void CCtrlButton::fitTexture()
{
// ***************************************************************************
void CCtrlButton::fitTexture()
{
CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 w, h;
rVR.getTextureSizeFromId(_TextureIdNormal, w, h);
setW(w);
setH(h);
}
}
// ***************************************************************************
bool CCtrlButton::getMouseOverShape(string &texName, uint8 &rot, CRGBA &col)
{
// ***************************************************************************
bool CCtrlButton::getMouseOverShape(string &texName, uint8 &rot, CRGBA &col)
{
if (_AHOnLeftClickString == "browse")
{
if (!_AHOnLeftClickStringParams.empty())
@ -344,4 +344,7 @@ bool CCtrlButton::getMouseOverShape(string &texName, uint8 &rot, CRGBA &col)
}
return false;
}
}

View file

@ -27,9 +27,13 @@
#include "dbctrl_sheet.h"
#include "view_text.h"
namespace NLGUI
{
class CCtrlButton;
}
// ***************************************************************************
class CCtrlButton;
class CCtrlScroll;
class CHandlerListSheetTradeSelect;
class CHandlerListSheetTradeRightClick;

View file

@ -23,9 +23,13 @@
#include "dbgroup_list_sheet_text.h"
#include "game_share/bot_chat_types.h"
namespace NLGUI
{
class CCtrlButton;
}
// ***************************************************************************
class CCtrlButton;
class CCtrlScroll;
class CHandlerListSheetTradeSelect;
class CHandlerListSheetTradeRightClick;

View file

@ -26,10 +26,10 @@
namespace NLGUI
{
class CEventDescriptorLocalised;
class CCtrlButton;
}
class CInterfaceList;
class CCtrlButton;
class CCtrlScroll;
class CViewText;
class COptionsContainerInsertion;

View file

@ -37,9 +37,13 @@ extern "C"
#include "WWWInit.h"
}
namespace NLGUI
{
class CCtrlButton;
}
class CGroupList;
class CCtrlScroll;
class CCtrlButton;
class CDBGroupComboBox;
class CGroupParagraph;