]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/frame.cpp
Fix explicitly setting focus to generic wxSpinCtrl.
[wxWidgets.git] / src / os2 / frame.cpp
index f8c4e9d11aa7f7d911f930c2217749634e83779f..bfa1f560b803389257ba01e4680e9ced405f83f4 100644 (file)
     #include "wx/settings.h"
     #include "wx/dcclient.h"
     #include "wx/mdi.h"
     #include "wx/settings.h"
     #include "wx/dcclient.h"
     #include "wx/mdi.h"
+    #include "wx/toolbar.h"
+    #include "wx/statusbr.h"
+    #include "wx/menuitem.h"
 #endif // WX_PRECOMP
 
 #include "wx/os2/private.h"
 
 #endif // WX_PRECOMP
 
 #include "wx/os2/private.h"
 
-#if wxUSE_STATUSBAR
-    #include "wx/statusbr.h"
-    #include "wx/generic/statusbr.h"
-#endif // wxUSE_STATUSBAR
-
-#if wxUSE_TOOLBAR
-    #include "wx/toolbar.h"
-#endif // wxUSE_TOOLBAR
-
-#include "wx/menuitem.h"
-#include "wx/log.h"
-
 // ----------------------------------------------------------------------------
 // globals
 // ----------------------------------------------------------------------------
 
 // ----------------------------------------------------------------------------
 // globals
 // ----------------------------------------------------------------------------
 
-extern wxList WXDLLEXPORT wxPendingDelete;
-
 #if wxUSE_MENUS_NATIVE
 extern wxMenu *wxCurrentPopupMenu;
 #endif
 #if wxUSE_MENUS_NATIVE
 extern wxMenu *wxCurrentPopupMenu;
 #endif
@@ -138,7 +127,8 @@ bool wxFrame::Create( wxWindow*       pParent,
 
 wxFrame::~wxFrame()
 {
 
 wxFrame::~wxFrame()
 {
-    m_isBeingDeleted = true;
+    SendDestroyEvent();
+
     DeleteAllBars();
 } // end of wxFrame::~wxFrame
 
     DeleteAllBars();
 } // end of wxFrame::~wxFrame
 
@@ -291,7 +281,7 @@ void wxFrame::PositionStatusBar()
         {
             vError = ::WinGetLastError(vHabmain);
             sError = wxPMErrorToStr(vError);
         {
             vError = ::WinGetLastError(vHabmain);
             sError = wxPMErrorToStr(vError);
-            wxLogError(_T("Error setting parent for StatusBar. Error: %s\n"), sError.c_str());
+            wxLogError(wxT("Error setting parent for StatusBar. Error: %s\n"), sError.c_str());
             return;
         }
     }
             return;
         }
     }
@@ -415,14 +405,14 @@ void wxFrame::InternalSetMenuBar()
     {
         vError = ::WinGetLastError(vHabmain);
         sError = wxPMErrorToStr(vError);
     {
         vError = ::WinGetLastError(vHabmain);
         sError = wxPMErrorToStr(vError);
-        wxLogError(_T("Error setting parent for submenu. Error: %s\n"), sError.c_str());
+        wxLogError(wxT("Error setting parent for submenu. Error: %s\n"), sError.c_str());
     }
 
     if (!::WinSetOwner(m_hMenu, m_hFrame))
     {
         vError = ::WinGetLastError(vHabmain);
         sError = wxPMErrorToStr(vError);
     }
 
     if (!::WinSetOwner(m_hMenu, m_hFrame))
     {
         vError = ::WinGetLastError(vHabmain);
         sError = wxPMErrorToStr(vError);
-        wxLogError(_T("Error setting parent for submenu. Error: %s\n"), sError.c_str());
+        wxLogError(wxT("Error setting parent for submenu. Error: %s\n"), sError.c_str());
     }
     ::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
 } // end of wxFrame::InternalSetMenuBar
     }
     ::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
 } // end of wxFrame::InternalSetMenuBar
@@ -444,7 +434,7 @@ void wxFrame::OnSysColourChanged(
         wxSysColourChangedEvent     vEvent2;
 
         vEvent2.SetEventObject(m_frameStatusBar);
         wxSysColourChangedEvent     vEvent2;
 
         vEvent2.SetEventObject(m_frameStatusBar);
-        m_frameStatusBar->GetEventHandler()->ProcessEvent(vEvent2);
+        m_frameStatusBar->HandleWindowEvent(vEvent2);
     }
 #endif //wxUSE_STATUSBAR
 
     }
 #endif //wxUSE_STATUSBAR
 
