Changed: Add hmin attribute to text button

--HG--
branch : develop
feature/pipeline-tools
Nimetu 6 years ago
parent b6d3ff8323
commit 69f73ba28b

@ -111,6 +111,9 @@ namespace NLGUI
sint32 getWMin() const { return _WMin; } sint32 getWMin() const { return _WMin; }
void setWMin( sint32 wmin ) { _WMin = wmin; } void setWMin( sint32 wmin ) { _WMin = wmin; }
sint32 getHMin() const { return _HMin; }
void setHMin( sint32 hmin ) { _HMin = hmin; }
// Compute Size according to bitmap and Text (Ensure as big as possible button) // Compute Size according to bitmap and Text (Ensure as big as possible button)
sint32 getWMax() const; sint32 getWMax() const;
@ -122,6 +125,7 @@ namespace NLGUI
REFLECT_SINT32("text_x", getTextX, setTextX) REFLECT_SINT32("text_x", getTextX, setTextX)
REFLECT_SINT32("wmargin", getWMargin, setWMargin) REFLECT_SINT32("wmargin", getWMargin, setWMargin)
REFLECT_SINT32("wmin", getWMin, setWMin) REFLECT_SINT32("wmin", getWMin, setWMin)
REFLECT_SINT32("hmin", getHMin, setHMin)
REFLECT_LUA_METHOD("getViewText", luaGetViewText) REFLECT_LUA_METHOD("getViewText", luaGetViewText)
REFLECT_EXPORT_END REFLECT_EXPORT_END
@ -151,8 +155,8 @@ namespace NLGUI
sint32 _BmpLeftW, _BmpMiddleW, _BmpRightW, _BmpH; sint32 _BmpLeftW, _BmpMiddleW, _BmpRightW, _BmpH;
// Value to add to TextW to get button W. // Value to add to TextW to get button W.
sint32 _WMargin; sint32 _WMargin;
// Min W Value // Min W, H Value
sint32 _WMin; sint32 _WMin, _HMin;
sint32 _TextY; sint32 _TextY;
sint32 _TextX; sint32 _TextX;
THotSpot _TextPosRef; THotSpot _TextPosRef;

@ -46,6 +46,7 @@ namespace NLGUI
_BmpLeftW= _BmpMiddleW= _BmpRightW= _BmpH= 0; _BmpLeftW= _BmpMiddleW= _BmpRightW= _BmpH= 0;
_WMargin= 0; _WMargin= 0;
_WMin= 0; _WMin= 0;
_HMin= 0;
_TextX= 0; _TextX= 0;
_TextY= 0; _TextY= 0;
_Setuped= false; _Setuped= false;
@ -124,6 +125,11 @@ namespace NLGUI
return toString( _WMin ); return toString( _WMin );
} }
else else
if( name == "hmin" )
{
return toString( _HMin );
}
else
if( name == "hardtext" ) if( name == "hardtext" )
{ {
if( _ViewText != NULL ) if( _ViewText != NULL )
@ -296,6 +302,14 @@ namespace NLGUI
return; return;
} }
else else
if( name == "hmin" )
{
sint32 i;
if( fromString( value, i ) )
_HMin = i;
return;
}
else
if( name == "hardtext" ) if( name == "hardtext" )
{ {
if( _ViewText != NULL ) if( _ViewText != NULL )
@ -469,6 +483,7 @@ namespace NLGUI
xmlNewProp( node, BAD_CAST "wmargin", BAD_CAST toString( _WMargin ).c_str() ); xmlNewProp( node, BAD_CAST "wmargin", BAD_CAST toString( _WMargin ).c_str() );
xmlNewProp( node, BAD_CAST "wmin", BAD_CAST toString( _WMin ).c_str() ); xmlNewProp( node, BAD_CAST "wmin", BAD_CAST toString( _WMin ).c_str() );
xmlNewProp( node, BAD_CAST "hmin", BAD_CAST toString( _HMin ).c_str() );
xmlNewProp( node, BAD_CAST "hardtext", BAD_CAST _ViewText->getText().toString().c_str() ); xmlNewProp( node, BAD_CAST "hardtext", BAD_CAST _ViewText->getText().toString().c_str() );
xmlNewProp( node, BAD_CAST "text_y", BAD_CAST toString( _TextY ).c_str() ); xmlNewProp( node, BAD_CAST "text_y", BAD_CAST toString( _TextY ).c_str() );
xmlNewProp( node, BAD_CAST "text_x", BAD_CAST toString( _TextX ).c_str() ); xmlNewProp( node, BAD_CAST "text_x", BAD_CAST toString( _TextX ).c_str() );
@ -519,7 +534,6 @@ namespace NLGUI
return false; return false;
} }
// *** Read Textures. // *** Read Textures.
prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_normal" ); prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_normal" );
if (prop) if (prop)
@ -604,6 +618,15 @@ namespace NLGUI
// _WMin is at least the size of All W Bitmaps // _WMin is at least the size of All W Bitmaps
_WMin= max(_WMin, _BmpLeftW + _BmpMiddleW + _BmpRightW); _WMin= max(_WMin, _BmpLeftW + _BmpMiddleW + _BmpRightW);
// hmin
_HMin= 0;
prop = (char*) xmlGetProp( cur, (xmlChar*)"hmin" );
if (prop)
{
fromString((const char *) prop, _HMin);
}
_HMin= max(_HMin, _BmpH);
// TextY // TextY
_TextY= 0; _TextY= 0;
prop = (char*) xmlGetProp( cur, (xmlChar*)"text_y" ); prop = (char*) xmlGetProp( cur, (xmlChar*)"text_y" );
@ -900,6 +923,7 @@ namespace NLGUI
if (!(_SizeRef & 2)) if (!(_SizeRef & 2))
{ {
_H= max(_BmpH, _ViewText->getH()); _H= max(_BmpH, _ViewText->getH());
_H= max(_H, _HMin);
} }
CViewBase::updateCoords(); CViewBase::updateCoords();

Loading…
Cancel
Save