Applied patch from Neil Robinson to allow manipulation of unattached menubars
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37270 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1054,7 +1054,11 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
|
||||
|
||||
m_titles[pos] = title;
|
||||
|
||||
if ( IsAttached() )
|
||||
#if defined(WINCE_WITHOUT_COMMANDBAR)
|
||||
if (IsAttached())
|
||||
#else
|
||||
if (GetHmenu())
|
||||
#endif
|
||||
{
|
||||
int mswpos = MSWPositionForWxMenu(menuOld,pos);
|
||||
|
||||
@@ -1079,7 +1083,8 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
|
||||
}
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
Refresh();
|
||||
if (IsAttached())
|
||||
Refresh();
|
||||
}
|
||||
|
||||
return menuOld;
|
||||
@@ -1090,7 +1095,14 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
|
||||
// Find out which MSW item before which we'll be inserting before
|
||||
// wxMenuBarBase::Insert is called and GetMenu(pos) is the new menu.
|
||||
// If IsAttached() is false this won't be used anyway
|
||||
int mswpos = (!IsAttached() || (pos == m_menus.GetCount()))
|
||||
bool isAttached =
|
||||
#if defined(WINCE_WITHOUT_COMMANDBAR)
|
||||
IsAttached();
|
||||
#else
|
||||
(GetHmenu() != 0);
|
||||
#endif
|
||||
|
||||
int mswpos = (!isAttached || (pos == m_menus.GetCount()))
|
||||
? -1 // append the menu
|
||||
: MSWPositionForWxMenu(GetMenu(pos),pos);
|
||||
|
||||
@@ -1099,9 +1111,9 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
|
||||
|
||||
m_titles.Insert(title, pos);
|
||||
|
||||
if ( IsAttached() )
|
||||
if ( isAttached )
|
||||
{
|
||||
#if defined(WINCE_WITHOUT_COMMANDAR)
|
||||
#if defined(WINCE_WITHOUT_COMMANDBAR)
|
||||
if (!GetToolBar())
|
||||
return false;
|
||||
TBBUTTON tbButton;
|
||||
@@ -1137,7 +1149,8 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
|
||||
}
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
Refresh();
|
||||
if (IsAttached())
|
||||
Refresh();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1153,9 +1166,13 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
|
||||
|
||||
m_titles.Add(title);
|
||||
|
||||
if ( IsAttached() )
|
||||
#if defined(WINCE_WITHOUT_COMMANDBAR)
|
||||
if (IsAttached())
|
||||
#else
|
||||
if (GetHmenu())
|
||||
#endif
|
||||
{
|
||||
#if defined(WINCE_WITHOUT_COMMANDAR)
|
||||
#if defined(WINCE_WITHOUT_COMMANDBAR)
|
||||
if (!GetToolBar())
|
||||
return false;
|
||||
TBBUTTON tbButton;
|
||||
@@ -1192,7 +1209,8 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
|
||||
}
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
Refresh();
|
||||
if (IsAttached())
|
||||
Refresh();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1204,9 +1222,13 @@ wxMenu *wxMenuBar::Remove(size_t pos)
|
||||
if ( !menu )
|
||||
return NULL;
|
||||
|
||||
if ( IsAttached() )
|
||||
#if defined(WINCE_WITHOUT_COMMANDBAR)
|
||||
if (IsAttached())
|
||||
#else
|
||||
if (GetHmenu())
|
||||
#endif
|
||||
{
|
||||
#if defined(WINCE_WITHOUT_COMMANDAR)
|
||||
#if defined(WINCE_WITHOUT_COMMANDBAR)
|
||||
if (GetToolBar())
|
||||
{
|
||||
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_DELETEBUTTON, (UINT) pos, (LPARAM) 0))
|
||||
@@ -1229,10 +1251,10 @@ wxMenu *wxMenuBar::Remove(size_t pos)
|
||||
}
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
Refresh();
|
||||
if (IsAttached())
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
m_titles.RemoveAt(pos);
|
||||
|
||||
return menu;
|
||||
|
Reference in New Issue
Block a user