- // generate a control id for the controls which were not given one by
- // user
- static int NewControlId() { return --ms_lastControlId; }
- // get the id of the control following the one with the given
- // (autogenerated) id
- static int NextControlId(int winid) { return winid - 1; }
- // get the id of the control preceding the one with the given
- // (autogenerated) id
- static int PrevControlId(int winid) { return winid + 1; }
+
+ // window id uniquely identifies the window among its siblings unless
+ // it is wxID_ANY which means "don't care"
+ void SetId( wxWindowID winid ) { m_windowId = winid; }
+ wxWindowID GetId() const { return m_windowId; }
+
+ // generate a unique id (or count of them consecutively), returns a
+ // valid id in the auto-id range or wxID_NONE if failed. If using
+ // autoid management, it will mark the id as reserved until it is
+ // used (by assigning it to a wxWindowIDRef) or unreserved.
+ static wxWindowID NewControlId(int count = 1)
+ {
+ return wxIdManager::ReserveId(count);
+ }
+
+ // If an ID generated from NewControlId is not assigned to a wxWindowIDRef,
+ // it must be unreserved
+ static void UnreserveControlId(wxWindowID id, int count = 1)
+ {
+ wxIdManager::UnreserveId(id, count);
+ }
+