@@ -510,7 +500,7 @@ bool wxFrame::ShowFullScreen( bool bShow, long lStyle )
         if ((lStyle & wxFULLSCREEN_NOSTATUSBAR) && pTheStatusBar)
         {
             m_nFsStatusBarFields = pTheStatusBar->GetFieldsCount();
         if ((lStyle & wxFULLSCREEN_NOSTATUSBAR) && pTheStatusBar)
         {
             m_nFsStatusBarFields = pTheStatusBar->GetFieldsCount();
-            SetStatusBar((wxStatusBar*) NULL);
+            SetStatusBar(NULL);
             delete pTheStatusBar;
         }
         else
             delete pTheStatusBar;
         }
         else
@@ -581,7 +571,7 @@ bool wxFrame::ShowFullScreen( bool bShow, long lStyle )
         wxSize sz( nWidth, nHeight );
         wxSizeEvent vEvent( sz, GetId() );
 
         wxSize sz( nWidth, nHeight );
         wxSizeEvent vEvent( sz, GetId() );
 
-        GetEventHandler()->ProcessEvent(vEvent);
+        HandleWindowEvent(vEvent);
         return true;
     }
     else
         return true;
     }
     else
@@ -706,7 +696,7 @@ void wxFrame::PositionToolBar()
                       ,&vTHeight
                      );
 
                       ,&vTHeight
                      );
 
-    if (pToolBar->GetWindowStyleFlag() & wxTB_HORIZONTAL)
+    if (pToolBar->GetWindowStyleFlag() & wxTB_TOP)
     {
         vWidth = (wxCoord)(vRect.xRight - vRect.xLeft);
         pToolBar->SetSize( vRect.xLeft - vFRect.xLeft
     {
         vWidth = (wxCoord)(vRect.xRight - vRect.xLeft);
         pToolBar->SetSize( vRect.xLeft - vFRect.xLeft
@@ -715,6 +705,38 @@ void wxFrame::PositionToolBar()
                           ,vTHeight
                          );
     }
                           ,vTHeight
                          );
     }
+    else if (pToolBar->GetWindowStyleFlag() & wxTB_BOTTOM)
+    {
+        wxCoord                     vSwidth = 0;
+        wxCoord                     vSheight = 0;
+
+        if (m_frameStatusBar)
+            m_frameStatusBar->GetSize( &vSwidth
+                                      ,&vSheight
+                                     );
+        vWidth = (wxCoord)(vRect.xRight - vRect.xLeft);
+        pToolBar->SetSize( vRect.xLeft - vFRect.xLeft
+                          ,vFRect.yTop - vRect.yBottom - vTHeight - vSheight
+                          ,vWidth
+                          ,vTHeight
+                         );
+    }
+    else if (pToolBar->GetWindowStyleFlag() & wxTB_LEFT)
+    {
+        wxCoord                     vSwidth = 0;
+        wxCoord                     vSheight = 0;
+
+        if (m_frameStatusBar)
+            m_frameStatusBar->GetSize( &vSwidth
+                                      ,&vSheight
+                                     );
+        vHeight = (wxCoord)(vRect.yTop - vRect.yBottom);
+        pToolBar->SetSize( vRect.xLeft - vRect.xLeft
+                          ,vPos.y
+                          ,vTWidth
+                          ,vHeight - vSheight
+                         );
+    }
     else
     {
         wxCoord                     vSwidth = 0;
     else
     {
         wxCoord                     vSwidth = 0;
@@ -725,7 +747,7 @@ void wxFrame::PositionToolBar()
                                       ,&vSheight
                                      );
         vHeight = (wxCoord)(vRect.yTop - vRect.yBottom);
                                       ,&vSheight
                                      );
         vHeight = (wxCoord)(vRect.yTop - vRect.yBottom);
-        pToolBar->SetSize( vRect.xLeft - vFRect.xLeft
+        pToolBar->SetSize( vRect.xRight - vFRect.xLeft - vTWidth
                           ,vPos.y
                           ,vTWidth
                           ,vHeight - vSheight
                           ,vPos.y
                           ,vTWidth
                           ,vHeight - vSheight
@@ -1030,11 +1052,11 @@ bool wxFrame::HandleMenuSelect( WXWORD nItem,
             wxMenuEvent                     vEvent(wxEVT_MENU_HIGHLIGHT, nItem);
 
             vEvent.SetEventObject(this);
             wxMenuEvent                     vEvent(wxEVT_MENU_HIGHLIGHT, nItem);
 
             vEvent.SetEventObject(this);
-            GetEventHandler()->ProcessEvent(vEvent); // return value would be ignored by PM
+            HandleWindowEvent(vEvent); // return value would be ignored by PM
         }
         else
         {
         }
         else
         {
-            DoGiveHelp(wxEmptyString, false);
+            DoGiveHelp(wxEmptyString, true);
             return false;
         }
     }
             return false;
         }
     }
