X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/271fa2508353d08b32d9204a94b0016edb9bf84e..3cdcf4d444770f7f0ff2ca64807d8699764ed8b3:/src/msw/menuitem.cpp?ds=sidebyside diff --git a/src/msw/menuitem.cpp b/src/msw/menuitem.cpp index e4a9d1beb9..085dc6e47f 100644 --- a/src/msw/menuitem.cpp +++ b/src/msw/menuitem.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: menuitem.cpp +// Name: src/msw/menuitem.cpp // Purpose: wxMenuItem implementation // Author: Vadim Zeitlin // Modified by: @@ -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" @@ -30,6 +26,8 @@ #if wxUSE_MENUS +#include "wx/menu.h" + #ifndef WX_PRECOMP #include "wx/font.h" #include "wx/bitmap.h" @@ -37,12 +35,11 @@ #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" @@ -162,13 +159,13 @@ 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); // setting default colors switched ownerdraw on: switch it off again ResetOwnerDrawn(); @@ -177,7 +174,7 @@ void wxMenuItem::Init() if ( GetId() != wxID_SEPARATOR ) SetMarginWidth(GetMarginWidth()); - // tell the owner drawing code to to show the accel string as well + // tell the owner drawing code to show the accel string as well SetAccelString(m_text.AfterFirst(_T('\t'))); #endif // wxUSE_OWNER_DRAWN } @@ -403,7 +400,7 @@ void wxMenuItem::SetText(const wxString& text) info.cbSize = sizeof(info); info.fMask = MIIM_TYPE; info.fType = MFT_STRING; - info.cch = text.Length(); + info.cch = text.length(); info.dwTypeData = (LPTSTR) data ; if ( !::SetMenuItemInfo(hMenu, id, FALSE, & info) ) {