Prevent idMenuTitle from being accidentally used as invalid wx ID.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64257 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -82,7 +82,7 @@
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// the (popup) menu title has this special id
|
// the (popup) menu title has this special id
|
||||||
static const UINT idMenuTitle = (UINT)-3;
|
static const int idMenuTitle = wxID_NONE;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// private functions
|
// private functions
|
||||||
@@ -695,7 +695,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
|||||||
|
|
||||||
|
|
||||||
// if we just appended the title, highlight it
|
// if we just appended the title, highlight it
|
||||||
if ( id == idMenuTitle )
|
if ( id == (UINT_PTR)idMenuTitle )
|
||||||
{
|
{
|
||||||
// visually select the menu title
|
// visually select the menu title
|
||||||
SetDefaultMenuItem(GetHmenu(), id);
|
SetDefaultMenuItem(GetHmenu(), id);
|
||||||
@@ -901,7 +901,7 @@ void wxMenu::SetTitle(const wxString& label)
|
|||||||
if ( !label.empty() )
|
if ( !label.empty() )
|
||||||
{
|
{
|
||||||
if ( !::InsertMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING,
|
if ( !::InsertMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING,
|
||||||
idMenuTitle, m_title.wx_str()) ||
|
(UINT_PTR)idMenuTitle, m_title.wx_str()) ||
|
||||||
!::InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) )
|
!::InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) )
|
||||||
{
|
{
|
||||||
wxLogLastError(wxT("InsertMenu"));
|
wxLogLastError(wxT("InsertMenu"));
|
||||||
@@ -937,7 +937,7 @@ void wxMenu::SetTitle(const wxString& label)
|
|||||||
#else
|
#else
|
||||||
if ( !ModifyMenu(hMenu, 0u,
|
if ( !ModifyMenu(hMenu, 0u,
|
||||||
MF_BYPOSITION | MF_STRING,
|
MF_BYPOSITION | MF_STRING,
|
||||||
idMenuTitle, m_title.wx_str()) )
|
(UINT_PTR)idMenuTitle, m_title.wx_str()) )
|
||||||
{
|
{
|
||||||
wxLogLastError(wxT("ModifyMenu"));
|
wxLogLastError(wxT("ModifyMenu"));
|
||||||
}
|
}
|
||||||
@@ -949,7 +949,7 @@ void wxMenu::SetTitle(const wxString& label)
|
|||||||
// put the title string in bold face
|
// put the title string in bold face
|
||||||
if ( !m_title.empty() )
|
if ( !m_title.empty() )
|
||||||
{
|
{
|
||||||
SetDefaultMenuItem(GetHmenu(), idMenuTitle);
|
SetDefaultMenuItem(GetHmenu(), (UINT_PTR)idMenuTitle);
|
||||||
}
|
}
|
||||||
#endif // Win32
|
#endif // Win32
|
||||||
}
|
}
|
||||||
@@ -963,7 +963,7 @@ bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id_)
|
|||||||
const int id = (signed short)id_;
|
const int id = (signed short)id_;
|
||||||
|
|
||||||
// ignore commands from the menu title
|
// ignore commands from the menu title
|
||||||
if ( id != (int)idMenuTitle )
|
if ( id != idMenuTitle )
|
||||||
{
|
{
|
||||||
// update the check item when it's clicked
|
// update the check item when it's clicked
|
||||||
wxMenuItem * const item = FindItem(id);
|
wxMenuItem * const item = FindItem(id);
|
||||||
|
Reference in New Issue
Block a user