added logic to manage automatically allocated ids in-use status to avoid clashes for long-running programs (modified patch 1800016, incidentally fixes bug 1832620)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50007 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-11-16 23:25:18 +00:00
parent 9d46359178
commit f35fdf7e4a
4 changed files with 177 additions and 27 deletions

View File

@@ -201,11 +201,6 @@ public:
wxWindowVariant GetWindowVariant() const { return m_windowVariant; }
// 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; }
// get or change the layout direction (LTR or RTL) for this window,
// wxLayout_Default is returned if layout direction is not supported
virtual wxLayoutDirection GetLayoutDirection() const
@@ -219,15 +214,24 @@ public:
wxCoord width,
wxCoord widthTotal) const;
// 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; }
// returns true if this id value belong to the range reserved for the
// auto-generated (by NewControlId()) ids (they're always negative)
static bool IsAutoGeneratedId(wxWindowID id);
// generate a unique id (or count of them consecutively), returns a
// valid id in IsAutoGeneratedId() range or wxID_NONE if failed
static wxWindowID NewControlId(int count = 1);
// mark an id previously returned by NewControlId() as being unused any
// more so that it can be reused again for another control later
static void ReleaseControlId(wxWindowID id);
// moving/resizing
// ---------------
@@ -1361,6 +1365,10 @@ protected:
// Layout() window automatically when its size changes?
bool m_autoLayout:1;
// true if we had automatically allocated the id value for this window
// (i.e. wxID_ANY had been passed to the ctor)
bool m_freeId:1;
// window state
bool m_isShown:1;
bool m_isEnabled:1;
@@ -1528,9 +1536,6 @@ private:
int DoGetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y);
#endif // wxUSE_MENUS
// contains the last id generated by NewControlId
static int ms_lastControlId;
// the stack of windows which have captured the mouse
static struct WXDLLIMPEXP_FWD_CORE wxWindowNext *ms_winCaptureNext;
// the window that currently has mouse capture