X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cf2810aa394d47a43489d6138edf0497c389a22c..979a73474cf18beb6fa4104dd89dade05ce98c4b:/src/msw/mdi.cpp diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index e4f5961386..c854040c05 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -44,10 +44,6 @@ #include "wx/stockitem.h" #include "wx/msw/private.h" -#if wxUSE_STATUSBAR && wxUSE_NATIVE_STATUSBAR - #include "wx/msw/statbr95.h" -#endif - #include // --------------------------------------------------------------------------- @@ -348,10 +344,8 @@ void wxMDIParentFrame::OnIconized(wxIconizeEvent& event) { event.Skip(); - if ( !event.Iconized() ) - { + if ( !event.IsIconized() ) UpdateClientSize(); - } } // Returns the active MDI child window @@ -522,8 +516,11 @@ bool wxMDIParentFrame::HandleActivate(int state, bool minimized, WXHWND activate return processed; } -bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd) +bool wxMDIParentFrame::HandleCommand(WXWORD id_, WXWORD cmd, WXHWND hwnd) { + // sign extend to int from short before comparing with the other int ids + int id = (signed short)id_; + // In case it's e.g. a toolbar. if ( hwnd ) { @@ -756,7 +753,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, wxWindowCreationHook hook(this); m_hWnd = (WXHWND)::SendMessage(GetWinHwnd(parent->GetClientWindow()), - WM_MDICREATE, 0, (LONG)(LPSTR)&mcs); + WM_MDICREATE, 0, (LPARAM)&mcs); if ( !m_hWnd ) { @@ -806,7 +803,7 @@ bool wxMDIChildFrame::Show(bool show) // we need to refresh the MDI frame window menu to include (or exclude if // we've been hidden) this frame - wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); + wxMDIParentFrame *parent = GetMDIParent(); MDISetMenu(parent->GetClientWindow(), NULL, NULL); return true; @@ -845,7 +842,7 @@ void wxMDIChildFrame::DoSetClientSize(int width, int height) // If there's an MDI parent, must subtract the parent's top left corner // since MoveWindow moves relative to the parent - wxMDIParentFrame *mdiParent = (wxMDIParentFrame *)GetParent(); + wxMDIParentFrame *mdiParent = GetMDIParent(); ::ScreenToClient((HWND) mdiParent->GetClientWindow()->GetHWND(), &point); MoveWindow(hWnd, point.x, point.y, actual_width, actual_height, (BOOL)true); @@ -881,7 +878,7 @@ void wxMDIChildFrame::DoGetPosition(int *x, int *y) const // Since we now have the absolute screen coords, // if there's a parent we must subtract its top left corner - wxMDIParentFrame *mdiParent = (wxMDIParentFrame *)GetParent(); + wxMDIParentFrame *mdiParent = GetMDIParent(); ::ScreenToClient((HWND) mdiParent->GetClientWindow()->GetHWND(), &point); if (x) @@ -892,7 +889,7 @@ void wxMDIChildFrame::DoGetPosition(int *x, int *y) const void wxMDIChildFrame::InternalSetMenuBar() { - wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); + wxMDIParentFrame *parent = GetMDIParent(); InsertWindowMenu(parent->GetClientWindow(), m_hMenu, GetMDIWindowMenu(parent)); @@ -918,7 +915,7 @@ WXHICON wxMDIChildFrame::GetDefaultIcon() const void wxMDIChildFrame::Maximize(bool maximize) { - wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); + wxMDIParentFrame *parent = GetMDIParent(); if ( parent && parent->GetClientWindow() ) { ::SendMessage(GetWinHwnd(parent->GetClientWindow()), @@ -929,7 +926,7 @@ void wxMDIChildFrame::Maximize(bool maximize) void wxMDIChildFrame::Restore() { - wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); + wxMDIParentFrame *parent = GetMDIParent(); if ( parent && parent->GetClientWindow() ) { ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIRESTORE, @@ -939,7 +936,7 @@ void wxMDIChildFrame::Restore() void wxMDIChildFrame::Activate() { - wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); + wxMDIParentFrame *parent = GetMDIParent(); if ( parent && parent->GetClientWindow() ) { ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIACTIVATE, @@ -1013,8 +1010,11 @@ WXLRESULT wxMDIChildFrame::MSWWindowProc(WXUINT message, return rc; } -bool wxMDIChildFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd) +bool wxMDIChildFrame::HandleCommand(WXWORD id_, WXWORD cmd, WXHWND hwnd) { + // sign extend to int from short before comparing with the other int ids + int id = (signed short)id_; + // In case it's e.g. a toolbar. if ( hwnd ) { @@ -1048,7 +1048,7 @@ bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate), WXHWND hwndAct, WXHWND hwndDeact) { - wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); + wxMDIParentFrame *parent = GetMDIParent(); HMENU menuToSet = 0; @@ -1172,7 +1172,7 @@ bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg) { // we must pass the parent frame to ::TranslateAccelerator(), otherwise it // doesn't do its job correctly for MDI child menus - return MSWDoTranslateMessage((wxMDIChildFrame *)GetParent(), msg); + return MSWDoTranslateMessage(GetMDIParent(), msg); } // --------------------------------------------------------------------------- @@ -1181,7 +1181,7 @@ bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg) void wxMDIChildFrame::MSWDestroyWindow() { - wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); + wxMDIParentFrame *parent = GetMDIParent(); // Must make sure this handle is invalidated (set to NULL) since all sorts // of things could happen after the child client is destroyed, but before @@ -1208,7 +1208,7 @@ void wxMDIChildFrame::MSWDestroyWindow() bool wxMDIChildFrame::ResetWindowStyle(void *vrect) { RECT *rect = (RECT *)vrect; - wxMDIParentFrame* pFrameWnd = (wxMDIParentFrame *)GetParent(); + wxMDIParentFrame* pFrameWnd = GetMDIParent(); wxMDIChildFrame* pChild = pFrameWnd->GetActiveChild(); if (!pChild || (pChild == this)) @@ -1430,14 +1430,15 @@ static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu) { success = true; ::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING, - (UINT)subMenu, _("&Window").wx_str()); + (UINT_PTR)subMenu, _("&Window").wx_str()); break; } } if ( !success ) { - ::AppendMenu(hmenu, MF_POPUP, (UINT)subMenu, _("&Window").wx_str()); + ::AppendMenu(hmenu, MF_POPUP, + (UINT_PTR)subMenu, _("&Window").wx_str()); } }