relayout frame contents when tool/statusbar is shown/hidden

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29580 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-10-01 01:49:45 +00:00
parent 5e62d4a5c7
commit a4f01f0592
2 changed files with 30 additions and 7 deletions

View File

@@ -112,8 +112,7 @@ public:
virtual wxStatusBar *GetStatusBar() const { return m_frameStatusBar; } virtual wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
// sets the main status bar // sets the main status bar
void SetStatusBar(wxStatusBar *statBar) virtual void SetStatusBar(wxStatusBar *statBar);
{ m_frameStatusBar = statBar; PositionStatusBar(); }
// forward these to status bar // forward these to status bar
virtual void SetStatusText(const wxString &text, int number = 0); virtual void SetStatusText(const wxString &text, int number = 0);
@@ -141,7 +140,7 @@ public:
// get/set the main toolbar // get/set the main toolbar
virtual wxToolBar *GetToolBar() const { return m_frameToolBar; } virtual wxToolBar *GetToolBar() const { return m_frameToolBar; }
virtual void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; } virtual void SetToolBar(wxToolBar *toolbar);
#endif // wxUSE_TOOLBAR #endif // wxUSE_TOOLBAR
// implementation only from now on // implementation only from now on

View File

@@ -309,9 +309,7 @@ wxStatusBar* wxFrameBase::CreateStatusBar(int number,
wxCHECK_MSG( !m_frameStatusBar, (wxStatusBar *)NULL, wxCHECK_MSG( !m_frameStatusBar, (wxStatusBar *)NULL,
wxT("recreating status bar in wxFrame") ); wxT("recreating status bar in wxFrame") );
m_frameStatusBar = OnCreateStatusBar( number, style, id, name ); SetStatusBar(OnCreateStatusBar(number, style, id, name));
if ( m_frameStatusBar )
PositionStatusBar();
return m_frameStatusBar; return m_frameStatusBar;
} }
@@ -386,6 +384,19 @@ bool wxFrameBase::ShowMenuHelp(wxStatusBar *WXUNUSED(statbar), int menuId)
#endif // wxUSE_MENUS/!wxUSE_MENUS #endif // wxUSE_MENUS/!wxUSE_MENUS
} }
void wxFrameBase::SetStatusBar(wxStatusBar *statBar)
{
bool hadBar = m_frameStatusBar != NULL;
m_frameStatusBar = statBar;
if ( (m_frameStatusBar != NULL) != hadBar )
{
PositionStatusBar();
DoLayout();
}
}
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
void wxFrameBase::DoGiveHelp(const wxString& text, bool show) void wxFrameBase::DoGiveHelp(const wxString& text, bool show)
@@ -460,7 +471,7 @@ wxToolBar* wxFrameBase::CreateToolBar(long style,
style = wxBORDER_NONE | wxTB_HORIZONTAL | wxTB_FLAT; style = wxBORDER_NONE | wxTB_HORIZONTAL | wxTB_FLAT;
} }
m_frameToolBar = OnCreateToolBar(style, id, name); SetToolBar(OnCreateToolBar(style, id, name));
return m_frameToolBar; return m_frameToolBar;
} }
@@ -474,6 +485,19 @@ wxToolBar* wxFrameBase::OnCreateToolBar(long style,
style, name); style, name);
} }
void wxFrameBase::SetToolBar(wxToolBar *toolbar)
{
bool hadBar = m_frameToolBar != NULL;
m_frameToolBar = toolbar;
if ( (m_frameToolBar != NULL) != hadBar )
{
PositionToolBar();
DoLayout();
}
}
#endif // wxUSE_TOOLBAR #endif // wxUSE_TOOLBAR
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------