statusbar handling

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11689 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-09-24 18:01:13 +00:00
parent 37d0bdff98
commit d08e6e59ed
2 changed files with 39 additions and 0 deletions

View File

@@ -57,6 +57,11 @@ protected:
virtual void PositionMenuBar();
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
// override to update statusbar position when the frame size changes
virtual void PositionStatusBar();
#endif // wxUSE_MENUS
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxFrame)
};

View File

@@ -31,6 +31,7 @@
#include "wx/menu.h"
#ifndef WX_PRECOMP
#include "wx/frame.h"
#include "wx/statusbr.h"
#endif // WX_PRECOMP
// ============================================================================
@@ -68,6 +69,9 @@ void wxFrame::OnSize(wxSizeEvent& event)
#if wxUSE_MENUS
PositionMenuBar();
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
PositionStatusBar();
#endif // wxUSE_STATUSBAR
event.Skip();
}
@@ -88,6 +92,20 @@ void wxFrame::PositionMenuBar()
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
void wxFrame::PositionStatusBar()
{
if ( m_frameStatusBar )
{
wxCoord heightBar = m_frameStatusBar->GetSize().y;
m_frameStatusBar->SetSize(0, GetClientSize().y,
GetClientSize().x, heightBar);
}
}
#endif // wxUSE_STATUSBAR
wxPoint wxFrame::GetClientAreaOrigin() const
{
wxPoint pt = wxFrameBase::GetClientAreaOrigin();
@@ -105,12 +123,20 @@ wxPoint wxFrame::GetClientAreaOrigin() const
void wxFrame::DoGetClientSize(int *width, int *height) const
{
wxFrameBase::DoGetClientSize(width, height);
#if wxUSE_MENUS
if ( m_frameMenuBar && height )
{
(*height) -= m_frameMenuBar->GetSize().y;
}
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
if ( m_frameStatusBar && height )
{
(*height) -= m_frameStatusBar->GetSize().y;
}
#endif // wxUSE_STATUSBAR
}
void wxFrame::DoSetClientSize(int width, int height)
@@ -121,6 +147,14 @@ void wxFrame::DoSetClientSize(int width, int height)
height += m_frameMenuBar->GetSize().y;
}
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
if ( m_frameStatusBar )
{
height += m_frameStatusBar->GetSize().y;
}
#endif // wxUSE_STATUSBAR
wxFrameBase::DoSetClientSize(width, height);
}