]> git.saurik.com Git - wxWidgets.git/commitdiff
use wxWindowIDRef to transparently implement auto-generated ids ref-counting (slightl...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 6 Jan 2008 14:38:44 +0000 (14:38 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 6 Jan 2008 14:38:44 +0000 (14:38 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51035 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

34 files changed:
Makefile.in
build/bakefiles/files.bkl
build/msw/makefile.bcc
build/msw/makefile.gcc
build/msw/makefile.vc
build/msw/makefile.wat
build/msw/wx_core.dsp
include/wx/defs.h
include/wx/mac/setup0.h
include/wx/menuitem.h
include/wx/motif/setup0.h
include/wx/msw/radiobox.h
include/wx/msw/setup0.h
include/wx/msw/slider95.h
include/wx/msw/wince/setup.h
include/wx/os2/setup0.h
include/wx/palmos/setup0.h
include/wx/setup_inc.h
include/wx/tbarbase.h
include/wx/window.h
include/wx/windowid.h [new file with mode: 0644]
setup.h.in
src/common/wincmn.cpp
src/common/windowid.cpp [new file with mode: 0644]
src/generic/editlbox.cpp
src/msw/bmpbuttn.cpp
src/msw/mdi.cpp
src/msw/radiobox.cpp
src/msw/slider95.cpp
src/msw/statbr95.cpp
src/xrc/xmlres.cpp
wxGTK.spec
wxMotif.spec
wxX11.spec

index 2905b02bf0695bc4be096681cbcfe2abf10cb713..a0a7b3b76e8ef658abaf6db3ae193a3eeef4c44d 100644 (file)
@@ -3223,6 +3223,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS =  \
        wx/validate.h \
        wx/valtext.h \
        wx/window.h \
+       wx/windowid.h \
        wx/wupdlock.h \
        wx/accel.h \
        wx/access.h \
@@ -3892,6 +3893,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS =  \
        monodll_validate.o \
        monodll_valtext.o \
        monodll_wincmn.o \
+       monodll_windowid.o \
        monodll_xpmdecod.o \
        monodll_busyinfo.o \
        monodll_buttonbar.o \
@@ -4074,6 +4076,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS =  \
        monodll_validate.o \
        monodll_valtext.o \
        monodll_wincmn.o \
+       monodll_windowid.o \
        monodll_xpmdecod.o \
        monodll_busyinfo.o \
        monodll_buttonbar.o \
@@ -5780,6 +5783,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_1 =  \
        monolib_validate.o \
        monolib_valtext.o \
        monolib_wincmn.o \
+       monolib_windowid.o \
        monolib_xpmdecod.o \
        monolib_busyinfo.o \
        monolib_buttonbar.o \
@@ -5962,6 +5966,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 =  \
        monolib_validate.o \
        monolib_valtext.o \
        monolib_wincmn.o \
+       monolib_windowid.o \
        monolib_xpmdecod.o \
        monolib_busyinfo.o \
        monolib_buttonbar.o \
@@ -7949,6 +7954,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_2 =  \
        coredll_validate.o \
        coredll_valtext.o \
        coredll_wincmn.o \
+       coredll_windowid.o \
        coredll_xpmdecod.o \
        coredll_busyinfo.o \
        coredll_buttonbar.o \
@@ -8131,6 +8137,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 =  \
        coredll_validate.o \
        coredll_valtext.o \
        coredll_wincmn.o \
+       coredll_windowid.o \
        coredll_xpmdecod.o \
        coredll_busyinfo.o \
        coredll_buttonbar.o \
@@ -9441,6 +9448,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_3 =  \
        corelib_validate.o \
        corelib_valtext.o \
        corelib_wincmn.o \
+       corelib_windowid.o \
        corelib_xpmdecod.o \
        corelib_busyinfo.o \
        corelib_buttonbar.o \
@@ -9623,6 +9631,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 =  \
        corelib_validate.o \
        corelib_valtext.o \
        corelib_wincmn.o \
+       corelib_windowid.o \
        corelib_xpmdecod.o \
        corelib_busyinfo.o \
        corelib_buttonbar.o \
@@ -17589,6 +17598,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
 @COND_USE_GUI_1@monodll_wincmn.o: $(srcdir)/src/common/wincmn.cpp $(MONODLL_ODEP)
 @COND_USE_GUI_1@       $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/wincmn.cpp
 
+@COND_USE_GUI_1@monodll_windowid.o: $(srcdir)/src/common/windowid.cpp $(MONODLL_ODEP)
+@COND_USE_GUI_1@       $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/windowid.cpp
+
 @COND_USE_GUI_1@monodll_xpmdecod.o: $(srcdir)/src/common/xpmdecod.cpp $(MONODLL_ODEP)
 @COND_USE_GUI_1@       $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/xpmdecod.cpp
 
@@ -22050,6 +22062,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
 @COND_USE_GUI_1@monolib_wincmn.o: $(srcdir)/src/common/wincmn.cpp $(MONOLIB_ODEP)
 @COND_USE_GUI_1@       $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/wincmn.cpp
 
+@COND_USE_GUI_1@monolib_windowid.o: $(srcdir)/src/common/windowid.cpp $(MONOLIB_ODEP)
+@COND_USE_GUI_1@       $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/windowid.cpp
+
 @COND_USE_GUI_1@monolib_xpmdecod.o: $(srcdir)/src/common/xpmdecod.cpp $(MONOLIB_ODEP)
 @COND_USE_GUI_1@       $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/xpmdecod.cpp
 
@@ -27027,6 +27042,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
 @COND_USE_GUI_1@coredll_wincmn.o: $(srcdir)/src/common/wincmn.cpp $(COREDLL_ODEP)
 @COND_USE_GUI_1@       $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/wincmn.cpp
 
+@COND_USE_GUI_1@coredll_windowid.o: $(srcdir)/src/common/windowid.cpp $(COREDLL_ODEP)
+@COND_USE_GUI_1@       $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/windowid.cpp
+
 @COND_USE_GUI_1@coredll_xpmdecod.o: $(srcdir)/src/common/xpmdecod.cpp $(COREDLL_ODEP)
 @COND_USE_GUI_1@       $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/xpmdecod.cpp
 
@@ -30087,6 +30105,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
 @COND_USE_GUI_1@corelib_wincmn.o: $(srcdir)/src/common/wincmn.cpp $(CORELIB_ODEP)
 @COND_USE_GUI_1@       $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/wincmn.cpp
 
+@COND_USE_GUI_1@corelib_windowid.o: $(srcdir)/src/common/windowid.cpp $(CORELIB_ODEP)
+@COND_USE_GUI_1@       $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/windowid.cpp
+
 @COND_USE_GUI_1@corelib_xpmdecod.o: $(srcdir)/src/common/xpmdecod.cpp $(CORELIB_ODEP)
 @COND_USE_GUI_1@       $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/xpmdecod.cpp
 
index 473e5ece3e32336b79844717b8611cee3c8d36c5..83a2de143eeb6cb3d9b05199e906614e7a73248a 100644 (file)
@@ -732,6 +732,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     src/common/validate.cpp
     src/common/valtext.cpp
     src/common/wincmn.cpp
+    src/common/windowid.cpp
     src/common/xpmdecod.cpp
     src/generic/busyinfo.cpp
     src/generic/buttonbar.cpp
@@ -852,6 +853,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     wx/validate.h
     wx/valtext.h
     wx/window.h
+    wx/windowid.h
     wx/wupdlock.h
 
     wx/accel.h
index 123206e3d91876be80a99a17c87cded3014a1c14..5175243b464658c3087920fee761df51560f47b8 100644 (file)
@@ -1666,6 +1666,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
        $(OBJS)\monodll_validate.obj \
        $(OBJS)\monodll_valtext.obj \
        $(OBJS)\monodll_wincmn.obj \
+       $(OBJS)\monodll_windowid.obj \
        $(OBJS)\monodll_xpmdecod.obj \
        $(OBJS)\monodll_busyinfo.obj \
        $(OBJS)\monodll_buttonbar.obj \
@@ -1896,6 +1897,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
        $(OBJS)\monodll_validate.obj \
        $(OBJS)\monodll_valtext.obj \
        $(OBJS)\monodll_wincmn.obj \
+       $(OBJS)\monodll_windowid.obj \
        $(OBJS)\monodll_xpmdecod.obj \
        $(OBJS)\monodll_busyinfo.obj \
        $(OBJS)\monodll_buttonbar.obj \
@@ -2307,6 +2309,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
        $(OBJS)\monolib_validate.obj \
        $(OBJS)\monolib_valtext.obj \
        $(OBJS)\monolib_wincmn.obj \
+       $(OBJS)\monolib_windowid.obj \
        $(OBJS)\monolib_xpmdecod.obj \
        $(OBJS)\monolib_busyinfo.obj \
        $(OBJS)\monolib_buttonbar.obj \
@@ -2537,6 +2540,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
        $(OBJS)\monolib_validate.obj \
        $(OBJS)\monolib_valtext.obj \
        $(OBJS)\monolib_wincmn.obj \
+       $(OBJS)\monolib_windowid.obj \
        $(OBJS)\monolib_xpmdecod.obj \
        $(OBJS)\monolib_busyinfo.obj \
        $(OBJS)\monolib_buttonbar.obj \
@@ -2863,6 +2867,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
        $(OBJS)\coredll_validate.obj \
        $(OBJS)\coredll_valtext.obj \
        $(OBJS)\coredll_wincmn.obj \
+       $(OBJS)\coredll_windowid.obj \
        $(OBJS)\coredll_xpmdecod.obj \
        $(OBJS)\coredll_busyinfo.obj \
        $(OBJS)\coredll_buttonbar.obj \
@@ -3093,6 +3098,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
        $(OBJS)\coredll_validate.obj \
        $(OBJS)\coredll_valtext.obj \
        $(OBJS)\coredll_wincmn.obj \
+       $(OBJS)\coredll_windowid.obj \
        $(OBJS)\coredll_xpmdecod.obj \
        $(OBJS)\coredll_busyinfo.obj \
        $(OBJS)\coredll_buttonbar.obj \
@@ -3325,6 +3331,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
        $(OBJS)\corelib_validate.obj \
        $(OBJS)\corelib_valtext.obj \
        $(OBJS)\corelib_wincmn.obj \
+       $(OBJS)\corelib_windowid.obj \
        $(OBJS)\corelib_xpmdecod.obj \
        $(OBJS)\corelib_busyinfo.obj \
        $(OBJS)\corelib_buttonbar.obj \
@@ -3555,6 +3562,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
        $(OBJS)\corelib_validate.obj \
        $(OBJS)\corelib_valtext.obj \
        $(OBJS)\corelib_wincmn.obj \
+       $(OBJS)\corelib_windowid.obj \
        $(OBJS)\corelib_xpmdecod.obj \
        $(OBJS)\corelib_busyinfo.obj \
        $(OBJS)\corelib_buttonbar.obj \
@@ -6963,6 +6971,11 @@ $(OBJS)\monodll_wincmn.obj: ..\..\src\common\wincmn.cpp
        $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monodll_windowid.obj: ..\..\src\common\windowid.cpp
+       $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\monodll_xpmdecod.obj: ..\..\src\common\xpmdecod.cpp
        $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
@@ -9061,6 +9074,11 @@ $(OBJS)\monolib_wincmn.obj: ..\..\src\common\wincmn.cpp
        $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monolib_windowid.obj: ..\..\src\common\windowid.cpp
+       $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\monolib_xpmdecod.obj: ..\..\src\common\xpmdecod.cpp
        $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
@@ -11216,6 +11234,11 @@ $(OBJS)\coredll_wincmn.obj: ..\..\src\common\wincmn.cpp
        $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\coredll_windowid.obj: ..\..\src\common\windowid.cpp
+       $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\coredll_xpmdecod.obj: ..\..\src\common\xpmdecod.cpp
        $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
@@ -12522,6 +12545,11 @@ $(OBJS)\corelib_wincmn.obj: ..\..\src\common\wincmn.cpp
        $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\corelib_windowid.obj: ..\..\src\common\windowid.cpp
+       $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\corelib_xpmdecod.obj: ..\..\src\common\xpmdecod.cpp
        $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
index f55a560f9ddc3b97ba1f038ca650085826066fdb..813b9354ead7ec469796cba705e932eb8c8c3d99 100644 (file)
@@ -1681,6 +1681,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
        $(OBJS)\monodll_validate.o \
        $(OBJS)\monodll_valtext.o \
        $(OBJS)\monodll_wincmn.o \
+       $(OBJS)\monodll_windowid.o \
        $(OBJS)\monodll_xpmdecod.o \
        $(OBJS)\monodll_busyinfo.o \
        $(OBJS)\monodll_buttonbar.o \
@@ -1913,6 +1914,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
        $(OBJS)\monodll_validate.o \
        $(OBJS)\monodll_valtext.o \
        $(OBJS)\monodll_wincmn.o \
+       $(OBJS)\monodll_windowid.o \
        $(OBJS)\monodll_xpmdecod.o \
        $(OBJS)\monodll_busyinfo.o \
        $(OBJS)\monodll_buttonbar.o \
@@ -2328,6 +2330,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
        $(OBJS)\monolib_validate.o \
        $(OBJS)\monolib_valtext.o \
        $(OBJS)\monolib_wincmn.o \
+       $(OBJS)\monolib_windowid.o \
        $(OBJS)\monolib_xpmdecod.o \
        $(OBJS)\monolib_busyinfo.o \
        $(OBJS)\monolib_buttonbar.o \
@@ -2560,6 +2563,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
        $(OBJS)\monolib_validate.o \
        $(OBJS)\monolib_valtext.o \
        $(OBJS)\monolib_wincmn.o \
+       $(OBJS)\monolib_windowid.o \
        $(OBJS)\monolib_xpmdecod.o \
        $(OBJS)\monolib_busyinfo.o \
        $(OBJS)\monolib_buttonbar.o \
@@ -2900,6 +2904,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
        $(OBJS)\coredll_validate.o \
        $(OBJS)\coredll_valtext.o \
        $(OBJS)\coredll_wincmn.o \
+       $(OBJS)\coredll_windowid.o \
        $(OBJS)\coredll_xpmdecod.o \
        $(OBJS)\coredll_busyinfo.o \
        $(OBJS)\coredll_buttonbar.o \
@@ -3132,6 +3137,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
        $(OBJS)\coredll_validate.o \
        $(OBJS)\coredll_valtext.o \
        $(OBJS)\coredll_wincmn.o \
+       $(OBJS)\coredll_windowid.o \
        $(OBJS)\coredll_xpmdecod.o \
        $(OBJS)\coredll_busyinfo.o \
        $(OBJS)\coredll_buttonbar.o \
@@ -3370,6 +3376,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
        $(OBJS)\corelib_validate.o \
        $(OBJS)\corelib_valtext.o \
        $(OBJS)\corelib_wincmn.o \
+       $(OBJS)\corelib_windowid.o \
        $(OBJS)\corelib_xpmdecod.o \
        $(OBJS)\corelib_busyinfo.o \
        $(OBJS)\corelib_buttonbar.o \
@@ -3602,6 +3609,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
        $(OBJS)\corelib_validate.o \
        $(OBJS)\corelib_valtext.o \
        $(OBJS)\corelib_wincmn.o \
+       $(OBJS)\corelib_windowid.o \
        $(OBJS)\corelib_xpmdecod.o \
        $(OBJS)\corelib_busyinfo.o \
        $(OBJS)\corelib_buttonbar.o \
@@ -7203,6 +7211,11 @@ $(OBJS)\monodll_wincmn.o: ../../src/common/wincmn.cpp
        $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
 endif
 
+ifeq ($(USE_GUI),1)
+$(OBJS)\monodll_windowid.o: ../../src/common/windowid.cpp
+       $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
+endif
+
 ifeq ($(USE_GUI),1)
 $(OBJS)\monodll_xpmdecod.o: ../../src/common/xpmdecod.cpp
        $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@@ -9403,6 +9416,11 @@ $(OBJS)\monolib_wincmn.o: ../../src/common/wincmn.cpp
        $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
 endif
 
+ifeq ($(USE_GUI),1)
+$(OBJS)\monolib_windowid.o: ../../src/common/windowid.cpp
+       $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
+endif
+
 ifeq ($(USE_GUI),1)
 $(OBJS)\monolib_xpmdecod.o: ../../src/common/xpmdecod.cpp
        $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@@ -11660,6 +11678,11 @@ $(OBJS)\coredll_wincmn.o: ../../src/common/wincmn.cpp
        $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
 endif
 
+ifeq ($(USE_GUI),1)
+$(OBJS)\coredll_windowid.o: ../../src/common/windowid.cpp
+       $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
+endif
+
 ifeq ($(USE_GUI),1)
 $(OBJS)\coredll_xpmdecod.o: ../../src/common/xpmdecod.cpp
        $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
@@ -13066,6 +13089,11 @@ $(OBJS)\corelib_wincmn.o: ../../src/common/wincmn.cpp
        $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
 endif
 
+ifeq ($(USE_GUI),1)
+$(OBJS)\corelib_windowid.o: ../../src/common/windowid.cpp
+       $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
+endif
+
 ifeq ($(USE_GUI),1)
 $(OBJS)\corelib_xpmdecod.o: ../../src/common/xpmdecod.cpp
        $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
index 9947a93a2224ada501264fa87fff1faeb02a63c2..0306891d63e9b55b2034d90a6f95e2ed5981e236 100644 (file)
@@ -1840,6 +1840,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
        $(OBJS)\monodll_validate.obj \
        $(OBJS)\monodll_valtext.obj \
        $(OBJS)\monodll_wincmn.obj \
+       $(OBJS)\monodll_windowid.obj \
        $(OBJS)\monodll_xpmdecod.obj \
        $(OBJS)\monodll_busyinfo.obj \
        $(OBJS)\monodll_buttonbar.obj \
@@ -2070,6 +2071,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
        $(OBJS)\monodll_validate.obj \
        $(OBJS)\monodll_valtext.obj \
        $(OBJS)\monodll_wincmn.obj \
+       $(OBJS)\monodll_windowid.obj \
        $(OBJS)\monodll_xpmdecod.obj \
        $(OBJS)\monodll_busyinfo.obj \
        $(OBJS)\monodll_buttonbar.obj \
@@ -2487,6 +2489,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
        $(OBJS)\monolib_validate.obj \
        $(OBJS)\monolib_valtext.obj \
        $(OBJS)\monolib_wincmn.obj \
+       $(OBJS)\monolib_windowid.obj \
        $(OBJS)\monolib_xpmdecod.obj \
        $(OBJS)\monolib_busyinfo.obj \
        $(OBJS)\monolib_buttonbar.obj \
@@ -2717,6 +2720,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
        $(OBJS)\monolib_validate.obj \
        $(OBJS)\monolib_valtext.obj \
        $(OBJS)\monolib_wincmn.obj \
+       $(OBJS)\monolib_windowid.obj \
        $(OBJS)\monolib_xpmdecod.obj \
        $(OBJS)\monolib_busyinfo.obj \
        $(OBJS)\monolib_buttonbar.obj \
@@ -3073,6 +3077,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
        $(OBJS)\coredll_validate.obj \
        $(OBJS)\coredll_valtext.obj \
        $(OBJS)\coredll_wincmn.obj \
+       $(OBJS)\coredll_windowid.obj \
        $(OBJS)\coredll_xpmdecod.obj \
        $(OBJS)\coredll_busyinfo.obj \
        $(OBJS)\coredll_buttonbar.obj \
@@ -3303,6 +3308,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
        $(OBJS)\coredll_validate.obj \
        $(OBJS)\coredll_valtext.obj \
        $(OBJS)\coredll_wincmn.obj \
+       $(OBJS)\coredll_windowid.obj \
        $(OBJS)\coredll_xpmdecod.obj \
        $(OBJS)\coredll_busyinfo.obj \
        $(OBJS)\coredll_buttonbar.obj \
@@ -3541,6 +3547,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
        $(OBJS)\corelib_validate.obj \
        $(OBJS)\corelib_valtext.obj \
        $(OBJS)\corelib_wincmn.obj \
+       $(OBJS)\corelib_windowid.obj \
        $(OBJS)\corelib_xpmdecod.obj \
        $(OBJS)\corelib_busyinfo.obj \
        $(OBJS)\corelib_buttonbar.obj \
@@ -3771,6 +3778,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
        $(OBJS)\corelib_validate.obj \
        $(OBJS)\corelib_valtext.obj \
        $(OBJS)\corelib_wincmn.obj \
+       $(OBJS)\corelib_windowid.obj \
        $(OBJS)\corelib_xpmdecod.obj \
        $(OBJS)\corelib_busyinfo.obj \
        $(OBJS)\corelib_buttonbar.obj \
@@ -7295,6 +7303,11 @@ $(OBJS)\monodll_wincmn.obj: ..\..\src\common\wincmn.cpp
        $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monodll_windowid.obj: ..\..\src\common\windowid.cpp
+       $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\monodll_xpmdecod.obj: ..\..\src\common\xpmdecod.cpp
        $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
@@ -9393,6 +9406,11 @@ $(OBJS)\monolib_wincmn.obj: ..\..\src\common\wincmn.cpp
        $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monolib_windowid.obj: ..\..\src\common\windowid.cpp
+       $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\monolib_xpmdecod.obj: ..\..\src\common\xpmdecod.cpp
        $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
@@ -11548,6 +11566,11 @@ $(OBJS)\coredll_wincmn.obj: ..\..\src\common\wincmn.cpp
        $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\coredll_windowid.obj: ..\..\src\common\windowid.cpp
+       $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\coredll_xpmdecod.obj: ..\..\src\common\xpmdecod.cpp
        $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
@@ -12854,6 +12877,11 @@ $(OBJS)\corelib_wincmn.obj: ..\..\src\common\wincmn.cpp
        $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\corelib_windowid.obj: ..\..\src\common\windowid.cpp
+       $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\corelib_xpmdecod.obj: ..\..\src\common\xpmdecod.cpp
        $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
index b14382546c082e3301a5618f0c2e82d8084bbdfa..96fa1492f906ea8d43c3a2d08b71f149a6bcb89c 100644 (file)
@@ -406,6 +406,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  &
        $(OBJS)\monodll_validate.obj &
        $(OBJS)\monodll_valtext.obj &
        $(OBJS)\monodll_wincmn.obj &
+       $(OBJS)\monodll_windowid.obj &
        $(OBJS)\monodll_xpmdecod.obj &
        $(OBJS)\monodll_busyinfo.obj &
        $(OBJS)\monodll_buttonbar.obj &
@@ -638,6 +639,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  &
        $(OBJS)\monodll_validate.obj &
        $(OBJS)\monodll_valtext.obj &
        $(OBJS)\monodll_wincmn.obj &
+       $(OBJS)\monodll_windowid.obj &
        $(OBJS)\monodll_xpmdecod.obj &
        $(OBJS)\monodll_busyinfo.obj &
        $(OBJS)\monodll_buttonbar.obj &
@@ -1058,6 +1060,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  &
        $(OBJS)\monolib_validate.obj &
        $(OBJS)\monolib_valtext.obj &
        $(OBJS)\monolib_wincmn.obj &
+       $(OBJS)\monolib_windowid.obj &
        $(OBJS)\monolib_xpmdecod.obj &
        $(OBJS)\monolib_busyinfo.obj &
        $(OBJS)\monolib_buttonbar.obj &
@@ -1290,6 +1293,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  &
        $(OBJS)\monolib_validate.obj &
        $(OBJS)\monolib_valtext.obj &
        $(OBJS)\monolib_wincmn.obj &
+       $(OBJS)\monolib_windowid.obj &
        $(OBJS)\monolib_xpmdecod.obj &
        $(OBJS)\monolib_busyinfo.obj &
        $(OBJS)\monolib_buttonbar.obj &
@@ -1641,6 +1645,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  &
        $(OBJS)\coredll_validate.obj &
        $(OBJS)\coredll_valtext.obj &
        $(OBJS)\coredll_wincmn.obj &
+       $(OBJS)\coredll_windowid.obj &
        $(OBJS)\coredll_xpmdecod.obj &
        $(OBJS)\coredll_busyinfo.obj &
        $(OBJS)\coredll_buttonbar.obj &
@@ -1873,6 +1878,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  &
        $(OBJS)\coredll_validate.obj &
        $(OBJS)\coredll_valtext.obj &
        $(OBJS)\coredll_wincmn.obj &
+       $(OBJS)\coredll_windowid.obj &
        $(OBJS)\coredll_xpmdecod.obj &
        $(OBJS)\coredll_busyinfo.obj &
        $(OBJS)\coredll_buttonbar.obj &
@@ -2113,6 +2119,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  &
        $(OBJS)\corelib_validate.obj &
        $(OBJS)\corelib_valtext.obj &
        $(OBJS)\corelib_wincmn.obj &
+       $(OBJS)\corelib_windowid.obj &
        $(OBJS)\corelib_xpmdecod.obj &
        $(OBJS)\corelib_busyinfo.obj &
        $(OBJS)\corelib_buttonbar.obj &
@@ -2345,6 +2352,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  &
        $(OBJS)\corelib_validate.obj &
        $(OBJS)\corelib_valtext.obj &
        $(OBJS)\corelib_wincmn.obj &
+       $(OBJS)\corelib_windowid.obj &
        $(OBJS)\corelib_xpmdecod.obj &
        $(OBJS)\corelib_busyinfo.obj &
        $(OBJS)\corelib_buttonbar.obj &
@@ -7437,6 +7445,11 @@ $(OBJS)\monodll_wincmn.obj :  .AUTODEPEND ..\..\src\common\wincmn.cpp
        $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
 !endif
 
+!ifeq USE_GUI 1
+$(OBJS)\monodll_windowid.obj :  .AUTODEPEND ..\..\src\common\windowid.cpp
+       $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
+!endif
+
 !ifeq USE_GUI 1
 $(OBJS)\monodll_xpmdecod.obj :  .AUTODEPEND ..\..\src\common\xpmdecod.cpp
        $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
@@ -9637,6 +9650,11 @@ $(OBJS)\monolib_wincmn.obj :  .AUTODEPEND ..\..\src\common\wincmn.cpp
        $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
 !endif
 
+!ifeq USE_GUI 1
+$(OBJS)\monolib_windowid.obj :  .AUTODEPEND ..\..\src\common\windowid.cpp
+       $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
+!endif
+
 !ifeq USE_GUI 1
 $(OBJS)\monolib_xpmdecod.obj :  .AUTODEPEND ..\..\src\common\xpmdecod.cpp
        $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
@@ -11894,6 +11912,11 @@ $(OBJS)\coredll_wincmn.obj :  .AUTODEPEND ..\..\src\common\wincmn.cpp
        $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
 !endif
 
+!ifeq USE_GUI 1
+$(OBJS)\coredll_windowid.obj :  .AUTODEPEND ..\..\src\common\windowid.cpp
+       $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
+!endif
+
 !ifeq USE_GUI 1
 $(OBJS)\coredll_xpmdecod.obj :  .AUTODEPEND ..\..\src\common\xpmdecod.cpp
        $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
@@ -13300,6 +13323,11 @@ $(OBJS)\corelib_wincmn.obj :  .AUTODEPEND ..\..\src\common\wincmn.cpp
        $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
 !endif
 
+!ifeq USE_GUI 1
+$(OBJS)\corelib_windowid.obj :  .AUTODEPEND ..\..\src\common\windowid.cpp
+       $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
+!endif
+
 !ifeq USE_GUI 1
 $(OBJS)\corelib_xpmdecod.obj :  .AUTODEPEND ..\..\src\common\xpmdecod.cpp
        $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
index bc98429ace50482ab171e7b8ff50ab4511c18b95..b0e626871fc817a86a7b12bc8db76d471b361804 100644 (file)
@@ -646,6 +646,10 @@ SOURCE=..\..\src\common\wincmn.cpp
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\src\common\windowid.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\src\common\xpmdecod.cpp\r
 # End Source File\r
 # End Group\r
@@ -6376,6 +6380,10 @@ SOURCE=..\..\include\wx\window.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\..\include\wx\windowid.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\..\include\wx\wizard.h\r
 # End Source File\r
 # Begin Source File\r
index 3c5ad727164d9df6a9165d378d22fd6795f28ad4..4d4b4bbf695329285c3d461a7c5aba219921f832 100644 (file)
 
 typedef short int WXTYPE;
 
-/*  special care should be taken with this type under Windows where the real */
-/*  window id is unsigned, so we must always do the cast before comparing them */
-/*  (or else they would be always different!). Using wxGetWindowId() which does */
-/*  the cast itself is recommended. Note that this type can't be unsigned */
-/*  because wxID_ANY == -1 is a valid (and largely used) value for window id. */
-typedef int wxWindowID;
 
 /*  ---------------------------------------------------------------------------- */
 /*  other feature tests */
@@ -1782,8 +1776,19 @@ enum
        These ids delimit the range used by automatically-generated ids
        (i.e. those used when wxID_ANY is specified during construction).
      */
+#if defined(__WXMSW__) || wxUSE_AUTOID_MANAGEMENT
+    /*
+       On MSW the range is always restricted no matter if id management
+       is used or not because the native window ids are limited to short
+       range.  On other platforms the range is only restricted if id
+       management is used so the reference count buffer won't be so big.
+     */
     wxID_AUTO_LOWEST = -32000,
     wxID_AUTO_HIGHEST = -2000,
+#else
+    wxID_AUTO_LOWEST = -1000000,
+    wxID_AUTO_HIGHEST = -2000,
+#endif
 
     /* no id matches this one when compared to it */
     wxID_NONE = -3,
@@ -1919,6 +1924,19 @@ enum
     wxID_HIGHEST = 5999
 };
 
+/*  ---------------------------------------------------------------------------- */
+/*  wxWindowID type (after wxID_XYZ enum, platform detection, and dlimpexp.h)    */
+/*  ---------------------------------------------------------------------------- */
+
+/*  special care should be taken with this type under Windows where the real */
+/*  window id is unsigned, so we must always do the cast before comparing them */
+/*  (or else they would be always different!). Using wxGetWindowId() which does */
+/*  the cast itself is recommended. Note that this type can't be unsigned */
+/*  because wxID_ANY == -1 is a valid (and largely used) value for window id. */
+#ifdef __cplusplus
+    #include "wx/windowid.h"
+#endif
+
 /*  ---------------------------------------------------------------------------- */
 /*  other constants */
 /*  ---------------------------------------------------------------------------- */
index 1e5083e3943654fc595625287688507cb8d9f886..063106af0da894fbf0d3a453e743417ce803eb9c 100644 (file)
 // wxValidator class and related methods
 #define wxUSE_VALIDATORS 1
 
+// Use reference counted ID management: this means that wxWidgets will track
+// the automatically allocated ids (those used when you use wxID_ANY when
+// creating a window, menu or toolbar item &c) instead of just supposing that
+// the program never runs out of them. This is mostly useful only under wxMSW
+// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where
+// long-running programs can run into problems with ids reuse without this. On
+// the other platforms, where the ids have the full int range, this shouldn't
+// be necessary.
+#define wxUSE_AUTOID_MANAGEMENT defined(__WXMSW__)
+
 // ----------------------------------------------------------------------------
 // common dialogs
 // ----------------------------------------------------------------------------
index 55a6a3172f9296b8875b8638c939c1c55dbd4017..f8cf44752a27b4944bd754bc6d6586319b84cc87 100644 (file)
@@ -145,7 +145,7 @@ public:
     }
 
 protected:
-    int           m_id;             // numeric id of the item >= 0 or wxID_ANY or wxID_SEPARATOR
+    wxWindowIDRef m_id;             // numeric id of the item >= 0 or wxID_ANY or wxID_SEPARATOR
     wxMenu       *m_parentMenu,     // the menu we belong to
                  *m_subMenu;        // our sub menu or NULL
     wxString      m_text,           // label of the item
index b9a5c9c6b0555c78b8c55c1c5d1a35f63ffd8113..4c6ad8d0e7fae762ba11f5df6172938aa30afda7 100644 (file)
 // wxValidator class and related methods
 #define wxUSE_VALIDATORS 1
 
+// Use reference counted ID management: this means that wxWidgets will track
+// the automatically allocated ids (those used when you use wxID_ANY when
+// creating a window, menu or toolbar item &c) instead of just supposing that
+// the program never runs out of them. This is mostly useful only under wxMSW
+// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where
+// long-running programs can run into problems with ids reuse without this. On
+// the other platforms, where the ids have the full int range, this shouldn't
+// be necessary.
+#define wxUSE_AUTOID_MANAGEMENT defined(__WXMSW__)
+
 // ----------------------------------------------------------------------------
 // common dialogs
 // ----------------------------------------------------------------------------
index c4e5b280a315fcb8fa47fe88e639e6e16550ae04..6ff07ce3d9fc2239228d61eae2ce21d2d243efb2 100644 (file)
@@ -158,6 +158,7 @@ protected:
 
     // the buttons we contain
     wxSubwindows *m_radioButtons;
+    wxWindowIDRef *m_radioButtonIds;
 
     // array of widths and heights of the buttons, may be wxDefaultCoord if the
     // corresponding quantity should be computed
index d1527cfde08c74e1bb581d06c3d004752e2bb153..17d09e4a58a0fa73a41c9aab64817d776142d496 100644 (file)
 // wxValidator class and related methods
 #define wxUSE_VALIDATORS 1
 
+// Use reference counted ID management: this means that wxWidgets will track
+// the automatically allocated ids (those used when you use wxID_ANY when
+// creating a window, menu or toolbar item &c) instead of just supposing that
+// the program never runs out of them. This is mostly useful only under wxMSW
+// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where
+// long-running programs can run into problems with ids reuse without this. On
+// the other platforms, where the ids have the full int range, this shouldn't
+// be necessary.
+#define wxUSE_AUTOID_MANAGEMENT defined(__WXMSW__)
+
 // ----------------------------------------------------------------------------
 // common dialogs
 // ----------------------------------------------------------------------------
index 08cf96528a69e9978f3d83dc410f0823e100b630..02ae8699ee69551d002d9a5e781a16fe7829d0ea 100644 (file)
@@ -117,7 +117,8 @@ protected:
     virtual wxSize DoGetBestSize() const;
 
     // the labels windows, if any
-    wxSubwindows *m_labels;
+    wxSubwindows  *m_labels;
+    wxWindowIDRef *m_labelIds;
 
     int           m_rangeMin;
     int           m_rangeMax;
index fb40f30a33a2bb1f02cb0e04140dea993a57fbe1..a7e365f3d6fd133608e9827aa4eb73b0dce3c5c3 100644 (file)
 // wxValidator class and related methods
 #define wxUSE_VALIDATORS 1
 
+// Use reference counted ID management: this means that wxWidgets will track
+// the automatically allocated ids (those used when you use wxID_ANY when
+// creating a window, menu or toolbar item &c) instead of just supposing that
+// the program never runs out of them. This is mostly useful only under wxMSW
+// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where
+// long-running programs can run into problems with ids reuse without this. On
+// the other platforms, where the ids have the full int range, this shouldn't
+// be necessary.
+#define wxUSE_AUTOID_MANAGEMENT defined(__WXMSW__)
+
 // ----------------------------------------------------------------------------
 // common dialogs
 // ----------------------------------------------------------------------------
index be39d4b4fa46876eaf1d6c4a0772e7610c2e08ba..2099ba0fa104cbee33d5c0f2d6168b0dbe07c611 100644 (file)
 // wxValidator class and related methods
 #define wxUSE_VALIDATORS 1
 
+// Use reference counted ID management: this means that wxWidgets will track
+// the automatically allocated ids (those used when you use wxID_ANY when
+// creating a window, menu or toolbar item &c) instead of just supposing that
+// the program never runs out of them. This is mostly useful only under wxMSW
+// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where
+// long-running programs can run into problems with ids reuse without this. On
+// the other platforms, where the ids have the full int range, this shouldn't
+// be necessary.
+#define wxUSE_AUTOID_MANAGEMENT defined(__WXMSW__)
+
 // ----------------------------------------------------------------------------
 // common dialogs
 // ----------------------------------------------------------------------------
index 01ee5a4cf8fa09ba6cf01af2382ee90f17c4b4cf..0988baa18d222157957a17d339380c1db72656fd 100644 (file)
 // wxValidator class and related methods
 #define wxUSE_VALIDATORS 1
 
+// Use reference counted ID management: this means that wxWidgets will track
+// the automatically allocated ids (those used when you use wxID_ANY when
+// creating a window, menu or toolbar item &c) instead of just supposing that
+// the program never runs out of them. This is mostly useful only under wxMSW
+// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where
+// long-running programs can run into problems with ids reuse without this. On
+// the other platforms, where the ids have the full int range, this shouldn't
+// be necessary.
+#define wxUSE_AUTOID_MANAGEMENT defined(__WXMSW__)
+
 // ----------------------------------------------------------------------------
 // common dialogs
 // ----------------------------------------------------------------------------
index 07ed994071190a72b29a22434dda31f4a604b682..04f73575c29ce963a253a11204ed43cde717512c 100644 (file)
 // wxValidator class and related methods
 #define wxUSE_VALIDATORS 1
 
+// Use reference counted ID management: this means that wxWidgets will track
+// the automatically allocated ids (those used when you use wxID_ANY when
+// creating a window, menu or toolbar item &c) instead of just supposing that
+// the program never runs out of them. This is mostly useful only under wxMSW
+// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where
+// long-running programs can run into problems with ids reuse without this. On
+// the other platforms, where the ids have the full int range, this shouldn't
+// be necessary.
+#define wxUSE_AUTOID_MANAGEMENT defined(__WXMSW__)
+
 // ----------------------------------------------------------------------------
 // common dialogs
 // ----------------------------------------------------------------------------
index 34928b79f6172b1311c3039591747178c362d4f6..0ff7c9373aff3565f4931e3a6fcab06066a173f7 100644 (file)
@@ -210,7 +210,7 @@ protected:
 
     // tool parameters
     int m_toolStyle;    // see enum wxToolBarToolStyle
-    int m_id;           // the tool id, wxID_SEPARATOR for separator
+    wxWindowIDRef m_id; // the tool id, wxID_SEPARATOR for separator
     wxItemKind m_kind;  // for normal buttons may be wxITEM_NORMAL/CHECK/RADIO
 
     // as controls have their own client data, no need to waste memory
index 4f5388aaa97cdcb88da4f1b7ff0d73aae0b1d3da..e1fb16519b455ba44b43add13ee764c07f33f7bb 100644 (file)
@@ -228,17 +228,21 @@ public:
     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);
