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 _CallingAH : 1;
bool _Cancelable : 1; // true if the slider may be cancelled when pressed on the mouse right button bool _Cancelable : 1; // true if the slider may be cancelled when pressed on the mouse right button
bool _Frozen : 1; bool _Frozen : 1;
bool _Scale : 1;
// For Target Scroller only: the target offset step in pixel. // For Target Scroller only: the target offset step in pixel.
sint32 _TargetStepX; sint32 _TargetStepX;

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

Loading…
Cancel
Save