-// ----------------------------------------------------------------------------
-// Window (and menu items) identifiers management
-// ----------------------------------------------------------------------------
-
-namespace
-{
-
-// this array contains, in packed form, the "in use" flags for the entire
-// auto-generated ids range: N-th element of the array contains the flags for
-// ids in [wxID_AUTO_LOWEST + 8*N, wxID_AUTO_LOWEST + 8*N + 7] range
-//
-// initially no ids are in use and we allocate them consecutively, but after we
-// exhaust the entire range, we wrap around and reuse the ids freed in the
-// meanwhile
-wxByte gs_autoIdsInUse[(wxID_AUTO_HIGHEST - wxID_AUTO_LOWEST + 1)/8 + 1] = { 0 };
-
-// this is an optimization used until we wrap around wxID_AUTO_HIGHEST: if this
-// value is < wxID_AUTO_HIGHEST we know that we haven't wrapped yet and so can
-// allocate the ids simply by incrementing it
-static wxWindowID gs_nextControlId = wxID_AUTO_LOWEST;
-
-void MarkAutoIdUsed(wxWindowID id)
-{
- id -= wxID_AUTO_LOWEST;
-
- const int theByte = id / 8;
- const int theBit = id % 8;
-
- gs_autoIdsInUse[theByte] |= 1 << theBit;
-}
-
-void FreeAutoId(wxWindowID id)
-{
- id -= wxID_AUTO_LOWEST;
-
- const int theByte = id / 8;
- const int theBit = id % 8;
-
- gs_autoIdsInUse[theByte] &= ~(1 << theBit);
-}
-
-bool IsAutoIdInUse(wxWindowID id)
-{
- id -= wxID_AUTO_LOWEST;
-
- const int theByte = id / 8;
- const int theBit = id % 8;
-
- return (gs_autoIdsInUse[theByte] & (1 << theBit)) != 0;
-}
-
-} // anonymous namespace
-
-
-/* static */
-bool wxWindowBase::IsAutoGeneratedId(wxWindowID id)
-{
- if ( id < wxID_AUTO_LOWEST || id > wxID_AUTO_HIGHEST )
- return false;
-
- // we shouldn't have any stray ids in this range
- wxASSERT_MSG( IsAutoIdInUse(id), "unused automatically generated id?" );
-
- return true;
-}
-
-wxWindowID wxWindowBase::NewControlId(int count)
-{
- wxASSERT_MSG( count > 0, "can't allocate less than 1 id" );
-
- if ( gs_nextControlId + count - 1 <= wxID_AUTO_HIGHEST )
- {
- // we haven't wrapped yet, so we can just grab the next count ids
- wxWindowID id = gs_nextControlId;
-
- while ( count-- )
- MarkAutoIdUsed(gs_nextControlId++);