2010-05-06 00:08:41 +00:00
|
|
|
// 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/>.
|
|
|
|
|
2012-06-15 22:23:20 +00:00
|
|
|
#include "nel/gui/ctrl_button.h"
|
2012-04-16 00:50:18 +00:00
|
|
|
#include "nel/misc/xml_auto_ptr.h"
|
2012-06-15 22:23:20 +00:00
|
|
|
#include "nel/gui/widget_manager.h"
|
|
|
|
#include "nel/gui/interface_group.h"
|
2010-05-06 00:08:41 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
using namespace std;
|
|
|
|
using namespace NLMISC;
|
|
|
|
using namespace NL3D;
|
|
|
|
|
|
|
|
NLMISC_REGISTER_OBJECT(CViewBase, CCtrlButton, std::string, "button");
|
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
namespace NLGUI
|
2010-05-06 00:08:41 +00:00
|
|
|
{
|
2012-08-03 19:34:48 +00:00
|
|
|
|
|
|
|
void CCtrlButton::setAlignFromString( const std::string &s )
|
|
|
|
{
|
|
|
|
_Align = 0;
|
|
|
|
|
|
|
|
std::string::size_type i;
|
|
|
|
for( i = 0; i < s.size(); i++ )
|
|
|
|
{
|
|
|
|
char c = toLower( s[ i ] );
|
|
|
|
|
|
|
|
switch( c ){
|
|
|
|
case 'l':
|
|
|
|
_Align &= ~1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'r':
|
|
|
|
_Align |= 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'b':
|
|
|
|
_Align &= ~2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 't':
|
|
|
|
_Align |= 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-28 18:07:20 +00:00
|
|
|
std::string CCtrlButton::getProperty( const std::string &name ) const
|
|
|
|
{
|
2012-07-28 18:37:36 +00:00
|
|
|
if( name == "tx_normal" )
|
|
|
|
{
|
|
|
|
return CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdNormal );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if( name == "tx_pushed" )
|
|
|
|
{
|
|
|
|
return CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdPushed );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if( name == "tx_over" )
|
|
|
|
{
|
|
|
|
return CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdOver );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if( name == "scale" )
|
|
|
|
{
|
|
|
|
return toString( _Scale );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if( name == "align" )
|
|
|
|
{
|
|
|
|
std::string align;
|
|
|
|
if( ( _Align & 1 ) != 0 )
|
|
|
|
align = "r";
|
|
|
|
else
|
|
|
|
align = "l";
|
|
|
|
if( ( _Align & 2 ) != 0 )
|
|
|
|
align += "t";
|
|
|
|
else
|
|
|
|
align += "b";
|
|
|
|
return align;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return CCtrlBaseButton::getProperty( name );
|
2012-07-28 18:07:20 +00:00
|
|
|
}
|
2012-06-15 22:49:40 +00:00
|
|
|
|
2012-08-03 19:34:48 +00:00
|
|
|
void CCtrlButton::setProperty( const std::string &name, const std::string &value )
|
|
|
|
{
|
|
|
|
if( name == "tx_normal" )
|
|
|
|
{
|
|
|
|
std::string s = CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdNormal );
|
|
|
|
if( !_TextureIdNormal.setTexture( value.c_str() ) )
|
|
|
|
{
|
|
|
|
_TextureIdNormal.setTexture( s.c_str() );
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if( name == "tx_pushed" )
|
|
|
|
{
|
|
|
|
std::string s = CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdPushed );
|
|
|
|
if( !_TextureIdPushed.setTexture( value.c_str() ) )
|
|
|
|
{
|
|
|
|
_TextureIdPushed.setTexture( s.c_str() );
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if( name == "tx_over" )
|
|
|
|
{
|
|
|
|
std::string s = CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdOver );
|
|
|
|
if( !_TextureIdOver.setTexture( value.c_str() ) )
|
|
|
|
{
|
|
|
|
_TextureIdOver.setTexture( s.c_str() );
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if( name == "scale" )
|
|
|
|
{
|
|
|
|
bool b;
|
|
|
|
if( fromString( value, b ) )
|
|
|
|
_Scale = b;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if( name == "align" )
|
|
|
|
{
|
|
|
|
setAlignFromString( value );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
CCtrlBaseButton::setProperty( name, value );
|
|
|
|
}
|
|
|
|
|
2012-08-10 17:23:39 +00:00
|
|
|
|
|
|
|
xmlNodePtr CCtrlButton::serialize( xmlNodePtr parentNode, const char *type ) const
|
|
|
|
{
|
|
|
|
xmlNodePtr node = CCtrlBaseButton::serialize( parentNode, type );
|
|
|
|
if( node == NULL )
|
|
|
|
return NULL;
|
|
|
|
|
2012-08-11 17:39:48 +00:00
|
|
|
if( xmlGetProp( node, BAD_CAST "type" ) == NULL )
|
|
|
|
xmlSetProp( node, BAD_CAST "type", BAD_CAST "button" );
|
|
|
|
|
2012-08-10 17:23:39 +00:00
|
|
|
xmlNewProp( node, BAD_CAST "tx_normal",
|
|
|
|
BAD_CAST CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdNormal ).c_str() );
|
|
|
|
|
|
|
|
xmlNewProp( node, BAD_CAST "tx_pushed",
|
|
|
|
BAD_CAST CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdPushed ).c_str() );
|
|
|
|
|
|
|
|
xmlNewProp( node, BAD_CAST "tx_over",
|
|
|
|
BAD_CAST CViewRenderer::getInstance()->getTextureNameFromId( _TextureIdOver ).c_str() );
|
|
|
|
|
|
|
|
xmlNewProp( node, BAD_CAST "scale", BAD_CAST toString( _Scale ).c_str() );
|
|
|
|
|
|
|
|
std::string align;
|
|
|
|
if( ( _Align & 1 ) != 0 )
|
|
|
|
align = "r";
|
|
|
|
else
|
|
|
|
align = "l";
|
|
|
|
if( ( _Align & 2 ) != 0 )
|
|
|
|
align += "t";
|
|
|
|
else
|
|
|
|
align += "b";
|
|
|
|
|
|
|
|
xmlNewProp( node, BAD_CAST "align", BAD_CAST align.c_str() );
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
bool CCtrlButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup)
|
2010-05-06 00:08:41 +00:00
|
|
|
{
|
2012-06-15 22:49:40 +00:00
|
|
|
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.
|
|
|
|
//if it is undefined, set it to zero
|
|
|
|
if (! CCtrlBaseButton::parse(cur,parentGroup) )
|
|
|
|
{
|
|
|
|
string tmp = "cannot parse view:"+getId()+", parent:"+parentGroup->getId();
|
|
|
|
nlinfo(tmp.c_str());
|
|
|
|
return false;
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// *** Read Textures
|
|
|
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_normal" );
|
|
|
|
if (prop)
|
|
|
|
{
|
|
|
|
string TxName = (const char *) prop;
|
|
|
|
TxName = strlwr(TxName);
|
|
|
|
_TextureIdNormal.setTexture(TxName.c_str());
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_pushed" );
|
|
|
|
if (prop)
|
|
|
|
{
|
|
|
|
string TxName = (const char *) prop;
|
|
|
|
TxName = strlwr(TxName);
|
|
|
|
_TextureIdPushed.setTexture(TxName.c_str());
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_over" );
|
|
|
|
if (prop)
|
|
|
|
{
|
|
|
|
string TxName = (const char *) prop;
|
|
|
|
TxName = strlwr(TxName);
|
|
|
|
_TextureIdOver.setTexture(TxName.c_str());
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// *** Misc.
|
|
|
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"scale" );
|
|
|
|
_Scale = false;
|
|
|
|
if (prop)
|
|
|
|
_Scale = convertBool(prop);
|
2010-05-06 00:08:41 +00:00
|
|
|
|
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"align");
|
|
|
|
if (prop)
|
2010-05-06 00:08:41 +00:00
|
|
|
{
|
2012-08-03 19:34:48 +00:00
|
|
|
setAlignFromString( std::string( prop ) );
|
2010-05-06 00:08:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
return true;
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void CCtrlButton::draw ()
|
|
|
|
{
|
|
|
|
sint32 nTxId = -1;
|
|
|
|
CRGBA color;
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
|
|
|
CRGBA globalColor= CWidgetManager::getInstance()->getGlobalColorForContent();
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// *** Detect Over
|
|
|
|
bool lastOver = false;
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
updateOver(lastOver);
|
2010-05-06 00:08:41 +00:00
|
|
|
|
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
sint32 x = _XReal;
|
|
|
|
sint32 y = _YReal;
|
|
|
|
sint32 txw, txh;
|
|
|
|
// the pointer is over the button
|
|
|
|
if (_Scale)
|
|
|
|
{
|
|
|
|
x = _XReal;
|
|
|
|
y = _YReal;
|
|
|
|
txw = _WReal;
|
|
|
|
txh = _HReal;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x = _XReal;
|
|
|
|
y = _YReal;
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
switch(_Type)
|
2010-05-06 00:08:41 +00:00
|
|
|
{
|
2012-06-15 22:49:40 +00:00
|
|
|
case ToggleButton:
|
2010-05-06 00:08:41 +00:00
|
|
|
{
|
2012-07-22 00:46:33 +00:00
|
|
|
if (_Pushed && !editorMode )
|
2012-06-15 22:49:40 +00:00
|
|
|
{
|
|
|
|
nTxId = _TextureIdPushed;
|
|
|
|
color = getCurrentColorPushed(globalColor);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nTxId = _TextureIdNormal;
|
|
|
|
color = getCurrentColorNormal(globalColor);
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
}
|
2012-06-15 22:49:40 +00:00
|
|
|
break;
|
|
|
|
case RadioButton:
|
2010-05-06 00:08:41 +00:00
|
|
|
{
|
2012-06-15 22:49:40 +00:00
|
|
|
// CViewPointer &rIP = *CInterfaceManager::getInstance()->getPointer();
|
|
|
|
// Init the radio button
|
|
|
|
initRBRef();
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
if (*_RBRef == this)
|
|
|
|
{
|
|
|
|
// if it is equal to the ref value, then the button must appear pushed
|
|
|
|
nTxId = _TextureIdPushed;
|
|
|
|
color = getCurrentColorPushed(globalColor);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-22 00:46:33 +00:00
|
|
|
if ( (_Over) && (CWidgetManager::getInstance()->getCapturePointerLeft() == this) && !editorMode )
|
2012-06-15 22:49:40 +00:00
|
|
|
{
|
|
|
|
nTxId = _TextureIdPushed;
|
|
|
|
color = getCurrentColorPushed(globalColor);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nTxId = _TextureIdNormal;
|
|
|
|
color = getCurrentColorNormal(globalColor);
|
|
|
|
_Pushed = false;
|
|
|
|
}
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
}
|
2012-06-15 22:49:40 +00:00
|
|
|
break;
|
|
|
|
case PushButton:
|
2010-05-06 00:08:41 +00:00
|
|
|
{
|
2012-07-22 00:46:33 +00:00
|
|
|
if ( _Over && (CWidgetManager::getInstance()->getCapturePointerLeft() == this) && !editorMode )
|
2010-05-06 00:08:41 +00:00
|
|
|
{
|
|
|
|
nTxId = _TextureIdPushed;
|
|
|
|
color = getCurrentColorPushed(globalColor);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nTxId = _TextureIdNormal;
|
|
|
|
color = getCurrentColorNormal(globalColor);
|
|
|
|
_Pushed = false;
|
|
|
|
}
|
|
|
|
}
|
2012-06-15 22:49:40 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2010-05-06 00:08:41 +00:00
|
|
|
}
|
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
color.A = (uint8)(((sint32)color.A*((sint32)globalColor.A+1))>>8);
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// Fromzen ?
|
|
|
|
if (getFrozen() && getFrozenHalfTone())
|
|
|
|
color.A >>= 2;
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
if (!_Scale)
|
|
|
|
{
|
|
|
|
CViewRenderer::getInstance()->getTextureSizeFromId (nTxId, txw, txh);
|
|
|
|
if (_Align&1)
|
|
|
|
x = x + _WReal - txw;
|
|
|
|
if (_Align&2)
|
|
|
|
y = y + _HReal - txh;
|
|
|
|
}
|
|
|
|
rVR.drawRotFlipBitmap ( _RenderLayer, x, y, txw, txh,
|
|
|
|
0, false,
|
|
|
|
nTxId,
|
|
|
|
color );
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
if ((_OverWhenPushed == false) && (_Pushed == true || (CWidgetManager::getInstance()->getCapturePointerLeft() == this)))
|
|
|
|
return;
|
2010-05-06 00:08:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-22 21:32:35 +00:00
|
|
|
if ( ( _Over && !editorMode ) || editorSelected )
|
2012-06-15 22:49:40 +00:00
|
|
|
{
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-07-22 21:32:35 +00:00
|
|
|
if( !editorMode && (lastOver == false) && (_AHOnOver != NULL))
|
2012-06-15 22:49:40 +00:00
|
|
|
CAHManager::getInstance()->runActionHandler (_AHOnOver, this, _AHOverParams);
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// the pointer is over the button
|
|
|
|
color= getCurrentColorOver(globalColor);
|
|
|
|
color.A = (uint8)(((sint32)color.A*((sint32)globalColor.A+1))>>8);
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// Frozen ?
|
|
|
|
if (getFrozen())
|
|
|
|
color.A >>= 2;
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// draw the over. force upper layer to avoid problem with DXTC/tga
|
|
|
|
rVR.drawRotFlipBitmap ( _RenderLayer+1, x, y, txw, txh,
|
|
|
|
0, false,
|
|
|
|
_TextureIdOver,
|
|
|
|
color );
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void CCtrlButton::updateCoords()
|
2010-05-06 00:08:41 +00:00
|
|
|
{
|
2012-06-15 22:49:40 +00:00
|
|
|
if (!_Scale)
|
|
|
|
{
|
|
|
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
|
|
|
sint32 txw, txh;
|
|
|
|
rVR.getTextureSizeFromId (_TextureIdNormal, txw, txh);
|
|
|
|
_W = txw;
|
|
|
|
_H = txh;
|
|
|
|
}
|
|
|
|
CViewBase::updateCoords();
|
2010-05-06 00:08:41 +00:00
|
|
|
}
|
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void CCtrlButton::setTexture(const std::string&name)
|
|
|
|
{
|
|
|
|
// CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
|
|
// CViewRenderer &rVR = *CViewRenderer::getInstance();
|
|
|
|
_TextureIdNormal.setTexture(name.c_str());
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void CCtrlButton::setTexturePushed(const std::string&name)
|
|
|
|
{
|
|
|
|
// CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
|
|
// CViewRenderer &rVR = *CViewRenderer::getInstance();
|
|
|
|
_TextureIdPushed.setTexture(name.c_str());
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
void CCtrlButton::setTextureOver(const std::string&name)
|
|
|
|
{
|
|
|
|
// CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
|
|
// CViewRenderer &rVR = *CViewRenderer::getInstance();
|
|
|
|
_TextureIdOver.setTexture(name.c_str());
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
std::string CCtrlButton::getTexture() const
|
|
|
|
{
|
|
|
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
|
|
|
return rVR.getTextureNameFromId(_TextureIdNormal);
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
std::string CCtrlButton::getTexturePushed() const
|
|
|
|
{
|
|
|
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
|
|
|
return rVR.getTextureNameFromId(_TextureIdPushed);
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
std::string CCtrlButton::getTextureOver() const
|
|
|
|
{
|
|
|
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
|
|
|
return rVR.getTextureNameFromId(_TextureIdOver);
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
sint32 CCtrlButton::getMaxUsedW() const
|
|
|
|
{
|
|
|
|
sint32 txw, txh;
|
|
|
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
|
|
|
rVR.getTextureSizeFromId (_TextureIdNormal, txw, txh);
|
|
|
|
return txw;
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
sint32 CCtrlButton::getMinUsedW() const
|
|
|
|
{
|
|
|
|
return getMaxUsedW();
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
void CCtrlButton::fitTexture()
|
|
|
|
{
|
|
|
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
|
|
|
sint32 w, h;
|
|
|
|
rVR.getTextureSizeFromId(_TextureIdNormal, w, h);
|
|
|
|
setW(w);
|
|
|
|
setH(h);
|
|
|
|
}
|
2010-05-06 00:08:41 +00:00
|
|
|
|
2012-06-15 22:49:40 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
bool CCtrlButton::getMouseOverShape(string &texName, uint8 &rot, CRGBA &col)
|
2011-05-26 12:33:04 +00:00
|
|
|
{
|
2012-06-15 22:49:40 +00:00
|
|
|
if (_AHOnLeftClickString == "browse")
|
2012-02-29 15:32:53 +00:00
|
|
|
{
|
2012-06-15 22:49:40 +00:00
|
|
|
if (!_AHOnLeftClickStringParams.empty())
|
|
|
|
{
|
|
|
|
texName = "@curs_pick.tga@"+_AHOnLeftClickStringParams;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
texName = "curs_pick.tga";
|
|
|
|
}
|
|
|
|
rot= 0;
|
|
|
|
col = CRGBA::White;
|
|
|
|
return true;
|
2012-02-29 15:32:53 +00:00
|
|
|
}
|
2012-06-15 22:49:40 +00:00
|
|
|
|
|
|
|
return false;
|
2011-05-26 12:33:04 +00:00
|
|
|
}
|
2012-06-15 22:49:40 +00:00
|
|
|
|
2011-05-26 12:33:04 +00:00
|
|
|
}
|
2012-06-15 22:49:40 +00:00
|
|
|
|