modified wxFrame/Univ to send wxSizeEvent when adding/removing bars (because client area changes)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11863 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-10-06 22:45:51 +00:00
parent 0aa236cddc
commit 6821401b1b
2 changed files with 41 additions and 1 deletions

View File

@@ -46,15 +46,28 @@ public:
virtual wxPoint GetClientAreaOrigin() const; virtual wxPoint GetClientAreaOrigin() const;
virtual bool Enable(bool enable = TRUE); 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: protected:
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
// sends wxSizeEvent to itself (used after attaching xxxBar)
void SendSizeEvent();
virtual void DoGetClientSize(int *width, int *height) const; virtual void DoGetClientSize(int *width, int *height) const;
virtual void DoSetClientSize(int width, int height); virtual void DoSetClientSize(int width, int height);
#if wxUSE_MENUS #if wxUSE_MENUS
// override to update menu bar position when the frame size changes // override to update menu bar position when the frame size changes
virtual void PositionMenuBar(); virtual void PositionMenuBar();
virtual void DetachMenuBar();
virtual void AttachMenuBar(wxMenuBar *menubar);
#endif // wxUSE_MENUS #endif // wxUSE_MENUS
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR

View File

@@ -76,6 +76,13 @@ void wxFrame::OnSize(wxSizeEvent& event)
event.Skip(); event.Skip();
} }
void wxFrame::SendSizeEvent()
{
wxSizeEvent event(GetSize(), GetId());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
}
#if wxUSE_MENUS #if wxUSE_MENUS
void wxFrame::PositionMenuBar() 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 #endif // wxUSE_MENUS
#if wxUSE_STATUSBAR #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 #endif // wxUSE_STATUSBAR
wxPoint wxFrame::GetClientAreaOrigin() const wxPoint wxFrame::GetClientAreaOrigin() const