X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/39d2f9a7c866338762ca974209219f40d4420af6..cb73e6001f891ae46b12a1e4ca39b93649cb6099:/src/msw/menu.cpp diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index 6bce598d97..6f1343b30c 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -17,7 +17,7 @@ // headers // --------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "menu.h" #endif @@ -115,6 +115,23 @@ UINT GetMenuState(HMENU hMenu, UINT id, UINT flags) IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler) IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow) +/* + TODO PROPERTIES + wxMenu + label + help + + separator + break + label + accel + radio + checkable + help + bitmap + wxMenuItem +*/ + // --------------------------------------------------------------------------- // wxMenu construction, adding and removing menu items // --------------------------------------------------------------------------- @@ -615,7 +632,10 @@ wxMenuBar::~wxMenuBar() { // In Windows CE, the menubar is always associated // with a toolbar, which destroys the menu implicitly. -#ifndef __WXWINCE__ +#ifdef __WXWINCE__ + if (GetToolBar()) + GetToolBar()->SetMenuBar(NULL); +#else // we should free Windows resources only if Windows doesn't do it for us // which happens if we're attached to a frame if (m_hMenu && !IsAttached()) @@ -646,6 +666,10 @@ void wxMenuBar::Refresh() WXHMENU wxMenuBar::Create() { + // Note: this totally doesn't work on Smartphone, + // since you have to use resources. + // We'll have to find another way to add a menu + // by changing/adding menu items to an existing menu. #ifdef __WXWINCE__ if ( m_hMenu != 0 ) return m_hMenu; @@ -670,9 +694,11 @@ WXHMENU wxMenuBar::Create() tbButton.dwData = (DWORD)hPopupMenu; wxString label = wxStripMenuCodes(GetLabelTop(i)); tbButton.iString = (int) label.c_str(); + + int position = i; tbButton.idCommand = NewControlId(); - if (!::SendMessage(hCommandBar, TB_INSERTBUTTON, i, (LPARAM)&tbButton)) + if (!::SendMessage(hCommandBar, TB_INSERTBUTTON, position, (LPARAM)&tbButton)) { wxLogLastError(wxT("TB_INSERTBUTTON")); }