From 0fe536e3f6784c350fd8bf3793d8300499bf4ff4 Mon Sep 17 00:00:00 2001 From: David Webster Date: Fri, 18 Feb 2000 23:35:39 +0000 Subject: [PATCH] no message git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6147 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/os2/menu.h | 8 ++- include/wx/os2/window.h | 1 + src/os2/frame.cpp | 120 +++++++++++++++++++++++++--------------- 3 files changed, 82 insertions(+), 47 deletions(-) diff --git a/include/wx/os2/menu.h b/include/wx/os2/menu.h index 6719c9e563..1dd6a5cef8 100644 --- a/include/wx/os2/menu.h +++ b/include/wx/os2/menu.h @@ -165,7 +165,8 @@ public: #endif // wxUSE_ACCEL // get the menu handle - WXHMENU GetHMenu() const { return m_hMenu; } + WXHMENU GetHMenu() const { return m_hMenu; } + unsigned long GetMenubarId() const { return m_ulMenubarId; } // if the menubar is modified, the display is not updated automatically, // call this function to update it (m_menuBarFrame should be !NULL) @@ -183,8 +184,9 @@ protected: wxArrayString m_titles; - wxFrame *m_menuBarFrame; - WXHMENU m_hMenu; + wxFrame* m_menuBarFrame; + WXHMENU m_hMenu; + unsigned long m_ulMenubarId; #if wxUSE_ACCEL // the accelerator table for all accelerators in all our menus diff --git a/include/wx/os2/window.h b/include/wx/os2/window.h index 3688662527..735da9fa70 100644 --- a/include/wx/os2/window.h +++ b/include/wx/os2/window.h @@ -494,6 +494,7 @@ protected: #endif // wxUSE_MOUSEEVENT_HACK WXHMENU m_hMenu; // Menu, if any + unsigned long m_ulMenubarId; // it's Id, if any // the return value of WM_GETDLGCODE handler long m_lDlgCode; diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index 5a91d2c6d1..6041cc2b5a 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -438,51 +438,74 @@ bool wxFrame::IsMaximized() const return (vSwp.fl & SWP_MAXIMIZE); } // end of wxFrame::IsMaximized -void wxFrame::SetIcon(const wxIcon& icon) +void wxFrame::SetIcon( + const wxIcon& rIcon +) { - wxFrameBase::SetIcon(icon); + wxFrameBase::SetIcon(rIcon); -// TODO: -/* - if ( m_icon.Ok() ) + if (m_icon.Ok()) { - SendMessage(GetHwnd(), WM_SETICON, - (WPARAM)TRUE, (LPARAM)(HICON) m_icon.GetHICON()); + WinSendMessage( GetHwnd() + ,WM_SETICON + ,(HICON) m_icon.GetHICON() + ,NULL + ) } -*/ -} +} // end of wxFrame::SetIcon #if wxUSE_STATUSBAR -wxStatusBar *wxFrame::OnCreateStatusBar(int number, - long style, - wxWindowID id, - const wxString& name) +wxStatusBar* wxFrame::OnCreateStatusBar( + int nNumber +, long lStyle +, wxWindowID vId +, const wxString& rName +) { - wxStatusBar *statusBar = NULL; + wxStatusBar* pStatusBar = NULL; - statusBar = wxFrameBase::OnCreateStatusBar(number, style, id, name); - - return statusBar; -} + pStatusBar = wxFrameBase::OnCreateStatusBar( nNumber + ,lStyle + ,vId + ,rName + ); + return pStatusBar; +} // end of wxFrame::OnCreateStatusBar void wxFrame::PositionStatusBar() { -// TODO: -/* - // native status bar positions itself - if ( m_frameStatusBar ) + // + // Native status bar positions itself + // + if (m_frameStatusBar) { - int w, h; - GetClientSize(&w, &h); - int sw, sh; - m_frameStatusBar->GetSize(&sw, &sh); + int nWidth + int nHeight; + int nStatbarWidth + int nStatbarHeight; + HWND hWndClient; + RECTL vRect; + + hWndClient = ::WinWindowFromId(GetHwnd(), FID_CLIENT); + ::WinQueryWindowRect(hWndClient, &vRect); + nWidth = vRect.xRight - vRect.xLeft; + nHeight = vRect.xTop - vRect.xBottom; + + m_frameStatusBar->GetSize( &nStatbarWidth + ,&nStatbarHeight + ); + // // Since we wish the status bar to be directly under the client area, // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS. - m_frameStatusBar->SetSize(0, h, w, sh); + // + m_frameStatusBar->SetSize( 0 + ,nHeight + ,nWidth + ,nStatbarHeight + ); } -*/ -} +} // end of wxFrame::PositionStatusBar #endif // wxUSE_STATUSBAR void wxFrame::DetachMenuBar() @@ -492,42 +515,51 @@ void wxFrame::DetachMenuBar() m_frameMenuBar->Detach(); m_frameMenuBar = NULL; } -} +} // end of wxFrame::DetachMenuBar -void wxFrame::SetMenuBar(wxMenuBar *menu_bar) +void wxFrame::SetMenuBar( + wxMenuBar* pMenuBbar +) { - if (!menu_bar) + if (!pMenuBar) { DetachMenuBar(); return; } - wxCHECK_RET( !menu_bar->GetFrame(), wxT("this menubar is already attached") ); + wxCHECK_RET(!pMenuBar->GetFrame(), wxT("this menubar is already attached")); if (m_frameMenuBar) delete m_frameMenuBar; - m_hMenu = menu_bar->Create(); + m_hMenu = pMenuBbar->Create(); + m_ulMenubarId = pMenubar->GetMenubarId(); + if (m_ulMenubarId != FID_MENU) + { + ::WinSetWIndowUShort( m_hMenu + ,QWS_ID + ,(unsigned short(m_ulMenubarId) + ); + } - if ( !m_hMenu ) + if (!m_hMenu) return; InternalSetMenuBar(); m_frameMenuBar = menu_bar; menu_bar->Attach(this); -} +} // end of wxFrame::SetMenuBar void wxFrame::InternalSetMenuBar() { -// TODO: -/* - if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) ) - { - wxLogLastError("SetMenu"); - } -*/ -} + + ::WinPostMsg( GetHwnd() + ,WM_UPDATEFRAME + ,FCF_MENU + ,NULL + ); +} // end of wxFrame::InternalSetMenuBar // Responds to colour changes, and passes event on to children. void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) -- 2.45.2