X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f03e9ae7a7590ab779ec833a66f7a46be4c5b4b1..6945b5878c8d46a56f1a59f558837a0943492f3c:/src/msw/menuitem.cpp diff --git a/src/msw/menuitem.cpp b/src/msw/menuitem.cpp index 0c44163a9a..6c0d6cf358 100644 --- a/src/msw/menuitem.cpp +++ b/src/msw/menuitem.cpp @@ -17,10 +17,6 @@ // headers // --------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "menuitem.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -162,18 +158,22 @@ void wxMenuItem::Init() m_isRadioGroupStart = false; #if wxUSE_OWNER_DRAWN - // set default menu colors - #define SYS_COLOR(c) (wxSystemSettings::GetColour(wxSYS_COLOUR_##c)) - - SetTextColour(SYS_COLOR(MENUTEXT)); - SetBackgroundColour(SYS_COLOR(MENU)); - #undef SYS_COLOR + // when the color is not valid, wxOwnerDraw takes the default ones. + // If we set the colors here and they are changed by the user during + // the execution, then the colors are not updated until the application + // is restarted and our menus look bad + SetTextColour(wxNullColour); + SetBackgroundColour(wxNullColour); - // we don't want normal items be owner-drawn + // setting default colors switched ownerdraw on: switch it off again ResetOwnerDrawn(); - // tell the owner drawing code to to show the accel string as well + // switch ownerdraw back on if using a non default margin + if ( GetId() != wxID_SEPARATOR ) + SetMarginWidth(GetMarginWidth()); + + // tell the owner drawing code to show the accel string as well SetAccelString(m_text.AfterFirst(_T('\t'))); #endif // wxUSE_OWNER_DRAWN } @@ -330,7 +330,7 @@ void wxMenuItem::Check(bool check) GetRealId(), MF_BYCOMMAND | flags) == (DWORD)-1 ) { - wxASSERT_MSG( _T("CheckMenuItem() failed, item not in the menu?") ); + wxFAIL_MSG( _T("CheckMenuItem() failed, item not in the menu?") ); } }