All (GUI):
+- wxWindow::SetAutoLayout() now works for all windows, not just panels.
- Support loading wxListCtrl items and image lists from XRC (Kinaou Hervé).
- wxGrid: add possibility to prevent resizing of individual rows/columns.
- wxHTML: add support for table borders width (Laurent Humbertclaude).
// implementation from now on
// --------------------------
- // calls layout for layout constraints and sizers
- void OnSize(wxSizeEvent& event);
-
virtual void InitDialog();
#ifdef __WXUNIVERSAL__
int DoGetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y);
#endif // wxUSE_MENUS
+ // layout the window children when its size changes unless this was
+ // explicitly disabled with SetAutoLayout(false)
+ void InternalOnSize(wxSizeEvent& event);
+
+
// the stack of windows which have captured the mouse
static struct WXDLLIMPEXP_FWD_CORE wxWindowNext *ms_winCaptureNext;
/**
Sets the window to have the given layout sizer.
+
The window will then own the object, and will take care of its deletion.
If an existing layout constraints object is already owned by the
- window, it will be deleted if the deleteOld parameter is @true.
+ window, it will be deleted if the @a deleteOld parameter is @true.
Note that this function will also call SetAutoLayout() implicitly with @true
- parameter if the @a sizer is non-@NULL and @false otherwise.
+ parameter if the @a sizer is non-@NULL and @false otherwise so that the
+ sizer will be effectively used to layout the window children whenever
+ it is resized.
@param sizer
The sizer to set. Pass @NULL to disassociate and conditionally delete
the window's sizer. See below.
@param deleteOld
If @true (the default), this will delete any pre-existing sizer.
- Pass @false if you wish to handle deleting the old sizer yourself.
+ Pass @false if you wish to handle deleting the old sizer yourself
+ but remember to do it yourself in this case to avoid memory leaks.
@remarks SetSizer enables and disables Layout automatically.
*/
/**
Determines whether the Layout() function will be called automatically
- when the window is resized. Please note that this only happens for the
- windows usually used to contain children, namely wxPanel and wxTopLevelWindow
- (and the classes deriving from them).
+ when the window is resized.
This method is called implicitly by SetSizer() but if you use SetConstraints()
you should call it manually or otherwise the window layout won't be correctly
updated when its size changes.
@param autoLayout
- Set this to @true if you wish the Layout() function to be
- called automatically when the window is resized
- (really happens only if you derive from wxPanel or wxTopLevelWindow).
+ Set this to @true if you wish the Layout() function to be called
+ automatically when the window is resized.
- @see SetConstraints()
+ @see SetSizer(), SetConstraints()
*/
void SetAutoLayout(bool autoLayout);
EVT_HELP(wxID_ANY, wxWindowBase::OnHelp)
#endif // wxUSE_HELP
+ EVT_SIZE(wxWindowBase::InternalOnSize)
END_EVENT_TABLE()
// ============================================================================
return true;
}
+void wxWindowBase::InternalOnSize(wxSizeEvent& event)
+{
+ if ( GetAutoLayout() )
+ Layout();
+
+ event.Skip();
+}
+
#if wxUSE_CONSTRAINTS
// first phase of the constraints evaluation: set our own constraints
#endif
BEGIN_EVENT_TABLE(wxPanel, wxWindow)
- EVT_SIZE(wxPanel::OnSize)
-
WX_EVENT_TABLE_CONTROL_CONTAINER(wxPanel)
END_EVENT_TABLE()
GetEventHandler()->ProcessEvent(event);
}
-// ----------------------------------------------------------------------------
-// event handlers
-// ----------------------------------------------------------------------------
-
-void wxPanel::OnSize(wxSizeEvent& event)
-{
- if (GetAutoLayout())
- Layout();
-#if wxUSE_CONSTRAINTS
-#if defined(__WXPM__) && 0
- else
- {
- // Need to properly move child windows under OS/2
-
- PSWP pWinSwp = GetSwp();
-
- if (pWinSwp->cx == 0 && pWinSwp->cy == 0 && pWinSwp->fl == 0)
- {
- // Uninitialized
-
- ::WinQueryWindowPos(GetHWND(), pWinSwp);
- }
- else
- {
- SWP vSwp;
- int nYDiff;
-
- ::WinQueryWindowPos(GetHWND(), &vSwp);
- nYDiff = pWinSwp->cy - vSwp.cy;
- MoveChildren(nYDiff);
- pWinSwp->cx = vSwp.cx;
- pWinSwp->cy = vSwp.cy;
- }
- }
-#endif
-#endif // wxUSE_CONSTRAINTS
-
- event.Skip();
-}
void wxHtmlWindow::OnSize(wxSizeEvent& event)
{
+ event.Skip();
+
wxDELETE(m_backBuffer);
- wxScrolledWindow::OnSize(event);
CreateLayout();
// Recompute selection if necessary: