Add wxControl::GetSizeFromText() helper function
Add the helper function that combines GetSizeFromTextSize() and GetTextExtent() as they are often used together.
This commit is contained in:
committed by
Vadim Zeitlin
parent
af4076865d
commit
9ef1b1529d
@@ -140,6 +140,27 @@ public:
|
||||
*/
|
||||
wxSize GetSizeFromTextSize(const wxSize& tsize) const;
|
||||
|
||||
/**
|
||||
Determine the minimum size needed by the control to display the given text.
|
||||
|
||||
The helper function that uses combination of GetSizeFromTextSize() and
|
||||
GetTextExtent() which used together pretty often:
|
||||
@code
|
||||
wxSize GetSizeFromText(const wxString& text) const
|
||||
{
|
||||
return GetSizeFromTextSize(GetTextExtent(text).GetWidth());
|
||||
}
|
||||
@endcode
|
||||
|
||||
@param text The given text.
|
||||
@return The size that the control should have to leave the area of the
|
||||
specified text. May return wxDefaultSize if this method is not
|
||||
implemented for this particular control under the current platform.
|
||||
|
||||
@since 3.1.3
|
||||
*/
|
||||
wxSize GetSizeFromText(const wxString& text) const;
|
||||
|
||||
/**
|
||||
Sets the control's label.
|
||||
|
||||
|
Reference in New Issue
Block a user