+        // 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);
+    }
 
-        // 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);
+        // 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);
+    }
 
 
     // moving/resizing
@@ -1356,7 +1360,7 @@ protected:
 
     // the window id - a number which uniquely identifies a window among
     // its siblings unless it is wxID_ANY
-    wxWindowID           m_windowId;
+    wxWindowIDRef        m_windowId;
 
     // the parent window of this window (or NULL) and the list of the children
     // of this window
@@ -1425,10 +1429,6 @@ 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;
@@ -1747,8 +1747,8 @@ WXDLLEXPORT wxWindow* wxGetTopLevelParent(wxWindow *win);
 
 #if WXWIN_COMPATIBILITY_2_6
     // deprecated (doesn't start with 'wx' prefix), use wxWindow::NewControlId()
-    wxDEPRECATED( int NewControlId() );
-    inline int NewControlId() { return wxWindowBase::NewControlId(); }
+    wxDEPRECATED( wxWindowID NewControlId() );
+    inline wxWindowID NewControlId() { return wxWindowBase::NewControlId(); }
 #endif // WXWIN_COMPATIBILITY_2_6
 
 #if wxUSE_ACCESSIBILITY
diff --git a/include/wx/windowid.h b/include/wx/windowid.h
new file mode 100644 (file)
index 0000000..4b2e3e1
--- /dev/null
@@ -0,0 +1,189 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        wx/windowid.h
+// Purpose:     wxWindowID class - a class for managing window ids
+// Author:      Brian Vanderburg II
+// Created:     2007-09-21
+// RCS-ID:      $Id$
+// Copyright:   (c) 2007 Brian Vanderburg II
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WINDOWID_H_
+#define _WX_WINDOWID_H_
+
+// NB: do not include defs.h as we are included from it
+
+typedef int wxWindowID;
+
+// ----------------------------------------------------------------------------
+// wxWindowIDRef: reference counted id value
+// ----------------------------------------------------------------------------
+
+// A wxWindowIDRef object wraps an id value and marks it as (un)used as
+// necessary. All ids returned from wxWindow::NewControlId() should be assigned
+// to an instance of this class to ensure that the id is marked as being in
+// use.
+//
+// This class is always defined but it is trivial if wxUSE_AUTOID_MANAGEMENT is
+// off.
+class WXDLLIMPEXP_CORE wxWindowIDRef
+{
+public:
+    // default ctor
+    wxWindowIDRef()
+    {
+        m_id = wxID_NONE;
+    }
+
+    // ctor taking id values
+    wxWindowIDRef(int id)
+    {
+        Init(id);
+    }
+
+    wxWindowIDRef(long id)
+    {
+        Init(id);
+    }
+
+    wxWindowIDRef(const wxWindowIDRef& id)
+    {
+        Init(id.m_id);
+    }
+
+    // dtor
+    ~wxWindowIDRef()
+    {
+        Assign(wxID_NONE);
+    }
+
+    // assignment
+    wxWindowIDRef& operator=(int id)
+    {
+        Assign(id);
+        return *this;
+    }
+
+    wxWindowIDRef& operator=(long id)
+    {
+        Assign(id);
+        return *this;
+    }
+
+    wxWindowIDRef& operator=(const wxWindowIDRef& id)
+    {
+        Assign(id.m_id);
+        return *this;
+    }
+
+    // access to the stored id value
+    wxWindowID GetValue() const
+    {
+        return m_id;
+    }
+
+    operator wxWindowID() const
+    {
+        return m_id;
+    }
+
+private:
+#if wxUSE_AUTOID_MANAGEMENT
+    // common part of all ctors: call Assign() for our new id
+    void Init(wxWindowID id)
+    {
+        // m_id must be initialized before calling Assign()
+        m_id = wxID_NONE;
+        Assign(id);
+    }
+
+    // increase reference count of id, decrease the one of m_id
+    void Assign(wxWindowID id);
+#else // !wxUSE_AUTOID_MANAGEMENT
+    // trivial stubs for the functions above
+    void Init(wxWindowID id)
+    {
+        m_id = id;
+    }
+
+    void Assign(wxWindowID id)
+    {
+        m_id = id;
+    }
+#endif // wxUSE_AUTOID_MANAGEMENT/!wxUSE_AUTOID_MANAGEMENT
+
+
+    wxWindowID m_id;
+};
+
+// comparison operators
+inline bool operator==(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs)
+{
+    return lhs.GetValue() == rhs.GetValue();
+}
+
+inline bool operator==(const wxWindowIDRef& lhs, int rhs)
+{
+    return lhs.GetValue() == rhs;
+}
+
+inline bool operator==(const wxWindowIDRef& lhs, long rhs)
+{
+    return lhs.GetValue() == rhs;
+}
+
+inline bool operator==(int lhs, const wxWindowIDRef& rhs)
+{
+    return rhs == lhs;
+}
+
+inline bool operator==(long lhs, const wxWindowIDRef& rhs)
+{
+    return rhs == lhs;
+}
+
+inline bool operator!=(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs)
+{
+    return !(lhs == rhs);
+}
+
+inline bool operator!=(const wxWindowIDRef& lhs, int rhs)
+{
+    return !(lhs == rhs);
+}
+
+inline bool operator!=(const wxWindowIDRef& lhs, long rhs)
+{
+    return !(lhs == rhs);
+}
+
+inline bool operator!=(int lhs, const wxWindowIDRef& rhs)
+{
+    return !(lhs == rhs);
+}
+
+inline bool operator!=(long lhs, const wxWindowIDRef& rhs)
+{
+    return !(lhs == rhs);
+}
+
+// ----------------------------------------------------------------------------
+// wxIdManager
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxIdManager
+{
+public:
+    // This returns an id value and not an wxWindowIDRef.  The returned value
+    // should be assigned a.s.a.p to a wxWindowIDRef.  The IDs are marked as
+    // reserved so that another call to ReserveId before assigning the id to a
+    // wxWindowIDRef will not use the same ID
+    static wxWindowID ReserveId(int count = 1);
+
+    // This will release an unused reserved ID.  This should only be called
+    // if the ID returned by ReserveId was NOT assigned to a wxWindowIDRef
+    // for some purpose, maybe an early return from a function
+    static void UnreserveId(wxWindowID id, int count = 1);
+};
+
+#endif // _WX_WINDOWID_H_
index 1443a641c4ce3312536db5ead3fd020d780c007f..e7defed624a2eceb1014f567e652f419c6ad6898 100644 (file)
 
 #define wxUSE_VALIDATORS 0
 
