diff --git a/include/wx/univ/frame.h b/include/wx/univ/frame.h index bfb03bf9a4..4ad4f8e2f5 100644 --- a/include/wx/univ/frame.h +++ b/include/wx/univ/frame.h @@ -46,15 +46,28 @@ public: virtual wxPoint GetClientAreaOrigin() const; virtual bool Enable(bool enable = TRUE); +#if wxUSE_STATUSBAR + virtual wxStatusBar* CreateStatusBar(int number = 1, + long style = wxST_SIZEGRIP, + wxWindowID id = 0, + const wxString& name = wxStatusLineNameStr); +#endif // wxUSE_STATUSBAR + + protected: void OnSize(wxSizeEvent& event); - + + // sends wxSizeEvent to itself (used after attaching xxxBar) + void SendSizeEvent(); + virtual void DoGetClientSize(int *width, int *height) const; virtual void DoSetClientSize(int width, int height); #if wxUSE_MENUS // override to update menu bar position when the frame size changes virtual void PositionMenuBar(); + virtual void DetachMenuBar(); + virtual void AttachMenuBar(wxMenuBar *menubar); #endif // wxUSE_MENUS #if wxUSE_STATUSBAR diff --git a/src/univ/framuniv.cpp b/src/univ/framuniv.cpp index f6b00d2b10..19b2c610cb 100644 --- a/src/univ/framuniv.cpp +++ b/src/univ/framuniv.cpp @@ -76,6 +76,13 @@ void wxFrame::OnSize(wxSizeEvent& event) event.Skip(); } +void wxFrame::SendSizeEvent() +{ + wxSizeEvent event(GetSize(), GetId()); + event.SetEventObject(this); + GetEventHandler()->ProcessEvent(event); +} + #if wxUSE_MENUS void wxFrame::PositionMenuBar() @@ -90,6 +97,18 @@ void wxFrame::PositionMenuBar() } } +void wxFrame::DetachMenuBar() +{ + wxFrameBase::DetachMenuBar(); + SendSizeEvent(); +} + +void wxFrame::AttachMenuBar(wxMenuBar *menubar) +{ + wxFrameBase::AttachMenuBar(menubar); + SendSizeEvent(); +} + #endif // wxUSE_MENUS #if wxUSE_STATUSBAR @@ -104,6 +123,14 @@ void wxFrame::PositionStatusBar() } } +wxStatusBar* wxFrame::CreateStatusBar(int number, long style, + wxWindowID id, const wxString& name) +{ + wxStatusBar *bar = wxFrameBase::CreateStatusBar(number, style, id, name); + SendSizeEvent(); + return bar; +} + #endif // wxUSE_STATUSBAR wxPoint wxFrame::GetClientAreaOrigin() const