]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/frame.cpp
docs for wxTimer change
[wxWidgets.git] / src / msw / frame.cpp
index 0472a949b6944a2867fecffcb541ce84694b1cf4..a213f318a35614c981c48e76259572e15b3ae729 100644 (file)
 
 #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
@@ -356,14 +351,27 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number,
 #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;
@@ -371,12 +379,22 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number,
 
 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);
@@ -561,6 +579,15 @@ bool wxFrame::MSWCreate(int id, wxWindow *parent, const wxChar *wclass, wxWindow
 // 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() )
@@ -581,60 +608,9 @@ void wxFrame::OnActivate(wxActivateEvent& event)
            )
         {
             child->SetFocus();
-            return;
-        }
-    }
-}
-
-// ----------------------------------------------------------------------------
-// wxFrame size management: we exclude the areas taken by menu/status/toolbars
-// from the client area, so the client area is what's really available for the
-// frame contents
-// ----------------------------------------------------------------------------
-
-// Checks if there is a toolbar, and returns the first free client position
-wxPoint wxFrame::GetClientAreaOrigin() const
-{
-    wxPoint pt(0, 0);
-    if (GetToolBar())
-    {
-        int w, h;
-        GetToolBar()->GetSize(& w, & h);
-
-        if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
-        {
-            pt.x += w;
-        }
-        else
-        {
-            pt.y += h;
+            break;
         }
     }
-    return pt;
-}
-
-void wxFrame::DoScreenToClient(int *x, int *y) const
-{
-    wxWindow::DoScreenToClient(x, y);
-
-    // We may be faking the client origin.
-    // So a window that's really at (0, 30) may appear
-    // (to wxWin apps) to be at (0, 0).
-    wxPoint pt(GetClientAreaOrigin());
-    *x -= pt.x;
-    *y -= pt.y;
-}
-
-void wxFrame::DoClientToScreen(int *x, int *y) const
-{
-    // We may be faking the client origin.
-    // So a window that's really at (0, 30) may appear
-    // (to wxWin apps) to be at (0, 0).
-    wxPoint pt1(GetClientAreaOrigin());
-    *x += pt1.x;
-    *y += pt1.y;
-
-    wxWindow::DoClientToScreen(x, y);
 }
 
 // ----------------------------------------------------------------------------
@@ -816,17 +792,6 @@ bool wxFrame::HandleSize(int x, int y, WXUINT id)
 
     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();