+#define wxUSE_AUTOID_MANAGEMENT defined(__WXMSW__)
+
 
 #define wxUSE_COMMON_DIALOGS 0
 
index 393f78120752e6b228def7c78be53a934144fd67..477c4d8c9d6473256520cc0b8682fbbf788202c1 100644 (file)
@@ -173,7 +173,6 @@ wxWindowBase::wxWindowBase()
     m_windowSizer = (wxSizer *) NULL;
     m_containingSizer = (wxSizer *) NULL;
     m_autoLayout = false;
-    m_freeId = false;
 
 #if wxUSE_DRAG_AND_DROP
     m_dropTarget = (wxDropTarget *)NULL;
@@ -247,9 +246,6 @@ bool wxWindowBase::CreateBase(wxWindowBase *parent,
     if ( id == wxID_ANY )
     {
         m_windowId = NewControlId();
-
-        // remember to call ReleaseControlId() when this window is destroyed
-        m_freeId = true;
     }
     else // valid id specified
     {
@@ -310,10 +306,6 @@ wxWindowBase::~wxWindowBase()
 {
     wxASSERT_MSG( GetCapture() != this, wxT("attempt to destroy window with mouse capture") );
 
-    // mark the id as unused if we allocated it for this control
-    if ( m_freeId )
-        ReleaseControlId(m_windowId);
-
     // FIXME if these 2 cases result from programming errors in the user code
     //       we should probably assert here instead of silently fixing them
 
@@ -3195,125 +3187,4 @@ wxWindowBase::AdjustForLayoutDirection(wxCoord x,
     return x;
 }
 
-// ----------------------------------------------------------------------------
-// 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++);
-
-        return id;
-    }
-    else // we've already wrapped or are now going to
-    {
-        // brute-force search for the id values
-
-        // number of consecutive free ids found so far
-        int found = 0;
-
-        for ( wxWindowID id = wxID_AUTO_LOWEST; id <= wxID_AUTO_HIGHEST; id++ )
-        {
-            if ( !IsAutoIdInUse(id) )
-            {
-                // found another consecutive available id
-                found++;
-                if ( found == count )
-                {
-                    // mark all count consecutive free ids we found as being in
-                    // use now and rewind back to the start of available range
-                    // in the process
-                    while ( count-- )
-                        MarkAutoIdUsed(id--);
-
-                    return id;
-                }
-            }
-            else // this id is in use
-            {
-                // reset the number of consecutive free values found
-                found = 0;
-            }
-        }
-    }
-
-    // if we get here, there are not enough consecutive free ids
-    return wxID_NONE;
-}
-
-void wxWindowBase::ReleaseControlId(wxWindowID id)
-{
-    wxCHECK_RET( IsAutoGeneratedId(id), "can't release non auto-generated id" );
 
-    FreeAutoId(id);
-}
diff --git a/src/common/windowid.cpp b/src/common/windowid.cpp
new file mode 100644 (file)
index 0000000..aace859
--- /dev/null
@@ -0,0 +1,256 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        src/common/windowid.cpp
+// Purpose:     wxWindowID class - a class for managing window ids
+// Author:      Brian Vanderburg II
+// Created:     2007-09-21
+// RCS-ID:      $Id$
+// Copyright:   (c) 2007 Brian Vanderburg II
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ----------------------------------------------------------------------------
+// Needed headers
+// ----------------------------------------------------------------------------
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+    #include "wx/intl.h"
+#endif //WX_PRECOMP
+
+// Not needed, included in defs.h
+// #include "wx/windowid.h"
+
+#define wxTRACE_WINDOWID _T("windowid")
+
+namespace
+{
+
+#if wxUSE_AUTOID_MANAGEMENT
+
+
+// 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
+static const wxUint8 ID_FREE = 0;
+static const wxUint8 ID_STARTCOUNT = 1;
+static const wxUint8 ID_MAXCOUNT = 254;
+static const wxUint8 ID_RESERVED = 255;
+
+wxUint8 gs_autoIdsRefCount[wxID_AUTO_HIGHEST - wxID_AUTO_LOWEST + 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
+wxWindowID gs_nextAutoId = wxID_AUTO_LOWEST;
+
+// Reserve an ID
+void ReserveIdRefCount(wxWindowID id)
+{
+    wxCHECK_RET(id >= wxID_AUTO_LOWEST && id <= wxID_AUTO_HIGHEST,
+            wxT("invalid id range"));
+
+    id -= wxID_AUTO_LOWEST;
+
+    wxCHECK_RET(gs_autoIdsRefCount[id] == ID_FREE,
+            wxT("id already in use or already reserved"));
+    gs_autoIdsRefCount[id] = ID_RESERVED;
+}
+
+// Unreserve and id
+void UnreserveIdRefCount(wxWindowID id)
+{
+    wxCHECK_RET(id >= wxID_AUTO_LOWEST && id <= wxID_AUTO_HIGHEST,
+            wxT("invalid id range"));
+
+    id -= wxID_AUTO_LOWEST;
+
+    wxCHECK_RET(gs_autoIdsRefCount[id] == ID_RESERVED,
+            wxT("id already in use or not reserved"));
+    gs_autoIdsRefCount[id] = ID_FREE;
+}
+
+// Get the usage count of an id
+int GetIdRefCount(wxWindowID id)
+{
+    wxCHECK_MSG(id >= wxID_AUTO_LOWEST && id <= wxID_AUTO_HIGHEST, 0,
+            wxT("invalid id range"));
+
+    id -= wxID_AUTO_LOWEST;
+    return gs_autoIdsRefCount[id];
+}
+
+// Increase the count for an id
+void IncIdRefCount(wxWindowID id)
+{
+    wxCHECK_RET(id >= wxID_AUTO_LOWEST && id <= wxID_AUTO_HIGHEST,
+            wxT("invalid id range"));
+
+    id -= wxID_AUTO_LOWEST;
+
+    wxCHECK_RET(gs_autoIdsRefCount[id] != ID_MAXCOUNT, wxT("id count at max"));
+    wxCHECK_RET(gs_autoIdsRefCount[id] != ID_FREE, wxT("id should first be reserved"));
+
+    if(gs_autoIdsRefCount[id] == ID_RESERVED)
+        gs_autoIdsRefCount[id] = ID_STARTCOUNT;
+    else
+        gs_autoIdsRefCount[id]++;
+
+    wxLogTrace(wxTRACE_WINDOWID, wxT("Increasing ref count of ID %d to %d"),
+            id + wxID_AUTO_LOWEST, gs_autoIdsRefCount[id]);
+}
+
+// Decrease the count for an id
+void DecIdRefCount(wxWindowID id)
+{
+    wxCHECK_RET(id >= wxID_AUTO_LOWEST && id <= wxID_AUTO_HIGHEST,
+            wxT("invalid id range"));
+
+    id -= wxID_AUTO_LOWEST;
+
+    wxCHECK_RET(gs_autoIdsRefCount[id] != ID_FREE, wxT("id count already 0"));
+
+    // DecIdRefCount is only called on an ID that has been IncIdRefCount'ed'
+    // so it should never be reserved, but test anyway
+    if(gs_autoIdsRefCount[id] == ID_RESERVED)
+    {
+        wxASSERT_MSG(false, wxT("reserve id being decreased"));
+        gs_autoIdsRefCount[id] = ID_FREE;
+    }
+    else
+        gs_autoIdsRefCount[id]--;
+
+    wxLogTrace(wxTRACE_WINDOWID, wxT("Decreasing ref count of ID %d to %d"),
+            id + wxID_AUTO_LOWEST, gs_autoIdsRefCount[id]);
+}
+
+#else // wxUSE_AUTOID_MANAGEMENT
+
+static wxWindowID gs_nextAutoId = wxID_AUTO_HIGHEST;
+
+#endif
+
+} // anonymous namespace
+
+
+#if wxUSE_AUTOID_MANAGEMENT
+
+void wxWindowIDRef::Assign(wxWindowID id)
+{
+    if ( id != m_id )
+    {
+        // decrease count if it is in the managed range
+        if ( m_id >= wxID_AUTO_LOWEST && m_id <= wxID_AUTO_HIGHEST )
+            DecIdRefCount(m_id);
+
+        m_id = id;
+
+        // increase count if it is in the managed range
+        if ( m_id >= wxID_AUTO_LOWEST && m_id <= wxID_AUTO_HIGHEST )
+            IncIdRefCount(m_id);
+    }
+}
+
+#endif // wxUSE_AUTOID_MANAGEMENT
+
+
+
+wxWindowID wxIdManager::ReserveId(int count)
+{
+    wxASSERT_MSG(count > 0, wxT("can't allocate less than 1 id"));
+
+
+#if wxUSE_AUTOID_MANAGEMENT
+    if ( gs_nextAutoId + count - 1 <= wxID_AUTO_HIGHEST )
+    {
+        wxWindowID id = gs_nextAutoId;
+
+        while(count--)
+        {
+            ReserveIdRefCount(gs_nextAutoId++);
+        }
+
+        return id;
+    }
+    else
+    {
+        int found = 0;
+
+        for(wxWindowID id = wxID_AUTO_LOWEST; id <= wxID_AUTO_HIGHEST; id++)
+        {
+            if(GetIdRefCount(id) == 0)
+            {
+                found++;
+                if(found == count)
+                {
+                    // Imagine this:  100 free IDs left.  Then NewId(50) takes 50
+                    // so 50 left.  Then, the 25 before that last 50 are freed, but
+                    // gs_nextAutoId does not decrement and stays where it is at
+                    // with 50 free. Then NewId(75) gets called, and since there
+                    // are only 50 left according to gs_nextAutoId, it does a
+                    // search and finds the 75 at the end.  Then NewId(10) gets
+                    // called, and accorind to gs_nextAutoId, their are still
+                    // 50 at the end so it returns them without testing the ref
+                    // To fix this, the next ID is also updated here as needed
+                    if(id >= gs_nextAutoId)
+                        gs_nextAutoId = id + 1;
+
+                    while(count--)
+                        ReserveIdRefCount(id--);
+
+                    return id;
+                }
+            }
+            else
+            {
+                found = 0;
+            }
+        }
+    }
+
+    ::wxLogError(_("Out of window IDs.  Recommend shutting down application."));
+    return wxID_NONE;
+#else // !wxUSE_AUTOID_MANAGEMENT
+    // Make sure enough in the range
+    wxWindowID id;
+
+    id = gs_nextAutoId - count + 1;
+
+    if ( id >= wxID_AUTO_LOWEST && id <= wxID_AUTO_HIGHEST )
+    {
+        // There is enough, but it may be time to wrap
+        if(id == wxID_AUTO_LOWEST)
+            gs_nextAutoId = wxID_AUTO_HIGHEST;
+        else
+            gs_nextAutoId = id - 1;
+
+        return id;
+    }
+    else
+    {
+        // There is not enough at the low end of the range or
+        // count was big enough to wrap around to the positive
+        // Surely 'count' is not so big to take up much of the range
+        gs_nextAutoId = wxID_AUTO_HIGHEST - count;
+        return gs_nextAutoId + 1;
+    }
+#endif // wxUSE_AUTOID_MANAGEMENT/!wxUSE_AUTOID_MANAGEMENT
+}
+
+void wxIdManager::UnreserveId(wxWindowID id, int count)
+{
+    wxASSERT_MSG(count > 0, wxT("can't unreserve less than 1 id"));
+
+#if wxUSE_AUTOID_MANAGEMENT
+    while (count--)
+        UnreserveIdRefCount(id++);
+#else
+    wxUnusedVar(id);
+    wxUnusedVar(count);
+#endif
+}
+
index 26512e0735070fb78409a4d90e67e2d96359a030..c1970a993a37c1059e301978d7d403dcd27ed460 100644 (file)
@@ -197,12 +197,12 @@ IMPLEMENT_CLASS(wxEditableListBox, wxPanel)
 
 // NB: generate the IDs at runtime to avoid conflict with XRCID values,
 //     they could cause XRCCTRL() failures in XRC-based dialogs
-const int wxID_ELB_DELETE = wxWindow::NewControlId();
-const int wxID_ELB_EDIT = wxWindow::NewControlId();
-const int wxID_ELB_NEW = wxWindow::NewControlId();
-const int wxID_ELB_UP = wxWindow::NewControlId();
-const int wxID_ELB_DOWN = wxWindow::NewControlId();
-const int wxID_ELB_LISTCTRL = wxWindow::NewControlId();
+const wxWindowIDRef wxID_ELB_DELETE = wxWindow::NewControlId();
+const wxWindowIDRef wxID_ELB_EDIT = wxWindow::NewControlId();
+const wxWindowIDRef wxID_ELB_NEW = wxWindow::NewControlId();
+const wxWindowIDRef wxID_ELB_UP = wxWindow::NewControlId();
+const wxWindowIDRef wxID_ELB_DOWN = wxWindow::NewControlId();
+const wxWindowIDRef wxID_ELB_LISTCTRL = wxWindow::NewControlId();
 
 BEGIN_EVENT_TABLE(wxEditableListBox, wxPanel)
     EVT_LIST_ITEM_SELECTED(wxID_ELB_LISTCTRL, wxEditableListBox::OnItemSelected)
index 333ab7a25bff5c4a6a3bdff74c663ab75a4292eb..7039eb149e0b25686fb275d4bcb8f83136880430 100644 (file)
@@ -175,7 +175,7 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id,
                     msStyle,
                     0, 0, 0, 0,
                     GetWinHwnd(parent),
-                    (HMENU)m_windowId,
+                    (HMENU)m_windowId.GetValue(),
                     wxGetInstance(),
                     NULL
                    );
index 6300654e8f878038b84d14a0280d5c573e5458a5..e4f5961386775225ba944f03e2790e915dbfa5a2 100644 (file)
@@ -694,7 +694,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
   if ( id != wxID_ANY )
     m_windowId = id;
   else
-    m_windowId = (int)NewControlId();
+    m_windowId = NewControlId();
 
   if ( parent )
   {
index b29e5eb3e23f71faedddc9fef2736ea56a99535e..7865639116a32724b638e1ae35608f030c2d6e87 100644 (file)
@@ -129,6 +129,7 @@ void wxRadioBox::Init()
 {
     m_selectedButton = wxNOT_FOUND;
     m_radioButtons = NULL;
+    m_radioButtonIds = NULL;
     m_radioWidth = NULL;
     m_radioHeight = NULL;
 }
@@ -156,6 +157,7 @@ bool wxRadioBox::Create(wxWindow *parent,
 #endif // wxUSE_VALIDATORS/!wxUSE_VALIDATORS
 
     m_radioButtons = new wxSubwindows(n);
+    m_radioButtonIds = new wxWindowIDRef[n + 1];
     m_radioWidth = new int[n];
     m_radioHeight = new int[n];
 
@@ -167,14 +169,14 @@ bool wxRadioBox::Create(wxWindow *parent,
         if ( i == 0 )
             styleBtn |= WS_GROUP;
 
-        long newId = NewControlId();
+        m_radioButtonIds[i] = NewControlId();
 
         HWND hwndBtn = ::CreateWindow(_T("BUTTON"),
                                       choices[i].wx_str(),
                                       styleBtn,
                                       0, 0, 0, 0,   // will be set in SetSize()
                                       GetHwndOf(parent),
-                                      (HMENU)newId,
+                                      (HMENU)(wxWindowID)m_radioButtonIds[i],
                                       wxGetInstance(),
                                       NULL);
 
@@ -189,15 +191,17 @@ bool wxRadioBox::Create(wxWindow *parent,
 
         SubclassRadioButton((WXHWND)hwndBtn);
 
-        m_subControls.Add(newId);
+        m_subControls.Add(m_radioButtonIds[i]);
     }
 
     // Create a dummy radio control to end the group.
+    m_radioButtonIds[n] = NewControlId();
+
     (void)::CreateWindow(_T("BUTTON"),
                          wxEmptyString,
                          WS_GROUP | BS_AUTORADIOBUTTON | WS_CHILD,
                          0, 0, 0, 0, GetHwndOf(parent),
-                         (HMENU)NewControlId(), wxGetInstance(), NULL);
+                         (HMENU)(wxWindowID)m_radioButtonIds[n], wxGetInstance(), NULL);
 
     m_radioButtons->SetFont(GetFont());
 
@@ -237,6 +241,7 @@ wxRadioBox::~wxRadioBox()
     m_isBeingDeleted = true;
 
     delete m_radioButtons;
+    delete[] m_radioButtonIds;
     delete[] m_radioWidth;
     delete[] m_radioHeight;
 }
index 3a0dbfb80ea7874f44aac6bf8418b8f0319386ea..159e0ddea3493c94e62291caeeacb4fd54c9e7c6 100644 (file)
@@ -135,6 +135,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
 void wxSlider::Init()
 {
     m_labels = NULL;
+    m_labelIds = NULL;
 
     m_pageSize = 1;
     m_lineSize = 1;
@@ -204,10 +205,13 @@ wxSlider::Create(wxWindow *parent,
     if ( m_windowStyle & wxSL_LABELS )
     {
         m_labels = new wxSubwindows(SliderLabel_Last);
+        m_labelIds = new wxWindowIDRef[SliderLabel_Last];
 
         HWND hwndParent = GetHwndOf(parent);
         for ( size_t n = 0; n < SliderLabel_Last; n++ )
         {
+            m_labelIds[n] = NewControlId();
+
             (*m_labels)[n] = ::CreateWindow
                                (
                                     wxT("STATIC"),
@@ -215,7 +219,7 @@ wxSlider::Create(wxWindow *parent,
                                     WS_CHILD | WS_VISIBLE | SS_CENTER,
                                     0, 0, 0, 0,
                                     hwndParent,
-                                    (HMENU)NewControlId(),
+                                    (HMENU)(wxWindowID)m_labelIds[n],
                                     wxGetInstance(),
                                     NULL
                                );
@@ -282,6 +286,7 @@ WXDWORD wxSlider::MSWGetStyle(long style, WXDWORD *exstyle) const
 wxSlider::~wxSlider()
 {
     delete m_labels;
+    delete[] m_labelIds;
 }
 
 // ----------------------------------------------------------------------------
index 57990a9c8078ed70fbc6a9fcdf156e2e20135a71..0913dbf5aa068f54b505030fba53664c741da06b 100644 (file)
@@ -106,7 +106,7 @@ bool wxStatusBar95::Create(wxWindow *parent,
                 wstyle,
                 0, 0, 0, 0,
                 GetHwndOf(parent),
-                (HMENU)m_windowId,
+                (HMENU)m_windowId.GetValue(),
                 wxGetInstance(),
                 NULL
              );
index 00af7a26f9ae6a644c875c7255844e93a3a37835..365a721f1d91673ea9b6a09b6df32a6120302d00 100644 (file)
@@ -1575,7 +1575,10 @@ void wxXmlResourceHandler::CreateChildrenPrivately(wxObject *parent, wxXmlNode *
 
 struct XRCID_record
 {
-    int id;
+    /* Hold the id so that once an id is allocated for a name, it
+       does not get created again by NewControlId at least
+       until we are done with it */
+    wxWindowIDRef id;
     char *key;
     XRCID_record *next;
 };
@@ -1648,11 +1651,6 @@ static void CleanXRCID_Record(XRCID_record *rec)
     {
         CleanXRCID_Record(rec->next);
 
-        // if we had generated the value of this id automatically, release it
-        // now that we don't need it any longer
-        if ( wxWindow::IsAutoGeneratedId(rec->id) )
-            wxWindow::ReleaseControlId(rec->id);
-
         free(rec->key);
         delete rec;
     }
index b9945f5cfc3543a94970bc44460424479c6886b7..90df649c563045580b323a3073b06059307411e0 100644 (file)
@@ -329,19 +329,19 @@ wx/xtistrm.h
 wx/zipstrm.h
 wx/zstream.h
 wx/private/fdiodispatcher.h
-wx/private/gsocketiohandler.h
 wx/private/selectdispatcher.h
 wx/unix/app.h
 wx/unix/apptbase.h
 wx/unix/apptrait.h
 wx/unix/chkconf.h
-wx/unix/execute.h
 wx/unix/evtloop.h
-wx/unix/mimetype.h
 wx/unix/pipe.h
+wx/unix/stdpaths.h
+wx/unix/execute.h
+wx/unix/mimetype.h
 wx/unix/private.h
+wx/private/gsocketiohandler.h
 wx/unix/stackwalk.h
-wx/unix/stdpaths.h
 wx/fs_inet.h
 wx/gsocket.h
 wx/protocol/file.h
index 232f58c139ad1fac23593af31606aed80a8d9afa..d8f00e3f52f20d177ca388b932a6fe376d4352fc 100644 (file)
@@ -234,19 +234,19 @@ wx/xtistrm.h
 wx/zipstrm.h
 wx/zstream.h
 wx/private/fdiodispatcher.h
-wx/private/gsocketiohandler.h
 wx/private/selectdispatcher.h
 wx/unix/app.h
 wx/unix/apptbase.h
 wx/unix/apptrait.h
 wx/unix/chkconf.h
-wx/unix/execute.h
 wx/unix/evtloop.h
-wx/unix/mimetype.h
 wx/unix/pipe.h
+wx/unix/stdpaths.h
+wx/unix/execute.h
+wx/unix/mimetype.h
 wx/unix/private.h
+wx/private/gsocketiohandler.h
 wx/unix/stackwalk.h
-wx/unix/stdpaths.h
 wx/fs_inet.h
 wx/gsocket.h
 wx/protocol/file.h
index 94eba4e03d02754d67e82fcc719b08d5be1c87e5..bb3a2c0091f8d16f328508db742949a34a8250ad 100644 (file)
@@ -258,19 +258,19 @@ wx/xtistrm.h
 wx/zipstrm.h
 wx/zstream.h
 wx/private/fdiodispatcher.h
-wx/private/gsocketiohandler.h
 wx/private/selectdispatcher.h
 wx/unix/app.h
 wx/unix/apptbase.h
 wx/unix/apptrait.h
 wx/unix/chkconf.h
-wx/unix/execute.h
 wx/unix/evtloop.h
-wx/unix/mimetype.h
 wx/unix/pipe.h
+wx/unix/stdpaths.h
+wx/unix/execute.h
+wx/unix/mimetype.h
 wx/unix/private.h
+wx/private/gsocketiohandler.h
 wx/unix/stackwalk.h
-wx/unix/stdpaths.h
 wx/fs_inet.h
 wx/gsocket.h
 wx/protocol/file.h