diff --git a/docs/doxygen/overviews/windowsizing.h b/docs/doxygen/overviews/windowsizing.h index 9b75a36246..940e51b8da 100644 --- a/docs/doxygen/overviews/windowsizing.h +++ b/docs/doxygen/overviews/windowsizing.h @@ -116,4 +116,9 @@ some simple explanations of things. the constraints algorithm is run. The @c Layout() method is what is called by the default @c EVT_SIZE handler for container windows. +@li wxTopLevelWindow::Layout(): this overridden version does the same thing as + the base wxWindow::Layout() except, for convenience, it will also resize + the only child of the top-level window to cover its entire client area if + there is no sizer associated with the window. Note that this only happens + if there is exactly one child. */ diff --git a/interface/wx/toplevel.h b/interface/wx/toplevel.h index 361a5794c9..a24ea8dbc7 100644 --- a/interface/wx/toplevel.h +++ b/interface/wx/toplevel.h @@ -283,8 +283,20 @@ public: bool IsUsingNativeDecorations() const; /** - See wxWindow::SetAutoLayout(): when auto layout is on, this function gets - called automatically when the window is resized. + Lays out the children using the window sizer or resizes the only child + of the window to cover its entire area. + + This class overrides the base class Layout() method to check if this + window contains exactly one child -- which is commonly the case, with + wxPanel being often created as the only child of wxTopLevelWindow -- + and, if this is the case, resizes this child window to cover the entire + client area. + + Note that if you associate a sizer with this window, the sizer takes + precedence and the only-child-resizing is only used as fallback. + + @returns @false if nothing was done because the window doesn't have + neither a sizer nor a single child, @true otherwise. */ virtual bool Layout(); diff --git a/interface/wx/window.h b/interface/wx/window.h index 8628ce5d26..cd873f0d65 100644 --- a/interface/wx/window.h +++ b/interface/wx/window.h @@ -3445,15 +3445,20 @@ public: void SetConstraints(wxLayoutConstraints* constraints); /** - Invokes the constraint-based layout algorithm or the sizer-based algorithm - for this window. + Lays out the children of this window using the associated sizer. - This function does not get called automatically when the window is resized - because lots of windows deriving from wxWindow does not need this functionality. - If you want to have Layout() called automatically, you should derive - from wxPanel (see wxPanel::Layout). + If a sizer hadn't been associated with this window (see SetSizer()), + this function doesn't do anything, unless this is a top level window + (see wxTopLevelWindow::Layout()). + + Note that this method is called automatically when the window size + changes if it has the associated sizer (or if SetAutoLayout() with + @true argument had been explicitly called), ensuring that it is always + laid out correctly. @see @ref overview_windowsizing + + @returns Always returns @true, the return value is not useful. */ virtual bool Layout();