diff --git a/code/nel/include/nel/gui/ctrl_text_button.h b/code/nel/include/nel/gui/ctrl_text_button.h index 69898639d..367e527f8 100644 --- a/code/nel/include/nel/gui/ctrl_text_button.h +++ b/code/nel/include/nel/gui/ctrl_text_button.h @@ -111,6 +111,9 @@ namespace NLGUI sint32 getWMin() const { return _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) sint32 getWMax() const; @@ -122,6 +125,7 @@ namespace NLGUI REFLECT_SINT32("text_x", getTextX, setTextX) REFLECT_SINT32("wmargin", getWMargin, setWMargin) REFLECT_SINT32("wmin", getWMin, setWMin) + REFLECT_SINT32("hmin", getHMin, setHMin) REFLECT_LUA_METHOD("getViewText", luaGetViewText) REFLECT_EXPORT_END @@ -151,8 +155,8 @@ namespace NLGUI sint32 _BmpLeftW, _BmpMiddleW, _BmpRightW, _BmpH; // Value to add to TextW to get button W. sint32 _WMargin; - // Min W Value - sint32 _WMin; + // Min W, H Value + sint32 _WMin, _HMin; sint32 _TextY; sint32 _TextX; THotSpot _TextPosRef; diff --git a/code/nel/src/gui/ctrl_text_button.cpp b/code/nel/src/gui/ctrl_text_button.cpp index 6e1fab26e..9775b1b07 100644 --- a/code/nel/src/gui/ctrl_text_button.cpp +++ b/code/nel/src/gui/ctrl_text_button.cpp @@ -46,6 +46,7 @@ namespace NLGUI _BmpLeftW= _BmpMiddleW= _BmpRightW= _BmpH= 0; _WMargin= 0; _WMin= 0; + _HMin= 0; _TextX= 0; _TextY= 0; _Setuped= false; @@ -124,6 +125,11 @@ namespace NLGUI return toString( _WMin ); } else + if( name == "hmin" ) + { + return toString( _HMin ); + } + else if( name == "hardtext" ) { if( _ViewText != NULL ) @@ -296,6 +302,14 @@ namespace NLGUI return; } else + if( name == "hmin" ) + { + sint32 i; + if( fromString( value, i ) ) + _HMin = i; + return; + } + else if( name == "hardtext" ) { if( _ViewText != NULL ) @@ -469,6 +483,7 @@ namespace NLGUI 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 "hmin", BAD_CAST toString( _HMin ).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_x", BAD_CAST toString( _TextX ).c_str() ); @@ -519,7 +534,6 @@ namespace NLGUI return false; } - // *** Read Textures. prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_normal" ); if (prop) @@ -604,6 +618,15 @@ namespace NLGUI // _WMin is at least the size of All W Bitmaps _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= 0; prop = (char*) xmlGetProp( cur, (xmlChar*)"text_y" ); @@ -900,6 +923,7 @@ namespace NLGUI if (!(_SizeRef & 2)) { _H= max(_BmpH, _ViewText->getH()); + _H= max(_H, _HMin); } CViewBase::updateCoords();