From 94aff5ff86189e39b7a95fc62e886374c060a2cf Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 8 Apr 2007 22:18:35 +0000 Subject: [PATCH] Call wxTLW::SetDefaultItem() from wxButtonBase::SetDefault() instead of doing it in wxButton implementations in (almost) all ports; changed its return type to "wxWindow *" from "void" to accommodate the ports needing the old default item (replaces part of patch 1696563) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45338 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- Makefile.in | 20 ++++++++++++++ build/bakefiles/files.bkl | 1 + build/msw/makefile.bcc | 28 +++++++++++++++++++ build/msw/makefile.gcc | 28 +++++++++++++++++++ build/msw/makefile.vc | 32 ++++++++++++++++++++-- build/msw/makefile.wat | 28 +++++++++++++++++++ build/msw/wx_core.dsp | 4 +++ include/wx/button.h | 7 +++-- include/wx/gtk/bmpbuttn.h | 1 - include/wx/gtk/button.h | 4 +-- include/wx/gtk1/bmpbuttn.h | 1 - include/wx/gtk1/button.h | 2 +- include/wx/mac/carbon/button.h | 50 +++++++++++++++++++--------------- include/wx/motif/button.h | 14 ++++------ include/wx/msw/bmpbuttn.h | 1 - include/wx/msw/button.h | 2 +- include/wx/os2/bmpbuttn.h | 1 - include/wx/os2/button.h | 3 +- include/wx/palmos/bmpbuttn.h | 1 - include/wx/palmos/button.h | 2 +- include/wx/univ/button.h | 2 +- src/common/btncmn.cpp | 44 ++++++++++++++++++++++++++++++ src/gtk/bmpbuttn.cpp | 8 ------ src/gtk/button.cpp | 13 ++++----- src/gtk1/bmpbuttn.cpp | 8 ------ src/gtk1/button.cpp | 13 ++++----- src/motif/button.cpp | 8 +++--- src/msw/bmpbuttn.cpp | 5 ---- src/msw/button.cpp | 8 ++---- src/os2/bmpbuttn.cpp | 5 ---- src/os2/button.cpp | 8 ++---- src/palmos/bmpbuttn.cpp | 4 --- src/palmos/button.cpp | 4 ++- src/univ/button.cpp | 4 ++- 34 files changed, 253 insertions(+), 111 deletions(-) create mode 100644 src/common/btncmn.cpp diff --git a/Makefile.in b/Makefile.in index c4540c61dd..809536fdb8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -3606,6 +3606,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS = \ monodll_artstd.o \ monodll_bmpbase.o \ monodll_bookctrl.o \ + monodll_btncmn.o \ monodll_choiccmn.o \ monodll_clipcmn.o \ monodll_clrpickercmn.o \ @@ -3784,6 +3785,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS = \ monodll_artstd.o \ monodll_bmpbase.o \ monodll_bookctrl.o \ + monodll_btncmn.o \ monodll_choiccmn.o \ monodll_clipcmn.o \ monodll_clrpickercmn.o \ @@ -5408,6 +5410,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_1 = \ monolib_artstd.o \ monolib_bmpbase.o \ monolib_bookctrl.o \ + monolib_btncmn.o \ monolib_choiccmn.o \ monolib_clipcmn.o \ monolib_clrpickercmn.o \ @@ -5586,6 +5589,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 = \ monolib_artstd.o \ monolib_bmpbase.o \ monolib_bookctrl.o \ + monolib_btncmn.o \ monolib_choiccmn.o \ monolib_clipcmn.o \ monolib_clrpickercmn.o \ @@ -7440,6 +7444,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_2 = \ coredll_artstd.o \ coredll_bmpbase.o \ coredll_bookctrl.o \ + coredll_btncmn.o \ coredll_choiccmn.o \ coredll_clipcmn.o \ coredll_clrpickercmn.o \ @@ -7618,6 +7623,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 = \ coredll_artstd.o \ coredll_bmpbase.o \ coredll_bookctrl.o \ + coredll_btncmn.o \ coredll_choiccmn.o \ coredll_clipcmn.o \ coredll_clrpickercmn.o \ @@ -8910,6 +8916,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_3 = \ corelib_artstd.o \ corelib_bmpbase.o \ corelib_bookctrl.o \ + corelib_btncmn.o \ corelib_choiccmn.o \ corelib_clipcmn.o \ corelib_clrpickercmn.o \ @@ -9088,6 +9095,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 = \ corelib_artstd.o \ corelib_bmpbase.o \ corelib_bookctrl.o \ + corelib_btncmn.o \ corelib_choiccmn.o \ corelib_clipcmn.o \ corelib_clrpickercmn.o \ @@ -16772,6 +16780,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@monodll_bookctrl.o: $(srcdir)/src/common/bookctrl.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/bookctrl.cpp +@COND_USE_GUI_1@monodll_btncmn.o: $(srcdir)/src/common/btncmn.cpp $(MONODLL_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/btncmn.cpp + @COND_USE_GUI_1@monodll_choiccmn.o: $(srcdir)/src/common/choiccmn.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/choiccmn.cpp @@ -20948,6 +20959,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@monolib_bookctrl.o: $(srcdir)/src/common/bookctrl.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/bookctrl.cpp +@COND_USE_GUI_1@monolib_btncmn.o: $(srcdir)/src/common/btncmn.cpp $(MONOLIB_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/btncmn.cpp + @COND_USE_GUI_1@monolib_choiccmn.o: $(srcdir)/src/common/choiccmn.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/choiccmn.cpp @@ -25472,6 +25486,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@coredll_bookctrl.o: $(srcdir)/src/common/bookctrl.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/bookctrl.cpp +@COND_USE_GUI_1@coredll_btncmn.o: $(srcdir)/src/common/btncmn.cpp $(COREDLL_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/btncmn.cpp + @COND_USE_GUI_1@coredll_choiccmn.o: $(srcdir)/src/common/choiccmn.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/choiccmn.cpp @@ -28451,6 +28468,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@corelib_bookctrl.o: $(srcdir)/src/common/bookctrl.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/bookctrl.cpp +@COND_USE_GUI_1@corelib_btncmn.o: $(srcdir)/src/common/btncmn.cpp $(CORELIB_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/btncmn.cpp + @COND_USE_GUI_1@corelib_choiccmn.o: $(srcdir)/src/common/choiccmn.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/choiccmn.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index dba73a7d3c..1f74cf0d2e 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -578,6 +578,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/common/artstd.cpp src/common/bmpbase.cpp src/common/bookctrl.cpp + src/common/btncmn.cpp src/common/choiccmn.cpp src/common/clipcmn.cpp src/common/clrpickercmn.cpp diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index c226de4897..4bc9e9bae9 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -1571,6 +1571,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_artstd.obj \ $(OBJS)\monodll_bmpbase.obj \ $(OBJS)\monodll_bookctrl.obj \ + $(OBJS)\monodll_btncmn.obj \ $(OBJS)\monodll_choiccmn.obj \ $(OBJS)\monodll_clipcmn.obj \ $(OBJS)\monodll_clrpickercmn.obj \ @@ -1800,6 +1801,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_artstd.obj \ $(OBJS)\monodll_bmpbase.obj \ $(OBJS)\monodll_bookctrl.obj \ + $(OBJS)\monodll_btncmn.obj \ $(OBJS)\monodll_choiccmn.obj \ $(OBJS)\monodll_clipcmn.obj \ $(OBJS)\monodll_clrpickercmn.obj \ @@ -2200,6 +2202,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_artstd.obj \ $(OBJS)\monolib_bmpbase.obj \ $(OBJS)\monolib_bookctrl.obj \ + $(OBJS)\monolib_btncmn.obj \ $(OBJS)\monolib_choiccmn.obj \ $(OBJS)\monolib_clipcmn.obj \ $(OBJS)\monolib_clrpickercmn.obj \ @@ -2429,6 +2432,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_artstd.obj \ $(OBJS)\monolib_bmpbase.obj \ $(OBJS)\monolib_bookctrl.obj \ + $(OBJS)\monolib_btncmn.obj \ $(OBJS)\monolib_choiccmn.obj \ $(OBJS)\monolib_clipcmn.obj \ $(OBJS)\monolib_clrpickercmn.obj \ @@ -2746,6 +2750,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_artstd.obj \ $(OBJS)\coredll_bmpbase.obj \ $(OBJS)\coredll_bookctrl.obj \ + $(OBJS)\coredll_btncmn.obj \ $(OBJS)\coredll_choiccmn.obj \ $(OBJS)\coredll_clipcmn.obj \ $(OBJS)\coredll_clrpickercmn.obj \ @@ -2975,6 +2980,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_artstd.obj \ $(OBJS)\coredll_bmpbase.obj \ $(OBJS)\coredll_bookctrl.obj \ + $(OBJS)\coredll_btncmn.obj \ $(OBJS)\coredll_choiccmn.obj \ $(OBJS)\coredll_clipcmn.obj \ $(OBJS)\coredll_clrpickercmn.obj \ @@ -3205,6 +3211,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_artstd.obj \ $(OBJS)\corelib_bmpbase.obj \ $(OBJS)\corelib_bookctrl.obj \ + $(OBJS)\corelib_btncmn.obj \ $(OBJS)\corelib_choiccmn.obj \ $(OBJS)\corelib_clipcmn.obj \ $(OBJS)\corelib_clrpickercmn.obj \ @@ -3434,6 +3441,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_artstd.obj \ $(OBJS)\corelib_bmpbase.obj \ $(OBJS)\corelib_bookctrl.obj \ + $(OBJS)\corelib_btncmn.obj \ $(OBJS)\corelib_choiccmn.obj \ $(OBJS)\corelib_clipcmn.obj \ $(OBJS)\corelib_clrpickercmn.obj \ @@ -6467,6 +6475,11 @@ $(OBJS)\monodll_bookctrl.obj: ..\..\src\common\bookctrl.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_btncmn.obj: ..\..\src\common\btncmn.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_choiccmn.obj: ..\..\src\common\choiccmn.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** @@ -8516,6 +8529,11 @@ $(OBJS)\monolib_bookctrl.obj: ..\..\src\common\bookctrl.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_btncmn.obj: ..\..\src\common\btncmn.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_choiccmn.obj: ..\..\src\common\choiccmn.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** @@ -10592,6 +10610,11 @@ $(OBJS)\coredll_bookctrl.obj: ..\..\src\common\bookctrl.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\coredll_btncmn.obj: ..\..\src\common\btncmn.cpp + $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\coredll_choiccmn.obj: ..\..\src\common\choiccmn.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** @@ -11887,6 +11910,11 @@ $(OBJS)\corelib_bookctrl.obj: ..\..\src\common\bookctrl.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\corelib_btncmn.obj: ..\..\src\common\btncmn.cpp + $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\corelib_choiccmn.obj: ..\..\src\common\choiccmn.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index 6625990e9e..a3ccf69819 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -1581,6 +1581,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_artstd.o \ $(OBJS)\monodll_bmpbase.o \ $(OBJS)\monodll_bookctrl.o \ + $(OBJS)\monodll_btncmn.o \ $(OBJS)\monodll_choiccmn.o \ $(OBJS)\monodll_clipcmn.o \ $(OBJS)\monodll_clrpickercmn.o \ @@ -1812,6 +1813,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_artstd.o \ $(OBJS)\monodll_bmpbase.o \ $(OBJS)\monodll_bookctrl.o \ + $(OBJS)\monodll_btncmn.o \ $(OBJS)\monodll_choiccmn.o \ $(OBJS)\monodll_clipcmn.o \ $(OBJS)\monodll_clrpickercmn.o \ @@ -2216,6 +2218,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_artstd.o \ $(OBJS)\monolib_bmpbase.o \ $(OBJS)\monolib_bookctrl.o \ + $(OBJS)\monolib_btncmn.o \ $(OBJS)\monolib_choiccmn.o \ $(OBJS)\monolib_clipcmn.o \ $(OBJS)\monolib_clrpickercmn.o \ @@ -2447,6 +2450,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_artstd.o \ $(OBJS)\monolib_bmpbase.o \ $(OBJS)\monolib_bookctrl.o \ + $(OBJS)\monolib_btncmn.o \ $(OBJS)\monolib_choiccmn.o \ $(OBJS)\monolib_clipcmn.o \ $(OBJS)\monolib_clrpickercmn.o \ @@ -2778,6 +2782,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_artstd.o \ $(OBJS)\coredll_bmpbase.o \ $(OBJS)\coredll_bookctrl.o \ + $(OBJS)\coredll_btncmn.o \ $(OBJS)\coredll_choiccmn.o \ $(OBJS)\coredll_clipcmn.o \ $(OBJS)\coredll_clrpickercmn.o \ @@ -3009,6 +3014,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_artstd.o \ $(OBJS)\coredll_bmpbase.o \ $(OBJS)\coredll_bookctrl.o \ + $(OBJS)\coredll_btncmn.o \ $(OBJS)\coredll_choiccmn.o \ $(OBJS)\coredll_clipcmn.o \ $(OBJS)\coredll_clrpickercmn.o \ @@ -3245,6 +3251,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_artstd.o \ $(OBJS)\corelib_bmpbase.o \ $(OBJS)\corelib_bookctrl.o \ + $(OBJS)\corelib_btncmn.o \ $(OBJS)\corelib_choiccmn.o \ $(OBJS)\corelib_clipcmn.o \ $(OBJS)\corelib_clrpickercmn.o \ @@ -3476,6 +3483,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_artstd.o \ $(OBJS)\corelib_bmpbase.o \ $(OBJS)\corelib_bookctrl.o \ + $(OBJS)\corelib_btncmn.o \ $(OBJS)\corelib_choiccmn.o \ $(OBJS)\corelib_clipcmn.o \ $(OBJS)\corelib_clrpickercmn.o \ @@ -6726,6 +6734,11 @@ $(OBJS)\monodll_bookctrl.o: ../../src/common/bookctrl.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monodll_btncmn.o: ../../src/common/btncmn.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monodll_choiccmn.o: ../../src/common/choiccmn.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -8875,6 +8888,11 @@ $(OBJS)\monolib_bookctrl.o: ../../src/common/bookctrl.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monolib_btncmn.o: ../../src/common/btncmn.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monolib_choiccmn.o: ../../src/common/choiccmn.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -11051,6 +11069,11 @@ $(OBJS)\coredll_bookctrl.o: ../../src/common/bookctrl.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\coredll_btncmn.o: ../../src/common/btncmn.cpp + $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\coredll_choiccmn.o: ../../src/common/choiccmn.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< @@ -12446,6 +12469,11 @@ $(OBJS)\corelib_bookctrl.o: ../../src/common/bookctrl.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\corelib_btncmn.o: ../../src/common/btncmn.cpp + $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\corelib_choiccmn.o: ../../src/common/choiccmn.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index e10c912a69..3ac1b68da0 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -1749,6 +1749,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_artstd.obj \ $(OBJS)\monodll_bmpbase.obj \ $(OBJS)\monodll_bookctrl.obj \ + $(OBJS)\monodll_btncmn.obj \ $(OBJS)\monodll_choiccmn.obj \ $(OBJS)\monodll_clipcmn.obj \ $(OBJS)\monodll_clrpickercmn.obj \ @@ -1978,6 +1979,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_artstd.obj \ $(OBJS)\monodll_bmpbase.obj \ $(OBJS)\monodll_bookctrl.obj \ + $(OBJS)\monodll_btncmn.obj \ $(OBJS)\monodll_choiccmn.obj \ $(OBJS)\monodll_clipcmn.obj \ $(OBJS)\monodll_clrpickercmn.obj \ @@ -2384,6 +2386,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_artstd.obj \ $(OBJS)\monolib_bmpbase.obj \ $(OBJS)\monolib_bookctrl.obj \ + $(OBJS)\monolib_btncmn.obj \ $(OBJS)\monolib_choiccmn.obj \ $(OBJS)\monolib_clipcmn.obj \ $(OBJS)\monolib_clrpickercmn.obj \ @@ -2613,6 +2616,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_artstd.obj \ $(OBJS)\monolib_bmpbase.obj \ $(OBJS)\monolib_bookctrl.obj \ + $(OBJS)\monolib_btncmn.obj \ $(OBJS)\monolib_choiccmn.obj \ $(OBJS)\monolib_clipcmn.obj \ $(OBJS)\monolib_clrpickercmn.obj \ @@ -2960,6 +2964,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_artstd.obj \ $(OBJS)\coredll_bmpbase.obj \ $(OBJS)\coredll_bookctrl.obj \ + $(OBJS)\coredll_btncmn.obj \ $(OBJS)\coredll_choiccmn.obj \ $(OBJS)\coredll_clipcmn.obj \ $(OBJS)\coredll_clrpickercmn.obj \ @@ -3189,6 +3194,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_artstd.obj \ $(OBJS)\coredll_bmpbase.obj \ $(OBJS)\coredll_bookctrl.obj \ + $(OBJS)\coredll_btncmn.obj \ $(OBJS)\coredll_choiccmn.obj \ $(OBJS)\coredll_clipcmn.obj \ $(OBJS)\coredll_clrpickercmn.obj \ @@ -3425,6 +3431,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_artstd.obj \ $(OBJS)\corelib_bmpbase.obj \ $(OBJS)\corelib_bookctrl.obj \ + $(OBJS)\corelib_btncmn.obj \ $(OBJS)\corelib_choiccmn.obj \ $(OBJS)\corelib_clipcmn.obj \ $(OBJS)\corelib_clrpickercmn.obj \ @@ -3654,6 +3661,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_artstd.obj \ $(OBJS)\corelib_bmpbase.obj \ $(OBJS)\corelib_bookctrl.obj \ + $(OBJS)\corelib_btncmn.obj \ $(OBJS)\corelib_choiccmn.obj \ $(OBJS)\corelib_clipcmn.obj \ $(OBJS)\corelib_clrpickercmn.obj \ @@ -4489,7 +4497,7 @@ clean: -if exist $(LIBDIRNAME)\wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib del $(LIBDIRNAME)\wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib cd ..\..\samples $(MAKE) -f makefile.vc $(MAKEARGS) clean - cd $(MAKEDIR) + cd "$(MAKEDIR)" setup_h: $(SETUPHDIR)\wx ..\..\include\wx\$(__SETUP_H_SUBDIR_FILENAMES)\setup.h $(SETUPHDIR)\wx\setup.h $(SETUPHDIR)\wx\msw\rcdefs.h @@ -4838,7 +4846,7 @@ $(LIBDIRNAME)\wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXD sub_samples: cd ..\..\samples $(MAKE) -f makefile.vc $(MAKEARGS) all - cd $(MAKEDIR) + cd "$(MAKEDIR)" $(LIBDIRNAME): if not exist $(LIBDIRNAME) mkdir $(LIBDIRNAME) @@ -6819,6 +6827,11 @@ $(OBJS)\monodll_bookctrl.obj: ..\..\src\common\bookctrl.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_btncmn.obj: ..\..\src\common\btncmn.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_choiccmn.obj: ..\..\src\common\choiccmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** @@ -8868,6 +8881,11 @@ $(OBJS)\monolib_bookctrl.obj: ..\..\src\common\bookctrl.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_btncmn.obj: ..\..\src\common\btncmn.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_choiccmn.obj: ..\..\src\common\choiccmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** @@ -10944,6 +10962,11 @@ $(OBJS)\coredll_bookctrl.obj: ..\..\src\common\bookctrl.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\coredll_btncmn.obj: ..\..\src\common\btncmn.cpp + $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\coredll_choiccmn.obj: ..\..\src\common\choiccmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** @@ -12239,6 +12262,11 @@ $(OBJS)\corelib_bookctrl.obj: ..\..\src\common\bookctrl.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\corelib_btncmn.obj: ..\..\src\common\btncmn.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\corelib_choiccmn.obj: ..\..\src\common\choiccmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** diff --git a/build/msw/makefile.wat b/build/msw/makefile.wat index 91d38e381b..ed9ae0b105 100644 --- a/build/msw/makefile.wat +++ b/build/msw/makefile.wat @@ -321,6 +321,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_artstd.obj & $(OBJS)\monodll_bmpbase.obj & $(OBJS)\monodll_bookctrl.obj & + $(OBJS)\monodll_btncmn.obj & $(OBJS)\monodll_choiccmn.obj & $(OBJS)\monodll_clipcmn.obj & $(OBJS)\monodll_clrpickercmn.obj & @@ -552,6 +553,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_artstd.obj & $(OBJS)\monodll_bmpbase.obj & $(OBJS)\monodll_bookctrl.obj & + $(OBJS)\monodll_btncmn.obj & $(OBJS)\monodll_choiccmn.obj & $(OBJS)\monodll_clipcmn.obj & $(OBJS)\monodll_clrpickercmn.obj & @@ -960,6 +962,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_artstd.obj & $(OBJS)\monolib_bmpbase.obj & $(OBJS)\monolib_bookctrl.obj & + $(OBJS)\monolib_btncmn.obj & $(OBJS)\monolib_choiccmn.obj & $(OBJS)\monolib_clipcmn.obj & $(OBJS)\monolib_clrpickercmn.obj & @@ -1191,6 +1194,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_artstd.obj & $(OBJS)\monolib_bmpbase.obj & $(OBJS)\monolib_bookctrl.obj & + $(OBJS)\monolib_btncmn.obj & $(OBJS)\monolib_choiccmn.obj & $(OBJS)\monolib_clipcmn.obj & $(OBJS)\monolib_clrpickercmn.obj & @@ -1533,6 +1537,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_artstd.obj & $(OBJS)\coredll_bmpbase.obj & $(OBJS)\coredll_bookctrl.obj & + $(OBJS)\coredll_btncmn.obj & $(OBJS)\coredll_choiccmn.obj & $(OBJS)\coredll_clipcmn.obj & $(OBJS)\coredll_clrpickercmn.obj & @@ -1764,6 +1769,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_artstd.obj & $(OBJS)\coredll_bmpbase.obj & $(OBJS)\coredll_bookctrl.obj & + $(OBJS)\coredll_btncmn.obj & $(OBJS)\coredll_choiccmn.obj & $(OBJS)\coredll_clipcmn.obj & $(OBJS)\coredll_clrpickercmn.obj & @@ -2002,6 +2008,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_artstd.obj & $(OBJS)\corelib_bmpbase.obj & $(OBJS)\corelib_bookctrl.obj & + $(OBJS)\corelib_btncmn.obj & $(OBJS)\corelib_choiccmn.obj & $(OBJS)\corelib_clipcmn.obj & $(OBJS)\corelib_clrpickercmn.obj & @@ -2233,6 +2240,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_artstd.obj & $(OBJS)\corelib_bmpbase.obj & $(OBJS)\corelib_bookctrl.obj & + $(OBJS)\corelib_btncmn.obj & $(OBJS)\corelib_choiccmn.obj & $(OBJS)\corelib_clipcmn.obj & $(OBJS)\corelib_clrpickercmn.obj & @@ -6995,6 +7003,11 @@ $(OBJS)\monodll_bookctrl.obj : .AUTODEPEND ..\..\src\common\bookctrl.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\monodll_btncmn.obj : .AUTODEPEND ..\..\src\common\btncmn.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\monodll_choiccmn.obj : .AUTODEPEND ..\..\src\common\choiccmn.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< @@ -9144,6 +9157,11 @@ $(OBJS)\monolib_bookctrl.obj : .AUTODEPEND ..\..\src\common\bookctrl.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\monolib_btncmn.obj : .AUTODEPEND ..\..\src\common\btncmn.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\monolib_choiccmn.obj : .AUTODEPEND ..\..\src\common\choiccmn.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< @@ -11320,6 +11338,11 @@ $(OBJS)\coredll_bookctrl.obj : .AUTODEPEND ..\..\src\common\bookctrl.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\coredll_btncmn.obj : .AUTODEPEND ..\..\src\common\btncmn.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\coredll_choiccmn.obj : .AUTODEPEND ..\..\src\common\choiccmn.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< @@ -12715,6 +12738,11 @@ $(OBJS)\corelib_bookctrl.obj : .AUTODEPEND ..\..\src\common\bookctrl.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\corelib_btncmn.obj : .AUTODEPEND ..\..\src\common\btncmn.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\corelib_choiccmn.obj : .AUTODEPEND ..\..\src\common\choiccmn.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< diff --git a/build/msw/wx_core.dsp b/build/msw/wx_core.dsp index 9910953f9c..8eaba14b64 100644 --- a/build/msw/wx_core.dsp +++ b/build/msw/wx_core.dsp @@ -480,6 +480,10 @@ SOURCE=..\..\src\common\bookctrl.cpp # End Source File # Begin Source File +SOURCE=..\..\src\common\btncmn.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\common\choiccmn.cpp # End Source File # Begin Source File diff --git a/include/wx/button.h b/include/wx/button.h index ee53cf704d..89bef2b6b5 100644 --- a/include/wx/button.h +++ b/include/wx/button.h @@ -64,9 +64,10 @@ public: // set the margins around the image virtual void SetImageMargins(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) { } - // this wxButton method is called when the button becomes the default one - // on its panel - virtual void SetDefault() { } + // make this button the default button in its top level window + // + // returns the old default item (possibly NULL) + virtual wxWindow *SetDefault(); // Buttons on MSW can look bad if they are not native colours, because // then they become owner-drawn and not theme-drawn. Disable it here diff --git a/include/wx/gtk/bmpbuttn.h b/include/wx/gtk/bmpbuttn.h index 3af18cfeec..68fe9bb8a4 100644 --- a/include/wx/gtk/bmpbuttn.h +++ b/include/wx/gtk/bmpbuttn.h @@ -46,7 +46,6 @@ public: void SetLabel( const wxString &label ); virtual void SetLabel( const wxBitmap& bitmap ) { SetBitmapLabel(bitmap); } - virtual void SetDefault(); virtual bool Enable(bool enable = TRUE); // implementation diff --git a/include/wx/gtk/button.h b/include/wx/gtk/button.h index ce620dec41..190805702d 100644 --- a/include/wx/gtk/button.h +++ b/include/wx/gtk/button.h @@ -37,7 +37,7 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxButtonNameStr); - virtual void SetDefault(); + virtual wxWindow *SetDefault(); virtual void SetLabel( const wxString &label ); virtual bool Enable( bool enable = TRUE ); @@ -47,7 +47,7 @@ public: // Since this wxButton doesn't derive from wxButtonBase (why?) we need // to override this here too... virtual bool ShouldInheritColours() const { return false; } - + static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); diff --git a/include/wx/gtk1/bmpbuttn.h b/include/wx/gtk1/bmpbuttn.h index 0469870587..da79870b6c 100644 --- a/include/wx/gtk1/bmpbuttn.h +++ b/include/wx/gtk1/bmpbuttn.h @@ -46,7 +46,6 @@ public: void SetLabel( const wxString &label ); virtual void SetLabel( const wxBitmap& bitmap ) { SetBitmapLabel(bitmap); } - virtual void SetDefault(); virtual bool Enable(bool enable = TRUE); // implementation diff --git a/include/wx/gtk1/button.h b/include/wx/gtk1/button.h index aa5fe7b18f..380e669a8f 100644 --- a/include/wx/gtk1/button.h +++ b/include/wx/gtk1/button.h @@ -54,7 +54,7 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxButtonNameStr); - virtual void SetDefault(); + virtual wxWindow *SetDefault(); virtual void SetLabel( const wxString &label ); virtual bool Enable( bool enable = TRUE ); diff --git a/include/wx/mac/carbon/button.h b/include/wx/mac/carbon/button.h index c4abaea100..126e3ad6c5 100644 --- a/include/wx/mac/carbon/button.h +++ b/include/wx/mac/carbon/button.h @@ -20,33 +20,39 @@ WXDLLEXPORT_DATA(extern const wxChar) wxButtonNameStr[]; // Pushbutton class WXDLLEXPORT wxButton: public wxButtonBase { - DECLARE_DYNAMIC_CLASS(wxButton) - public: - inline wxButton() {} - inline wxButton(wxWindow *parent, wxWindowID id, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - +public: + wxButton() {} + wxButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; static wxSize GetDefaultSize(); - virtual void SetDefault(); - virtual void Command(wxCommandEvent& event); + virtual wxWindow *SetDefault(); + virtual void Command(wxCommandEvent& event); + protected: virtual wxSize DoGetBestSize() const ; + + DECLARE_DYNAMIC_CLASS(wxButton) }; #endif diff --git a/include/wx/motif/button.h b/include/wx/motif/button.h index 583578d668..58fa70b3c6 100644 --- a/include/wx/motif/button.h +++ b/include/wx/motif/button.h @@ -15,8 +15,6 @@ // Pushbutton class WXDLLEXPORT wxButton: public wxButtonBase { - DECLARE_DYNAMIC_CLASS(wxButton) - public: wxButton() { } wxButton(wxWindow *parent, @@ -37,23 +35,23 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxButtonNameStr); - virtual void SetDefault(); + virtual wxWindow *SetDefault(); virtual void Command(wxCommandEvent& event); static wxSize GetDefaultSize(); // Implementation -protected: + virtual wxSize GetMinSize() const; +protected: virtual wxSize DoGetBestSize() const; private: - - virtual wxSize GetMinSize() const; wxSize OldGetBestSize() const; wxSize OldGetMinSize() const; void SetDefaultShadowThicknessAndResize(); + + DECLARE_DYNAMIC_CLASS(wxButton) }; -#endif -// _WX_BUTTON_H_ +#endif // _WX_BUTTON_H_ diff --git a/include/wx/msw/bmpbuttn.h b/include/wx/msw/bmpbuttn.h index 93ee168fa7..86ffd452a4 100644 --- a/include/wx/msw/bmpbuttn.h +++ b/include/wx/msw/bmpbuttn.h @@ -44,7 +44,6 @@ public: // Implementation virtual bool SetBackgroundColour(const wxColour& colour); - virtual void SetDefault(); virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel ); virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel ); diff --git a/include/wx/msw/button.h b/include/wx/msw/button.h index 25f4ba1ad7..7fc7e0f0a2 100644 --- a/include/wx/msw/button.h +++ b/include/wx/msw/button.h @@ -43,7 +43,7 @@ public: virtual ~wxButton(); - virtual void SetDefault(); + virtual wxWindow *SetDefault(); // implementation from now on virtual void Command(wxCommandEvent& event); diff --git a/include/wx/os2/bmpbuttn.h b/include/wx/os2/bmpbuttn.h index 905d372a22..e7e2dfef31 100644 --- a/include/wx/os2/bmpbuttn.h +++ b/include/wx/os2/bmpbuttn.h @@ -66,7 +66,6 @@ public: // // Implementation // - virtual void SetDefault(); virtual bool OS2OnDraw(WXDRAWITEMSTRUCT* pItem); private: diff --git a/include/wx/os2/button.h b/include/wx/os2/button.h index 272bb08899..1d705ea936 100644 --- a/include/wx/os2/button.h +++ b/include/wx/os2/button.h @@ -49,10 +49,9 @@ class WXDLLEXPORT wxButton: public wxButtonBase ,const wxValidator& rValidator = wxDefaultValidator ,const wxString& rsName = wxButtonNameStr ); - + virtual ~wxButton(); - virtual void SetDefault(void); static wxSize GetDefaultSize(void); virtual void Command(wxCommandEvent& rEvent); virtual bool OS2Command( WXUINT uParam diff --git a/include/wx/palmos/bmpbuttn.h b/include/wx/palmos/bmpbuttn.h index e24bfbb874..f21f5bae67 100644 --- a/include/wx/palmos/bmpbuttn.h +++ b/include/wx/palmos/bmpbuttn.h @@ -44,7 +44,6 @@ public: const wxString& name = wxButtonNameStr); // Implementation - virtual void SetDefault(); virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel ); virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel ); virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg ); diff --git a/include/wx/palmos/button.h b/include/wx/palmos/button.h index cc45441469..4c1118b475 100644 --- a/include/wx/palmos/button.h +++ b/include/wx/palmos/button.h @@ -43,7 +43,7 @@ public: virtual ~wxButton(); - virtual void SetDefault(); + virtual wxWindow *SetDefault(); // implementation from now on virtual void Command(wxCommandEvent& event); diff --git a/include/wx/univ/button.h b/include/wx/univ/button.h index b9ce26f632..c5856b5ab7 100644 --- a/include/wx/univ/button.h +++ b/include/wx/univ/button.h @@ -89,7 +89,7 @@ public: virtual void SetImageLabel(const wxBitmap& bitmap); virtual void SetImageMargins(wxCoord x, wxCoord y); - virtual void SetDefault(); + virtual wxWindow *SetDefault(); virtual bool IsPressed() const { return m_isPressed; } virtual bool IsDefault() const { return m_isDefault; } diff --git a/src/common/btncmn.cpp b/src/common/btncmn.cpp new file mode 100644 index 0000000000..92e8103586 --- /dev/null +++ b/src/common/btncmn.cpp @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/common/btncmn.cpp +// Purpose: implementation of wxButtonBase +// Author: Vadim Zeitlin +// Created: 2007-04-08 +// RCS-ID: $Id$ +// Copyright: (c) 2007 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/button.h" + #include "wx/toplevel.h" +#endif //WX_PRECOMP + +// ============================================================================ +// implementation +// ============================================================================ + +wxWindow *wxButtonBase::SetDefault() +{ + wxTopLevelWindow * const + tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); + + wxCHECK_MSG( tlw, NULL, _T("button without top level window?") ); + + return tlw->SetDefaultItem(this); +} + diff --git a/src/gtk/bmpbuttn.cpp b/src/gtk/bmpbuttn.cpp index 6ec496ea1a..6a02c24538 100644 --- a/src/gtk/bmpbuttn.cpp +++ b/src/gtk/bmpbuttn.cpp @@ -165,14 +165,6 @@ bool wxBitmapButton::Create( wxWindow *parent, return true; } -void wxBitmapButton::SetDefault() -{ - GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); - gtk_widget_grab_default( m_widget ); - - SetSize( m_x, m_y, m_width, m_height ); -} - void wxBitmapButton::SetLabel( const wxString &label ) { wxCHECK_RET( m_widget != NULL, wxT("invalid button") ); diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index 3e4e83feeb..004b1cb41b 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -12,10 +12,8 @@ #if wxUSE_BUTTON -#include "wx/button.h" - #ifndef WX_PRECOMP - #include "wx/toplevel.h" + #include "wx/button.h" #endif #include "wx/stockitem.h" @@ -167,18 +165,17 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, } -void wxButton::SetDefault() +wxWindow *wxButton::SetDefault() { - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - wxCHECK_RET( tlw, _T("button without top level window?") ); - - tlw->SetDefaultItem(this); + wxWindow *oldDefault = wxButtonBase::SetDefault(); GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); gtk_widget_grab_default( m_widget ); // resize for default border gtk_button_style_set_callback( m_widget, NULL, this ); + + return oldDefault; } /* static */ diff --git a/src/gtk1/bmpbuttn.cpp b/src/gtk1/bmpbuttn.cpp index 91ed882377..62f3509404 100644 --- a/src/gtk1/bmpbuttn.cpp +++ b/src/gtk1/bmpbuttn.cpp @@ -172,14 +172,6 @@ bool wxBitmapButton::Create( wxWindow *parent, return true; } -void wxBitmapButton::SetDefault() -{ - GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); - gtk_widget_grab_default( m_widget ); - - SetSize( m_x, m_y, m_width, m_height ); -} - void wxBitmapButton::SetLabel( const wxString &label ) { wxCHECK_RET( m_widget != NULL, wxT("invalid button") ); diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index f84cfc3221..6d71384052 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -12,10 +12,8 @@ #if wxUSE_BUTTON -#include "wx/button.h" - #ifndef WX_PRECOMP - #include "wx/toplevel.h" + #include "wx/button.h" #endif #include "wx/stockitem.h" @@ -157,18 +155,17 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, } -void wxButton::SetDefault() +wxWindow *wxButton::SetDefault() { - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - wxCHECK_RET( tlw, _T("button without top level window?") ); - - tlw->SetDefaultItem(this); + wxWindow *oldDefault = wxButtonBase::SetDefault(); GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); gtk_widget_grab_default( m_widget ); // resize for default border gtk_button_style_set_callback( m_widget, NULL, this ); + + return oldDefault; } /* static */ diff --git a/src/motif/button.cpp b/src/motif/button.cpp index 5befa4d2f1..99324c3f9c 100644 --- a/src/motif/button.cpp +++ b/src/motif/button.cpp @@ -125,11 +125,9 @@ void wxButton::SetDefaultShadowThicknessAndResize() } -void wxButton::SetDefault() +wxWindow *wxButton::SetDefault() { - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - if ( tlw ) - tlw->SetDefaultItem(this); + wxWindow *oldDefault = wxButtonBase::SetDefault(); // We initially do not set XmNdefaultShadowThickness, to have // small buttons. Unfortunately, buttons are now mis-aligned. We @@ -151,6 +149,8 @@ void wxButton::SetDefault() XtVaSetValues ((Widget) parent->GetMainWidget(), XmNdefaultButton, (Widget) GetMainWidget(), NULL); + + return oldDefault; } static inline bool wxMotifLargeButtons() diff --git a/src/msw/bmpbuttn.cpp b/src/msw/bmpbuttn.cpp index 1d16f90dab..e20d012df2 100644 --- a/src/msw/bmpbuttn.cpp +++ b/src/msw/bmpbuttn.cpp @@ -582,11 +582,6 @@ wxBitmapButton::DrawButtonDisable( WXHDC dc, ::PatBlt( (HDC) dc, left, top, right, bottom, PATTERNPAINT); } -void wxBitmapButton::SetDefault() -{ - wxButton::SetDefault(); -} - wxSize wxBitmapButton::DoGetBestSize() const { if ( m_bmpNormal.Ok() ) diff --git a/src/msw/button.cpp b/src/msw/button.cpp index 13f270d4c5..7ca213e413 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -343,14 +343,10 @@ wxSize wxButtonBase::GetDefaultSize() */ // set this button as the (permanently) default one in its panel -void wxButton::SetDefault() +wxWindow *wxButton::SetDefault() { - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - - wxCHECK_RET( tlw, _T("button without top level window?") ); - // set this one as the default button both for wxWidgets ... - wxWindow *winOldDefault = tlw->SetDefaultItem(this); + wxWindow *winOldDefault = wxButtonBase::SetDefault(); // ... and Windows SetDefaultStyle(wxDynamicCast(winOldDefault, wxButton), false); diff --git a/src/os2/bmpbuttn.cpp b/src/os2/bmpbuttn.cpp index 9b7d91cebe..6bd9f29557 100644 --- a/src/os2/bmpbuttn.cpp +++ b/src/os2/bmpbuttn.cpp @@ -292,9 +292,4 @@ void wxBitmapButton::DrawButtonDisable( wxClientDC& rDC, wxDisableBitmap(rBmp, vGreyPen.GetColour().GetPixel()); } // end of wxBitmapButton::DrawButtonDisable -void wxBitmapButton::SetDefault() -{ - wxButton::SetDefault(); -} - #endif // ndef for wxUSE_BMPBUTTON diff --git a/src/os2/button.cpp b/src/os2/button.cpp index 746e0300c4..c237d91542 100644 --- a/src/os2/button.cpp +++ b/src/os2/button.cpp @@ -233,17 +233,15 @@ bool wxButton::SendClickEvent() void wxButton::SetDefault() { - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - - wxCHECK_RET( tlw, _T("button without top level window?") ); - // // Set this one as the default button both for wxWidgets and Windows // - wxWindow* pWinOldDefault = tlw->SetDefaultItem(this); + wxWindow* pWinOldDefault = wxButtonBase::Set(); SetDefaultStyle( wxDynamicCast(pWinOldDefault, wxButton), false); SetDefaultStyle( this, true ); + + return pWinOldDefault; } // end of wxButton::SetDefault void wxButton::SetTmpDefault() diff --git a/src/palmos/bmpbuttn.cpp b/src/palmos/bmpbuttn.cpp index 6755d15ce1..07523034e4 100644 --- a/src/palmos/bmpbuttn.cpp +++ b/src/palmos/bmpbuttn.cpp @@ -114,10 +114,6 @@ void wxBitmapButton::DrawButtonDisable( WXHDC dc, int left, int top, int right, { } -void wxBitmapButton::SetDefault() -{ -} - wxSize wxBitmapButton::DoGetBestSize() const { wxSize best; diff --git a/src/palmos/button.cpp b/src/palmos/button.cpp index fc794449ad..7b9be28910 100644 --- a/src/palmos/button.cpp +++ b/src/palmos/button.cpp @@ -196,12 +196,14 @@ wxSize wxButtonBase::GetDefaultSize() return wxSize(36,12); } -void wxButton::SetDefault() +wxWindow *wxButton::SetDefault() { FormType* form = (FormType* )GetParentForm(); if(form==NULL) return; FrmSetDefaultButtonID(form,GetId()); + + return wxButtonBase::SetDefault(); } void wxButton::SetTmpDefault() diff --git a/src/univ/button.cpp b/src/univ/button.cpp index c1a5aa5b20..7bda74e449 100644 --- a/src/univ/button.cpp +++ b/src/univ/button.cpp @@ -330,9 +330,11 @@ void wxButton::SetImageMargins(wxCoord x, wxCoord y) SetInitialSize(wxDefaultSize); } -void wxButton::SetDefault() +wxWindow *wxButton::SetDefault() { m_isDefault = true; + + return wxButtonBase::SetDefault(); } // ============================================================================ -- 2.45.2