X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6670f56440ae9209b3e2e51e06acf3bc5aaf1905..c5cc7fbd27fb53c36beb0ade36153ae48d9e961e:/src/os2/menuitem.cpp?ds=sidebyside diff --git a/src/os2/menuitem.cpp b/src/os2/menuitem.cpp index ebec03ef25..bffbf97258 100644 --- a/src/os2/menuitem.cpp +++ b/src/os2/menuitem.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: menuitem.cpp +// Name: src/os2/menuitem.cpp // Purpose: wxMenuItem implementation // Author: David Webster // Modified by: @@ -13,27 +13,23 @@ // headers & declarations // ============================================================================ -#ifdef __GNUG__ - #pragma implementation "menuitem.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#include "wx/menuitem.h" +#include "wx/stockitem.h" + #ifndef WX_PRECOMP #include "wx/font.h" #include "wx/bitmap.h" #include "wx/settings.h" - #include "wx/font.h" #include "wx/window.h" #include "wx/accel.h" #include "wx/menu.h" #include "wx/string.h" + #include "wx/log.h" #endif -#include "wx/menuitem.h" -#include "wx/log.h" - #if wxUSE_ACCEL #include "wx/accel.h" #endif // wxUSE_ACCEL @@ -150,7 +146,7 @@ void wxMenuItem::Init() // // Tell the owner drawing code to to show the accel string as well // - SetAccelString(m_text.AfterFirst(_T('\t'))); + SetAccelString(m_text.AfterFirst(wxT('\t'))); #endif // wxUSE_OWNER_DRAWN } // end of wxMenuItem::Init @@ -184,7 +180,7 @@ bool wxMenuItem::IsChecked() const return (uFlag & MIA_CHECKED) == MIA_CHECKED ; } // end of wxMenuItem::IsChecked -wxString wxMenuItemBase::GetLabelFromText( +wxString wxMenuItemBase::GetLabelText( const wxString& rsText ) { @@ -203,7 +199,7 @@ wxString wxMenuItemBase::GetLabelFromText( sLabel += *zPc; } return sLabel; -} // end of wxMenuItemBase::GetLabelFromText +} // end of wxMenuItemBase::GetLabelText // // Radio group stuff @@ -219,7 +215,7 @@ void wxMenuItem::SetRadioGroupStart( ) { wxASSERT_MSG( !m_bIsRadioGroupStart - ,_T("should only be called for the next radio items") + ,wxT("should only be called for the next radio items") ); m_vRadioGroup.m_nStart = nStart; @@ -230,7 +226,7 @@ void wxMenuItem::SetRadioGroupEnd( ) { wxASSERT_MSG( m_bIsRadioGroupStart - ,_T("should only be called for the first radio item") + ,wxT("should only be called for the first radio item") ); m_vRadioGroup.m_nEnd = nEnd; } // end of wxMenuItem::SetRadioGroupEnd @@ -292,7 +288,7 @@ void wxMenuItem::Check( int nPos = rItems.IndexOf(this); wxCHECK_RET( nPos != wxNOT_FOUND - ,_T("menuitem not found in the menu items list?") + ,wxT("menuitem not found in the menu items list?") ); // @@ -367,7 +363,7 @@ void wxMenuItem::Check( wxMenuItemBase::Check(bCheck); } // end of wxMenuItem::Check -void wxMenuItem::SetText( const wxString& rText ) +void wxMenuItem::SetItemLabel( const wxString& rText ) { // // Don't do anything if label didn't change @@ -377,10 +373,18 @@ void wxMenuItem::SetText( const wxString& rText ) if (m_text == sText) return; - wxMenuItemBase::SetText(sText); - OWNER_DRAWN_ONLY(wxOwnerDrawn::SetName(sText)); + // wxMenuItemBase will do stock ID checks + wxMenuItemBase::SetItemLabel(sText); + + // m_text could now be different from 'text' if we are a stock menu item, + // so use only m_text below + + OWNER_DRAWN_ONLY(wxOwnerDrawn::SetName(m_text)); #if wxUSE_OWNER_DRAWN - SetAccelString(rText.AfterFirst(_T('\t'))); + if (rText.IsEmpty()) + SetAccelString(m_text.AfterFirst(wxT('\t'))); + else + SetAccelString(rText.AfterFirst(wxT('\t'))); #endif // wxUSE_OWNER_DRAWN HWND hMenu = GetHmenuOf(m_parentMenu); @@ -411,19 +415,19 @@ void wxMenuItem::SetText( const wxString& rText ) uFlagsOld |= MIS_SUBMENU; } - BYTE* pData; + char* pData; #if wxUSE_OWNER_DRAWN if (IsOwnerDrawn()) { uFlagsOld |= MIS_OWNERDRAW; - pData = (BYTE*)this; + pData = (char*)this; } else #endif //owner drawn { uFlagsOld |= MIS_TEXT; - pData = (BYTE*)sText.c_str(); + pData = (char*) m_text.wx_str(); } //