#if wxUSE_STATUSBAR
#include "wx/statusbr.h"
-
- #if wxUSE_NATIVE_STATUSBAR
- #include "wx/msw/statbr95.h"
- #endif
+ #include "wx/generic/statusbr.h"
#endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
extern wxWindowList wxModelessWindows;
extern wxList WXDLLEXPORT wxPendingDelete;
-extern wxChar wxFrameClassName[];
+extern const wxChar *wxFrameClassName;
extern wxMenu *wxCurrentPopupMenu;
// ----------------------------------------------------------------------------
// event tables
// ----------------------------------------------------------------------------
-#if !USE_SHARED_LIBRARY
BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
EVT_ACTIVATE(wxFrame::OnActivate)
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
-#endif
// ============================================================================
// implementation
#if wxUSE_NATIVE_STATUSBAR
if ( UsesNativeStatusBar() )
{
- statusBar = new wxStatusBar95(this, id, style);
+ statusBar = (wxStatusBar *)new wxStatusBar95(this, id, style);
statusBar->SetFieldsCount(number);
}
else
#endif
{
- statusBar = wxFrameBase::OnCreateStatusBar(number, style, id, name);
+ statusBar = (wxStatusBar *)new wxStatusBarGeneric(this, id, style, name);
+
+ // Set the height according to the font and the border size
+ wxClientDC dc(statusBar);
+ dc.SetFont(statusBar->GetFont());
+
+ wxCoord y;
+ dc.GetTextExtent(_T("X"), NULL, &y );
+
+ int height = (int)( (11*y)/10 + 2*statusBar->GetBorderY());
+
+ statusBar->SetSize(-1, -1, -1, height);
+
+ statusBar->SetFieldsCount(number);
}
return statusBar;
void wxFrame::PositionStatusBar()
{
- // native status bar positions itself
- if ( m_frameStatusBar
+ if ( !m_frameStatusBar )
+ return;
+
+ // native status bar positions itself, but we must forward the WM_SIZE
+ // messages to it
#if wxUSE_NATIVE_STATUSBAR
- && !m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95))
-#endif
- )
+ wxStatusBar95 *sb = wxDynamicCast(m_frameStatusBar, wxStatusBar95);
+ if ( sb )
+ {
+ wxSizeEvent event(GetSize(), sb->GetId());
+ event.SetEventObject(sb);
+
+ sb->GetEventHandler()->ProcessEvent(event);
+ }
+ else
+#endif // wxUSE_NATIVE_STATUSBAR
{
int w, h;
GetClientSize(&w, &h);
// subwindow found.
void wxFrame::OnActivate(wxActivateEvent& event)
{
+ if ( !event.GetActive() )
+ {
+ event.Skip();
+
+ return;
+ }
+
+ wxLogTrace(_T("focus"), _T("wxFrame %08x activated."), m_hWnd);
+
for ( wxWindowList::Node *node = GetChildren().GetFirst();
node;
node = node->GetNext() )
)
{
child->SetFocus();
- return;
+ break;
}
}
}
if ( !m_iconized )
{
- // forward WM_SIZE to status bar control
-#if wxUSE_NATIVE_STATUSBAR
- if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
- {
- wxSizeEvent event(wxSize(x, y), m_frameStatusBar->GetId());
- event.SetEventObject( m_frameStatusBar );
-
- ((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
- }
-#endif // wxUSE_NATIVE_STATUSBAR
-
PositionStatusBar();
PositionToolBar();