Improve SetSizerAndFit() and Fit() documentation

Mention the difference between these two functions in Fit() description,
it could be expected to behave as SetSizerAndFit() but doesn't.

See #18003.
This commit is contained in:
Vadim Zeitlin
2018-01-28 19:04:42 +01:00
parent 4fcc6e15b0
commit 26997607b6

View File

@@ -948,20 +948,13 @@ public:
virtual wxSize WindowToClientSize(const wxSize& size) const;
/**
Sizes the window so that it fits around its subwindows.
Sizes the window to fit its best size.
This function won't do anything if there are no subwindows and will only really
work correctly if sizers are used for the subwindows layout.
Using this function is equivalent to setting window size to the return
value of GetBestSize().
Also, if the window has exactly one subwindow it is better (faster and the result
is more precise as Fit() adds some margin to account for fuzziness of its calculations)
to call:
@code
window->SetClientSize(child->GetSize());
@endcode
instead of calling Fit().
Note that, unlike SetSizerAndFit(), this function only changes the
current window size and doesn't change its minimal size.
@see @ref overview_windowsizing
*/
@@ -3336,10 +3329,15 @@ public:
void SetSizer(wxSizer* sizer, bool deleteOld = true);
/**
This method calls SetSizer() and then wxSizer::SetSizeHints which sets the initial
window size to the size needed to accommodate all sizer elements and sets the
size hints which, if this window is a top level one, prevent the user from
resizing it to be less than this minimal size.
Associate the sizer with the window and set the window size and minimal
size accordingly.
This method calls SetSizer() and then wxSizer::SetSizeHints() which
sets the initial window size to the size needed to accommodate all
sizer elements and sets the minimal size to the same size, this
preventing the user from resizing this window to be less than this
minimal size (if it's a top-level window which can be directly resized
by the user).
*/
void SetSizerAndFit(wxSizer* sizer, bool deleteOld = true);