@@ -1103,20 +1125,34 @@ MRESULT EXPENTRY wxFrameMainWndProc( HWND   hWnd,
                 {
                     if(pWnd->m_hWnd && pSWP[i].hwnd == pWnd->m_hWnd)
                     {
                 {
                     if(pWnd->m_hWnd && pSWP[i].hwnd == pWnd->m_hWnd)
                     {
-                        if (pWnd->m_frameToolBar && pWnd->m_frameToolBar->GetWindowStyleFlag() & wxTB_HORIZONTAL)
+                        if (pWnd->m_frameToolBar && pWnd->m_frameToolBar->GetWindowStyleFlag() & wxTB_TOP)
                         {
                             pSWP[i].x    = vRectl.xLeft;
                             pSWP[i].y    = vRectl.yBottom + nHeight;
                             pSWP[i].cx   = vRectl.xRight - vRectl.xLeft;
                             pSWP[i].cy   = vRectl.yTop - vRectl.yBottom - (nHeight + nHeight2);
                         }
                         {
                             pSWP[i].x    = vRectl.xLeft;
                             pSWP[i].y    = vRectl.yBottom + nHeight;
                             pSWP[i].cx   = vRectl.xRight - vRectl.xLeft;
                             pSWP[i].cy   = vRectl.yTop - vRectl.yBottom - (nHeight + nHeight2);
                         }
-                        else
+                        else if (pWnd->m_frameToolBar && pWnd->m_frameToolBar->GetWindowStyleFlag() & wxTB_BOTTOM)
+                        {
+                            pSWP[i].x    = vRectl.xLeft;
+                            pSWP[i].y    = vRectl.yBottom + nHeight + nHeight2;
+                            pSWP[i].cx   = vRectl.xRight - vRectl.xLeft;
+                            pSWP[i].cy   = vRectl.yTop - vRectl.yBottom - (nHeight + nHeight2);
+                         }
+                        else if (pWnd->m_frameToolBar && pWnd->m_frameToolBar->GetWindowStyleFlag() & wxTB_LEFT)
                         {
                             pSWP[i].x    = vRectl.xLeft + nWidth;
                             pSWP[i].y    = vRectl.yBottom + nHeight;
                             pSWP[i].cx   = vRectl.xRight - (vRectl.xLeft + nWidth);
                             pSWP[i].cy   = vRectl.yTop - vRectl.yBottom - nHeight;
                         }
                         {
                             pSWP[i].x    = vRectl.xLeft + nWidth;
                             pSWP[i].y    = vRectl.yBottom + nHeight;
                             pSWP[i].cx   = vRectl.xRight - (vRectl.xLeft + nWidth);
                             pSWP[i].cy   = vRectl.yTop - vRectl.yBottom - nHeight;
                         }
+                        else
+                        {
+                            pSWP[i].x    = vRectl.xLeft;
+                            pSWP[i].y    = vRectl.yBottom + nHeight;
+                            pSWP[i].cx   = vRectl.xRight - (vRectl.xLeft + nWidth);
+                            pSWP[i].cy   = vRectl.yTop - vRectl.yBottom - nHeight;
+                        }
                         pSWP[i].fl   = SWP_SIZE | SWP_MOVE | SWP_SHOW;
                         pSWP[i].hwndInsertBehind = HWND_TOP;
                     }
                         pSWP[i].fl   = SWP_SIZE | SWP_MOVE | SWP_SHOW;
                         pSWP[i].hwndInsertBehind = HWND_TOP;
                     }
@@ -1344,20 +1380,3 @@ wxWindow* wxFrame::GetClient()
     return wxFindWinFromHandle((WXHWND)::WinWindowFromID(m_hFrame, FID_CLIENT));
 }
 
     return wxFindWinFromHandle((WXHWND)::WinWindowFromID(m_hFrame, FID_CLIENT));
 }
 
-void wxFrame::SendSizeEvent()
-{
-    if (!m_bIconized)
-    {
-        RECTL                       vRect = wxGetWindowRect(GetHwnd());
-
-        ::WinPostMsg( GetHwnd()
-                     ,WM_SIZE
-                     ,MPFROM2SHORT( vRect.xRight - vRect.xLeft
-                                   ,vRect.xRight - vRect.xLeft
-                                  )
-                     ,MPFROM2SHORT( vRect.yTop - vRect.yBottom
-                                   ,vRect.yTop - vRect.yBottom
-                                  )
-                    );
-    }
-}