Changed: Allow to override scroll bar texture width/height

--HG--
branch : develop
feature/pipeline-tools
Nimetu 6 years ago
parent d97f5b1a8b
commit 1f1bd9fb8f

@ -175,6 +175,7 @@ namespace NLGUI
bool _CallingAH : 1;
bool _Cancelable : 1; // true if the slider may be cancelled when pressed on the mouse right button
bool _Frozen : 1;
bool _Scale : 1;
// For Target Scroller only: the target offset step in pixel.
sint32 _TargetStepX;

@ -68,6 +68,7 @@ namespace NLGUI
_StepValue = 0;
_TileM = false;
_Frozen = false;
_Scale = false;
}
// ------------------------------------------------------------------------------------------------
@ -108,6 +109,11 @@ namespace NLGUI
return getTextureTopOrRight();
}
else
if( name == "scale" )
{
return toString( _Scale );
}
else
if( name == "vertical" )
{
return toString( _Vertical );
@ -244,6 +250,14 @@ namespace NLGUI
return;
}
else
if( name =="scale" )
{
bool b;
if (fromString( value, b ) )
_Scale = b;
return;
}
else
if( name == "vertical" )
{
bool b;
@ -408,6 +422,7 @@ namespace NLGUI
xmlSetProp( node, BAD_CAST "tx_bottomleft", BAD_CAST getTextureBottomOrLeft().c_str() );
xmlSetProp( node, BAD_CAST "tx_middle", BAD_CAST getTextureMiddle().c_str() );
xmlSetProp( node, BAD_CAST "tx_topright", BAD_CAST getTextureTopOrRight().c_str() );
xmlSetProp( node, BAD_CAST "scale", BAD_CAST toString( _Scale ).c_str() );
xmlSetProp( node, BAD_CAST "vertical", BAD_CAST toString( _Vertical ).c_str() );
std::string align;
@ -480,6 +495,10 @@ namespace NLGUI
if(prop) setTextureTopOrRight(string((const char*)prop));
else setTextureTopOrRight ("w_scroll_l0_t.tga");
// Override texture size (w for vertical, h for horizontal)
prop = (char*) xmlGetProp( node, (xmlChar*)"scale" );
if (prop) _Scale = convertBool((const char*)prop);
// Read properties
prop = (char*) xmlGetProp( node, (xmlChar*)"vertical" );
if (prop) _Vertical = convertBool((const char*)prop);
@ -606,13 +625,13 @@ namespace NLGUI
if (_Vertical)
{
_W = w;
if (!_Scale) _W = w;
_H = _Target->getMaxHReal();
}
else
{
_W = _Target->getMaxWReal();
_H = h;
if (!_Scale) _H = h;
}
CCtrlBase::updateCoords ();

Loading…
Cancel
Save