From e0dd12db9955e1e173064bde29943f171c53698f Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 4 Feb 2004 23:28:11 +0000 Subject: [PATCH] Using a -1 (wxID_ANY) for menu or toolbar item IDs will now generate a new ID for the item using wxNewId(). As a consequence of this, the value of wxID_SEPARATOR was changed from -1 to -2 in order to not clash. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25504 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 5 +++++ include/wx/defs.h | 2 +- include/wx/tbarbase.h | 2 ++ src/common/menucmn.cpp | 4 ++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index d4ffa59682..ac1bb2f712 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -122,6 +122,11 @@ All (GUI): - added wxStatusBar support to XRC (Brian Ravnsgaard Riis) - wxMenu::Append and etc. return a pointer to the wxMenuItem that was added or inserted, or NULL on failure. +- Using a -1 (wxID_ANY) for menu or toolbar item IDs will now generate + a new ID for the item using wxNewId(). As a consequence of this, + the value of wxID_SEPARATOR was changed from -1 to -2 in order to + not clash. + wxMSW: diff --git a/include/wx/defs.h b/include/wx/defs.h index 76260c94fb..c59c71ee43 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -1418,7 +1418,7 @@ enum /* id for a separator line in the menu (invalid for normal item) */ enum { - wxID_SEPARATOR = -1 + wxID_SEPARATOR = -2 }; /* Standard menu IDs */ diff --git a/include/wx/tbarbase.h b/include/wx/tbarbase.h index 16344e72f4..299a018e23 100644 --- a/include/wx/tbarbase.h +++ b/include/wx/tbarbase.h @@ -79,6 +79,8 @@ public: { m_tbar = tbar; m_id = toolid; + if (m_id == wxID_ANY) + m_id = wxNewId(); m_clientData = clientData; m_bmpNormal = bmpNormal; diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index 4cca372c62..3b2c9d37aa 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -72,6 +72,10 @@ wxMenuItemBase::wxMenuItemBase(wxMenu *parentMenu, m_isChecked = FALSE; m_id = id; m_kind = kind; + if (m_id == wxID_ANY) + m_id = wxNewId(); + if (m_id == wxID_SEPARATOR) + m_kind = wxITEM_SEPARATOR; } wxMenuItemBase::~wxMenuItemBase() -- 2.45.2