From a340b80d8a692f5308d26c1c1b95fd689a1d7eb3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 8 May 2006 23:42:45 +0000 Subject: [PATCH] wxComboControl and wxOwnerDrawnComboBox (patch 1479938) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39113 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- Makefile.in | 100 +- build/bakefiles/files.bkl | 8 + build/msw/makefile.bcc | 96 ++ build/msw/makefile.gcc | 96 ++ build/msw/makefile.vc | 96 ++ build/msw/makefile.wat | 96 ++ build/msw/wx_adv.dsp | 8 + build/msw/wx_base.dsp | 4 + build/msw/wx_core.dsp | 87 ++ build/msw/wx_html.dsp | 4 + include/wx/combo.h | 633 ++++++++++++ include/wx/generic/combo.h | 135 +++ include/wx/msw/combo.h | 86 ++ include/wx/odcombo.h | 267 +++++ samples/combo/combo.bkl | 16 + samples/combo/combo.cpp | 990 ++++++++++++++++++ samples/combo/dropbuth.png | Bin 0 -> 371 bytes samples/combo/dropbutn.png | Bin 0 -> 237 bytes samples/combo/dropbutp.png | Bin 0 -> 366 bytes samples/samples.bkl | 1 + src/common/combocmn.cpp | 1944 ++++++++++++++++++++++++++++++++++++ src/common/popupcmn.cpp | 2 +- src/generic/combog.cpp | 364 +++++++ src/generic/odcombo.cpp | 737 ++++++++++++++ src/msw/combo.cpp | 521 ++++++++++ src/univ/combobox.cpp | 656 ++---------- src/wxWindows.dsp | 36 + 27 files changed, 6409 insertions(+), 574 deletions(-) create mode 100644 include/wx/combo.h create mode 100644 include/wx/generic/combo.h create mode 100644 include/wx/msw/combo.h create mode 100644 include/wx/odcombo.h create mode 100644 samples/combo/combo.bkl create mode 100644 samples/combo/combo.cpp create mode 100644 samples/combo/dropbuth.png create mode 100644 samples/combo/dropbutn.png create mode 100644 samples/combo/dropbutp.png create mode 100644 src/common/combocmn.cpp create mode 100644 src/generic/combog.cpp create mode 100644 src/generic/odcombo.cpp create mode 100644 src/msw/combo.cpp diff --git a/Makefile.in b/Makefile.in index c392635471..4b41e143ed 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2148,6 +2148,7 @@ COND_TOOLKIT_MSW_GUI_HDR = \ wx/msw/clipbrd.h \ wx/msw/colordlg.h \ wx/msw/colour.h \ + wx/msw/combo.h \ wx/msw/combobox.h \ wx/msw/control.h \ wx/msw/cursor.h \ @@ -2247,7 +2248,6 @@ COND_TOOLKIT_MSW_GUI_HDR = \ wx/msw/checklst.h \ wx/msw/fdrepdlg.h \ wx/msw/fontdlg.h \ - wx/msw/helpbest.h \ wx/msw/ole/automtn.h \ wx/msw/ole/uuid.h @COND_TOOLKIT_MSW@GUI_HDR = $(COND_TOOLKIT_MSW_GUI_HDR) @@ -2339,6 +2339,7 @@ COND_TOOLKIT_WINCE_GUI_HDR = \ wx/msw/clipbrd.h \ wx/msw/colordlg.h \ wx/msw/colour.h \ + wx/msw/combo.h \ wx/msw/combobox.h \ wx/msw/control.h \ wx/msw/cursor.h \ @@ -2491,6 +2492,7 @@ COND_WXUNIV_0_ADVANCED_HDR = \ wx/grid.h \ wx/joystick.h \ wx/laywin.h \ + wx/odcombo.h \ wx/propdlg.h \ wx/sashwin.h \ wx/sound.h \ @@ -2529,6 +2531,7 @@ COND_WXUNIV_1_ADVANCED_HDR = \ wx/grid.h \ wx/joystick.h \ wx/laywin.h \ + wx/odcombo.h \ wx/propdlg.h \ wx/sashwin.h \ wx/sound.h \ @@ -2608,6 +2611,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \ wx/choicdlg.h \ wx/choice.h \ wx/cmndata.h \ + wx/combo.h \ wx/combobox.h \ wx/control.h \ wx/ctrlsub.h \ @@ -2629,6 +2633,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \ wx/generic/accel.h \ wx/generic/choicdgg.h \ wx/generic/colrdlgg.h \ + wx/generic/combo.h \ wx/generic/dcpsg.h \ wx/generic/dirctrlg.h \ wx/generic/dragimgg.h \ @@ -2796,6 +2801,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \ wx/html/winpars.h \ wx/wxhtml.h \ wx/htmllbox.h \ + wx/msw/helpbest.h \ $(OPENGL_HDR) \ wx/debugrpt.h \ wx/dbgrid.h \ @@ -3139,6 +3145,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS = \ monodll_choiccmn.o \ monodll_clipcmn.o \ monodll_colourcmn.o \ + monodll_combocmn.o \ monodll_cmdproc.o \ monodll_cmndata.o \ monodll_containr.o \ @@ -3209,6 +3216,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS = \ monodll_busyinfo.o \ monodll_choicdgg.o \ monodll_choicbkg.o \ + monodll_combog.o \ monodll_dcpsg.o \ monodll_dirctrlg.o \ monodll_dragimgg.o \ @@ -3291,6 +3299,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS = \ monodll_choiccmn.o \ monodll_clipcmn.o \ monodll_colourcmn.o \ + monodll_combocmn.o \ monodll_cmdproc.o \ monodll_cmndata.o \ monodll_containr.o \ @@ -3361,6 +3370,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS = \ monodll_busyinfo.o \ monodll_choicdgg.o \ monodll_choicbkg.o \ + monodll_combog.o \ monodll_dcpsg.o \ monodll_dirctrlg.o \ monodll_dragimgg.o \ @@ -3989,6 +3999,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS = \ monodll_checkbox.o \ monodll_choice.o \ monodll_colordlg.o \ + monodll_combo.o \ monodll_combobox.o \ monodll_control.o \ monodll_dialog.o \ @@ -4122,6 +4133,7 @@ COND_TOOLKIT_WINCE___GUI_SRC_OBJECTS = \ monodll_checkbox.o \ monodll_choice.o \ monodll_colordlg.o \ + monodll_combo.o \ monodll_combobox.o \ monodll_control.o \ monodll_dialog.o \ @@ -4450,6 +4462,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS = \ monodll_gridsel.o \ monodll_helpext.o \ monodll_laywin.o \ + monodll_odcombo.o \ monodll_propdlg.o \ monodll_sashwin.o \ monodll_splash.o \ @@ -4474,6 +4487,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS = \ monodll_gridsel.o \ monodll_helpext.o \ monodll_laywin.o \ + monodll_odcombo.o \ monodll_propdlg.o \ monodll_sashwin.o \ monodll_splash.o \ @@ -4766,6 +4780,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_1 = \ monolib_choiccmn.o \ monolib_clipcmn.o \ monolib_colourcmn.o \ + monolib_combocmn.o \ monolib_cmdproc.o \ monolib_cmndata.o \ monolib_containr.o \ @@ -4836,6 +4851,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_1 = \ monolib_busyinfo.o \ monolib_choicdgg.o \ monolib_choicbkg.o \ + monolib_combog.o \ monolib_dcpsg.o \ monolib_dirctrlg.o \ monolib_dragimgg.o \ @@ -4918,6 +4934,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 = \ monolib_choiccmn.o \ monolib_clipcmn.o \ monolib_colourcmn.o \ + monolib_combocmn.o \ monolib_cmdproc.o \ monolib_cmndata.o \ monolib_containr.o \ @@ -4988,6 +5005,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 = \ monolib_busyinfo.o \ monolib_choicdgg.o \ monolib_choicbkg.o \ + monolib_combog.o \ monolib_dcpsg.o \ monolib_dirctrlg.o \ monolib_dragimgg.o \ @@ -5617,6 +5635,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS_1 = \ monolib_checkbox.o \ monolib_choice.o \ monolib_colordlg.o \ + monolib_combo.o \ monolib_combobox.o \ monolib_control.o \ monolib_dialog.o \ @@ -5750,6 +5769,7 @@ COND_TOOLKIT_WINCE___GUI_SRC_OBJECTS_1 = \ monolib_checkbox.o \ monolib_choice.o \ monolib_colordlg.o \ + monolib_combo.o \ monolib_combobox.o \ monolib_control.o \ monolib_dialog.o \ @@ -6079,6 +6099,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_1 = \ monolib_gridsel.o \ monolib_helpext.o \ monolib_laywin.o \ + monolib_odcombo.o \ monolib_propdlg.o \ monolib_sashwin.o \ monolib_splash.o \ @@ -6103,6 +6124,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_1 = \ monolib_gridsel.o \ monolib_helpext.o \ monolib_laywin.o \ + monolib_odcombo.o \ monolib_propdlg.o \ monolib_sashwin.o \ monolib_splash.o \ @@ -6627,6 +6649,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_2 = \ coredll_choiccmn.o \ coredll_clipcmn.o \ coredll_colourcmn.o \ + coredll_combocmn.o \ coredll_cmdproc.o \ coredll_cmndata.o \ coredll_containr.o \ @@ -6697,6 +6720,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_2 = \ coredll_busyinfo.o \ coredll_choicdgg.o \ coredll_choicbkg.o \ + coredll_combog.o \ coredll_dcpsg.o \ coredll_dirctrlg.o \ coredll_dragimgg.o \ @@ -6779,6 +6803,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 = \ coredll_choiccmn.o \ coredll_clipcmn.o \ coredll_colourcmn.o \ + coredll_combocmn.o \ coredll_cmdproc.o \ coredll_cmndata.o \ coredll_containr.o \ @@ -6849,6 +6874,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 = \ coredll_busyinfo.o \ coredll_choicdgg.o \ coredll_choicbkg.o \ + coredll_combog.o \ coredll_dcpsg.o \ coredll_dirctrlg.o \ coredll_dragimgg.o \ @@ -7478,6 +7504,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS_2 = \ coredll_checkbox.o \ coredll_choice.o \ coredll_colordlg.o \ + coredll_combo.o \ coredll_combobox.o \ coredll_control.o \ coredll_dialog.o \ @@ -7611,6 +7638,7 @@ COND_TOOLKIT_WINCE___GUI_SRC_OBJECTS_2 = \ coredll_checkbox.o \ coredll_choice.o \ coredll_colordlg.o \ + coredll_combo.o \ coredll_combobox.o \ coredll_control.o \ coredll_dialog.o \ @@ -7960,6 +7988,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_3 = \ corelib_choiccmn.o \ corelib_clipcmn.o \ corelib_colourcmn.o \ + corelib_combocmn.o \ corelib_cmdproc.o \ corelib_cmndata.o \ corelib_containr.o \ @@ -8030,6 +8059,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_3 = \ corelib_busyinfo.o \ corelib_choicdgg.o \ corelib_choicbkg.o \ + corelib_combog.o \ corelib_dcpsg.o \ corelib_dirctrlg.o \ corelib_dragimgg.o \ @@ -8112,6 +8142,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 = \ corelib_choiccmn.o \ corelib_clipcmn.o \ corelib_colourcmn.o \ + corelib_combocmn.o \ corelib_cmdproc.o \ corelib_cmndata.o \ corelib_containr.o \ @@ -8182,6 +8213,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 = \ corelib_busyinfo.o \ corelib_choicdgg.o \ corelib_choicbkg.o \ + corelib_combog.o \ corelib_dcpsg.o \ corelib_dirctrlg.o \ corelib_dragimgg.o \ @@ -8811,6 +8843,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS_3 = \ corelib_checkbox.o \ corelib_choice.o \ corelib_colordlg.o \ + corelib_combo.o \ corelib_combobox.o \ corelib_control.o \ corelib_dialog.o \ @@ -8944,6 +8977,7 @@ COND_TOOLKIT_WINCE___GUI_SRC_OBJECTS_3 = \ corelib_checkbox.o \ corelib_choice.o \ corelib_colordlg.o \ + corelib_combo.o \ corelib_combobox.o \ corelib_control.o \ corelib_dialog.o \ @@ -9319,6 +9353,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_2 = \ advdll_gridsel.o \ advdll_helpext.o \ advdll_laywin.o \ + advdll_odcombo.o \ advdll_propdlg.o \ advdll_sashwin.o \ advdll_splash.o \ @@ -9343,6 +9378,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_2 = \ advdll_gridsel.o \ advdll_helpext.o \ advdll_laywin.o \ + advdll_odcombo.o \ advdll_propdlg.o \ advdll_sashwin.o \ advdll_splash.o \ @@ -9382,6 +9418,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_3 = \ advlib_gridsel.o \ advlib_helpext.o \ advlib_laywin.o \ + advlib_odcombo.o \ advlib_propdlg.o \ advlib_sashwin.o \ advlib_splash.o \ @@ -9406,6 +9443,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_3 = \ advlib_gridsel.o \ advlib_helpext.o \ advlib_laywin.o \ + advlib_odcombo.o \ advlib_propdlg.o \ advlib_sashwin.o \ advlib_splash.o \ @@ -14328,6 +14366,12 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_USE_GUI_1_WXUNIV_1@monodll_toolbar.o: $(srcdir)/src/univ/toolbar.cpp $(MONODLL_ODEP) @COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/univ/toolbar.cpp +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monodll_combo.o: $(srcdir)/src/msw/combo.cpp $(MONODLL_ODEP) +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/combo.cpp + +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monodll_combo.o: $(srcdir)/src/msw/combo.cpp $(MONODLL_ODEP) +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/combo.cpp + @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monodll_dragimag.o: $(srcdir)/src/msw/dragimag.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/dragimag.cpp @@ -14487,6 +14531,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@monodll_colourcmn.o: $(srcdir)/src/common/colourcmn.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/colourcmn.cpp +@COND_USE_GUI_1@monodll_combocmn.o: $(srcdir)/src/common/combocmn.cpp $(MONODLL_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/combocmn.cpp + @COND_USE_GUI_1@monodll_cmdproc.o: $(srcdir)/src/common/cmdproc.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/cmdproc.cpp @@ -14697,6 +14744,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@monodll_choicbkg.o: $(srcdir)/src/generic/choicbkg.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/choicbkg.cpp +@COND_USE_GUI_1@monodll_combog.o: $(srcdir)/src/generic/combog.cpp $(MONODLL_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/combog.cpp + @COND_USE_GUI_1@monodll_dcpsg.o: $(srcdir)/src/generic/dcpsg.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/dcpsg.cpp @@ -14790,6 +14840,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@monodll_laywin.o: $(srcdir)/src/generic/laywin.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/laywin.cpp +@COND_USE_GUI_1@monodll_odcombo.o: $(srcdir)/src/generic/odcombo.cpp $(MONODLL_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/odcombo.cpp + @COND_USE_GUI_1@monodll_propdlg.o: $(srcdir)/src/generic/propdlg.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/propdlg.cpp @@ -18123,6 +18176,12 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1_WXUNIV_1@monolib_toolbar.o: $(srcdir)/src/univ/toolbar.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/univ/toolbar.cpp +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monolib_combo.o: $(srcdir)/src/msw/combo.cpp $(MONOLIB_ODEP) +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/combo.cpp + +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@monolib_combo.o: $(srcdir)/src/msw/combo.cpp $(MONOLIB_ODEP) +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/combo.cpp + @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@monolib_dragimag.o: $(srcdir)/src/msw/dragimag.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/dragimag.cpp @@ -18282,6 +18341,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@monolib_colourcmn.o: $(srcdir)/src/common/colourcmn.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/colourcmn.cpp +@COND_USE_GUI_1@monolib_combocmn.o: $(srcdir)/src/common/combocmn.cpp $(MONOLIB_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/combocmn.cpp + @COND_USE_GUI_1@monolib_cmdproc.o: $(srcdir)/src/common/cmdproc.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/cmdproc.cpp @@ -18492,6 +18554,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@monolib_choicbkg.o: $(srcdir)/src/generic/choicbkg.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/choicbkg.cpp +@COND_USE_GUI_1@monolib_combog.o: $(srcdir)/src/generic/combog.cpp $(MONOLIB_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/combog.cpp + @COND_USE_GUI_1@monolib_dcpsg.o: $(srcdir)/src/generic/dcpsg.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/dcpsg.cpp @@ -18585,6 +18650,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@monolib_laywin.o: $(srcdir)/src/generic/laywin.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/laywin.cpp +@COND_USE_GUI_1@monolib_odcombo.o: $(srcdir)/src/generic/odcombo.cpp $(MONOLIB_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/odcombo.cpp + @COND_USE_GUI_1@monolib_propdlg.o: $(srcdir)/src/generic/propdlg.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/propdlg.cpp @@ -22338,6 +22406,12 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP) @COND_USE_GUI_1_WXUNIV_1@coredll_toolbar.o: $(srcdir)/src/univ/toolbar.cpp $(COREDLL_ODEP) @COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/univ/toolbar.cpp +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@coredll_combo.o: $(srcdir)/src/msw/combo.cpp $(COREDLL_ODEP) +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/combo.cpp + +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@coredll_combo.o: $(srcdir)/src/msw/combo.cpp $(COREDLL_ODEP) +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/combo.cpp + @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@coredll_dragimag.o: $(srcdir)/src/msw/dragimag.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/dragimag.cpp @@ -22464,6 +22538,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@coredll_colourcmn.o: $(srcdir)/src/common/colourcmn.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/colourcmn.cpp +@COND_USE_GUI_1@coredll_combocmn.o: $(srcdir)/src/common/combocmn.cpp $(COREDLL_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/combocmn.cpp + @COND_USE_GUI_1@coredll_cmdproc.o: $(srcdir)/src/common/cmdproc.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/cmdproc.cpp @@ -22674,6 +22751,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@coredll_choicbkg.o: $(srcdir)/src/generic/choicbkg.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/choicbkg.cpp +@COND_USE_GUI_1@coredll_combog.o: $(srcdir)/src/generic/combog.cpp $(COREDLL_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/combog.cpp + @COND_USE_GUI_1@coredll_dcpsg.o: $(srcdir)/src/generic/dcpsg.cpp $(COREDLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/dcpsg.cpp @@ -25113,6 +25193,12 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP) @COND_USE_GUI_1_WXUNIV_1@corelib_toolbar.o: $(srcdir)/src/univ/toolbar.cpp $(CORELIB_ODEP) @COND_USE_GUI_1_WXUNIV_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/univ/toolbar.cpp +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@corelib_combo.o: $(srcdir)/src/msw/combo.cpp $(CORELIB_ODEP) +@COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/combo.cpp + +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@corelib_combo.o: $(srcdir)/src/msw/combo.cpp $(CORELIB_ODEP) +@COND_TOOLKIT_WINCE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/combo.cpp + @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@corelib_dragimag.o: $(srcdir)/src/msw/dragimag.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/dragimag.cpp @@ -25239,6 +25325,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@corelib_colourcmn.o: $(srcdir)/src/common/colourcmn.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/colourcmn.cpp +@COND_USE_GUI_1@corelib_combocmn.o: $(srcdir)/src/common/combocmn.cpp $(CORELIB_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/combocmn.cpp + @COND_USE_GUI_1@corelib_cmdproc.o: $(srcdir)/src/common/cmdproc.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/cmdproc.cpp @@ -25449,6 +25538,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@corelib_choicbkg.o: $(srcdir)/src/generic/choicbkg.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/choicbkg.cpp +@COND_USE_GUI_1@corelib_combog.o: $(srcdir)/src/generic/combog.cpp $(CORELIB_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/combog.cpp + @COND_USE_GUI_1@corelib_dcpsg.o: $(srcdir)/src/generic/dcpsg.cpp $(CORELIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/dcpsg.cpp @@ -25548,6 +25640,9 @@ advdll_helpext.o: $(srcdir)/src/generic/helpext.cpp $(ADVDLL_ODEP) advdll_laywin.o: $(srcdir)/src/generic/laywin.cpp $(ADVDLL_ODEP) $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/generic/laywin.cpp +advdll_odcombo.o: $(srcdir)/src/generic/odcombo.cpp $(ADVDLL_ODEP) + $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/generic/odcombo.cpp + advdll_propdlg.o: $(srcdir)/src/generic/propdlg.cpp $(ADVDLL_ODEP) $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/generic/propdlg.cpp @@ -25725,6 +25820,9 @@ advlib_helpext.o: $(srcdir)/src/generic/helpext.cpp $(ADVLIB_ODEP) advlib_laywin.o: $(srcdir)/src/generic/laywin.cpp $(ADVLIB_ODEP) $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/generic/laywin.cpp +advlib_odcombo.o: $(srcdir)/src/generic/odcombo.cpp $(ADVLIB_ODEP) + $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/generic/odcombo.cpp + advlib_propdlg.o: $(srcdir)/src/generic/propdlg.cpp $(ADVLIB_ODEP) $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/generic/propdlg.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 080d547885..90b5c1411b 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -553,6 +553,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/common/choiccmn.cpp src/common/clipcmn.cpp src/common/colourcmn.cpp + src/common/combocmn.cpp src/common/cmdproc.cpp src/common/cmndata.cpp src/common/containr.cpp @@ -623,6 +624,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/generic/busyinfo.cpp src/generic/choicdgg.cpp src/generic/choicbkg.cpp + src/generic/combog.cpp src/generic/dcpsg.cpp src/generic/dirctrlg.cpp src/generic/dragimgg.cpp @@ -654,6 +656,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/choicdlg.h wx/choice.h wx/cmndata.h + wx/combo.h wx/combobox.h wx/control.h wx/ctrlsub.h @@ -675,6 +678,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/generic/accel.h wx/generic/choicdgg.h wx/generic/colrdlgg.h + wx/generic/combo.h wx/generic/dcpsg.h wx/generic/dirctrlg.h wx/generic/dragimgg.h @@ -1481,6 +1485,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/msw/checkbox.cpp src/msw/choice.cpp src/msw/colordlg.cpp + src/msw/combo.cpp src/msw/combobox.cpp src/msw/control.cpp src/msw/dialog.cpp @@ -1532,6 +1537,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/msw/clipbrd.h wx/msw/colordlg.h wx/msw/colour.h + wx/msw/combo.h wx/msw/combobox.h wx/msw/control.h wx/msw/cursor.h @@ -2518,6 +2524,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/generic/gridsel.cpp src/generic/helpext.cpp src/generic/laywin.cpp + src/generic/odcombo.cpp src/generic/propdlg.cpp src/generic/sashwin.cpp src/generic/splash.cpp @@ -2551,6 +2558,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/grid.h wx/joystick.h wx/laywin.h + wx/odcombo.h wx/propdlg.h wx/sashwin.h wx/sound.h diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index 8cdcf2dfc9..baa1e406cd 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -1203,6 +1203,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_checkbox.obj \ $(OBJS)\monodll_choice.obj \ $(OBJS)\monodll_colordlg.obj \ + $(OBJS)\monodll_combo.obj \ $(OBJS)\monodll_combobox.obj \ $(OBJS)\monodll_control.obj \ $(OBJS)\monodll_dialog.obj \ @@ -1252,6 +1253,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_choiccmn.obj \ $(OBJS)\monodll_clipcmn.obj \ $(OBJS)\monodll_colourcmn.obj \ + $(OBJS)\monodll_combocmn.obj \ $(OBJS)\monodll_cmdproc.obj \ $(OBJS)\monodll_cmndata.obj \ $(OBJS)\monodll_containr.obj \ @@ -1322,6 +1324,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_busyinfo.obj \ $(OBJS)\monodll_choicdgg.obj \ $(OBJS)\monodll_choicbkg.obj \ + $(OBJS)\monodll_combog.obj \ $(OBJS)\monodll_dcpsg.obj \ $(OBJS)\monodll_dirctrlg.obj \ $(OBJS)\monodll_dragimgg.obj \ @@ -1452,6 +1455,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_choiccmn.obj \ $(OBJS)\monodll_clipcmn.obj \ $(OBJS)\monodll_colourcmn.obj \ + $(OBJS)\monodll_combocmn.obj \ $(OBJS)\monodll_cmdproc.obj \ $(OBJS)\monodll_cmndata.obj \ $(OBJS)\monodll_containr.obj \ @@ -1522,6 +1526,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_busyinfo.obj \ $(OBJS)\monodll_choicdgg.obj \ $(OBJS)\monodll_choicbkg.obj \ + $(OBJS)\monodll_combog.obj \ $(OBJS)\monodll_dcpsg.obj \ $(OBJS)\monodll_dirctrlg.obj \ $(OBJS)\monodll_dragimgg.obj \ @@ -1556,6 +1561,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gridsel.obj \ $(OBJS)\monodll_helpext.obj \ $(OBJS)\monodll_laywin.obj \ + $(OBJS)\monodll_odcombo.obj \ $(OBJS)\monodll_propdlg.obj \ $(OBJS)\monodll_sashwin.obj \ $(OBJS)\monodll_splash.obj \ @@ -1584,6 +1590,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gridsel.obj \ $(OBJS)\monodll_helpext.obj \ $(OBJS)\monodll_laywin.obj \ + $(OBJS)\monodll_odcombo.obj \ $(OBJS)\monodll_propdlg.obj \ $(OBJS)\monodll_sashwin.obj \ $(OBJS)\monodll_splash.obj \ @@ -1744,6 +1751,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_checkbox.obj \ $(OBJS)\monolib_choice.obj \ $(OBJS)\monolib_colordlg.obj \ + $(OBJS)\monolib_combo.obj \ $(OBJS)\monolib_combobox.obj \ $(OBJS)\monolib_control.obj \ $(OBJS)\monolib_dialog.obj \ @@ -1793,6 +1801,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_choiccmn.obj \ $(OBJS)\monolib_clipcmn.obj \ $(OBJS)\monolib_colourcmn.obj \ + $(OBJS)\monolib_combocmn.obj \ $(OBJS)\monolib_cmdproc.obj \ $(OBJS)\monolib_cmndata.obj \ $(OBJS)\monolib_containr.obj \ @@ -1863,6 +1872,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_busyinfo.obj \ $(OBJS)\monolib_choicdgg.obj \ $(OBJS)\monolib_choicbkg.obj \ + $(OBJS)\monolib_combog.obj \ $(OBJS)\monolib_dcpsg.obj \ $(OBJS)\monolib_dirctrlg.obj \ $(OBJS)\monolib_dragimgg.obj \ @@ -1993,6 +2003,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_choiccmn.obj \ $(OBJS)\monolib_clipcmn.obj \ $(OBJS)\monolib_colourcmn.obj \ + $(OBJS)\monolib_combocmn.obj \ $(OBJS)\monolib_cmdproc.obj \ $(OBJS)\monolib_cmndata.obj \ $(OBJS)\monolib_containr.obj \ @@ -2063,6 +2074,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_busyinfo.obj \ $(OBJS)\monolib_choicdgg.obj \ $(OBJS)\monolib_choicbkg.obj \ + $(OBJS)\monolib_combog.obj \ $(OBJS)\monolib_dcpsg.obj \ $(OBJS)\monolib_dirctrlg.obj \ $(OBJS)\monolib_dragimgg.obj \ @@ -2097,6 +2109,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gridsel.obj \ $(OBJS)\monolib_helpext.obj \ $(OBJS)\monolib_laywin.obj \ + $(OBJS)\monolib_odcombo.obj \ $(OBJS)\monolib_propdlg.obj \ $(OBJS)\monolib_sashwin.obj \ $(OBJS)\monolib_splash.obj \ @@ -2125,6 +2138,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gridsel.obj \ $(OBJS)\monolib_helpext.obj \ $(OBJS)\monolib_laywin.obj \ + $(OBJS)\monolib_odcombo.obj \ $(OBJS)\monolib_propdlg.obj \ $(OBJS)\monolib_sashwin.obj \ $(OBJS)\monolib_splash.obj \ @@ -2218,6 +2232,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_checkbox.obj \ $(OBJS)\coredll_choice.obj \ $(OBJS)\coredll_colordlg.obj \ + $(OBJS)\coredll_combo.obj \ $(OBJS)\coredll_combobox.obj \ $(OBJS)\coredll_control.obj \ $(OBJS)\coredll_dialog.obj \ @@ -2267,6 +2282,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_choiccmn.obj \ $(OBJS)\coredll_clipcmn.obj \ $(OBJS)\coredll_colourcmn.obj \ + $(OBJS)\coredll_combocmn.obj \ $(OBJS)\coredll_cmdproc.obj \ $(OBJS)\coredll_cmndata.obj \ $(OBJS)\coredll_containr.obj \ @@ -2337,6 +2353,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_busyinfo.obj \ $(OBJS)\coredll_choicdgg.obj \ $(OBJS)\coredll_choicbkg.obj \ + $(OBJS)\coredll_combog.obj \ $(OBJS)\coredll_dcpsg.obj \ $(OBJS)\coredll_dirctrlg.obj \ $(OBJS)\coredll_dragimgg.obj \ @@ -2467,6 +2484,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_choiccmn.obj \ $(OBJS)\coredll_clipcmn.obj \ $(OBJS)\coredll_colourcmn.obj \ + $(OBJS)\coredll_combocmn.obj \ $(OBJS)\coredll_cmdproc.obj \ $(OBJS)\coredll_cmndata.obj \ $(OBJS)\coredll_containr.obj \ @@ -2537,6 +2555,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_busyinfo.obj \ $(OBJS)\coredll_choicdgg.obj \ $(OBJS)\coredll_choicbkg.obj \ + $(OBJS)\coredll_combog.obj \ $(OBJS)\coredll_dcpsg.obj \ $(OBJS)\coredll_dirctrlg.obj \ $(OBJS)\coredll_dragimgg.obj \ @@ -2621,6 +2640,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_checkbox.obj \ $(OBJS)\corelib_choice.obj \ $(OBJS)\corelib_colordlg.obj \ + $(OBJS)\corelib_combo.obj \ $(OBJS)\corelib_combobox.obj \ $(OBJS)\corelib_control.obj \ $(OBJS)\corelib_dialog.obj \ @@ -2670,6 +2690,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_choiccmn.obj \ $(OBJS)\corelib_clipcmn.obj \ $(OBJS)\corelib_colourcmn.obj \ + $(OBJS)\corelib_combocmn.obj \ $(OBJS)\corelib_cmdproc.obj \ $(OBJS)\corelib_cmndata.obj \ $(OBJS)\corelib_containr.obj \ @@ -2740,6 +2761,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_busyinfo.obj \ $(OBJS)\corelib_choicdgg.obj \ $(OBJS)\corelib_choicbkg.obj \ + $(OBJS)\corelib_combog.obj \ $(OBJS)\corelib_dcpsg.obj \ $(OBJS)\corelib_dirctrlg.obj \ $(OBJS)\corelib_dragimgg.obj \ @@ -2870,6 +2892,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_choiccmn.obj \ $(OBJS)\corelib_clipcmn.obj \ $(OBJS)\corelib_colourcmn.obj \ + $(OBJS)\corelib_combocmn.obj \ $(OBJS)\corelib_cmdproc.obj \ $(OBJS)\corelib_cmndata.obj \ $(OBJS)\corelib_containr.obj \ @@ -2940,6 +2963,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_busyinfo.obj \ $(OBJS)\corelib_choicdgg.obj \ $(OBJS)\corelib_choicbkg.obj \ + $(OBJS)\corelib_combog.obj \ $(OBJS)\corelib_dcpsg.obj \ $(OBJS)\corelib_dirctrlg.obj \ $(OBJS)\corelib_dragimgg.obj \ @@ -2978,6 +3002,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\advdll_gridsel.obj \ $(OBJS)\advdll_helpext.obj \ $(OBJS)\advdll_laywin.obj \ + $(OBJS)\advdll_odcombo.obj \ $(OBJS)\advdll_propdlg.obj \ $(OBJS)\advdll_sashwin.obj \ $(OBJS)\advdll_splash.obj \ @@ -3006,6 +3031,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\advdll_gridsel.obj \ $(OBJS)\advdll_helpext.obj \ $(OBJS)\advdll_laywin.obj \ + $(OBJS)\advdll_odcombo.obj \ $(OBJS)\advdll_propdlg.obj \ $(OBJS)\advdll_sashwin.obj \ $(OBJS)\advdll_splash.obj \ @@ -3037,6 +3063,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\advlib_gridsel.obj \ $(OBJS)\advlib_helpext.obj \ $(OBJS)\advlib_laywin.obj \ + $(OBJS)\advlib_odcombo.obj \ $(OBJS)\advlib_propdlg.obj \ $(OBJS)\advlib_sashwin.obj \ $(OBJS)\advlib_splash.obj \ @@ -3065,6 +3092,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\advlib_gridsel.obj \ $(OBJS)\advlib_helpext.obj \ $(OBJS)\advlib_laywin.obj \ + $(OBJS)\advlib_odcombo.obj \ $(OBJS)\advlib_propdlg.obj \ $(OBJS)\advlib_sashwin.obj \ $(OBJS)\advlib_splash.obj \ @@ -4334,6 +4362,9 @@ $(OBJS)\monodll_urlmsw.obj: ..\..\src\msw\urlmsw.cpp $(OBJS)\monodll_colordlg.obj: ..\..\src\msw\colordlg.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** +$(OBJS)\monodll_combo.obj: ..\..\src\msw\combo.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** + $(OBJS)\monodll_dirdlg.obj: ..\..\src\msw\dirdlg.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** @@ -5249,6 +5280,11 @@ $(OBJS)\monodll_colourcmn.obj: ..\..\src\common\colourcmn.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_combocmn.obj: ..\..\src\common\combocmn.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_cmdproc.obj: ..\..\src\common\cmdproc.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** @@ -5599,6 +5635,11 @@ $(OBJS)\monodll_choicbkg.obj: ..\..\src\generic\choicbkg.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_combog.obj: ..\..\src\generic\combog.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** @@ -5754,6 +5795,11 @@ $(OBJS)\monodll_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_odcombo.obj: ..\..\src\generic\odcombo.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_propdlg.obj: ..\..\src\generic\propdlg.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** @@ -6100,6 +6146,9 @@ $(OBJS)\monolib_urlmsw.obj: ..\..\src\msw\urlmsw.cpp $(OBJS)\monolib_colordlg.obj: ..\..\src\msw\colordlg.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** +$(OBJS)\monolib_combo.obj: ..\..\src\msw\combo.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** + $(OBJS)\monolib_dirdlg.obj: ..\..\src\msw\dirdlg.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** @@ -7015,6 +7064,11 @@ $(OBJS)\monolib_colourcmn.obj: ..\..\src\common\colourcmn.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_combocmn.obj: ..\..\src\common\combocmn.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_cmdproc.obj: ..\..\src\common\cmdproc.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** @@ -7365,6 +7419,11 @@ $(OBJS)\monolib_choicbkg.obj: ..\..\src\generic\choicbkg.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_combog.obj: ..\..\src\generic\combog.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** @@ -7520,6 +7579,11 @@ $(OBJS)\monolib_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_odcombo.obj: ..\..\src\generic\odcombo.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_propdlg.obj: ..\..\src\generic\propdlg.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** @@ -8178,6 +8242,9 @@ $(OBJS)\coredll_volume.obj: ..\..\src\msw\volume.cpp $(OBJS)\coredll_colordlg.obj: ..\..\src\msw\colordlg.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** +$(OBJS)\coredll_combo.obj: ..\..\src\msw\combo.cpp + $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** + $(OBJS)\coredll_dirdlg.obj: ..\..\src\msw\dirdlg.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** @@ -8850,6 +8917,11 @@ $(OBJS)\coredll_colourcmn.obj: ..\..\src\common\colourcmn.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\coredll_combocmn.obj: ..\..\src\common\combocmn.cpp + $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\coredll_cmdproc.obj: ..\..\src\common\cmdproc.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** @@ -9200,6 +9272,11 @@ $(OBJS)\coredll_choicbkg.obj: ..\..\src\generic\choicbkg.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\coredll_combog.obj: ..\..\src\generic\combog.cpp + $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\coredll_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** @@ -9332,6 +9409,9 @@ $(OBJS)\corelib_volume.obj: ..\..\src\msw\volume.cpp $(OBJS)\corelib_colordlg.obj: ..\..\src\msw\colordlg.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** +$(OBJS)\corelib_combo.obj: ..\..\src\msw\combo.cpp + $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** + $(OBJS)\corelib_dirdlg.obj: ..\..\src\msw\dirdlg.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** @@ -10004,6 +10084,11 @@ $(OBJS)\corelib_colourcmn.obj: ..\..\src\common\colourcmn.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\corelib_combocmn.obj: ..\..\src\common\combocmn.cpp + $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\corelib_cmdproc.obj: ..\..\src\common\cmdproc.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** @@ -10354,6 +10439,11 @@ $(OBJS)\corelib_choicbkg.obj: ..\..\src\generic\choicbkg.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\corelib_combog.obj: ..\..\src\generic\combog.cpp + $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\corelib_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** @@ -10498,6 +10588,9 @@ $(OBJS)\advdll_helpext.obj: ..\..\src\generic\helpext.cpp $(OBJS)\advdll_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) -q -c -P -o$@ $(ADVDLL_CXXFLAGS) $** +$(OBJS)\advdll_odcombo.obj: ..\..\src\generic\odcombo.cpp + $(CXX) -q -c -P -o$@ $(ADVDLL_CXXFLAGS) $** + $(OBJS)\advdll_propdlg.obj: ..\..\src\generic\propdlg.cpp $(CXX) -q -c -P -o$@ $(ADVDLL_CXXFLAGS) $** @@ -10576,6 +10669,9 @@ $(OBJS)\advlib_helpext.obj: ..\..\src\generic\helpext.cpp $(OBJS)\advlib_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) -q -c -P -o$@ $(ADVLIB_CXXFLAGS) $** +$(OBJS)\advlib_odcombo.obj: ..\..\src\generic\odcombo.cpp + $(CXX) -q -c -P -o$@ $(ADVLIB_CXXFLAGS) $** + $(OBJS)\advlib_propdlg.obj: ..\..\src\generic\propdlg.cpp $(CXX) -q -c -P -o$@ $(ADVLIB_CXXFLAGS) $** diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index 828d3055bf..95e3cb4aab 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -1214,6 +1214,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_checkbox.o \ $(OBJS)\monodll_choice.o \ $(OBJS)\monodll_colordlg.o \ + $(OBJS)\monodll_combo.o \ $(OBJS)\monodll_combobox.o \ $(OBJS)\monodll_control.o \ $(OBJS)\monodll_dialog.o \ @@ -1263,6 +1264,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_choiccmn.o \ $(OBJS)\monodll_clipcmn.o \ $(OBJS)\monodll_colourcmn.o \ + $(OBJS)\monodll_combocmn.o \ $(OBJS)\monodll_cmdproc.o \ $(OBJS)\monodll_cmndata.o \ $(OBJS)\monodll_containr.o \ @@ -1333,6 +1335,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_busyinfo.o \ $(OBJS)\monodll_choicdgg.o \ $(OBJS)\monodll_choicbkg.o \ + $(OBJS)\monodll_combog.o \ $(OBJS)\monodll_dcpsg.o \ $(OBJS)\monodll_dirctrlg.o \ $(OBJS)\monodll_dragimgg.o \ @@ -1465,6 +1468,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_choiccmn.o \ $(OBJS)\monodll_clipcmn.o \ $(OBJS)\monodll_colourcmn.o \ + $(OBJS)\monodll_combocmn.o \ $(OBJS)\monodll_cmdproc.o \ $(OBJS)\monodll_cmndata.o \ $(OBJS)\monodll_containr.o \ @@ -1535,6 +1539,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_busyinfo.o \ $(OBJS)\monodll_choicdgg.o \ $(OBJS)\monodll_choicbkg.o \ + $(OBJS)\monodll_combog.o \ $(OBJS)\monodll_dcpsg.o \ $(OBJS)\monodll_dirctrlg.o \ $(OBJS)\monodll_dragimgg.o \ @@ -1570,6 +1575,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gridsel.o \ $(OBJS)\monodll_helpext.o \ $(OBJS)\monodll_laywin.o \ + $(OBJS)\monodll_odcombo.o \ $(OBJS)\monodll_propdlg.o \ $(OBJS)\monodll_sashwin.o \ $(OBJS)\monodll_splash.o \ @@ -1598,6 +1604,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gridsel.o \ $(OBJS)\monodll_helpext.o \ $(OBJS)\monodll_laywin.o \ + $(OBJS)\monodll_odcombo.o \ $(OBJS)\monodll_propdlg.o \ $(OBJS)\monodll_sashwin.o \ $(OBJS)\monodll_splash.o \ @@ -1761,6 +1768,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_checkbox.o \ $(OBJS)\monolib_choice.o \ $(OBJS)\monolib_colordlg.o \ + $(OBJS)\monolib_combo.o \ $(OBJS)\monolib_combobox.o \ $(OBJS)\monolib_control.o \ $(OBJS)\monolib_dialog.o \ @@ -1810,6 +1818,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_choiccmn.o \ $(OBJS)\monolib_clipcmn.o \ $(OBJS)\monolib_colourcmn.o \ + $(OBJS)\monolib_combocmn.o \ $(OBJS)\monolib_cmdproc.o \ $(OBJS)\monolib_cmndata.o \ $(OBJS)\monolib_containr.o \ @@ -1880,6 +1889,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_busyinfo.o \ $(OBJS)\monolib_choicdgg.o \ $(OBJS)\monolib_choicbkg.o \ + $(OBJS)\monolib_combog.o \ $(OBJS)\monolib_dcpsg.o \ $(OBJS)\monolib_dirctrlg.o \ $(OBJS)\monolib_dragimgg.o \ @@ -2012,6 +2022,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_choiccmn.o \ $(OBJS)\monolib_clipcmn.o \ $(OBJS)\monolib_colourcmn.o \ + $(OBJS)\monolib_combocmn.o \ $(OBJS)\monolib_cmdproc.o \ $(OBJS)\monolib_cmndata.o \ $(OBJS)\monolib_containr.o \ @@ -2082,6 +2093,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_busyinfo.o \ $(OBJS)\monolib_choicdgg.o \ $(OBJS)\monolib_choicbkg.o \ + $(OBJS)\monolib_combog.o \ $(OBJS)\monolib_dcpsg.o \ $(OBJS)\monolib_dirctrlg.o \ $(OBJS)\monolib_dragimgg.o \ @@ -2117,6 +2129,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gridsel.o \ $(OBJS)\monolib_helpext.o \ $(OBJS)\monolib_laywin.o \ + $(OBJS)\monolib_odcombo.o \ $(OBJS)\monolib_propdlg.o \ $(OBJS)\monolib_sashwin.o \ $(OBJS)\monolib_splash.o \ @@ -2145,6 +2158,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gridsel.o \ $(OBJS)\monolib_helpext.o \ $(OBJS)\monolib_laywin.o \ + $(OBJS)\monolib_odcombo.o \ $(OBJS)\monolib_propdlg.o \ $(OBJS)\monolib_sashwin.o \ $(OBJS)\monolib_splash.o \ @@ -2251,6 +2265,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_checkbox.o \ $(OBJS)\coredll_choice.o \ $(OBJS)\coredll_colordlg.o \ + $(OBJS)\coredll_combo.o \ $(OBJS)\coredll_combobox.o \ $(OBJS)\coredll_control.o \ $(OBJS)\coredll_dialog.o \ @@ -2300,6 +2315,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_choiccmn.o \ $(OBJS)\coredll_clipcmn.o \ $(OBJS)\coredll_colourcmn.o \ + $(OBJS)\coredll_combocmn.o \ $(OBJS)\coredll_cmdproc.o \ $(OBJS)\coredll_cmndata.o \ $(OBJS)\coredll_containr.o \ @@ -2370,6 +2386,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_busyinfo.o \ $(OBJS)\coredll_choicdgg.o \ $(OBJS)\coredll_choicbkg.o \ + $(OBJS)\coredll_combog.o \ $(OBJS)\coredll_dcpsg.o \ $(OBJS)\coredll_dirctrlg.o \ $(OBJS)\coredll_dragimgg.o \ @@ -2502,6 +2519,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_choiccmn.o \ $(OBJS)\coredll_clipcmn.o \ $(OBJS)\coredll_colourcmn.o \ + $(OBJS)\coredll_combocmn.o \ $(OBJS)\coredll_cmdproc.o \ $(OBJS)\coredll_cmndata.o \ $(OBJS)\coredll_containr.o \ @@ -2572,6 +2590,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_busyinfo.o \ $(OBJS)\coredll_choicdgg.o \ $(OBJS)\coredll_choicbkg.o \ + $(OBJS)\coredll_combog.o \ $(OBJS)\coredll_dcpsg.o \ $(OBJS)\coredll_dirctrlg.o \ $(OBJS)\coredll_dragimgg.o \ @@ -2662,6 +2681,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_checkbox.o \ $(OBJS)\corelib_choice.o \ $(OBJS)\corelib_colordlg.o \ + $(OBJS)\corelib_combo.o \ $(OBJS)\corelib_combobox.o \ $(OBJS)\corelib_control.o \ $(OBJS)\corelib_dialog.o \ @@ -2711,6 +2731,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_choiccmn.o \ $(OBJS)\corelib_clipcmn.o \ $(OBJS)\corelib_colourcmn.o \ + $(OBJS)\corelib_combocmn.o \ $(OBJS)\corelib_cmdproc.o \ $(OBJS)\corelib_cmndata.o \ $(OBJS)\corelib_containr.o \ @@ -2781,6 +2802,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_busyinfo.o \ $(OBJS)\corelib_choicdgg.o \ $(OBJS)\corelib_choicbkg.o \ + $(OBJS)\corelib_combog.o \ $(OBJS)\corelib_dcpsg.o \ $(OBJS)\corelib_dirctrlg.o \ $(OBJS)\corelib_dragimgg.o \ @@ -2913,6 +2935,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_choiccmn.o \ $(OBJS)\corelib_clipcmn.o \ $(OBJS)\corelib_colourcmn.o \ + $(OBJS)\corelib_combocmn.o \ $(OBJS)\corelib_cmdproc.o \ $(OBJS)\corelib_cmndata.o \ $(OBJS)\corelib_containr.o \ @@ -2983,6 +3006,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_busyinfo.o \ $(OBJS)\corelib_choicdgg.o \ $(OBJS)\corelib_choicbkg.o \ + $(OBJS)\corelib_combog.o \ $(OBJS)\corelib_dcpsg.o \ $(OBJS)\corelib_dirctrlg.o \ $(OBJS)\corelib_dragimgg.o \ @@ -3026,6 +3050,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\advdll_gridsel.o \ $(OBJS)\advdll_helpext.o \ $(OBJS)\advdll_laywin.o \ + $(OBJS)\advdll_odcombo.o \ $(OBJS)\advdll_propdlg.o \ $(OBJS)\advdll_sashwin.o \ $(OBJS)\advdll_splash.o \ @@ -3054,6 +3079,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\advdll_gridsel.o \ $(OBJS)\advdll_helpext.o \ $(OBJS)\advdll_laywin.o \ + $(OBJS)\advdll_odcombo.o \ $(OBJS)\advdll_propdlg.o \ $(OBJS)\advdll_sashwin.o \ $(OBJS)\advdll_splash.o \ @@ -3089,6 +3115,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\advlib_gridsel.o \ $(OBJS)\advlib_helpext.o \ $(OBJS)\advlib_laywin.o \ + $(OBJS)\advlib_odcombo.o \ $(OBJS)\advlib_propdlg.o \ $(OBJS)\advlib_sashwin.o \ $(OBJS)\advlib_splash.o \ @@ -3117,6 +3144,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\advlib_gridsel.o \ $(OBJS)\advlib_helpext.o \ $(OBJS)\advlib_laywin.o \ + $(OBJS)\advlib_odcombo.o \ $(OBJS)\advlib_propdlg.o \ $(OBJS)\advlib_sashwin.o \ $(OBJS)\advlib_splash.o \ @@ -4438,6 +4466,9 @@ $(OBJS)\monodll_urlmsw.o: ../../src/msw/urlmsw.cpp $(OBJS)\monodll_colordlg.o: ../../src/msw/colordlg.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\monodll_combo.o: ../../src/msw/combo.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\monodll_dirdlg.o: ../../src/msw/dirdlg.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -5453,6 +5484,11 @@ $(OBJS)\monodll_colourcmn.o: ../../src/common/colourcmn.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monodll_combocmn.o: ../../src/common/combocmn.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monodll_cmdproc.o: ../../src/common/cmdproc.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -5803,6 +5839,11 @@ $(OBJS)\monodll_choicbkg.o: ../../src/generic/choicbkg.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monodll_combog.o: ../../src/generic/combog.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monodll_dcpsg.o: ../../src/generic/dcpsg.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -5958,6 +5999,11 @@ $(OBJS)\monodll_laywin.o: ../../src/generic/laywin.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monodll_odcombo.o: ../../src/generic/odcombo.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monodll_propdlg.o: ../../src/generic/propdlg.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -6304,6 +6350,9 @@ $(OBJS)\monolib_urlmsw.o: ../../src/msw/urlmsw.cpp $(OBJS)\monolib_colordlg.o: ../../src/msw/colordlg.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\monolib_combo.o: ../../src/msw/combo.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\monolib_dirdlg.o: ../../src/msw/dirdlg.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -7319,6 +7368,11 @@ $(OBJS)\monolib_colourcmn.o: ../../src/common/colourcmn.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monolib_combocmn.o: ../../src/common/combocmn.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monolib_cmdproc.o: ../../src/common/cmdproc.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -7669,6 +7723,11 @@ $(OBJS)\monolib_choicbkg.o: ../../src/generic/choicbkg.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monolib_combog.o: ../../src/generic/combog.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monolib_dcpsg.o: ../../src/generic/dcpsg.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -7824,6 +7883,11 @@ $(OBJS)\monolib_laywin.o: ../../src/generic/laywin.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monolib_odcombo.o: ../../src/generic/odcombo.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monolib_propdlg.o: ../../src/generic/propdlg.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -8482,6 +8546,9 @@ $(OBJS)\coredll_volume.o: ../../src/msw/volume.cpp $(OBJS)\coredll_colordlg.o: ../../src/msw/colordlg.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\coredll_combo.o: ../../src/msw/combo.cpp + $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\coredll_dirdlg.o: ../../src/msw/dirdlg.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< @@ -9254,6 +9321,11 @@ $(OBJS)\coredll_colourcmn.o: ../../src/common/colourcmn.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\coredll_combocmn.o: ../../src/common/combocmn.cpp + $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\coredll_cmdproc.o: ../../src/common/cmdproc.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< @@ -9604,6 +9676,11 @@ $(OBJS)\coredll_choicbkg.o: ../../src/generic/choicbkg.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\coredll_combog.o: ../../src/generic/combog.cpp + $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\coredll_dcpsg.o: ../../src/generic/dcpsg.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< @@ -9736,6 +9813,9 @@ $(OBJS)\corelib_volume.o: ../../src/msw/volume.cpp $(OBJS)\corelib_colordlg.o: ../../src/msw/colordlg.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\corelib_combo.o: ../../src/msw/combo.cpp + $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\corelib_dirdlg.o: ../../src/msw/dirdlg.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< @@ -10508,6 +10588,11 @@ $(OBJS)\corelib_colourcmn.o: ../../src/common/colourcmn.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\corelib_combocmn.o: ../../src/common/combocmn.cpp + $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\corelib_cmdproc.o: ../../src/common/cmdproc.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< @@ -10858,6 +10943,11 @@ $(OBJS)\corelib_choicbkg.o: ../../src/generic/choicbkg.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\corelib_combog.o: ../../src/generic/combog.cpp + $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\corelib_dcpsg.o: ../../src/generic/dcpsg.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< @@ -11002,6 +11092,9 @@ $(OBJS)\advdll_helpext.o: ../../src/generic/helpext.cpp $(OBJS)\advdll_laywin.o: ../../src/generic/laywin.cpp $(CXX) -c -o $@ $(ADVDLL_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\advdll_odcombo.o: ../../src/generic/odcombo.cpp + $(CXX) -c -o $@ $(ADVDLL_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\advdll_propdlg.o: ../../src/generic/propdlg.cpp $(CXX) -c -o $@ $(ADVDLL_CXXFLAGS) $(CPPDEPS) $< @@ -11080,6 +11173,9 @@ $(OBJS)\advlib_helpext.o: ../../src/generic/helpext.cpp $(OBJS)\advlib_laywin.o: ../../src/generic/laywin.cpp $(CXX) -c -o $@ $(ADVLIB_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\advlib_odcombo.o: ../../src/generic/odcombo.cpp + $(CXX) -c -o $@ $(ADVLIB_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\advlib_propdlg.o: ../../src/generic/propdlg.cpp $(CXX) -c -o $@ $(ADVLIB_CXXFLAGS) $(CPPDEPS) $< diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index a357735140..4a1ea735c0 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -1362,6 +1362,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_checkbox.obj \ $(OBJS)\monodll_choice.obj \ $(OBJS)\monodll_colordlg.obj \ + $(OBJS)\monodll_combo.obj \ $(OBJS)\monodll_combobox.obj \ $(OBJS)\monodll_control.obj \ $(OBJS)\monodll_dialog.obj \ @@ -1411,6 +1412,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_choiccmn.obj \ $(OBJS)\monodll_clipcmn.obj \ $(OBJS)\monodll_colourcmn.obj \ + $(OBJS)\monodll_combocmn.obj \ $(OBJS)\monodll_cmdproc.obj \ $(OBJS)\monodll_cmndata.obj \ $(OBJS)\monodll_containr.obj \ @@ -1481,6 +1483,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_busyinfo.obj \ $(OBJS)\monodll_choicdgg.obj \ $(OBJS)\monodll_choicbkg.obj \ + $(OBJS)\monodll_combog.obj \ $(OBJS)\monodll_dcpsg.obj \ $(OBJS)\monodll_dirctrlg.obj \ $(OBJS)\monodll_dragimgg.obj \ @@ -1611,6 +1614,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_choiccmn.obj \ $(OBJS)\monodll_clipcmn.obj \ $(OBJS)\monodll_colourcmn.obj \ + $(OBJS)\monodll_combocmn.obj \ $(OBJS)\monodll_cmdproc.obj \ $(OBJS)\monodll_cmndata.obj \ $(OBJS)\monodll_containr.obj \ @@ -1681,6 +1685,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_busyinfo.obj \ $(OBJS)\monodll_choicdgg.obj \ $(OBJS)\monodll_choicbkg.obj \ + $(OBJS)\monodll_combog.obj \ $(OBJS)\monodll_dcpsg.obj \ $(OBJS)\monodll_dirctrlg.obj \ $(OBJS)\monodll_dragimgg.obj \ @@ -1715,6 +1720,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gridsel.obj \ $(OBJS)\monodll_helpext.obj \ $(OBJS)\monodll_laywin.obj \ + $(OBJS)\monodll_odcombo.obj \ $(OBJS)\monodll_propdlg.obj \ $(OBJS)\monodll_sashwin.obj \ $(OBJS)\monodll_splash.obj \ @@ -1743,6 +1749,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gridsel.obj \ $(OBJS)\monodll_helpext.obj \ $(OBJS)\monodll_laywin.obj \ + $(OBJS)\monodll_odcombo.obj \ $(OBJS)\monodll_propdlg.obj \ $(OBJS)\monodll_sashwin.obj \ $(OBJS)\monodll_splash.obj \ @@ -1909,6 +1916,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_checkbox.obj \ $(OBJS)\monolib_choice.obj \ $(OBJS)\monolib_colordlg.obj \ + $(OBJS)\monolib_combo.obj \ $(OBJS)\monolib_combobox.obj \ $(OBJS)\monolib_control.obj \ $(OBJS)\monolib_dialog.obj \ @@ -1958,6 +1966,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_choiccmn.obj \ $(OBJS)\monolib_clipcmn.obj \ $(OBJS)\monolib_colourcmn.obj \ + $(OBJS)\monolib_combocmn.obj \ $(OBJS)\monolib_cmdproc.obj \ $(OBJS)\monolib_cmndata.obj \ $(OBJS)\monolib_containr.obj \ @@ -2028,6 +2037,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_busyinfo.obj \ $(OBJS)\monolib_choicdgg.obj \ $(OBJS)\monolib_choicbkg.obj \ + $(OBJS)\monolib_combog.obj \ $(OBJS)\monolib_dcpsg.obj \ $(OBJS)\monolib_dirctrlg.obj \ $(OBJS)\monolib_dragimgg.obj \ @@ -2158,6 +2168,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_choiccmn.obj \ $(OBJS)\monolib_clipcmn.obj \ $(OBJS)\monolib_colourcmn.obj \ + $(OBJS)\monolib_combocmn.obj \ $(OBJS)\monolib_cmdproc.obj \ $(OBJS)\monolib_cmndata.obj \ $(OBJS)\monolib_containr.obj \ @@ -2228,6 +2239,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_busyinfo.obj \ $(OBJS)\monolib_choicdgg.obj \ $(OBJS)\monolib_choicbkg.obj \ + $(OBJS)\monolib_combog.obj \ $(OBJS)\monolib_dcpsg.obj \ $(OBJS)\monolib_dirctrlg.obj \ $(OBJS)\monolib_dragimgg.obj \ @@ -2262,6 +2274,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gridsel.obj \ $(OBJS)\monolib_helpext.obj \ $(OBJS)\monolib_laywin.obj \ + $(OBJS)\monolib_odcombo.obj \ $(OBJS)\monolib_propdlg.obj \ $(OBJS)\monolib_sashwin.obj \ $(OBJS)\monolib_splash.obj \ @@ -2290,6 +2303,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gridsel.obj \ $(OBJS)\monolib_helpext.obj \ $(OBJS)\monolib_laywin.obj \ + $(OBJS)\monolib_odcombo.obj \ $(OBJS)\monolib_propdlg.obj \ $(OBJS)\monolib_sashwin.obj \ $(OBJS)\monolib_splash.obj \ @@ -2413,6 +2427,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_checkbox.obj \ $(OBJS)\coredll_choice.obj \ $(OBJS)\coredll_colordlg.obj \ + $(OBJS)\coredll_combo.obj \ $(OBJS)\coredll_combobox.obj \ $(OBJS)\coredll_control.obj \ $(OBJS)\coredll_dialog.obj \ @@ -2462,6 +2477,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_choiccmn.obj \ $(OBJS)\coredll_clipcmn.obj \ $(OBJS)\coredll_colourcmn.obj \ + $(OBJS)\coredll_combocmn.obj \ $(OBJS)\coredll_cmdproc.obj \ $(OBJS)\coredll_cmndata.obj \ $(OBJS)\coredll_containr.obj \ @@ -2532,6 +2548,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_busyinfo.obj \ $(OBJS)\coredll_choicdgg.obj \ $(OBJS)\coredll_choicbkg.obj \ + $(OBJS)\coredll_combog.obj \ $(OBJS)\coredll_dcpsg.obj \ $(OBJS)\coredll_dirctrlg.obj \ $(OBJS)\coredll_dragimgg.obj \ @@ -2662,6 +2679,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_choiccmn.obj \ $(OBJS)\coredll_clipcmn.obj \ $(OBJS)\coredll_colourcmn.obj \ + $(OBJS)\coredll_combocmn.obj \ $(OBJS)\coredll_cmdproc.obj \ $(OBJS)\coredll_cmndata.obj \ $(OBJS)\coredll_containr.obj \ @@ -2732,6 +2750,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_busyinfo.obj \ $(OBJS)\coredll_choicdgg.obj \ $(OBJS)\coredll_choicbkg.obj \ + $(OBJS)\coredll_combog.obj \ $(OBJS)\coredll_dcpsg.obj \ $(OBJS)\coredll_dirctrlg.obj \ $(OBJS)\coredll_dragimgg.obj \ @@ -2822,6 +2841,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_checkbox.obj \ $(OBJS)\corelib_choice.obj \ $(OBJS)\corelib_colordlg.obj \ + $(OBJS)\corelib_combo.obj \ $(OBJS)\corelib_combobox.obj \ $(OBJS)\corelib_control.obj \ $(OBJS)\corelib_dialog.obj \ @@ -2871,6 +2891,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_choiccmn.obj \ $(OBJS)\corelib_clipcmn.obj \ $(OBJS)\corelib_colourcmn.obj \ + $(OBJS)\corelib_combocmn.obj \ $(OBJS)\corelib_cmdproc.obj \ $(OBJS)\corelib_cmndata.obj \ $(OBJS)\corelib_containr.obj \ @@ -2941,6 +2962,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_busyinfo.obj \ $(OBJS)\corelib_choicdgg.obj \ $(OBJS)\corelib_choicbkg.obj \ + $(OBJS)\corelib_combog.obj \ $(OBJS)\corelib_dcpsg.obj \ $(OBJS)\corelib_dirctrlg.obj \ $(OBJS)\corelib_dragimgg.obj \ @@ -3071,6 +3093,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_choiccmn.obj \ $(OBJS)\corelib_clipcmn.obj \ $(OBJS)\corelib_colourcmn.obj \ + $(OBJS)\corelib_combocmn.obj \ $(OBJS)\corelib_cmdproc.obj \ $(OBJS)\corelib_cmndata.obj \ $(OBJS)\corelib_containr.obj \ @@ -3141,6 +3164,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_busyinfo.obj \ $(OBJS)\corelib_choicdgg.obj \ $(OBJS)\corelib_choicbkg.obj \ + $(OBJS)\corelib_combog.obj \ $(OBJS)\corelib_dcpsg.obj \ $(OBJS)\corelib_dirctrlg.obj \ $(OBJS)\corelib_dragimgg.obj \ @@ -3185,6 +3209,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\advdll_gridsel.obj \ $(OBJS)\advdll_helpext.obj \ $(OBJS)\advdll_laywin.obj \ + $(OBJS)\advdll_odcombo.obj \ $(OBJS)\advdll_propdlg.obj \ $(OBJS)\advdll_sashwin.obj \ $(OBJS)\advdll_splash.obj \ @@ -3213,6 +3238,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\advdll_gridsel.obj \ $(OBJS)\advdll_helpext.obj \ $(OBJS)\advdll_laywin.obj \ + $(OBJS)\advdll_odcombo.obj \ $(OBJS)\advdll_propdlg.obj \ $(OBJS)\advdll_sashwin.obj \ $(OBJS)\advdll_splash.obj \ @@ -3250,6 +3276,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\advlib_gridsel.obj \ $(OBJS)\advlib_helpext.obj \ $(OBJS)\advlib_laywin.obj \ + $(OBJS)\advlib_odcombo.obj \ $(OBJS)\advlib_propdlg.obj \ $(OBJS)\advlib_sashwin.obj \ $(OBJS)\advlib_splash.obj \ @@ -3278,6 +3305,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\advlib_gridsel.obj \ $(OBJS)\advlib_helpext.obj \ $(OBJS)\advlib_laywin.obj \ + $(OBJS)\advlib_odcombo.obj \ $(OBJS)\advlib_propdlg.obj \ $(OBJS)\advlib_sashwin.obj \ $(OBJS)\advlib_splash.obj \ @@ -4643,6 +4671,9 @@ $(OBJS)\monodll_urlmsw.obj: ..\..\src\msw\urlmsw.cpp $(OBJS)\monodll_colordlg.obj: ..\..\src\msw\colordlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** +$(OBJS)\monodll_combo.obj: ..\..\src\msw\combo.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** + $(OBJS)\monodll_dirdlg.obj: ..\..\src\msw\dirdlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** @@ -5558,6 +5589,11 @@ $(OBJS)\monodll_colourcmn.obj: ..\..\src\common\colourcmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_combocmn.obj: ..\..\src\common\combocmn.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_cmdproc.obj: ..\..\src\common\cmdproc.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** @@ -5908,6 +5944,11 @@ $(OBJS)\monodll_choicbkg.obj: ..\..\src\generic\choicbkg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_combog.obj: ..\..\src\generic\combog.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** @@ -6063,6 +6104,11 @@ $(OBJS)\monodll_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_odcombo.obj: ..\..\src\generic\odcombo.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_propdlg.obj: ..\..\src\generic\propdlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** @@ -6409,6 +6455,9 @@ $(OBJS)\monolib_urlmsw.obj: ..\..\src\msw\urlmsw.cpp $(OBJS)\monolib_colordlg.obj: ..\..\src\msw\colordlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** +$(OBJS)\monolib_combo.obj: ..\..\src\msw\combo.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** + $(OBJS)\monolib_dirdlg.obj: ..\..\src\msw\dirdlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** @@ -7324,6 +7373,11 @@ $(OBJS)\monolib_colourcmn.obj: ..\..\src\common\colourcmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_combocmn.obj: ..\..\src\common\combocmn.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_cmdproc.obj: ..\..\src\common\cmdproc.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** @@ -7674,6 +7728,11 @@ $(OBJS)\monolib_choicbkg.obj: ..\..\src\generic\choicbkg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_combog.obj: ..\..\src\generic\combog.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** @@ -7829,6 +7888,11 @@ $(OBJS)\monolib_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_odcombo.obj: ..\..\src\generic\odcombo.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_propdlg.obj: ..\..\src\generic\propdlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** @@ -8487,6 +8551,9 @@ $(OBJS)\coredll_volume.obj: ..\..\src\msw\volume.cpp $(OBJS)\coredll_colordlg.obj: ..\..\src\msw\colordlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** +$(OBJS)\coredll_combo.obj: ..\..\src\msw\combo.cpp + $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** + $(OBJS)\coredll_dirdlg.obj: ..\..\src\msw\dirdlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** @@ -9159,6 +9226,11 @@ $(OBJS)\coredll_colourcmn.obj: ..\..\src\common\colourcmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\coredll_combocmn.obj: ..\..\src\common\combocmn.cpp + $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\coredll_cmdproc.obj: ..\..\src\common\cmdproc.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** @@ -9509,6 +9581,11 @@ $(OBJS)\coredll_choicbkg.obj: ..\..\src\generic\choicbkg.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\coredll_combog.obj: ..\..\src\generic\combog.cpp + $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\coredll_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** @@ -9641,6 +9718,9 @@ $(OBJS)\corelib_volume.obj: ..\..\src\msw\volume.cpp $(OBJS)\corelib_colordlg.obj: ..\..\src\msw\colordlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** +$(OBJS)\corelib_combo.obj: ..\..\src\msw\combo.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** + $(OBJS)\corelib_dirdlg.obj: ..\..\src\msw\dirdlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** @@ -10313,6 +10393,11 @@ $(OBJS)\corelib_colourcmn.obj: ..\..\src\common\colourcmn.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\corelib_combocmn.obj: ..\..\src\common\combocmn.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\corelib_cmdproc.obj: ..\..\src\common\cmdproc.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** @@ -10663,6 +10748,11 @@ $(OBJS)\corelib_choicbkg.obj: ..\..\src\generic\choicbkg.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\corelib_combog.obj: ..\..\src\generic\combog.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\corelib_dcpsg.obj: ..\..\src\generic\dcpsg.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** @@ -10807,6 +10897,9 @@ $(OBJS)\advdll_helpext.obj: ..\..\src\generic\helpext.cpp $(OBJS)\advdll_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) /c /nologo /TP /Fo$@ $(ADVDLL_CXXFLAGS) $** +$(OBJS)\advdll_odcombo.obj: ..\..\src\generic\odcombo.cpp + $(CXX) /c /nologo /TP /Fo$@ $(ADVDLL_CXXFLAGS) $** + $(OBJS)\advdll_propdlg.obj: ..\..\src\generic\propdlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(ADVDLL_CXXFLAGS) $** @@ -10885,6 +10978,9 @@ $(OBJS)\advlib_helpext.obj: ..\..\src\generic\helpext.cpp $(OBJS)\advlib_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) /c /nologo /TP /Fo$@ $(ADVLIB_CXXFLAGS) $** +$(OBJS)\advlib_odcombo.obj: ..\..\src\generic\odcombo.cpp + $(CXX) /c /nologo /TP /Fo$@ $(ADVLIB_CXXFLAGS) $** + $(OBJS)\advlib_propdlg.obj: ..\..\src\generic\propdlg.cpp $(CXX) /c /nologo /TP /Fo$@ $(ADVLIB_CXXFLAGS) $** diff --git a/build/msw/makefile.wat b/build/msw/makefile.wat index f19137d92e..5a4f57bea4 100644 --- a/build/msw/makefile.wat +++ b/build/msw/makefile.wat @@ -239,6 +239,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_checkbox.obj & $(OBJS)\monodll_choice.obj & $(OBJS)\monodll_colordlg.obj & + $(OBJS)\monodll_combo.obj & $(OBJS)\monodll_combobox.obj & $(OBJS)\monodll_control.obj & $(OBJS)\monodll_dialog.obj & @@ -288,6 +289,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_choiccmn.obj & $(OBJS)\monodll_clipcmn.obj & $(OBJS)\monodll_colourcmn.obj & + $(OBJS)\monodll_combocmn.obj & $(OBJS)\monodll_cmdproc.obj & $(OBJS)\monodll_cmndata.obj & $(OBJS)\monodll_containr.obj & @@ -358,6 +360,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_busyinfo.obj & $(OBJS)\monodll_choicdgg.obj & $(OBJS)\monodll_choicbkg.obj & + $(OBJS)\monodll_combog.obj & $(OBJS)\monodll_dcpsg.obj & $(OBJS)\monodll_dirctrlg.obj & $(OBJS)\monodll_dragimgg.obj & @@ -490,6 +493,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_choiccmn.obj & $(OBJS)\monodll_clipcmn.obj & $(OBJS)\monodll_colourcmn.obj & + $(OBJS)\monodll_combocmn.obj & $(OBJS)\monodll_cmdproc.obj & $(OBJS)\monodll_cmndata.obj & $(OBJS)\monodll_containr.obj & @@ -560,6 +564,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_busyinfo.obj & $(OBJS)\monodll_choicdgg.obj & $(OBJS)\monodll_choicbkg.obj & + $(OBJS)\monodll_combog.obj & $(OBJS)\monodll_dcpsg.obj & $(OBJS)\monodll_dirctrlg.obj & $(OBJS)\monodll_dragimgg.obj & @@ -596,6 +601,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_gridsel.obj & $(OBJS)\monodll_helpext.obj & $(OBJS)\monodll_laywin.obj & + $(OBJS)\monodll_odcombo.obj & $(OBJS)\monodll_propdlg.obj & $(OBJS)\monodll_sashwin.obj & $(OBJS)\monodll_splash.obj & @@ -624,6 +630,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_gridsel.obj & $(OBJS)\monodll_helpext.obj & $(OBJS)\monodll_laywin.obj & + $(OBJS)\monodll_odcombo.obj & $(OBJS)\monodll_propdlg.obj & $(OBJS)\monodll_sashwin.obj & $(OBJS)\monodll_splash.obj & @@ -790,6 +797,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_checkbox.obj & $(OBJS)\monolib_choice.obj & $(OBJS)\monolib_colordlg.obj & + $(OBJS)\monolib_combo.obj & $(OBJS)\monolib_combobox.obj & $(OBJS)\monolib_control.obj & $(OBJS)\monolib_dialog.obj & @@ -839,6 +847,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_choiccmn.obj & $(OBJS)\monolib_clipcmn.obj & $(OBJS)\monolib_colourcmn.obj & + $(OBJS)\monolib_combocmn.obj & $(OBJS)\monolib_cmdproc.obj & $(OBJS)\monolib_cmndata.obj & $(OBJS)\monolib_containr.obj & @@ -909,6 +918,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_busyinfo.obj & $(OBJS)\monolib_choicdgg.obj & $(OBJS)\monolib_choicbkg.obj & + $(OBJS)\monolib_combog.obj & $(OBJS)\monolib_dcpsg.obj & $(OBJS)\monolib_dirctrlg.obj & $(OBJS)\monolib_dragimgg.obj & @@ -1041,6 +1051,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_choiccmn.obj & $(OBJS)\monolib_clipcmn.obj & $(OBJS)\monolib_colourcmn.obj & + $(OBJS)\monolib_combocmn.obj & $(OBJS)\monolib_cmdproc.obj & $(OBJS)\monolib_cmndata.obj & $(OBJS)\monolib_containr.obj & @@ -1111,6 +1122,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_busyinfo.obj & $(OBJS)\monolib_choicdgg.obj & $(OBJS)\monolib_choicbkg.obj & + $(OBJS)\monolib_combog.obj & $(OBJS)\monolib_dcpsg.obj & $(OBJS)\monolib_dirctrlg.obj & $(OBJS)\monolib_dragimgg.obj & @@ -1147,6 +1159,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_gridsel.obj & $(OBJS)\monolib_helpext.obj & $(OBJS)\monolib_laywin.obj & + $(OBJS)\monolib_odcombo.obj & $(OBJS)\monolib_propdlg.obj & $(OBJS)\monolib_sashwin.obj & $(OBJS)\monolib_splash.obj & @@ -1175,6 +1188,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_gridsel.obj & $(OBJS)\monolib_helpext.obj & $(OBJS)\monolib_laywin.obj & + $(OBJS)\monolib_odcombo.obj & $(OBJS)\monolib_propdlg.obj & $(OBJS)\monolib_sashwin.obj & $(OBJS)\monolib_splash.obj & @@ -1287,6 +1301,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_checkbox.obj & $(OBJS)\coredll_choice.obj & $(OBJS)\coredll_colordlg.obj & + $(OBJS)\coredll_combo.obj & $(OBJS)\coredll_combobox.obj & $(OBJS)\coredll_control.obj & $(OBJS)\coredll_dialog.obj & @@ -1336,6 +1351,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_choiccmn.obj & $(OBJS)\coredll_clipcmn.obj & $(OBJS)\coredll_colourcmn.obj & + $(OBJS)\coredll_combocmn.obj & $(OBJS)\coredll_cmdproc.obj & $(OBJS)\coredll_cmndata.obj & $(OBJS)\coredll_containr.obj & @@ -1406,6 +1422,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_busyinfo.obj & $(OBJS)\coredll_choicdgg.obj & $(OBJS)\coredll_choicbkg.obj & + $(OBJS)\coredll_combog.obj & $(OBJS)\coredll_dcpsg.obj & $(OBJS)\coredll_dirctrlg.obj & $(OBJS)\coredll_dragimgg.obj & @@ -1538,6 +1555,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_choiccmn.obj & $(OBJS)\coredll_clipcmn.obj & $(OBJS)\coredll_colourcmn.obj & + $(OBJS)\coredll_combocmn.obj & $(OBJS)\coredll_cmdproc.obj & $(OBJS)\coredll_cmndata.obj & $(OBJS)\coredll_containr.obj & @@ -1608,6 +1626,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_busyinfo.obj & $(OBJS)\coredll_choicdgg.obj & $(OBJS)\coredll_choicbkg.obj & + $(OBJS)\coredll_combog.obj & $(OBJS)\coredll_dcpsg.obj & $(OBJS)\coredll_dirctrlg.obj & $(OBJS)\coredll_dragimgg.obj & @@ -1700,6 +1719,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_checkbox.obj & $(OBJS)\corelib_choice.obj & $(OBJS)\corelib_colordlg.obj & + $(OBJS)\corelib_combo.obj & $(OBJS)\corelib_combobox.obj & $(OBJS)\corelib_control.obj & $(OBJS)\corelib_dialog.obj & @@ -1749,6 +1769,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_choiccmn.obj & $(OBJS)\corelib_clipcmn.obj & $(OBJS)\corelib_colourcmn.obj & + $(OBJS)\corelib_combocmn.obj & $(OBJS)\corelib_cmdproc.obj & $(OBJS)\corelib_cmndata.obj & $(OBJS)\corelib_containr.obj & @@ -1819,6 +1840,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_busyinfo.obj & $(OBJS)\corelib_choicdgg.obj & $(OBJS)\corelib_choicbkg.obj & + $(OBJS)\corelib_combog.obj & $(OBJS)\corelib_dcpsg.obj & $(OBJS)\corelib_dirctrlg.obj & $(OBJS)\corelib_dragimgg.obj & @@ -1951,6 +1973,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_choiccmn.obj & $(OBJS)\corelib_clipcmn.obj & $(OBJS)\corelib_colourcmn.obj & + $(OBJS)\corelib_combocmn.obj & $(OBJS)\corelib_cmdproc.obj & $(OBJS)\corelib_cmndata.obj & $(OBJS)\corelib_containr.obj & @@ -2021,6 +2044,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_busyinfo.obj & $(OBJS)\corelib_choicdgg.obj & $(OBJS)\corelib_choicbkg.obj & + $(OBJS)\corelib_combog.obj & $(OBJS)\corelib_dcpsg.obj & $(OBJS)\corelib_dirctrlg.obj & $(OBJS)\corelib_dragimgg.obj & @@ -2066,6 +2090,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\advdll_gridsel.obj & $(OBJS)\advdll_helpext.obj & $(OBJS)\advdll_laywin.obj & + $(OBJS)\advdll_odcombo.obj & $(OBJS)\advdll_propdlg.obj & $(OBJS)\advdll_sashwin.obj & $(OBJS)\advdll_splash.obj & @@ -2094,6 +2119,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\advdll_gridsel.obj & $(OBJS)\advdll_helpext.obj & $(OBJS)\advdll_laywin.obj & + $(OBJS)\advdll_odcombo.obj & $(OBJS)\advdll_propdlg.obj & $(OBJS)\advdll_sashwin.obj & $(OBJS)\advdll_splash.obj & @@ -2131,6 +2157,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\advlib_gridsel.obj & $(OBJS)\advlib_helpext.obj & $(OBJS)\advlib_laywin.obj & + $(OBJS)\advlib_odcombo.obj & $(OBJS)\advlib_propdlg.obj & $(OBJS)\advlib_sashwin.obj & $(OBJS)\advlib_splash.obj & @@ -2159,6 +2186,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\advlib_gridsel.obj & $(OBJS)\advlib_helpext.obj & $(OBJS)\advlib_laywin.obj & + $(OBJS)\advlib_odcombo.obj & $(OBJS)\advlib_propdlg.obj & $(OBJS)\advlib_sashwin.obj & $(OBJS)\advlib_splash.obj & @@ -4638,6 +4666,9 @@ $(OBJS)\monodll_urlmsw.obj : .AUTODEPEND ..\..\src\msw\urlmsw.cpp $(OBJS)\monodll_colordlg.obj : .AUTODEPEND ..\..\src\msw\colordlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< +$(OBJS)\monodll_combo.obj : .AUTODEPEND ..\..\src\msw\combo.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< + $(OBJS)\monodll_dirdlg.obj : .AUTODEPEND ..\..\src\msw\dirdlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< @@ -5653,6 +5684,11 @@ $(OBJS)\monodll_colourcmn.obj : .AUTODEPEND ..\..\src\common\colourcmn.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\monodll_combocmn.obj : .AUTODEPEND ..\..\src\common\combocmn.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\monodll_cmdproc.obj : .AUTODEPEND ..\..\src\common\cmdproc.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< @@ -6003,6 +6039,11 @@ $(OBJS)\monodll_choicbkg.obj : .AUTODEPEND ..\..\src\generic\choicbkg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\monodll_combog.obj : .AUTODEPEND ..\..\src\generic\combog.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\monodll_dcpsg.obj : .AUTODEPEND ..\..\src\generic\dcpsg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< @@ -6158,6 +6199,11 @@ $(OBJS)\monodll_laywin.obj : .AUTODEPEND ..\..\src\generic\laywin.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\monodll_odcombo.obj : .AUTODEPEND ..\..\src\generic\odcombo.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\monodll_propdlg.obj : .AUTODEPEND ..\..\src\generic\propdlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< @@ -6504,6 +6550,9 @@ $(OBJS)\monolib_urlmsw.obj : .AUTODEPEND ..\..\src\msw\urlmsw.cpp $(OBJS)\monolib_colordlg.obj : .AUTODEPEND ..\..\src\msw\colordlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< +$(OBJS)\monolib_combo.obj : .AUTODEPEND ..\..\src\msw\combo.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< + $(OBJS)\monolib_dirdlg.obj : .AUTODEPEND ..\..\src\msw\dirdlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< @@ -7519,6 +7568,11 @@ $(OBJS)\monolib_colourcmn.obj : .AUTODEPEND ..\..\src\common\colourcmn.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\monolib_combocmn.obj : .AUTODEPEND ..\..\src\common\combocmn.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\monolib_cmdproc.obj : .AUTODEPEND ..\..\src\common\cmdproc.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< @@ -7869,6 +7923,11 @@ $(OBJS)\monolib_choicbkg.obj : .AUTODEPEND ..\..\src\generic\choicbkg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\monolib_combog.obj : .AUTODEPEND ..\..\src\generic\combog.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\monolib_dcpsg.obj : .AUTODEPEND ..\..\src\generic\dcpsg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< @@ -8024,6 +8083,11 @@ $(OBJS)\monolib_laywin.obj : .AUTODEPEND ..\..\src\generic\laywin.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\monolib_odcombo.obj : .AUTODEPEND ..\..\src\generic\odcombo.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\monolib_propdlg.obj : .AUTODEPEND ..\..\src\generic\propdlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< @@ -8682,6 +8746,9 @@ $(OBJS)\coredll_volume.obj : .AUTODEPEND ..\..\src\msw\volume.cpp $(OBJS)\coredll_colordlg.obj : .AUTODEPEND ..\..\src\msw\colordlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< +$(OBJS)\coredll_combo.obj : .AUTODEPEND ..\..\src\msw\combo.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< + $(OBJS)\coredll_dirdlg.obj : .AUTODEPEND ..\..\src\msw\dirdlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< @@ -9454,6 +9521,11 @@ $(OBJS)\coredll_colourcmn.obj : .AUTODEPEND ..\..\src\common\colourcmn.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\coredll_combocmn.obj : .AUTODEPEND ..\..\src\common\combocmn.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\coredll_cmdproc.obj : .AUTODEPEND ..\..\src\common\cmdproc.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< @@ -9804,6 +9876,11 @@ $(OBJS)\coredll_choicbkg.obj : .AUTODEPEND ..\..\src\generic\choicbkg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\coredll_combog.obj : .AUTODEPEND ..\..\src\generic\combog.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\coredll_dcpsg.obj : .AUTODEPEND ..\..\src\generic\dcpsg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< @@ -9936,6 +10013,9 @@ $(OBJS)\corelib_volume.obj : .AUTODEPEND ..\..\src\msw\volume.cpp $(OBJS)\corelib_colordlg.obj : .AUTODEPEND ..\..\src\msw\colordlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< +$(OBJS)\corelib_combo.obj : .AUTODEPEND ..\..\src\msw\combo.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< + $(OBJS)\corelib_dirdlg.obj : .AUTODEPEND ..\..\src\msw\dirdlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< @@ -10708,6 +10788,11 @@ $(OBJS)\corelib_colourcmn.obj : .AUTODEPEND ..\..\src\common\colourcmn.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\corelib_combocmn.obj : .AUTODEPEND ..\..\src\common\combocmn.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\corelib_cmdproc.obj : .AUTODEPEND ..\..\src\common\cmdproc.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< @@ -11058,6 +11143,11 @@ $(OBJS)\corelib_choicbkg.obj : .AUTODEPEND ..\..\src\generic\choicbkg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\corelib_combog.obj : .AUTODEPEND ..\..\src\generic\combog.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\corelib_dcpsg.obj : .AUTODEPEND ..\..\src\generic\dcpsg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< @@ -11202,6 +11292,9 @@ $(OBJS)\advdll_helpext.obj : .AUTODEPEND ..\..\src\generic\helpext.cpp $(OBJS)\advdll_laywin.obj : .AUTODEPEND ..\..\src\generic\laywin.cpp $(CXX) -bt=nt -zq -fo=$^@ $(ADVDLL_CXXFLAGS) $< +$(OBJS)\advdll_odcombo.obj : .AUTODEPEND ..\..\src\generic\odcombo.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(ADVDLL_CXXFLAGS) $< + $(OBJS)\advdll_propdlg.obj : .AUTODEPEND ..\..\src\generic\propdlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(ADVDLL_CXXFLAGS) $< @@ -11280,6 +11373,9 @@ $(OBJS)\advlib_helpext.obj : .AUTODEPEND ..\..\src\generic\helpext.cpp $(OBJS)\advlib_laywin.obj : .AUTODEPEND ..\..\src\generic\laywin.cpp $(CXX) -bt=nt -zq -fo=$^@ $(ADVLIB_CXXFLAGS) $< +$(OBJS)\advlib_odcombo.obj : .AUTODEPEND ..\..\src\generic\odcombo.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(ADVLIB_CXXFLAGS) $< + $(OBJS)\advlib_propdlg.obj : .AUTODEPEND ..\..\src\generic\propdlg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(ADVLIB_CXXFLAGS) $< diff --git a/build/msw/wx_adv.dsp b/build/msw/wx_adv.dsp index 8d8abb1c3b..d9882bb8c0 100644 --- a/build/msw/wx_adv.dsp +++ b/build/msw/wx_adv.dsp @@ -648,6 +648,10 @@ SOURCE=..\..\src\generic\laywin.cpp # End Source File # Begin Source File +SOURCE=..\..\src\generic\odcombo.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\generic\propdlg.cpp # End Source File # Begin Source File @@ -1205,6 +1209,10 @@ SOURCE=..\..\include\wx\laywin.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\odcombo.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\propdlg.h # End Source File # Begin Source File diff --git a/build/msw/wx_base.dsp b/build/msw/wx_base.dsp index 03f10f066a..0ac699b71a 100644 --- a/build/msw/wx_base.dsp +++ b/build/msw/wx_base.dsp @@ -1319,6 +1319,10 @@ SOURCE=..\..\include\wx\msw\registry.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\msw\seh.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\msw\stackwalk.h # End Source File # Begin Source File diff --git a/build/msw/wx_core.dsp b/build/msw/wx_core.dsp index 5ef1ee2619..38b212ff8a 100644 --- a/build/msw/wx_core.dsp +++ b/build/msw/wx_core.dsp @@ -496,6 +496,10 @@ SOURCE=..\..\src\common\colourcmn.cpp # End Source File # Begin Source File +SOURCE=..\..\src\common\combocmn.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\common\containr.cpp # End Source File # Begin Source File @@ -1308,6 +1312,69 @@ SOURCE=..\..\src\msw\colour.cpp # End Source File # Begin Source File +SOURCE=..\..\src\msw\combo.cpp + +!IF "$(CFG)" == "core - Win32 DLL Universal Unicode Release" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "core - Win32 DLL Universal Unicode Debug" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "core - Win32 DLL Universal Release" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "core - Win32 DLL Universal Debug" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "core - Win32 DLL Unicode Release" + + +!ELSEIF "$(CFG)" == "core - Win32 DLL Unicode Debug" + + +!ELSEIF "$(CFG)" == "core - Win32 DLL Release" + + +!ELSEIF "$(CFG)" == "core - Win32 DLL Debug" + + +!ELSEIF "$(CFG)" == "core - Win32 Universal Unicode Release" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "core - Win32 Universal Unicode Debug" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "core - Win32 Universal Release" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "core - Win32 Universal Debug" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "core - Win32 Unicode Release" + + +!ELSEIF "$(CFG)" == "core - Win32 Unicode Debug" + + +!ELSEIF "$(CFG)" == "core - Win32 Release" + + +!ELSEIF "$(CFG)" == "core - Win32 Debug" + + +!ENDIF + +# End Source File +# Begin Source File + SOURCE=..\..\src\msw\combobox.cpp !IF "$(CFG)" == "core - Win32 DLL Universal Unicode Release" @@ -4089,6 +4156,10 @@ SOURCE=..\..\src\generic\colrdlgg.cpp # End Source File # Begin Source File +SOURCE=..\..\src\generic\combog.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\generic\dcpsg.cpp # End Source File # Begin Source File @@ -7484,6 +7555,10 @@ SOURCE=..\..\include\wx\msw\colour.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\msw\combo.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\msw\combobox.h # End Source File # Begin Source File @@ -7987,6 +8062,10 @@ SOURCE=..\..\include\wx\generic\colrdlgg.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\generic\combo.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\generic\dataview.h # End Source File # Begin Source File @@ -8439,6 +8518,10 @@ SOURCE=..\..\include\wx\colour.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\combo.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\combobox.h # End Source File # Begin Source File @@ -8771,6 +8854,10 @@ SOURCE=..\..\include\wx\numdlg.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\odcombo.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\ownerdrw.h # End Source File # Begin Source File diff --git a/build/msw/wx_html.dsp b/build/msw/wx_html.dsp index 28aa4574d2..228b30af17 100644 --- a/build/msw/wx_html.dsp +++ b/build/msw/wx_html.dsp @@ -1051,6 +1051,10 @@ SOURCE=..\..\include\wx\msw\genrcdefs.h !ENDIF +# End Source File +# Begin Source File + +SOURCE=..\..\include\wx\msw\helpbest.h # End Source File # End Group # Begin Group "wxHTML Headers" diff --git a/include/wx/combo.h b/include/wx/combo.h new file mode 100644 index 0000000000..b8a3550916 --- /dev/null +++ b/include/wx/combo.h @@ -0,0 +1,633 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/combo.h +// Purpose: wxComboControl declaration +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// RCS-ID: $Id$ +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COMBOCONTROL_H_BASE_ +#define _WX_COMBOCONTROL_H_BASE_ + + +/* + A few words about all the classes defined in this file are probably in + order: why do we need extra wxComboControl and wxComboPopup classes? + + This is because a traditional combobox is a combination of a text control + (with a button allowing to open the pop down list) with a listbox and + wxComboBox class is exactly such control, however we want to also have other + combinations - in fact, we want to allow anything at all to be used as pop + down list, not just a wxListBox. + + So we define a base wxComboControl which can use any control as pop down + list and wxComboBox deriving from it which implements the standard wxWidgets + combobox API. wxComboControl needs to be told somehow which control to use + and this is done by SetPopupControl(). However, we need something more than + just a wxControl in this method as, for example, we need to call + SetSelection("initial text value") and wxControl doesn't have such method. + So we also need a wxComboPopup which is just a very simple interface which + must be implemented by a control to be usable as a popup. + + We couldn't derive wxComboPopup from wxControl as this would make it + impossible to have a class deriving from both wxListBx and from it, so + instead it is just a mix-in. + */ + + +#include "wx/defs.h" + +#if wxUSE_COMBOCONTROL + + +#include "wx/textctrl.h" +#include "wx/button.h" +#include "wx/combobox.h" +#include "wx/renderer.h" // this is needed for wxCONTROL_XXX flags + + +class WXDLLEXPORT wxComboPopup; + +// +// New window styles for wxComboControlBase +// +enum +{ + // Double-clicking a read-only combo triggers call to popup's OnComboPopup. + // In wxOwnerDrawnComboBox, for instance, it cycles item. + wxCC_SPECIAL_DCLICK = 0x0100, + + // Use keyboard behaviour alternate to platform default: + // Up an down keys will show popup instead of cycling value. + wxCC_ALT_KEYS = 0x0200, + + // Dropbutton acts like standard push button. + wxCC_STD_BUTTON = 0x0400, +}; + + +// wxComboControl internal flags +enum +{ + // First those that can be passed to Customize. + // It is Windows style for all flags to be clear. + + // Button is preferred outside the border (GTK style) + wxCC_BUTTON_OUTSIDE_BORDER = 0x0001, + // Show popup on mouse up instead of mouse down (which is the Windows style) + wxCC_POPUP_ON_MOUSE_UP = 0x0002, + // All text is not automatically selected on click + wxCC_NO_TEXT_AUTO_SELECT = 0x0004, + + // Internal use: signals creation is complete + wxCC_IFLAG_CREATED = 0x0100, + // Internal use: really put button outside + wxCC_IFLAG_BUTTON_OUTSIDE = 0x0200, + // Internal use: SetTextIndent has been called + wxCC_IFLAG_INDENT_SET = 0x0400, + // Internal use: Set wxTAB_TRAVERSAL to parent when popup is dismissed + wxCC_IFLAG_PARENT_TAB_TRAVERSAL = 0x0800, +}; + + +// Flags used by PreprocessMouseEvent and HandleButtonMouseEvent +enum +{ + wxCC_MF_ON_BUTTON = 0x0001, // cursor is on dropbutton area +}; + + +// Namespace for wxComboControl feature flags +struct wxComboControlFeatures +{ + enum + { + MovableButton = 0x0001, // Button can be on either side of control + BitmapButton = 0x0002, // Button may be replaced with bitmap + ButtonSpacing = 0x0004, // Button can have spacing from the edge + // of the control + TextIndent = 0x0008, // SetTextIndent can be used + PaintControl = 0x0010, // Combo control itself can be custom painted + PaintWritable = 0x0020, // A variable-width area in front of writable + // combo control's textctrl can be custom + // painted + Borderless = 0x0040, // wxNO_BORDER window style works + + // There are no feature flags for... + // PushButtonBitmapBackground - if its in wxRendererNative, then it should be + // not an issue to have it automatically under the bitmap. + + All = MovableButton|BitmapButton| + ButtonSpacing|TextIndent| + PaintControl|PaintWritable| + Borderless, + }; +}; + + +class WXDLLEXPORT wxComboControlBase : public wxControl +{ + friend class wxComboPopup; +public: + // ctors and such + wxComboControlBase() : wxControl() { Init(); } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name); + + virtual ~wxComboControlBase(); + + // show/hide popup window + virtual void ShowPopup(); + virtual void HidePopup(); + + // Override for totally custom combo action + virtual void OnButtonClick(); + + // return true if the popup is currently shown + bool IsPopupShown() const { return m_isPopupShown; } + + // set interface class instance derived from wxComboPopup + void SetPopupControl( wxComboPopup* iface ); + + // get interface class instance derived from wxComboPopup + wxComboPopup* GetPopup() const { return m_popupInterface; } + + // get the popup window containing the popup control + wxWindow *GetPopupWindow() const { return m_winPopup; } + + // get the popup control/panel in window + wxWindow *GetPopupControl() const { return m_popup; } + + // Get the text control which is part of the combobox. + wxTextCtrl *GetTextCtrl() const { return m_text; } + + // get the dropdown button which is part of the combobox + // note: its not necessarily a wxButton or wxBitmapButton + wxWindow *GetButton() const { return m_btn; } + + // forward these methods to all subcontrols + virtual bool Enable(bool enable = true); + virtual bool Show(bool show = true); + virtual bool SetFont(const wxFont& font); +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); +#endif + + // wxTextCtrl methods - for readonly combo they should return + // without errors. + virtual wxString GetValue() const; + virtual void SetValue(const wxString& value); + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual long GetLastPosition() const; + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + virtual void SetSelection(long from, long to); + virtual void Undo(); + + // + // Popup customization methods + // + + // Sets minimum width of the popup. If wider than combo control, it will extend to the left. + // Remarks: + // * Value -1 indicates the default. + // * Custom popup may choose to ignore this (wxOwnerDrawnComboBox does not). + void SetPopupMinWidth( int width ) + { + m_widthMinPopup = width; + } + + // Sets preferred maximum height of the popup. + // Remarks: + // * Value -1 indicates the default. + // * Custom popup may choose to ignore this (wxOwnerDrawnComboBox does not). + void SetPopupMaxHeight( int height ) + { + m_heightPopup = height; + } + + // Extends popup size horizontally, relative to the edges of the combo control. + // Remarks: + // * Popup minimum width may override extLeft (ie. it has higher precedence). + // * Values 0 indicate default. + // * Custom popup may not take this fully into account (wxOwnerDrawnComboBox takes). + void SetPopupExtents( int extLeft, int extRight ) + { + m_extLeft = extLeft; + m_extRight = extRight; + } + + // Set width, in pixels, of custom paint area in writable combo. + // In read-only, used to indicate area that is not covered by the + // focus rectangle (which may or may not be drawn, depending on the + // popup type). + void SetCustomPaintWidth( int width ); + int GetCustomPaintWidth() const { return m_widthCustomPaint; } + + // Set side of the control to which the popup will align itself. + // Valid values are wxLEFT, wxRIGHT and 0. The default value 0 wmeans + // that the side of the button will be used. + void SetPopupAnchor( int anchorSide ) + { + m_anchorSide = anchorSide; + } + + // Set position of dropdown button. + // width: 0 > for specific custom width, negative to adjust to smaller than default + // height: 0 > for specific custom height, negative to adjust to smaller than default + // side: wxLEFT or wxRIGHT, indicates on which side the button will be placed. + // spacingX: empty space on sides of the button. Default is 0. + // Remarks: + // There is no spacingY - the button will be centered vertically. + void SetButtonPosition( int width = 0, int height = 0, int side = wxRIGHT, + int spacingX = 0 /*, int spacingY = 0*/ ); + + + // + // Sets dropbutton to be drawn with custom bitmaps. + // + // bmpNormal: drawn when cursor is not on button + // blankButtonBg: Draw blank button background below the image. + // NOTE! This is only properly supported on platforms with appropriate + // method in wxRendererNative. + // bmpPressed: drawn when button is depressed + // bmpHover: drawn when cursor hovers on button. This is ignored on platforms + // that do not generally display hover differently. + // bmpDisabled: drawn when combobox is disabled. + void SetButtonBitmaps( const wxBitmap& bmpNormal, + bool blankButtonBg = false, + const wxBitmap& bmpPressed = wxNullBitmap, + const wxBitmap& bmpHover = wxNullBitmap, + const wxBitmap& bmpDisabled = wxNullBitmap ); + + // + // This will set the space in pixels between left edge of the control and the + // text, regardless whether control is read-only (ie. no wxTextCtrl) or not. + // Platform-specific default can be set with value-1. + // Remarks + // * This method may do nothing on some native implementations. + void SetTextIndent( int indent ); + + // Returns actual indentation in pixels. + wxCoord GetTextIndent() const + { + return m_absIndent; + } + + // + // Utilies needed by the popups or native implementations + // + + // Draws focus background (on combo control) in a way typical on platform. + // Unless you plan to paint your own focus indicator, you should always call this + // in your wxComboPopup::PaintComboControl implementation. + // In addition, it sets pen and text colour to what looks good and proper + // against the background. + // flags: wxRendererNative flags: wxCONTROL_ISSUBMENU: is drawing a list item instead of combo control + // wxCONTROL_SELECTED: list item is selected + // wxCONTROL_DISABLED: control/item is disabled + virtual void DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags ); + + // Returns true if focus indicator should be drawn. + bool ShouldDrawFocus() const + { + const wxWindow* curFocus = FindFocus(); + return ( !m_isPopupShown && + (curFocus == this || (m_btn && curFocus == m_btn)) && + (m_windowStyle & wxCB_READONLY) ); + } + + // These methods return references to appropriate dropbutton bitmaps + const wxBitmap& GetBitmapNormal() const { return m_bmpNormal; } + const wxBitmap& GetBitmapPressed() const { return m_bmpPressed; } + const wxBitmap& GetBitmapHover() const { return m_bmpHover; } + const wxBitmap& GetBitmapDisabled() const { return m_bmpDisabled; } + + // Return internal flags + wxUint32 GetInternalFlags() const { return m_iFlags; } + + // Return true if Create has finished + bool IsCreated() const { return m_iFlags & wxCC_IFLAG_CREATED ? true : false; } + + // Popup may use these as callbacks to measure and draw list items. + // (wxOwnerDrawnComboBox uses these, obviously) + // item: -1 means item is the combo control itself + // flags: wxCC_PAINTING_CONTROL is set if painting to combo control instead of list + // return value: OnDrawListItem must return true if it did anything + virtual bool OnDrawListItem( wxDC& dc, const wxRect& rect, int item, int flags ); + + // Return item height, or -1 for text height (default) + virtual wxCoord OnMeasureListItem( int item ); + + // Return item width, or -1 for calculating from text extent (default) + virtual wxCoord OnMeasureListItemWidth( int item ); + + // NOTE: + // I basicly needed to add callback methods into wxComboControlBase - otherwise it + // will not be easily possible to use wxVListBoxComboPopup from simultaneously existing + // wxComboControl and wxGenericComboControl (since some native implementations + // might not have all the features, I really would like to have this options). + + // common code to be called on popup hide/dismiss + void OnPopupDismiss(); + +protected: + + // + // Override these for customization purposes + // + + // called from wxSizeEvent handler + virtual void OnResize() = 0; + + // Return native text identation (for pure text, not textctrl) + virtual wxCoord GetNativeTextIndent() const; + + // Called in syscolourchanged handler and base create + virtual void OnThemeChange(); + + // Creates wxTextCtrl. + // extraStyle: Extra style parameters + void CreateTextCtrl( int extraStyle, const wxValidator& validator ); + + // Installs standard input handler to combo (and optionally to the textctrl) + void InstallInputHandlers( bool alsoTextCtrl = true ); + + // Draws dropbutton. Using wxRenderer or bitmaps, as appropriate. + void DrawButton( wxDC& dc, const wxRect& rect, bool paintBg = true ); + + // Call if cursor is on button area or mouse is captured for the button. + //bool HandleButtonMouseEvent( wxMouseEvent& event, bool isInside ); + bool HandleButtonMouseEvent( wxMouseEvent& event, int flags ); + + // Conversion to double-clicks and some basic filtering + // returns true if event was consumed or filtered (event type is also set to 0 in this case) + //bool PreprocessMouseEvent( wxMouseEvent& event, bool isOnButtonArea ); + bool PreprocessMouseEvent( wxMouseEvent& event, int flags ); + + // + // This will handle left_down and left_dclick events outside button in a Windows-like manner. + // If you need alternate behaviour, it is recommended you manipulate and filter events to it + // instead of building your own handling routine (for reference, on wxEVT_LEFT_DOWN it will + // toggle popup and on wxEVT_LEFT_DCLICK it will do the same or run the popup's dclick method, + // if defined - you should pass events of other types of it for common processing). + void HandleNormalMouseEvent( wxMouseEvent& event ); + + // Creates popup window, calls interface->Create(), etc + void CreatePopup(); + + // override the base class virtuals involved in geometry calculations + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual wxSize DoGetBestSize() const; + + // Recalculates button and textctrl areas. Called when size or button setup change. + // btnWidth: default/calculated width of the dropbutton. 0 means unchanged, + // just recalculate. + void CalculateAreas( int btnWidth = 0 ); + + // Standard textctrl positioning routine. Just give it platform-dependant + // textctrl coordinate adjustment. + void PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust ); + + // event handlers + void OnSizeEvent( wxSizeEvent& event ); + void OnFocusEvent(wxFocusEvent& event); + void OnTextCtrlEvent(wxCommandEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // Set customization flags (directs how wxComboControlBase helpers behave) + void Customize( wxUint32 flags ) { m_iFlags |= flags; } + + // Dispatches size event and refreshes + void RecalcAndRefresh(); + + // Used by OnPaints of derived classes + wxBitmap& GetBufferBitmap(const wxSize& sz) const; + + // This is used when m_text is hidden (readonly). + wxString m_valueString; + + // the text control and button we show all the time + wxTextCtrl* m_text; + wxWindow* m_btn; + + // wxPopupWindow or similar containing the window managed by the interface. + wxWindow* m_winPopup; + + // the popup control/panel + wxWindow* m_popup; + + // popup interface + wxComboPopup* m_popupInterface; + + // this is for this control itself + wxEvtHandler* m_extraEvtHandler; + + // this is for text + wxEvtHandler* m_textEvtHandler; + + // this is for the top level window + wxEvtHandler* m_toplevEvtHandler; + + // this is for the control in popup + wxEvtHandler* m_popupExtraHandler; + + // needed for "instant" double-click handling + wxLongLong m_timeLastMouseUp; + + // used to prevent immediate re-popupping incase closed popup + // by clicking on the combo control (needed because of inconsistent + // transient implementation across platforms). + wxLongLong m_timeCanAcceptClick; + + // how much popup should expand to the left/right of the control + wxCoord m_extLeft; + wxCoord m_extRight; + + // minimum popup width + wxCoord m_widthMinPopup; + + // preferred popup height + wxCoord m_heightPopup; + + // how much of writable combo is custom-paint by callback? + // also used to indicate area that is not covered by "blue" + // selection indicator. + wxCoord m_widthCustomPaint; + + // absolute text indentation, in pixels + wxCoord m_absIndent; + + // side on which the popup is aligned + int m_anchorSide; + + // Width of the "fake" border + wxCoord m_widthCustomBorder; + + // The button and textctrl click/paint areas + wxRect m_tcArea; + wxRect m_btnArea; + + // current button state (uses renderer flags) + int m_btnState; + + // button position + int m_btnWid; + int m_btnHei; + int m_btnSide; + int m_btnSpacingX; + + // last default button width + int m_btnWidDefault; + + // custom dropbutton bitmaps + wxBitmap m_bmpNormal; + wxBitmap m_bmpPressed; + wxBitmap m_bmpHover; + wxBitmap m_bmpDisabled; + + // area used by the button + wxSize m_btnSize; + + // platform-dependant customization and other flags + wxUint32 m_iFlags; + + // draw blank button background under bitmap? + bool m_blankButtonBg; + + // is the popup window currenty shown? + bool m_isPopupShown; + + // Set to 1 on mouse down, 0 on mouse up. Used to eliminate down-less mouse ups. + bool m_downReceived; + +private: + void Init(); + + DECLARE_EVENT_TABLE() + + DECLARE_ABSTRACT_CLASS(wxComboControlBase) +}; + + +// ---------------------------------------------------------------------------- +// wxComboPopup is the interface which must be implemented by a control to be +// used as a popup by wxComboControl +// ---------------------------------------------------------------------------- + + +// wxComboPopup internal flags +enum +{ + wxCP_IFLAG_CREATED = 0x0001, // Set by wxComboControlBase after Create is called +}; + + +class WXDLLEXPORT wxComboPopup +{ + friend class wxComboControlBase; +public: + wxComboPopup(wxComboControlBase *combo) + { + m_combo = combo; + m_iFlags = 0; + } + + virtual ~wxComboPopup(); + + // Create the popup child control. + // Return true for success. + virtual bool Create(wxWindow* parent) = 0; + + // We must have an associated control which is subclassed by the combobox. + virtual wxWindow *GetControl() = 0; + + // Called immediately after the popup is shown + virtual void OnPopup(); + + // Called when popup is dismissed + virtual void OnDismiss(); + + // Called just prior to displaying popup. + // Default implementation does nothing. + virtual void SetStringValue( const wxString& value ); + + // Gets displayed string representation of the value. + virtual wxString GetStringValue() const = 0; + + // This is called to custom paint in the combo control itself (ie. not the popup). + // Default implementation draws value as string. + virtual void PaintComboControl( wxDC& dc, const wxRect& rect ); + + // Receives key events from the parent wxComboControl. + // Events not handled should be skipped, as usual. + virtual void OnComboKeyEvent( wxKeyEvent& event ); + + // Implement if you need to support special action when user + // double-clicks on the parent wxComboControl. + virtual void OnComboDoubleClick(); + + // Return final size of popup. Called on every popup, just prior to OnShow. + // minWidth = preferred minimum width for window + // prefHeight = preferred height. Only applies if > 0, + // maxHeight = max height for window, as limited by screen size + // and should only be rounded down, if necessary. + virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight ); + + // Return true if you want delay call to Create until the popup is shown + // for the first time. It is more efficient, but note that it is often + // more convenient to have the control created immediately. + // Default returns false. + virtual bool LazyCreate(); + + // + // Utilies + // + + // Hides the popup + void Dismiss(); + + // Returns true if Create has been called. + bool IsCreated() const + { + return (m_iFlags & wxCP_IFLAG_CREATED) ? true : false; + } + +protected: + wxComboControlBase* m_combo; + wxUint32 m_iFlags; +}; + + +// ---------------------------------------------------------------------------- +// include the platform-dependent header defining the real class +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + // No native universal (but it must still be first in the list) +#elif defined(__WXMSW__) + #include "wx/msw/combo.h" +#endif + +// Any ports may need generic as an alternative +#include "wx/generic/combo.h" + +#endif // wxUSE_COMBOCONTROL + +#endif + // _WX_COMBOCONTROL_H_BASE_ diff --git a/include/wx/generic/combo.h b/include/wx/generic/combo.h new file mode 100644 index 0000000000..49c3c271d0 --- /dev/null +++ b/include/wx/generic/combo.h @@ -0,0 +1,135 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/combo.h +// Purpose: Generic wxComboControl +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// RCS-ID: $Id$ +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_COMBOCONTROL_H_ +#define _WX_GENERIC_COMBOCONTROL_H_ + +#if wxUSE_COMBOCONTROL + +// Only define generic if native doesn't have all the features +#if !defined(wxCOMBOCONTROL_FULLY_FEATURED) + +// ---------------------------------------------------------------------------- +// Generic wxComboControl +// ---------------------------------------------------------------------------- + +#if defined(__WXUNIVERSAL__) + +// all actions of single line text controls are supported + +// popup/dismiss the choice window +#define wxACTION_COMBOBOX_POPUP _T("popup") +#define wxACTION_COMBOBOX_DISMISS _T("dismiss") + +#endif + + +class WXDLLEXPORT wxGenericComboControl : public wxComboControlBase +{ +public: + // ctors and such + wxGenericComboControl() : wxComboControlBase() { Init(); } + + wxGenericComboControl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + : wxComboControlBase() + { + Init(); + + (void)Create(parent, id, value, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + virtual ~wxGenericComboControl(); + + static int GetFeatures() { return wxComboControlFeatures::All; } + +#if defined(__WXUNIVERSAL__) + // we have our own input handler and our own actions + virtual bool PerformAction(const wxControlAction& action, + long numArg = 0l, + const wxString& strArg = wxEmptyString); +#endif + +protected: + + // Mandatory virtuals + virtual void OnResize(); + + // Event handlers + void OnPaintEvent( wxPaintEvent& event ); + void OnMouseEvent( wxMouseEvent& event ); + +private: + void Init(); + + DECLARE_EVENT_TABLE() + + DECLARE_DYNAMIC_CLASS(wxGenericComboControl) +}; + + +#ifndef _WX_COMBOCONTROL_H_ + +// If native wxComboControl was not defined, then prepare a simple +// front-end so that wxRTTI works as expected. + +class WXDLLEXPORT wxComboControl : public wxGenericComboControl +{ +public: + wxComboControl() : wxGenericComboControl() {} + + wxComboControl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + : wxGenericComboControl() + { + (void)Create(parent, id, value, pos, size, style, validator, name); + } + + virtual ~wxComboControl() {} + +protected: + +private: + DECLARE_DYNAMIC_CLASS(wxComboControl) +}; + +#endif // _WX_COMBOCONTROL_H_ + +#else + +#define wxGenericComboControl wxComboControl + +#endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED) + +#endif // wxUSE_COMBOCONTROL +#endif + // _WX_GENERIC_COMBOCONTROL_H_ diff --git a/include/wx/msw/combo.h b/include/wx/msw/combo.h new file mode 100644 index 0000000000..a62255e133 --- /dev/null +++ b/include/wx/msw/combo.h @@ -0,0 +1,86 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/combo.h +// Purpose: wxComboControl class +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// RCS-ID: $Id$ +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COMBOCONTROL_H_ +#define _WX_COMBOCONTROL_H_ + +// NB: Definition of _WX_COMBOCONTROL_H_ is used in wx/generic/combo.h to +// determine whether there is native wxComboControl, so make sure you +// use it in all native wxComboControls. + +#if wxUSE_COMBOCONTROL + +// ---------------------------------------------------------------------------- +// Native wxComboControl +// ---------------------------------------------------------------------------- + +// Define this only if native implementation includes all features +#define wxCOMBOCONTROL_FULLY_FEATURED + +class WXDLLEXPORT wxComboControl : public wxComboControlBase +{ +public: + // ctors and such + wxComboControl() : wxComboControlBase() { Init(); } + + wxComboControl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + : wxComboControlBase() + { + Init(); + + (void)Create(parent, id, value, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + virtual ~wxComboControl(); + + virtual void DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags ); + + static int GetFeatures() { return wxComboControlFeatures::All; } + +protected: + + // customization + virtual void OnResize(); + virtual wxCoord GetNativeTextIndent() const; + virtual void OnThemeChange(); + + // event handlers + void OnPaintEvent( wxPaintEvent& event ); + void OnMouseEvent( wxMouseEvent& event ); + +private: + void Init(); + + DECLARE_EVENT_TABLE() + + DECLARE_DYNAMIC_CLASS(wxComboControl) +}; + + +#endif // wxUSE_COMBOCONTROL +#endif + // _WX_COMBOCONTROL_H_ diff --git a/include/wx/odcombo.h b/include/wx/odcombo.h new file mode 100644 index 0000000000..33d7025e55 --- /dev/null +++ b/include/wx/odcombo.h @@ -0,0 +1,267 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/odcombo.h +// Purpose: wxOwnerDrawnComboBox and wxVListBoxPopup +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// RCS-ID: $Id$ +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ODCOMBO_H_ +#define _WX_ODCOMBO_H_ + +#include "wx/defs.h" + +#if wxUSE_OWNERDRAWNCOMBOBOX + +#include "wx/combo.h" +#include "wx/ctrlsub.h" +#include "wx/vlbox.h" + + +// +// New window styles for wxOwnerDrawnComboBox +// +enum +{ + // Double-clicking cycles item if wxCB_READONLY is also used. + wxODCB_DCLICK_CYCLES = wxCC_SPECIAL_DCLICK, + + // If used, control itself is not custom paint using callback. + // Even if this is not used, writable combo is never custom paint + // until SetCustomPaintWidth is called + wxODCB_STD_CONTROL_PAINT = 0x1000 +}; + + +// +// Callback flags +// +enum +{ + // when set, we are painting the selected item in control, + // not in the popup + wxCC_PAINTING_CONTROL = 0x0001 +}; + + +// ---------------------------------------------------------------------------- +// wxVListBoxComboPopup is a wxVListBox customized to act as a popup control. +// +// Notes: +// wxOwnerDrawnComboBox uses this as its popup. However, it always derives +// from native wxComboControl. If you need to use this popup with +// wxGenericComboControl, then remember that vast majority of item manipulation +// functionality is implemented in the wxVListBoxComboPopup class itself. +// +// ---------------------------------------------------------------------------- + + +class WXDLLEXPORT wxVListBoxComboPopup : public wxVListBox, public wxComboPopup +{ + friend class wxOwnerDrawnComboBox; +public: + + // ctor and dtor + wxVListBoxComboPopup(wxComboControlBase* combo); + virtual ~wxVListBoxComboPopup(); + + // required virtuals + virtual bool Create(wxWindow* parent); + virtual wxWindow *GetControl() { return this; } + virtual void SetStringValue( const wxString& value ); + virtual wxString GetStringValue() const; + + // more customization + virtual void OnPopup(); + virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight ); + virtual void PaintComboControl( wxDC& dc, const wxRect& rect ); + virtual void OnComboKeyEvent( wxKeyEvent& event ); + virtual void OnComboDoubleClick(); + virtual bool LazyCreate(); + + // Item management + void SetSelection( int item ); + void Insert( const wxString& item, int pos ); + int Append(const wxString& item); + void Clear(); + void Delete( unsigned int item ); + void SetItemClientData(unsigned int n, void* clientData, wxClientDataType clientDataItemsType); + void *GetItemClientData(unsigned int n) const; + void SetString( int item, const wxString& str ); + wxString GetString( int item ) const; + unsigned int GetCount() const; + int FindString(const wxString& s) const; + + void Populate( int n, const wxString choices[] ); + void ClearClientDatas(); + + // helpers + int GetItemAtPosition( const wxPoint& pos ) { return HitTest(pos); } + wxCoord GetTotalHeight() const { return EstimateTotalHeight(); } + wxCoord GetLineHeight(int line) const { return OnGetLineHeight(line); } + +protected: + + // Called by OnComboDoubleClick and OnComboKeyEvent + bool HandleKey( int keycode, bool saturate ); + + // sends combobox select event from the parent combo control + void SendComboBoxEvent(); + + // Re-calculates width for given item + void CheckWidth( int pos ); + + // wxVListBox implementation + virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const; + virtual wxCoord OnMeasureItem(size_t n) const; + void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const; + + // filter mouse move events happening outside the list box + // move selection with cursor + void OnMouseMove(wxMouseEvent& event); + void OnMouseWheel(wxMouseEvent& event); + void OnKey(wxKeyEvent& event); + void OnLeftClick(wxMouseEvent& event); + + wxArrayString m_strings; + wxArrayPtrVoid m_clientDatas; + wxArrayInt m_widths; // cached line widths + + wxFont m_font; + + int m_value; // selection + int m_itemHover; // on which item the cursor is + int m_widestWidth; // width of widest item thus far + int m_avgCharWidth; + int m_baseImageWidth; // how much per item drawn in addition to text + int m_itemHeight; // default item height (calculate from font size + // and used in the absence of callback) + wxClientDataType m_clientDataItemsType; + +private: + + // has the mouse been released on this control? + bool m_clicked; + + DECLARE_EVENT_TABLE() +}; + + +// ---------------------------------------------------------------------------- +// wxOwnerDrawnComboBox: a generic wxComboBox that allows custom paint items +// in addition to many other types of customization already allowed by +// the wxComboControl. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxOwnerDrawnComboBox : public wxComboControl, public wxItemContainer +{ + friend class wxComboPopupWindow; + friend class wxComboControlBase; +public: + + // ctors and such + wxOwnerDrawnComboBox() : wxComboControl() { Init(); } + + wxOwnerDrawnComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + int n, + const wxString choices[], + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + : wxComboControl() + { + Init(); + + (void)Create(parent, id, value, pos, size, n, + choices, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + wxOwnerDrawnComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = (const wxString *) NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + virtual ~wxOwnerDrawnComboBox(); + + // wxControlWithItems methods + virtual void Clear(); + virtual void Delete(unsigned int n); + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); + virtual int FindString(const wxString& s) const; + virtual void Select(int n); + virtual int GetSelection() const; + void SetSelection(int n) { Select(n); } + + wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST + +protected: + + // clears all allocated client datas + void ClearClientDatas(); + + virtual int DoAppend(const wxString& item); + virtual int DoInsert(const wxString& item, unsigned int pos); + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(unsigned int n) const; + + // overload m_popupInterface member so we can access specific popup interface easier + wxVListBoxComboPopup* m_popupInterface; + +private: + void Init(); + + DECLARE_EVENT_TABLE() + + DECLARE_DYNAMIC_CLASS(wxOwnerDrawnComboBox) +}; + + +#endif // wxUSE_OWNERDRAWNCOMBOBOX +#endif + // _WX_ODCOMBO_H_ diff --git a/samples/combo/combo.bkl b/samples/combo/combo.bkl new file mode 100644 index 0000000000..debf0e4920 --- /dev/null +++ b/samples/combo/combo.bkl @@ -0,0 +1,16 @@ + + + + + + + + + combo.cpp + core + base + adv + wx06 + + + diff --git a/samples/combo/combo.cpp b/samples/combo/combo.cpp new file mode 100644 index 0000000000..7d96e34276 --- /dev/null +++ b/samples/combo/combo.cpp @@ -0,0 +1,990 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: combo.cpp +// Purpose: wxComboControl sample +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// RCS-ID: $Id$ +// Copyright: (c) Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +// for all others, include the necessary headers (this file is usually all you +// need because it includes almost all "standard" wxWidgets headers) +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#if !wxUSE_COMBOCONTROL + #error "Please set wxUSE_COMBOCONTROL to 1 and rebuild the library." +#endif + +#include "wx/image.h" + +#include "wx/combo.h" +#include "wx/odcombo.h" + +// ---------------------------------------------------------------------------- +// resources +// ---------------------------------------------------------------------------- + +// the application icon (under Windows and OS/2 it is in resources and even +// though we could still include the XPM here it would be unused) +#if !defined(__WXMSW__) && !defined(__WXPM__) + #include "../sample.xpm" +#endif + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// Define a new application type, each program should derive a class from wxApp +class MyApp : public wxApp +{ +public: + // override base class virtuals + // ---------------------------- + + // this one is called on application startup and is a good place for the app + // initialization (doing it here and not in the ctor allows to have an error + // return: if OnInit() returns false, the application terminates) + virtual bool OnInit(); +}; + +// Define a new frame type: this is going to be our main frame +class MyFrame : public wxFrame +{ +public: + // ctor and dtor + MyFrame(const wxString& title); + ~MyFrame(); + + // event handlers (these functions should _not_ be virtual) + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + + // log wxComboControl events + void OnComboBoxUpdate( wxCommandEvent& event ); + +protected: + wxTextCtrl* m_logWin; + wxLog* m_logOld; + +private: + // any class wishing to process wxWidgets events must use this macro + DECLARE_EVENT_TABLE() +}; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// IDs for the controls and the menu commands +enum +{ + // menu items + ComboControl_Quit = wxID_EXIT, + + // it is important for the id corresponding to the "About" command to have + // this standard value as otherwise it won't be handled properly under Mac + // (where it is special and put into the "Apple" menu) + ComboControl_About = wxID_ABOUT +}; + +// ---------------------------------------------------------------------------- +// event tables and other macros for wxWidgets +// ---------------------------------------------------------------------------- + +// the event tables connect the wxWidgets events with the functions (event +// handlers) which process them. It can be also done at run-time, but for the +// simple menu events like this the static method is much simpler. +BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_TEXT(wxID_ANY,MyFrame::OnComboBoxUpdate) + EVT_COMBOBOX(wxID_ANY,MyFrame::OnComboBoxUpdate) + + EVT_MENU(ComboControl_Quit, MyFrame::OnQuit) + EVT_MENU(ComboControl_About, MyFrame::OnAbout) +END_EVENT_TABLE() + +// Create a new application object: this macro will allow wxWidgets to create +// the application object during program execution (it's better than using a +// static object for many reasons) and also implements the accessor function +// wxGetApp() which will return the reference of the right type (i.e. MyApp and +// not wxApp) +IMPLEMENT_APP(MyApp) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// the application class +// ---------------------------------------------------------------------------- + +// 'Main program' equivalent: the program execution "starts" here +bool MyApp::OnInit() +{ + // create the main application window + MyFrame *frame = new MyFrame(_T("wxComboControl Sample")); + + // and show it (the frames, unlike simple controls, are not shown when + // created initially) + frame->Show(true); + + // success: wxApp::OnRun() will be called which will enter the main message + // loop and the application will run. If we returned false here, the + // application would exit immediately. + return true; +} + + +// ---------------------------------------------------------------------------- +// wxListView Custom popup interface +// ---------------------------------------------------------------------------- + +#include + +class ListViewComboPopup : public wxListView, public wxComboPopup +{ +public: + + ListViewComboPopup(wxComboControlBase* combo) + : wxListView(), wxComboPopup(combo) + { + m_value = -1; + m_itemHere = -1; // hot item in list + } + + virtual bool Create( wxWindow* parent ) + { + return wxListView::Create(parent,1, + wxPoint(0,0),wxDefaultSize, + wxLC_LIST|wxLC_SINGLE_SEL| + wxLC_SORT_ASCENDING|wxSIMPLE_BORDER); + } + + virtual wxWindow *GetControl() { return this; } + + virtual void SetStringValue( const wxString& s ) + { + int n = wxListView::FindItem(-1,s); + if ( n >= 0 && n < GetItemCount() ) + wxListView::Select(n); + } + + virtual wxString GetStringValue() const + { + if ( m_value >= 0 ) + return wxListView::GetItemText(m_value); + return wxEmptyString; + } + + // + // Popup event handlers + // + + // Mouse hot-tracking + void OnMouseMove(wxMouseEvent& event) + { + // Move selection to cursor if it is inside the popup + + int resFlags; + int itemHere = HitTest(event.GetPosition(),resFlags); + if ( itemHere >= 0 ) + { + wxListView::Select(itemHere,true); + m_itemHere = itemHere; + } + event.Skip(); + } + + // On mouse left, set the value and close the popup + void OnMouseClick(wxMouseEvent& WXUNUSED(event)) + { + m_value = m_itemHere; + // TODO: Send event + Dismiss(); + } + + // + // Utilies for item manipulation + // + + void AddSelection( const wxString& selstr ) + { + wxListView::InsertItem(GetItemCount(),selstr); + } + +protected: + + int m_value; // current item index + int m_itemHere; // hot item in popup + +private: + DECLARE_EVENT_TABLE() +}; + +BEGIN_EVENT_TABLE(ListViewComboPopup, wxListView) + EVT_MOTION(ListViewComboPopup::OnMouseMove) + // NOTE: Left down event is used instead of left up right now + // since MSW wxListCtrl doesn't seem to emit left ups + // consistently. + EVT_LEFT_DOWN(ListViewComboPopup::OnMouseClick) +END_EVENT_TABLE() + + +// ---------------------------------------------------------------------------- +// wxTreeCtrl Custom popup interface +// ---------------------------------------------------------------------------- + +#include + +class TreeCtrlComboPopup : public wxTreeCtrl, public wxComboPopup +{ +public: + + TreeCtrlComboPopup(wxComboControlBase* combo) + : wxTreeCtrl(), wxComboPopup(combo) + { + } + + virtual bool Create( wxWindow* parent ) + { + return wxTreeCtrl::Create(parent,1, + wxPoint(0,0),wxDefaultSize, + wxTR_HIDE_ROOT|wxTR_HAS_BUTTONS| + wxTR_SINGLE|wxTR_LINES_AT_ROOT| + wxSIMPLE_BORDER); + } + + virtual void OnShow() + { + // make sure selected item is visible + if ( m_value.IsOk() ) + EnsureVisible(m_value); + } + + virtual wxSize GetAdjustedSize( int minWidth, + int WXUNUSED(prefHeight), + int maxHeight ) + { + return wxSize(wxMax(300,minWidth),wxMin(250,maxHeight)); + } + + virtual wxWindow *GetControl() { return this; } + + // Needed by SetStringValue + wxTreeItemId FindItemByText( wxTreeItemId parent, const wxString& text ) + { + wxTreeItemIdValue cookie; + wxTreeItemId child = GetFirstChild(parent,cookie); + while ( child.IsOk() ) + { + if ( GetItemText(child) == text ) + { + return child; + } + if ( ItemHasChildren(child) ) + { + wxTreeItemId found = FindItemByText(child,text); + if ( found.IsOk() ) + return found; + } + child = GetNextChild(parent,cookie); + } + return wxTreeItemId(); + } + + virtual void SetStringValue( const wxString& s ) + { + wxTreeItemId root = GetRootItem(); + if ( !root.IsOk() ) + return; + + wxTreeItemId found = FindItemByText(root,s); + if ( found.IsOk() ) + { + m_value = m_itemHere = found; + wxTreeCtrl::SelectItem(found); + } + } + + virtual wxString GetStringValue() const + { + if ( m_value.IsOk() ) + return wxTreeCtrl::GetItemText(m_value); + return wxEmptyString; + } + + // + // Popup event handlers + // + + // Mouse hot-tracking + void OnMouseMove(wxMouseEvent& event) + { + int resFlags; + wxTreeItemId itemHere = HitTest(event.GetPosition(),resFlags); + if ( itemHere.IsOk() && (resFlags & wxTREE_HITTEST_ONITEMLABEL) ) + { + wxTreeCtrl::SelectItem(itemHere,true); + m_itemHere = itemHere; + } + event.Skip(); + } + + // On mouse left, set the value and close the popup + void OnMouseClick(wxMouseEvent& event) + { + int resFlags; + wxTreeItemId itemHere = HitTest(event.GetPosition(),resFlags); + if ( itemHere.IsOk() && (resFlags & wxTREE_HITTEST_ONITEMLABEL) ) + { + m_itemHere = itemHere; + m_value = itemHere; + Dismiss(); + // TODO: Send event + } + event.Skip(); + } + +protected: + + wxTreeItemId m_value; // current item index + wxTreeItemId m_itemHere; // hot item in popup + +private: + DECLARE_EVENT_TABLE() +}; + +BEGIN_EVENT_TABLE(TreeCtrlComboPopup, wxTreeCtrl) + EVT_MOTION(TreeCtrlComboPopup::OnMouseMove) + // NOTE: Left down event is used instead of left up right now + // since MSW wxTreeCtrl doesn't seem to emit left ups + // consistently. + EVT_LEFT_DOWN(TreeCtrlComboPopup::OnMouseClick) +END_EVENT_TABLE() + +// ---------------------------------------------------------------------------- +// wxOwnerDrawnComboBox with custom paint list items +// ---------------------------------------------------------------------------- + +class wxPenStyleComboBox : public wxOwnerDrawnComboBox +{ +public: + virtual bool OnDrawListItem( wxDC& dc, const wxRect& rect, int item, int flags ) + { + wxRect r(rect); + r.Deflate(3); + r.height -= 2; + + int pen_style = wxSOLID; + if ( item == 1 ) + pen_style = wxTRANSPARENT; + else if ( item == 2 ) + pen_style = wxDOT; + else if ( item == 3 ) + pen_style = wxLONG_DASH; + else if ( item == 4 ) + pen_style = wxSHORT_DASH; + else if ( item == 5 ) + pen_style = wxDOT_DASH; + else if ( item == 6 ) + pen_style = wxBDIAGONAL_HATCH; + else if ( item == 7 ) + pen_style = wxCROSSDIAG_HATCH; + else if ( item == 8 ) + pen_style = wxFDIAGONAL_HATCH; + else if ( item == 9 ) + pen_style = wxCROSS_HATCH; + else if ( item == 10 ) + pen_style = wxHORIZONTAL_HATCH; + else if ( item == 11 ) + pen_style = wxVERTICAL_HATCH; + + wxPen pen( dc.GetTextForeground(), 3, pen_style ); + + // Get text colour as pen colour + dc.SetPen ( pen ); + + if ( !(flags & wxCC_PAINTING_CONTROL) ) + { + dc.DrawText(GetString( item ), + r.x + 3, + (r.y + 0) + ( (r.height/2) - dc.GetCharHeight() )/2 + ); + + dc.DrawLine( r.x+5, r.y+((r.height/4)*3), r.x+r.width - 5, r.y+((r.height/4)*3) ); + + /* + dc.SetBrush( *wxTRANSPARENT_BRUSH ); + dc.DrawRectangle( r ); + + dc.DrawText(GetString( item ), + r.x + 3, + (r.y + 0) + ( (r.height) - dc.GetCharHeight() )/2 + ); + */ + } + else + { + dc.DrawLine( r.x+5, r.y+r.height/2, r.x+r.width - 5, r.y+r.height/2 ); + } + + return true; + } + + virtual wxCoord OnMeasureListItem( int WXUNUSED(item) ) + { + return 24; + } + + virtual wxCoord OnMeasureListItemWidth( int WXUNUSED(item) ) + { + return -1; // default - will be measured from text width + } + +}; + +// ---------------------------------------------------------------------------- +// wxComboControl with entirely custom button action (opens file dialog) +// ---------------------------------------------------------------------------- + +class wxFileSelectorCombo : public wxComboControl +{ +public: + wxFileSelectorCombo() : wxComboControl() { Init(); } + + wxFileSelectorCombo(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + : wxComboControl() + { + Init(); + Create(parent,id,value, + pos,size, + // Style flag wxCC_STD_BUTTON makes the button + // behave more like a standard push button. + style | wxCC_STD_BUTTON, + validator,name); + + // + // Prepare custom button bitmap (just '...' text) + wxMemoryDC dc; + wxBitmap bmp(12,16); + dc.SelectObject(bmp); + + // Draw transparent background + wxColour magic(255,0,255); + wxBrush magicBrush(magic); + dc.SetBrush( magicBrush ); + dc.SetPen( *wxTRANSPARENT_PEN ); + dc.DrawRectangle(0,0,bmp.GetWidth(),bmp.GetHeight()); + + // Draw text + wxString str = wxT("..."); + int w,h; + dc.GetTextExtent(str, &w, &h, 0, 0); + dc.DrawText(str, (bmp.GetWidth()-w)/2, (bmp.GetHeight()-h)/2); + + dc.SelectObject( wxNullBitmap ); + + // Finalize transparency with a mask + wxMask *mask = new wxMask( bmp, magic ); + bmp.SetMask( mask ); + + SetButtonBitmaps(bmp,true); + } + + virtual void OnButtonClick() + { + // Show standard wxFileDialog on button click + + wxFileDialog dlg(this, + wxT("Choose File"), + wxEmptyString, + GetValue(), + wxT("All files (*.*)|*.*"), + wxOPEN); + + if ( dlg.ShowModal() == wxID_OK ) + { + SetValue(dlg.GetPath()); + } + } + +private: + void Init() + { + // Initialize member variables here + } +}; + +// ---------------------------------------------------------------------------- +// main frame +// ---------------------------------------------------------------------------- + +// frame constructor +MyFrame::MyFrame(const wxString& title) + : wxFrame(NULL, wxID_ANY, title) +{ + wxBoxSizer* topSizer; + wxBoxSizer* topRowSizer; + wxBoxSizer* colSizer; + wxBoxSizer* rowSizer; + wxStaticBoxSizer* groupSizer; + + // set the frame icon + SetIcon(wxICON(sample)); + +#if wxUSE_MENUS + // create a menu bar + wxMenu *fileMenu = new wxMenu; + + // the "About" item should be in the help menu + wxMenu *helpMenu = new wxMenu; + helpMenu->Append(ComboControl_About, _T("&About...\tF1"), _T("Show about dialog")); + + fileMenu->Append(ComboControl_Quit, _T("E&xit\tAlt-X"), _T("Quit this program")); + + // now append the freshly created menu to the menu bar... + wxMenuBar *menuBar = new wxMenuBar(); + menuBar->Append(fileMenu, _T("&File")); + menuBar->Append(helpMenu, _T("&Help")); + + // ... and attach this menu bar to the frame + SetMenuBar(menuBar); +#endif // wxUSE_MENUS + + wxPanel* panel = new wxPanel(this); + + // Prepare log window right away since it shows EVT_TEXTs + m_logWin = new wxTextCtrl( panel, 105, wxEmptyString, wxDefaultPosition, + wxSize(-1,125), wxTE_MULTILINE|wxFULL_REPAINT_ON_RESIZE ); + m_logWin->SetEditable(false); + wxLogTextCtrl* logger = new wxLogTextCtrl( m_logWin ); + m_logOld = logger->SetActiveTarget( logger ); + logger->SetTimestamp( NULL ); + + + topSizer = new wxBoxSizer( wxVERTICAL ); + + topRowSizer = new wxBoxSizer( wxHORIZONTAL ); + + colSizer = new wxBoxSizer( wxVERTICAL ); + + + // Make sure GetFeatures is implemented + int features = wxComboControl::GetFeatures(); + wxLogDebug(wxT("wxComboControl features: 0x%X (all features: 0x%X)"), + features,wxComboControlFeatures::All); + + + wxComboBox* cb; + wxComboControl* cc; + wxGenericComboControl* gcc; + wxOwnerDrawnComboBox* odc; + + // Create common strings array + wxArrayString arrItems; + arrItems.Add( wxT("Solid") ); + arrItems.Add( wxT("Transparent") ); + arrItems.Add( wxT("Dot") ); + arrItems.Add( wxT("Long Dash") ); + arrItems.Add( wxT("Short Dash") ); + arrItems.Add( wxT("Dot Dash") ); + arrItems.Add( wxT("Backward Diagonal Hatch") ); + arrItems.Add( wxT("Cross-diagonal Hatch") ); + arrItems.Add( wxT("Forward Diagonal Hatch") ); + arrItems.Add( wxT("Cross Hatch") ); + arrItems.Add( wxT("Horizontal Hatch") ); + arrItems.Add( wxT("Vertical Hatch") ); + + int border = 4; + + // + // Show some wxOwnerDrawComboBoxes for comparison + // + rowSizer = new wxBoxSizer(wxHORIZONTAL); + + groupSizer = new wxStaticBoxSizer(new wxStaticBox(panel,wxID_ANY,wxT(" wxOwnerDrawnComboBox ")), + wxVERTICAL); + + groupSizer->Add( new wxStaticText(panel,wxID_ANY,wxT("Writable, sorted:")), 0, + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND, border ); + + odc = new wxOwnerDrawnComboBox(panel,wxID_ANY,wxEmptyString, + wxDefaultPosition, wxDefaultSize, + arrItems, + wxCB_SORT // wxNO_BORDER|wxCB_READONLY + ); + + odc->Append(wxT("H - Appended Item")); // test sorting in append + + odc->SetValue(wxT("Dot Dash")); + + groupSizer->Add( odc, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border ); + + // + // Readonly ODComboBox + groupSizer->Add( new wxStaticText(panel,wxID_ANY,wxT("Read-only:")), 0, + wxALIGN_CENTER_VERTICAL|wxRIGHT, border ); + + odc = new wxOwnerDrawnComboBox(panel,wxID_ANY,wxEmptyString, + wxDefaultPosition, wxDefaultSize, + arrItems, + wxCB_SORT|wxCB_READONLY // wxNO_BORDER|wxCB_READONLY + ); + + odc->SetValue(wxT("Dot Dash")); + + groupSizer->Add( odc, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border ); + + // + // Disabled ODComboBox + groupSizer->Add( new wxStaticText(panel,wxID_ANY,wxT("Disabled:")), 0, + wxALIGN_CENTER_VERTICAL|wxRIGHT, border ); + + odc = new wxOwnerDrawnComboBox(panel,wxID_ANY,wxEmptyString, + wxDefaultPosition, wxDefaultSize, + arrItems, + wxCB_SORT|wxCB_READONLY // wxNO_BORDER|wxCB_READONLY + ); + + odc->SetValue(wxT("Dot Dash")); + odc->Enable(false); + + groupSizer->Add( odc, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border ); + + rowSizer->Add( groupSizer, 1, wxEXPAND|wxALL, border ); + + + groupSizer = new wxStaticBoxSizer(new wxStaticBox(panel,wxID_ANY,wxT(" wxComboBox ")), + wxVERTICAL); + + // + // wxComboBox + // + groupSizer->Add( new wxStaticText(panel,wxID_ANY,wxT("Writable, sorted:")), 0, + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND, border ); + + cb = new wxComboBox(panel,wxID_ANY,wxEmptyString, + wxDefaultPosition, wxDefaultSize, + arrItems, + wxCB_SORT // wxNO_BORDER|wxCB_READONLY + ); + + cb->Append(wxT("H - Appended Item")); // test sorting in append + + cb->SetValue(wxT("Dot Dash")); + + groupSizer->Add( cb, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border ); + + // + // Readonly wxComboBox + groupSizer->Add( new wxStaticText(panel,wxID_ANY,wxT("Read-only:")), 0, + wxALIGN_CENTER_VERTICAL|wxRIGHT, border ); + + cb = new wxComboBox(panel,wxID_ANY,wxEmptyString, + wxDefaultPosition, wxDefaultSize, + arrItems, + wxCB_SORT|wxCB_READONLY // wxNO_BORDER|wxCB_READONLY + ); + + cb->SetValue(wxT("Dot Dash")); + + groupSizer->Add( cb, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border ); + + // + // Disabled wxComboBox + groupSizer->Add( new wxStaticText(panel,wxID_ANY,wxT("Disabled:")), 0, + wxALIGN_CENTER_VERTICAL|wxRIGHT, border ); + + cb = new wxComboBox(panel,wxID_ANY,wxEmptyString, + wxDefaultPosition, wxDefaultSize, + arrItems, + wxCB_SORT|wxCB_READONLY // wxNO_BORDER|wxCB_READONLY + ); + + cb->SetValue(wxT("Dot Dash")); + cb->Enable(false); + + groupSizer->Add( cb, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, border ); + + rowSizer->Add( groupSizer, 1, wxEXPAND|wxALL, border ); + + + colSizer->Add( rowSizer, 1, wxEXPAND|wxALL, border ); + + + // + // Pen selector ODComboBox with application painted items + // + rowSizer = new wxBoxSizer ( wxHORIZONTAL ); + rowSizer->Add( new wxStaticText(panel,wxID_ANY, + wxT("OwnerDrawnComboBox with Custom Paint Items and Button Placing:")), 1, + wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); + colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 ); + + rowSizer = new wxBoxSizer ( wxHORIZONTAL ); + + // When defining derivative class for callbacks, we need + // to use two-stage creation (or redefine the common wx + // constructor). + odc = new wxPenStyleComboBox(); + odc->Create(panel,wxID_ANY,wxEmptyString, + wxDefaultPosition, wxDefaultSize, + arrItems, + wxCB_READONLY //wxNO_BORDER | wxCB_READONLY + ); + + //m_odc->SetCustomPaintWidth( 60 ); + odc->SetSelection(0); + odc->SetButtonPosition(-2, // width adjustment + -6, // height adjustment + wxLEFT, // side + 2 // horizontal spacing + ); + + rowSizer->Add( odc, 1, wxALIGN_CENTER_VERTICAL|wxALL, 4 ); + rowSizer->AddStretchSpacer(1); + colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 ); + + + // + // List View wxComboControl + // + + rowSizer = new wxBoxSizer ( wxHORIZONTAL ); + rowSizer->Add( new wxStaticText(panel,wxID_ANY,wxT("List View wxComboControl:")), 1, + wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); + rowSizer->Add( new wxStaticText(panel,wxID_ANY,wxT("Tree Ctrl wxGenericComboControl:")), 1, + wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); + colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 ); + + rowSizer = new wxBoxSizer ( wxHORIZONTAL ); + cc = new wxComboControl(panel,2,wxEmptyString, + wxDefaultPosition, wxDefaultSize); + + cc->SetPopupMinWidth(300); + + ListViewComboPopup* iface = new ListViewComboPopup(cc); + cc->SetPopupControl(iface); + + iface->AddSelection( wxT("Cabbage") ); + iface->AddSelection( wxT("Potato") ); + iface->AddSelection( wxT("Onion") ); + iface->AddSelection( wxT("Carrot") ); + iface->AddSelection( wxT("Cauliflower") ); + iface->AddSelection( wxT("Bean") ); + iface->AddSelection( wxT("Raddish") ); + iface->AddSelection( wxT("Banana") ); + iface->AddSelection( wxT("Apple") ); + iface->AddSelection( wxT("Orange") ); + iface->AddSelection( wxT("Kiwi") ); + iface->AddSelection( wxT("Strawberry") ); + iface->AddSelection( wxT("Cucumber") ); + iface->AddSelection( wxT("Blackberry") ); + iface->AddSelection( wxT("Melon") ); + iface->AddSelection( wxT("Cherry") ); + iface->AddSelection( wxT("Pea") ); + iface->AddSelection( wxT("Pear") ); + + rowSizer->Add( cc, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + // + // Tree Ctrl wxComboControl + // + + // Note that we test that wxGenericComboControl works + gcc = new wxGenericComboControl(panel,wxID_ANY,wxEmptyString, + wxDefaultPosition, wxDefaultSize); + + // Set popup interface right away, otherwise some of the calls + // below may fail + TreeCtrlComboPopup* tcPopup = new TreeCtrlComboPopup(gcc); + gcc->SetPopupControl(tcPopup); + + // Add items using wxTreeCtrl methods directly + wxTreeItemId rootId = tcPopup->AddRoot(wxT("")); + + wxTreeItemId groupId; + + groupId = tcPopup->AppendItem(rootId,wxT("Controls")); + tcPopup->AppendItem(groupId,wxT("wxButton")); + tcPopup->AppendItem(groupId,wxT("wxCheckBox")); + tcPopup->AppendItem(groupId,wxT("wxListCtrl")); + tcPopup->AppendItem(groupId,wxT("wxStaticBox")); + tcPopup->AppendItem(groupId,wxT("wxStaticText")); + tcPopup->AppendItem(groupId,wxT("wxTextCtrl")); + tcPopup->AppendItem(groupId,wxT("wxTreeCtrl")); + groupId = tcPopup->AppendItem(rootId,wxT("Dialogs")); + tcPopup->AppendItem(groupId,wxT("wxDirDialog")); + tcPopup->AppendItem(groupId,wxT("wxFileDialog")); + tcPopup->AppendItem(groupId,wxT("wxWizard")); + + gcc->SetValue(wxT("wxStaticBox")); + + // Move button to left - it makes more sense for a tree ctrl + gcc->SetButtonPosition(0, // width adjustment + 0, // height adjustment + wxLEFT, // side + 0 // horizontal spacing + ); + + rowSizer->Add( gcc, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 ); + +#if wxUSE_IMAGE + wxInitAllImageHandlers(); + + // + // Custom Dropbutton Bitmaps + // (second one uses blank button background) + // + rowSizer = new wxBoxSizer ( wxHORIZONTAL ); + rowSizer->Add( new wxStaticText(panel,wxID_ANY, + wxT("OwnerDrawnComboBox with simple dropbutton graphics:")), 1, + wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); + + colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 ); + + rowSizer = new wxBoxSizer ( wxHORIZONTAL ); + + odc = new wxOwnerDrawnComboBox(panel,wxID_ANY,wxEmptyString, + wxDefaultPosition, wxDefaultSize, + arrItems, + (long)0 // wxCB_SORT // wxNO_BORDER | wxCB_READONLY + ); + + wxOwnerDrawnComboBox* odc2; + odc2 = new wxOwnerDrawnComboBox(panel,wxID_ANY,wxEmptyString, + wxDefaultPosition, wxDefaultSize, + arrItems, + (long)0 // wxCB_SORT // wxNO_BORDER | wxCB_READONLY + ); + + // Load images from disk + wxImage imgNormal(wxT("dropbutn.png")); + wxImage imgPressed(wxT("dropbutp.png")); + wxImage imgHover(wxT("dropbuth.png")); + + if ( imgNormal.Ok() && imgPressed.Ok() && imgHover.Ok() ) + { + wxBitmap bmpNormal(imgNormal); + wxBitmap bmpPressed(imgPressed); + wxBitmap bmpHover(imgHover); + odc->SetButtonBitmaps(bmpNormal,false,bmpPressed,bmpHover); + odc2->SetButtonBitmaps(bmpNormal,true,bmpPressed,bmpHover); + } + else + wxLogError(wxT("Dropbutton images not found")); + + //odc2->SetButtonPosition(0, // width adjustment + // 0, // height adjustment + // wxLEFT, // side + // 0 // horizontal spacing + // ); + + rowSizer->Add( odc, 1, wxALIGN_CENTER_VERTICAL|wxALL, 4 ); + rowSizer->Add( odc2, 1, wxALIGN_CENTER_VERTICAL|wxALL, 4 ); + colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 ); +#endif + + + // + // wxComboControl with totally custom button action (open file dialog) + // + rowSizer = new wxBoxSizer ( wxHORIZONTAL ); + rowSizer->Add( new wxStaticText(panel,wxID_ANY, + wxT("wxComboControl with custom button action:")), 1, + wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); + + + colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 ); + + rowSizer = new wxBoxSizer ( wxHORIZONTAL ); + wxFileSelectorCombo* fsc; + + fsc = new wxFileSelectorCombo(panel,wxID_ANY,wxEmptyString, + wxDefaultPosition, wxDefaultSize, + (long)0 + ); + + rowSizer->Add( fsc, 1, wxALIGN_CENTER_VERTICAL|wxALL, 4 ); + colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 ); + + + topRowSizer->Add( colSizer, 1, wxALL, 2 ); + + topRowSizer->Add( m_logWin, 1, wxEXPAND|wxALL, 5 ); + topSizer->Add( topRowSizer, 1, wxEXPAND ); + + panel->SetSizer( topSizer ); + topSizer->SetSizeHints( panel ); + + SetSize(740,480); + Centre(); +} + +MyFrame::~MyFrame() +{ + delete wxLog::SetActiveTarget(m_logOld); +} + +// event handlers + +void MyFrame::OnComboBoxUpdate( wxCommandEvent& event ) +{ + // Don't show messages for the log output window (it'll crash) + if ( event.GetId() == 105 ) + return; + + if ( event.GetEventType() == wxEVT_COMMAND_COMBOBOX_SELECTED ) + wxLogDebug(wxT("EVT_COMBOBOX(id=%i,selection=%i)"),event.GetId(),event.GetSelection()); + else if ( event.GetEventType() == wxEVT_COMMAND_TEXT_UPDATED ) + wxLogDebug(wxT("EVT_TEXT(id=%i,string=\"%s\")"),event.GetId(),event.GetString().c_str()); +} + +void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) +{ + // true is to force the frame to close + Close(true); +} + +void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) +{ + wxMessageBox(wxString::Format( + _T("Welcome to %s!\n") + _T("\n") + _T("This is the wxWidgets wxComboControl sample\n") + _T("running under %s."), + wxVERSION_STRING, + wxGetOsDescription().c_str() + ), + _T("About wxComboControl sample"), + wxOK | wxICON_INFORMATION, + this); +} diff --git a/samples/combo/dropbuth.png b/samples/combo/dropbuth.png new file mode 100644 index 0000000000000000000000000000000000000000..089eda926db75e8d6998564440a6553693ca0708 GIT binary patch literal 371 zcmeAS@N?(olHy`uVBq!ia0vp^d_c_4!3HF+i2N%7Qfx`y?k)`L7*;bpzbhVp2`Iu@ z;1OBOz@VoL!i*J5?aP3I>?NMQuI$%X#Q8Ki*?&$m1PaNPxJHyX=jZ08=9Mrw7o{ea zq^2m8XO?6rgk+>DxO@5ryiZZh11h}k>Eaktack}*M=xhXfwui8pIl86tKHiiE@0bi z9b3(IaB&4!|1yP$Q{5J`Q)2c+tvY*oTcZQV{ps~>Jacv|DSY0(VWaCE`?Z>>HI6Lv zY~q$BL)v*VqCidhS|zZMiuWC`uyik*-wG}Z5Q#JX+O zJl63a_U_zmx7goleoHFXmKk@g{yg1lFynKgpIN$rdbFx^O0ittx$WoPv;E19J@HI> zN8Y(}Z?FDgzdvVAsNU@FdgVjYXVK&ES3t(>I`yY>8_`iF1B#Zfaf$gL6@8Vo7R> zLV0FMhC)b2s)DZ{rEqA-E2Y4q=>g3RSpZ* zin0bi?k?A0&x}0q{r%O@dIrJ03H#UVShey)O>=oNZ?pUn5w6L?EDVuPc-AcN+4E%E aI!-1{DdC9nrTsv|89ZJ6T-G@yGywpzi%c&7 literal 0 HcmV?d00001 diff --git a/samples/combo/dropbutp.png b/samples/combo/dropbutp.png new file mode 100644 index 0000000000000000000000000000000000000000..82e905e081c5f9a0cd848b63ce925166ae113574 GIT binary patch literal 366 zcmeAS@N?(olHy`uVBq!ia0vp^d_c_4!3HF+i2N%7Qfx`y?k)`L7*;bpzbhVp2`Iu@ z;1OBOz@VoL!i*J5?aP3I>?NMQuI$%X#Q8M1KfE~>0~C@iag8W(&d<$F%`0JWE=o-- zNlj5G&n(GM2+2rQaQE~Lc%P!02UK{;)5S5Q;?~?rzI;sv0zQ?vbdo$PRjXEapOA`O=%b>0bu;hp4BxP9 z(S!#(T_&x`u6z9K#mNl~e-$$-Zr4RE-L7?$<*R4uo3|Bv86O(^@v2^LtOfdx!PC{x JWt~$(69C7UkSPEF literal 0 HcmV?d00001 diff --git a/samples/samples.bkl b/samples/samples.bkl index 97791cde49..932d95063f 100644 --- a/samples/samples.bkl +++ b/samples/samples.bkl @@ -15,6 +15,7 @@ + diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp new file mode 100644 index 0000000000..3ae8b2c22d --- /dev/null +++ b/src/common/combocmn.cpp @@ -0,0 +1,1944 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: combocmn.cpp +// Purpose: wxComboControlBase +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// RCS-ID: $Id$ +// Copyright: (c) 2005 Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_COMBOCONTROL + +#ifndef WX_PRECOMP + #include "wx/defs.h" + #include "wx/log.h" + #include "wx/combobox.h" + #include "wx/dcclient.h" + #include "wx/settings.h" + #include "wx/dialog.h" +#endif + +#include "wx/dcbuffer.h" +#include "wx/tooltip.h" +#include "wx/timer.h" + +#include "wx/combo.h" + + + +// constants +// ---------------------------------------------------------------------------- + +// Milliseconds to wait for two mouse-ups after focus inorder +// to trigger a double-click. +#define DOUBLE_CLICK_CONVERSION_TRESHOLD 500 + +#define DEFAULT_DROPBUTTON_WIDTH 19 + +#define BMP_BUTTON_MARGIN 4 + +#define DEFAULT_POPUP_HEIGHT 200 + +#define DEFAULT_TEXT_INDENT 3 + +#define COMBO_MARGIN 2 // spacing right of wxTextCtrl + + +#if defined(__WXMSW__) + +#define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform) + +//#undef wxUSE_POPUPWIN +//#define wxUSE_POPUPWIN 0 + +#elif defined(__WXGTK__) + +#define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform) + +#elif defined(__WXMAC__) + +#define USE_TRANSIENT_POPUP 0 // Use wxPopupWindowTransient (preferred, if it works properly on platform) + +#else + +#define USE_TRANSIENT_POPUP 0 // Use wxPopupWindowTransient (preferred, if it works properly on platform) + +#endif + + +// Popupwin is really only supported on wxMSW (not WINCE) and wxGTK, regardless +// what the wxUSE_POPUPWIN says. +// FIXME: Why isn't wxUSE_POPUPWIN reliable any longer? (it was in wxW2.6.2) +#if (!defined(__WXMSW__) && !defined(__WXGTK__)) || defined(__WXWINCE__) +#undef wxUSE_POPUPWIN +#define wxUSE_POPUPWIN 0 +#endif + + +#if wxUSE_POPUPWIN + #include "wx/popupwin.h" +#else + #undef USE_TRANSIENT_POPUP + #define USE_TRANSIENT_POPUP 0 +#endif + + +#if USE_TRANSIENT_POPUP + + #define wxComboPopupWindowBase wxPopupTransientWindow + #define INSTALL_TOPLEV_HANDLER 0 + +#elif wxUSE_POPUPWIN + + #define wxComboPopupWindowBase wxPopupWindow + #define INSTALL_TOPLEV_HANDLER 1 + +#else + + #define wxComboPopupWindowBase wxDialog + #define INSTALL_TOPLEV_HANDLER 0 // Doesn't need since can monitor active event + +#endif + + + +// +// ** TODO ** +// * wxComboPopupWindow for external use (ie. replace old wxUniv wxPopupComboWindow) +// + + +// ---------------------------------------------------------------------------- +// wxComboFrameEventHandler takes care of hiding the popup when events happen +// in its top level parent. +// ---------------------------------------------------------------------------- + +#if INSTALL_TOPLEV_HANDLER + +// +// This will no longer be necessary after wxTransientPopupWindow +// works well on all platforms. +// + +class wxComboFrameEventHandler : public wxEvtHandler +{ +public: + wxComboFrameEventHandler( wxComboControlBase* pCb ); + ~wxComboFrameEventHandler(); + + void OnPopup(); + + void OnIdle( wxIdleEvent& event ); + void OnMouseEvent( wxMouseEvent& event ); + void OnActivate( wxActivateEvent& event ); + void OnResize( wxSizeEvent& event ); + void OnMove( wxMoveEvent& event ); + void OnMenuEvent( wxMenuEvent& event ); + void OnClose( wxCloseEvent& event ); + +protected: + wxWindow* m_focusStart; + wxComboControlBase* m_combo; + +private: + DECLARE_EVENT_TABLE() +}; + +BEGIN_EVENT_TABLE(wxComboFrameEventHandler, wxEvtHandler) + EVT_IDLE(wxComboFrameEventHandler::OnIdle) + EVT_LEFT_DOWN(wxComboFrameEventHandler::OnMouseEvent) + EVT_RIGHT_DOWN(wxComboFrameEventHandler::OnMouseEvent) + EVT_SIZE(wxComboFrameEventHandler::OnResize) + EVT_MOVE(wxComboFrameEventHandler::OnMove) + EVT_MENU_HIGHLIGHT(wxID_ANY,wxComboFrameEventHandler::OnMenuEvent) + EVT_MENU_OPEN(wxComboFrameEventHandler::OnMenuEvent) + EVT_ACTIVATE(wxComboFrameEventHandler::OnActivate) + EVT_CLOSE(wxComboFrameEventHandler::OnClose) +END_EVENT_TABLE() + +wxComboFrameEventHandler::wxComboFrameEventHandler( wxComboControlBase* combo ) + : wxEvtHandler() +{ + m_combo = combo; +} + +wxComboFrameEventHandler::~wxComboFrameEventHandler() +{ +} + +void wxComboFrameEventHandler::OnPopup() +{ + m_focusStart = ::wxWindow::FindFocus(); +} + +void wxComboFrameEventHandler::OnIdle( wxIdleEvent& event ) +{ + wxWindow* winFocused = ::wxWindow::FindFocus(); + + wxWindow* popup = m_combo->GetPopupControl(); + wxWindow* winpopup = m_combo->GetPopupWindow(); + + if ( + winFocused != m_focusStart && + winFocused != popup && + winFocused->GetParent() != popup && + winFocused != winpopup && + winFocused->GetParent() != winpopup && + winFocused != m_combo && + winFocused != m_combo->GetButton() // GTK (atleast) requires this + ) + { + m_combo->HidePopup(); + } + + event.Skip(); +} + +void wxComboFrameEventHandler::OnMenuEvent( wxMenuEvent& event ) +{ + m_combo->HidePopup(); + event.Skip(); +} + +void wxComboFrameEventHandler::OnMouseEvent( wxMouseEvent& event ) +{ + m_combo->HidePopup(); + event.Skip(); +} + +void wxComboFrameEventHandler::OnClose( wxCloseEvent& event ) +{ + m_combo->HidePopup(); + event.Skip(); +} + +void wxComboFrameEventHandler::OnActivate( wxActivateEvent& event ) +{ + m_combo->HidePopup(); + event.Skip(); +} + +void wxComboFrameEventHandler::OnResize( wxSizeEvent& event ) +{ + m_combo->HidePopup(); + event.Skip(); +} + +void wxComboFrameEventHandler::OnMove( wxMoveEvent& event ) +{ + m_combo->HidePopup(); + event.Skip(); +} + +#endif // INSTALL_TOPLEV_HANDLER + +// ---------------------------------------------------------------------------- +// wxComboPopupWindow is wxPopupWindow customized for +// wxComboControl. +// ---------------------------------------------------------------------------- + +class wxComboPopupWindow : public wxComboPopupWindowBase +{ +public: + + wxComboPopupWindow( wxComboControlBase *parent, int style = wxBORDER_NONE ); + +#if USE_TRANSIENT_POPUP + virtual bool ProcessLeftDown(wxMouseEvent& event); +#endif + + void OnKeyEvent(wxKeyEvent& event); + + void OnMouseEvent( wxMouseEvent& event ); +#if !wxUSE_POPUPWIN + void OnActivate( wxActivateEvent& event ); +#endif + +protected: + +#if USE_TRANSIENT_POPUP + virtual void OnDismiss(); +#endif + +private: + DECLARE_EVENT_TABLE() +}; + + +BEGIN_EVENT_TABLE(wxComboPopupWindow, wxComboPopupWindowBase) + EVT_MOUSE_EVENTS(wxComboPopupWindow::OnMouseEvent) +#if !wxUSE_POPUPWIN + EVT_ACTIVATE(wxComboPopupWindow::OnActivate) +#endif + EVT_KEY_DOWN(wxComboPopupWindow::OnKeyEvent) + EVT_KEY_UP(wxComboPopupWindow::OnKeyEvent) +END_EVENT_TABLE() + + +wxComboPopupWindow::wxComboPopupWindow( wxComboControlBase *parent, + int style ) +#if wxUSE_POPUPWIN + : wxComboPopupWindowBase(parent,style) +#else + : wxComboPopupWindowBase(parent, + wxID_ANY, + wxEmptyString, + wxPoint(-21,-21), + wxSize(20,20), + style) +#endif +{ +} + +void wxComboPopupWindow::OnKeyEvent( wxKeyEvent& event ) +{ + // Relay keyboard event to the main child controls + // (just skipping may just cause the popup to close) + wxWindowList children = GetChildren(); + wxWindowList::iterator node = children.begin(); + wxWindow* child = (wxWindow*)*node; + child->AddPendingEvent(event); +} + +void wxComboPopupWindow::OnMouseEvent( wxMouseEvent& event ) +{ + event.Skip(); +} + +#if !wxUSE_POPUPWIN +void wxComboPopupWindow::OnActivate( wxActivateEvent& event ) +{ + if ( !event.GetActive() ) + { + // Tell combo control that we are dismissed. + wxComboControl* combo = (wxComboControl*) GetParent(); + wxASSERT( combo ); + wxASSERT( combo->IsKindOf(CLASSINFO(wxComboControl)) ); + + combo->HidePopup(); + + event.Skip(); + } +} +#endif + +#if USE_TRANSIENT_POPUP +bool wxComboPopupWindow::ProcessLeftDown(wxMouseEvent& event ) +{ + return wxComboPopupWindowBase::ProcessLeftDown(event); +} +#endif + +#if USE_TRANSIENT_POPUP +// First thing that happens when a transient popup closes is that this method gets called. +void wxComboPopupWindow::OnDismiss() +{ + wxComboControlBase* combo = (wxComboControlBase*) GetParent(); + wxASSERT_MSG( combo->IsKindOf(CLASSINFO(wxComboControlBase)), + wxT("parent might not be wxComboControl, but check IMPLEMENT_DYNAMIC_CLASS(2) macro for correctness") ); + + combo->OnPopupDismiss(); +} +#endif + +// ---------------------------------------------------------------------------- +// wxComboPopup +// +// ---------------------------------------------------------------------------- + +wxComboPopup::~wxComboPopup() +{ +} + +void wxComboPopup::OnPopup() +{ +} + +void wxComboPopup::OnDismiss() +{ +} + +wxSize wxComboPopup::GetAdjustedSize( int minWidth, + int prefHeight, + int WXUNUSED(maxHeight) ) +{ + return wxSize(minWidth,prefHeight); +} + +void wxComboPopup::PaintComboControl( wxDC& dc, const wxRect& rect ) +{ + if ( m_combo->GetWindowStyle() & wxCB_READONLY ) // ie. no textctrl + { + m_combo->DrawFocusBackground(dc,rect,0); + + dc.DrawText( GetStringValue(), + rect.x + m_combo->GetTextIndent(), + (rect.height-dc.GetCharHeight())/2 + m_combo->m_widthCustomBorder ); + } +} + +void wxComboPopup::OnComboKeyEvent( wxKeyEvent& event ) +{ + event.Skip(); +} + +void wxComboPopup::OnComboDoubleClick() +{ +} + +void wxComboPopup::SetStringValue( const wxString& WXUNUSED(value) ) +{ +} + +bool wxComboPopup::LazyCreate() +{ + return false; +} + +void wxComboPopup::Dismiss() +{ + m_combo->HidePopup(); +} + +// ---------------------------------------------------------------------------- +// input handling +// ---------------------------------------------------------------------------- + +// +// This is pushed to the event handler queue of either combo box +// or its textctrl (latter if not readonly combo). +// +class wxComboBoxExtraInputHandler : public wxEvtHandler +{ +public: + + wxComboBoxExtraInputHandler( wxComboControlBase* combo ) + : wxEvtHandler() + { + m_combo = combo; + } + ~wxComboBoxExtraInputHandler() { } + void OnKey(wxKeyEvent& event); + void OnFocus(wxFocusEvent& event); + +protected: + wxComboControlBase* m_combo; + +private: + DECLARE_EVENT_TABLE() +}; + + +BEGIN_EVENT_TABLE(wxComboBoxExtraInputHandler, wxEvtHandler) + EVT_KEY_DOWN(wxComboBoxExtraInputHandler::OnKey) + EVT_SET_FOCUS(wxComboBoxExtraInputHandler::OnFocus) +END_EVENT_TABLE() + + +void wxComboBoxExtraInputHandler::OnKey(wxKeyEvent& event) +{ + int keycode = event.GetKeyCode(); + + if ( keycode == WXK_TAB ) + { + wxNavigationKeyEvent evt; + evt.SetFlags(wxNavigationKeyEvent::FromTab| + (!event.ShiftDown()?wxNavigationKeyEvent::IsForward: + wxNavigationKeyEvent::IsBackward)); + evt.SetEventObject(m_combo); + m_combo->GetParent()->GetEventHandler()->AddPendingEvent(evt); + return; + } + + if ( m_combo->IsPopupShown() ) + { + // pass it to the popped up control + m_combo->GetPopupControl()->AddPendingEvent(event); + } + else // no popup + { + int comboStyle = m_combo->GetWindowStyle(); + wxComboPopup* popupInterface = m_combo->GetPopup(); + + if ( !popupInterface ) + { + event.Skip(); + return; + } + + if ( (comboStyle & wxCB_READONLY) || + ( keycode != WXK_RIGHT && keycode != WXK_LEFT ) + ) + { + // Alternate keys: UP and DOWN show the popup instead of cycling + if ( (comboStyle & wxCC_ALT_KEYS) ) + { + if ( keycode == WXK_UP || keycode == WXK_DOWN ) + { + m_combo->OnButtonClick(); + return; + } + } + else + popupInterface->OnComboKeyEvent(event); + } + else + event.Skip(); + } +} + + +void wxComboBoxExtraInputHandler::OnFocus(wxFocusEvent& event) +{ + // FIXME: This code does run when control is clicked, + // yet on Windows it doesn't select all the text. + if ( !(m_combo->GetInternalFlags() & wxCC_NO_TEXT_AUTO_SELECT) ) + { + if ( m_combo->GetTextCtrl() ) + m_combo->GetTextCtrl()->SelectAll(); + else + m_combo->SetSelection(-1,-1); + } + + event.Skip(); +} + + +// +// This is pushed to the event handler queue of the control in popup. +// + +class wxComboPopupExtraEventHandler : public wxEvtHandler +{ +public: + + wxComboPopupExtraEventHandler( wxComboControlBase* combo ) + : wxEvtHandler() + { + m_combo = combo; + m_beenInside = false; + } + ~wxComboPopupExtraEventHandler() { } + + void OnMouseEvent( wxMouseEvent& event ); + + // Called from wxPGComboControlBase::OnPopupDismiss + void OnPopupDismiss() + { + m_beenInside = false; + } + +protected: + wxComboControlBase* m_combo; + + bool m_beenInside; + +private: + DECLARE_EVENT_TABLE() +}; + + +BEGIN_EVENT_TABLE(wxComboPopupExtraEventHandler, wxEvtHandler) + EVT_MOUSE_EVENTS(wxComboPopupExtraEventHandler::OnMouseEvent) +END_EVENT_TABLE() + + +void wxComboPopupExtraEventHandler::OnMouseEvent( wxMouseEvent& event ) +{ + wxPoint pt = event.GetPosition(); + wxSize sz = m_combo->GetPopupControl()->GetClientSize(); + int evtType = event.GetEventType(); + bool isInside = pt.x >= 0 && pt.y >= 0 && pt.x < sz.x && pt.y < sz.y; + + if ( evtType == wxEVT_MOTION || + evtType == wxEVT_LEFT_DOWN || + evtType == wxEVT_RIGHT_DOWN ) + { + // Block motion and click events outside the popup + if ( !isInside ) + { + event.Skip(false); + return; + } + } + else if ( evtType == wxEVT_LEFT_UP ) + { + // Don't let left-down events in if outside + if ( evtType == wxEVT_LEFT_DOWN ) + { + if ( !isInside ) + return; + } + + if ( !m_beenInside ) + { + if ( isInside ) + { + m_beenInside = true; + } + else + { + // + // Some mouse events to popup that happen outside it, before cursor + // has been inside the popu, need to be ignored by it but relayed to + // the dropbutton. + // + wxWindow* btn = m_combo->GetButton(); + if ( btn ) + btn->GetEventHandler()->AddPendingEvent(event); + else + m_combo->GetEventHandler()->AddPendingEvent(event); + + return; + } + + event.Skip(); + } + } + + event.Skip(); +} + +// ---------------------------------------------------------------------------- +// wxComboControlBase +// ---------------------------------------------------------------------------- + + +BEGIN_EVENT_TABLE(wxComboControlBase, wxControl) + EVT_TEXT(wxID_ANY,wxComboControlBase::OnTextCtrlEvent) + EVT_SIZE(wxComboControlBase::OnSizeEvent) + EVT_SET_FOCUS(wxComboControlBase::OnFocusEvent) + EVT_KILL_FOCUS(wxComboControlBase::OnFocusEvent) + //EVT_BUTTON(wxID_ANY,wxComboControlBase::OnButtonClickEvent) + EVT_TEXT_ENTER(wxID_ANY,wxComboControlBase::OnTextCtrlEvent) + EVT_SYS_COLOUR_CHANGED(wxComboControlBase::OnSysColourChanged) +END_EVENT_TABLE() + + +IMPLEMENT_ABSTRACT_CLASS(wxComboControlBase, wxControl) + +// Have global double buffer - should be enough for multiple combos +static wxBitmap* gs_doubleBuffer = (wxBitmap*) NULL; + +void wxComboControlBase::Init() +{ + m_winPopup = (wxWindow *)NULL; + m_popup = (wxWindow *)NULL; + m_isPopupShown = false; + m_btn = (wxWindow*) NULL; + m_text = (wxTextCtrl*) NULL; + m_popupInterface = (wxComboPopup*) NULL; + + m_extraEvtHandler = (wxEvtHandler*) NULL; + m_popupExtraHandler = (wxEvtHandler*) NULL; + m_textEvtHandler = (wxEvtHandler*) NULL; + +#if INSTALL_TOPLEV_HANDLER + m_toplevEvtHandler = (wxEvtHandler*) NULL; +#endif + + m_heightPopup = -1; + m_widthMinPopup = -1; + m_anchorSide = 0; + m_widthCustomPaint = 0; + m_widthCustomBorder = 0; + + m_btnState = 0; + m_btnWidDefault = 0; + m_blankButtonBg = false; + m_btnWid = m_btnHei = 0; + m_btnSide = wxRIGHT; + m_btnSpacingX = 0; + + m_extLeft = 0; + m_extRight = 0; + m_absIndent = -1; + m_iFlags = 0; + m_downReceived = false; + m_timeCanAcceptClick = 0; +} + +bool wxComboControlBase::Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + if ( !wxControl::Create(parent, + id, + pos, + size, + style | wxWANTS_CHARS, + validator, + name) ) + return false; + + m_valueString = value; + + // Get colours + OnThemeChange(); + m_absIndent = GetNativeTextIndent(); + + return true; +} + +void wxComboControlBase::InstallInputHandlers( bool alsoTextCtrl ) +{ + if ( m_text && alsoTextCtrl ) + { + m_textEvtHandler = new wxComboBoxExtraInputHandler(this); + m_text->PushEventHandler(m_textEvtHandler); + } + + wxComboBoxExtraInputHandler* inputHandler = new wxComboBoxExtraInputHandler(this); + PushEventHandler(inputHandler); + m_extraEvtHandler = inputHandler; +} + +void wxComboControlBase::CreateTextCtrl( int extraStyle, const wxValidator& validator ) +{ + if ( !(m_windowStyle & wxCB_READONLY) ) + { + m_text = new wxTextCtrl(this, + 12345, + m_valueString, + wxDefaultPosition, + wxDefaultSize, + // wxTE_PROCESS_TAB is needed because on Windows, wxTAB_TRAVERSAL is + // not used by the wxPropertyGrid and therefore the tab is + // processed by looking at ancestors to see if they have + // wxTAB_TRAVERSAL. The navigation event is then sent to + // the wrong window. + wxTE_PROCESS_TAB | + extraStyle, + validator); + + // This is required for some platforms (GTK+ atleast) + m_text->SetSizeHints(2,4); + } +} + +void wxComboControlBase::OnThemeChange() +{ + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); +} + +wxComboControlBase::~wxComboControlBase() +{ + if ( HasCapture() ) + ReleaseMouse(); + + delete gs_doubleBuffer; + gs_doubleBuffer = (wxBitmap*) NULL; + +#if INSTALL_TOPLEV_HANDLER + delete ((wxComboFrameEventHandler*)m_toplevEvtHandler); + m_toplevEvtHandler = (wxEvtHandler*) NULL; +#endif + + if ( m_popup ) + m_popup->RemoveEventHandler(m_popupExtraHandler); + + delete m_popupExtraHandler; + + HidePopup(); + + delete m_popupInterface; + delete m_winPopup; + + RemoveEventHandler(m_extraEvtHandler); + + if ( m_text ) + m_text->RemoveEventHandler(m_textEvtHandler); + + delete m_textEvtHandler; + delete m_extraEvtHandler; +} + + +// ---------------------------------------------------------------------------- +// geometry stuff +// ---------------------------------------------------------------------------- + +// Recalculates button and textctrl areas +void wxComboControlBase::CalculateAreas( int btnWidth ) +{ + wxSize sz = GetClientSize(); + int customBorder = m_widthCustomBorder; + bool buttonOutside; + int btnBorder; // border for button only + + if ( ( (m_iFlags & wxCC_BUTTON_OUTSIDE_BORDER) || m_blankButtonBg ) && + m_btnSpacingX == 0 && m_btnWid == 0 && m_btnHei == 0 && + (!m_bmpNormal.Ok() || m_blankButtonBg) ) + { + buttonOutside = true; + m_iFlags |= wxCC_IFLAG_BUTTON_OUTSIDE; + btnBorder = 0; + } + else + { + buttonOutside = false; + m_iFlags &= ~(wxCC_IFLAG_BUTTON_OUTSIDE); + btnBorder = customBorder; + } + + // Defaul indentation + if ( m_absIndent < 0 ) + m_absIndent = GetNativeTextIndent(); + + int butWidth = btnWidth; + + if ( butWidth <= 0 ) + butWidth = m_btnWidDefault; + else + m_btnWidDefault = butWidth; + + if ( butWidth <= 0 ) + return; + + // Adjust button width + if ( m_btnWid < 0 ) + butWidth += m_btnWid; + else if ( m_btnWid > 0 ) + butWidth = m_btnWid; + + int butHeight = sz.y; + + butHeight -= btnBorder*2; + + // Adjust button height + if ( m_btnHei < 0 ) + butHeight += m_btnHei; + else if ( m_btnHei > 0 ) + butHeight = m_btnHei; + + // Use size of normal bitmap if... + // It is larger + // OR + // button width is set to default and blank button bg is not drawn + if ( m_bmpNormal.Ok() ) + { + int bmpReqWidth = m_bmpNormal.GetWidth(); + int bmpReqHeight = m_bmpNormal.GetHeight(); + + // If drawing blank button background, we need to add some margin. + if ( m_blankButtonBg ) + { + bmpReqWidth += BMP_BUTTON_MARGIN*2; + bmpReqHeight += BMP_BUTTON_MARGIN*2; + } + + if ( butWidth < bmpReqWidth || ( m_btnWid == 0 && !m_blankButtonBg ) ) + butWidth = bmpReqWidth; + if ( butHeight < bmpReqHeight || ( m_btnHei == 0 && !m_blankButtonBg ) ) + butHeight = bmpReqHeight; + + // Need to fix height? + if ( (sz.y-(customBorder*2)) < butHeight && btnWidth == 0 ) + { + int newY = butHeight+(customBorder*2); + SetClientSize(-1,newY); + sz.y = newY; + } + } + + int butAreaWid = butWidth + (m_btnSpacingX*2); + + m_btnSize.x = butWidth; + m_btnSize.y = butHeight; + + m_btnArea.x = ( m_btnSide==wxRIGHT ? sz.x - butAreaWid - btnBorder : btnBorder ); + m_btnArea.y = btnBorder; + m_btnArea.width = butAreaWid; + m_btnArea.height = sz.y - (btnBorder*2); + + m_tcArea.x = ( m_btnSide==wxRIGHT ? 0 : butAreaWid ) + customBorder; + m_tcArea.y = customBorder; + m_tcArea.width = sz.x - butAreaWid - (customBorder*2); + m_tcArea.height = sz.y - (customBorder*2); + +/* + if ( m_text ) + { + ::wxMessageBox(wxString::Format(wxT("ButtonArea (%i,%i,%i,%i)\n"),m_btnArea.x,m_btnArea.y,m_btnArea.width,m_btnArea.height) + + wxString::Format(wxT("TextCtrlArea (%i,%i,%i,%i)"),m_tcArea.x,m_tcArea.y,m_tcArea.width,m_tcArea.height)); + } +*/ +} + +void wxComboControlBase::PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust ) +{ + if ( !m_text ) + return; + + wxSize sz = GetClientSize(); + int customBorder = m_widthCustomBorder; + + if ( (m_text->GetWindowStyleFlag() & wxBORDER_MASK) == wxNO_BORDER ) + { + // Centre textctrl + int tcSizeY = m_text->GetBestSize().y; + int diff = sz.y - tcSizeY; + int y = textCtrlYAdjust + (diff/2); + + if ( y < customBorder ) + y = customBorder; + + m_text->SetSize( m_tcArea.x + m_widthCustomPaint + m_absIndent + textCtrlXAdjust, + y, + m_tcArea.width - COMBO_MARGIN - + (textCtrlXAdjust + m_widthCustomPaint + m_absIndent), + -1 ); + + // Make sure textctrl doesn't exceed the bottom custom border + wxSize tsz = m_text->GetSize(); + diff = (y + tsz.y) - (sz.y - customBorder); + if ( diff >= 0 ) + { + tsz.y = tsz.y - diff - 1; + m_text->SetSize(tsz); + } + } + else + { + m_text->SetSize( m_tcArea.x, + 0, + sz.x - m_btnArea.x - m_widthCustomPaint - customBorder, + sz.y ); + } +} + +wxSize wxComboControlBase::DoGetBestSize() const +{ + wxSize sizeText(150,0); + + if ( m_text ) + sizeText = m_text->GetBestSize(); + + // TODO: Better method to calculate close-to-native control height. + + int fhei; + if ( m_font.Ok() ) + fhei = (m_font.GetPointSize()*2) + 5; + else if ( wxNORMAL_FONT->Ok() ) + fhei = (wxNORMAL_FONT->GetPointSize()*2) + 5; + else + fhei = sizeText.y + 4; + + // Need to force height to accomodate bitmap? + int btnSizeY = m_btnSize.y; + if ( m_bmpNormal.Ok() && fhei < btnSizeY ) + fhei = btnSizeY; + + // Control height doesn't depend on border +/* + // Add border + int border = m_windowStyle & wxBORDER_MASK; + if ( border == wxSIMPLE_BORDER ) + fhei += 2; + else if ( border == wxNO_BORDER ) + fhei += (m_widthCustomBorder*2); + else + // Sunken etc. + fhei += 4; +*/ + + // Final adjustments +#ifdef __WXGTK__ + fhei += 1; +#endif + + wxSize ret(sizeText.x + COMBO_MARGIN + DEFAULT_DROPBUTTON_WIDTH, + fhei); + + CacheBestSize(ret); + return ret; +} + +void wxComboControlBase::DoMoveWindow(int x, int y, int width, int height) +{ + // SetSize is called last in create, so it marks the end of creation + m_iFlags |= wxCC_IFLAG_CREATED; + + wxControl::DoMoveWindow(x, y, width, height); +} + +void wxComboControlBase::OnSizeEvent( wxSizeEvent& event ) +{ + if ( !IsCreated() ) + return; + + // defined by actual wxComboControls + OnResize(); + + event.Skip(); +} + +// ---------------------------------------------------------------------------- +// standard operations +// ---------------------------------------------------------------------------- + +bool wxComboControlBase::Enable(bool enable) +{ + if ( !wxControl::Enable(enable) ) + return false; + + if ( m_btn ) + m_btn->Enable(enable); + if ( m_text ) + m_text->Enable(enable); + + return true; +} + +bool wxComboControlBase::Show(bool show) +{ + if ( !wxControl::Show(show) ) + return false; + + if (m_btn) + m_btn->Show(show); + + if (m_text) + m_text->Show(show); + + return true; +} + +bool wxComboControlBase::SetFont ( const wxFont& font ) +{ + if ( !wxControl::SetFont(font) ) + return false; + + if (m_text) + m_text->SetFont(font); + + return true; +} + +#if wxUSE_TOOLTIPS +void wxComboControlBase::DoSetToolTip(wxToolTip *tooltip) +{ + wxControl::DoSetToolTip(tooltip); + + // Set tool tip for button and text box + if ( tooltip ) + { + const wxString &tip = tooltip->GetTip(); + if ( m_text ) m_text->SetToolTip(tip); + if ( m_btn ) m_btn->SetToolTip(tip); + } + else + { + if ( m_text ) m_text->SetToolTip( (wxToolTip*) NULL ); + if ( m_btn ) m_btn->SetToolTip( (wxToolTip*) NULL ); + } +} +#endif // wxUSE_TOOLTIPS + +// ---------------------------------------------------------------------------- +// painting +// ---------------------------------------------------------------------------- + +// draw focus background on area in a way typical on platform +void wxComboControlBase::DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags ) +{ + wxSize sz = GetClientSize(); + bool isEnabled; + bool isFocused; // also selected + + // For smaller size control (and for disabled background) use less spacing + int focusSpacingX; + int focusSpacingY; + + if ( !(flags & wxCONTROL_ISSUBMENU) ) + { + // Drawing control + isEnabled = IsEnabled(); + isFocused = ShouldDrawFocus(); + + // Windows-style: for smaller size control (and for disabled background) use less spacing + focusSpacingX = isEnabled ? 2 : 1; + focusSpacingY = sz.y > (GetCharHeight()+2) && isEnabled ? 2 : 1; + } + else + { + // Drawing a list item + isEnabled = true; // they are never disabled + isFocused = flags & wxCONTROL_SELECTED ? true : false; + + focusSpacingX = 0; + focusSpacingY = 0; + } + + // Set the background sub-rectangle for selection, disabled etc + wxRect selRect(rect); + selRect.y += focusSpacingY; + selRect.height -= (focusSpacingY*2); + selRect.x += m_widthCustomPaint + focusSpacingX; + selRect.width -= m_widthCustomPaint + (focusSpacingX*2); + + wxColour bgCol; + + if ( isEnabled ) + { + // If popup is hidden and this control is focused, + // then draw the focus-indicator (selbgcolor background etc.). + if ( isFocused ) + { + dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT) ); + bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); + } + else + { + dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT) ); + bgCol = GetBackgroundColour(); + } + } + else + { + dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT) ); + bgCol = GetBackgroundColour(); + } + + dc.SetBrush( bgCol ); + dc.SetPen( bgCol ); + dc.DrawRectangle( selRect ); +} + +void wxComboControlBase::DrawButton( wxDC& dc, const wxRect& rect, bool paintBg ) +{ + int drawState = m_btnState; + +#ifdef __WXGTK__ + if ( m_isPopupShown ) + drawState |= wxCONTROL_PRESSED; +#endif + + wxRect drawRect(rect.x+m_btnSpacingX, + rect.y+((rect.height-m_btnSize.y)/2), + m_btnSize.x, + m_btnSize.y); + + // Make sure area is not larger than the control + if ( drawRect.y < rect.y ) + drawRect.y = rect.y; + if ( drawRect.height > rect.height ) + drawRect.height = rect.height; + + bool enabled = IsEnabled(); + + if ( !enabled ) + drawState |= wxCONTROL_DISABLED; + + if ( !m_bmpNormal.Ok() ) + { + // Need to clear button background even if m_btn is present + // (assume non-button background was cleared just before this call so brushes are good) + if ( paintBg ) + dc.DrawRectangle(rect); + + // Draw standard button + wxRendererNative::Get().DrawComboBoxDropButton(this, + dc, + drawRect, + drawState); + } + else + { + // Draw bitmap + + wxBitmap* pBmp; + + if ( !enabled ) + pBmp = &m_bmpDisabled; + else if ( m_btnState & wxCONTROL_PRESSED ) + pBmp = &m_bmpPressed; + else if ( m_btnState & wxCONTROL_CURRENT ) + pBmp = &m_bmpHover; + else + pBmp = &m_bmpNormal; + + if ( m_blankButtonBg ) + { + // If using blank button background, we need to clear its background + // with button face colour instead of colour for rest of the control. + if ( paintBg ) + { + wxColour bgCol = GetParent()->GetBackgroundColour(); //wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); + //wxColour bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); + dc.SetPen(bgCol); + dc.SetBrush(bgCol); + dc.DrawRectangle(rect); + } + + wxRendererNative::Get().DrawPushButton(this, + dc, + drawRect, + drawState); + + } + else + + { + // Need to clear button background even if m_btn is present + // (assume non-button background was cleared just before this call so brushes are good) + if ( paintBg ) + dc.DrawRectangle(rect); + } + + // Draw bitmap centered in drawRect + dc.DrawBitmap(*pBmp, + drawRect.x + (drawRect.width-pBmp->GetWidth())/2, + drawRect.y + (drawRect.height-pBmp->GetHeight())/2, + true); + } +} + +void wxComboControlBase::RecalcAndRefresh() +{ + if ( IsCreated() ) + { + wxSizeEvent evt(GetSize(),GetId()); + GetEventHandler()->ProcessEvent(evt); + Refresh(); + } +} + +wxBitmap& wxComboControlBase::GetBufferBitmap( const wxSize& sz ) const +{ + // If size is larger, recalculate double buffer bitmap + if ( !gs_doubleBuffer || + sz.x > gs_doubleBuffer->GetWidth() || + sz.y > gs_doubleBuffer->GetHeight() ) + { + delete gs_doubleBuffer; + gs_doubleBuffer = new wxBitmap(sz.x+25,sz.y); + } + return *gs_doubleBuffer; +} + + +bool wxComboControlBase::OnDrawListItem( wxDC& WXUNUSED(dc), + const wxRect& WXUNUSED(rect), + int WXUNUSED(item), + int WXUNUSED(flags) ) +{ + return false; // signals caller to make default drawing +} + +wxCoord wxComboControlBase::OnMeasureListItem( int WXUNUSED(item) ) +{ + return -1; // signals caller to use default +} + +wxCoord wxComboControlBase::OnMeasureListItemWidth( int WXUNUSED(item) ) +{ + return -1; // signals caller to use default +} + +// ---------------------------------------------------------------------------- +// miscellaneous event handlers +// ---------------------------------------------------------------------------- + +void wxComboControlBase::OnTextCtrlEvent(wxCommandEvent& event) +{ + // Change event id and relay it forward + event.SetId(GetId()); + event.Skip(); +} + +// call if cursor is on button area or mouse is captured for the button +bool wxComboControlBase::HandleButtonMouseEvent( wxMouseEvent& event, + int flags ) +{ + int type = event.GetEventType(); + + if ( type == wxEVT_MOTION ) + { + if ( flags & wxCC_MF_ON_BUTTON ) + { + if ( !(m_btnState & wxCONTROL_CURRENT) ) + { + // Mouse hover begins + m_btnState |= wxCONTROL_CURRENT; + if ( HasCapture() ) // Retain pressed state. + m_btnState |= wxCONTROL_PRESSED; + Refresh(); + } + } + else if ( (m_btnState & wxCONTROL_CURRENT) ) + { + // Mouse hover ends + m_btnState &= ~(wxCONTROL_CURRENT|wxCONTROL_PRESSED); + Refresh(); + } + } + else if ( type == wxEVT_LEFT_DOWN ) + { + // Only accept event if it wasn't right after popup dismiss + //if ( ::wxGetLocalTimeMillis() > m_timeCanClick ) + { + // Need to test this, because it might be outside. + if ( flags & wxCC_MF_ON_BUTTON ) + { + m_btnState |= wxCONTROL_PRESSED; + Refresh(); + + if ( !(m_iFlags & wxCC_POPUP_ON_MOUSE_UP) ) + OnButtonClick(); + else + // If showing popup now, do not capture mouse or there will be interference + CaptureMouse(); + } + } + /*else + { + m_btnState = 0; + }*/ + } + else if ( type == wxEVT_LEFT_UP ) + { + + // Only accept event if mouse was left-press was previously accepted + if ( HasCapture() ) + ReleaseMouse(); + + if ( m_btnState & wxCONTROL_PRESSED ) + { + // If mouse was inside, fire the click event. + if ( m_iFlags & wxCC_POPUP_ON_MOUSE_UP ) + { + if ( flags & wxCC_MF_ON_BUTTON ) + OnButtonClick(); + } + + m_btnState &= ~(wxCONTROL_PRESSED); + Refresh(); + } + } + else if ( type == wxEVT_LEAVE_WINDOW ) + { + if ( m_btnState & (wxCONTROL_CURRENT|wxCONTROL_PRESSED) ) + { + m_btnState &= ~(wxCONTROL_CURRENT); + + // Mouse hover ends + if ( !m_isPopupShown ) + { + m_btnState &= ~(wxCONTROL_PRESSED); + Refresh(); + } + } + } + else + return false; + + return true; +} + +// Conversion to double-clicks and some basic filtering +// returns true if event was consumed or filtered +//bool wxComboControlBase::PreprocessMouseEvent( wxMouseEvent& event, bool isOnButtonArea ) +bool wxComboControlBase::PreprocessMouseEvent( wxMouseEvent& event, + int flags ) +{ + wxLongLong t = ::wxGetLocalTimeMillis(); + int evtType = event.GetEventType(); + + // + // Generate our own double-clicks + // (to allow on-focus dc-event on double-clicks instead of triple-clicks) + if ( (m_windowStyle & wxCC_SPECIAL_DCLICK) && + !m_isPopupShown && + //!(handlerFlags & wxCC_MF_ON_BUTTON) ) + !(flags & wxCC_MF_ON_BUTTON) ) + { + if ( evtType == wxEVT_LEFT_DOWN ) + { + // Set value to avoid up-events without corresponding downs + m_downReceived = true; + } + else if ( evtType == wxEVT_LEFT_DCLICK ) + { + // We'll make our own double-clicks + //evtType = 0; + event.SetEventType(0); + return true; + } + else if ( evtType == wxEVT_LEFT_UP ) + { + if ( m_downReceived || m_timeLastMouseUp == 1 ) + { + wxLongLong timeFromLastUp = (t-m_timeLastMouseUp); + + if ( timeFromLastUp < DOUBLE_CLICK_CONVERSION_TRESHOLD ) + { + //type = wxEVT_LEFT_DCLICK; + event.SetEventType(wxEVT_LEFT_DCLICK); + m_timeLastMouseUp = 1; + } + else + { + m_timeLastMouseUp = t; + } + + //m_downReceived = false; + } + } + } + + // Filter out clicks on button immediately after popup dismiss (Windows like behaviour) + if ( evtType == wxEVT_LEFT_DOWN && t < m_timeCanAcceptClick ) + { + event.SetEventType(0); + return true; + } + + return false; +} + +void wxComboControlBase::HandleNormalMouseEvent( wxMouseEvent& event ) +{ + int evtType = event.GetEventType(); + + if ( (evtType == wxEVT_LEFT_DOWN || evtType == wxEVT_LEFT_DCLICK) && + (m_windowStyle & wxCB_READONLY) ) + { + if ( m_isPopupShown ) + { + #if !wxUSE_POPUPWIN + // Normally do nothing - evt handler should close it for us + #elif !USE_TRANSIENT_POPUP + // Click here always hides the popup. + HidePopup(); + #endif + } + else + { + if ( !(m_windowStyle & wxCC_SPECIAL_DCLICK) ) + { + // In read-only mode, clicking the text is the + // same as clicking the button. + OnButtonClick(); + } + else if ( /*evtType == wxEVT_LEFT_UP || */evtType == wxEVT_LEFT_DCLICK ) + { + //if ( m_popupInterface->CycleValue() ) + // Refresh(); + if ( m_popupInterface ) + m_popupInterface->OnComboDoubleClick(); + } + } + } + else + if ( m_isPopupShown ) + { + // relay (some) mouse events to the popup + if ( evtType == wxEVT_MOUSEWHEEL ) + m_popup->AddPendingEvent(event); + } + else if ( evtType ) + event.Skip(); +} + +void wxComboControlBase::OnFocusEvent( wxFocusEvent& ) +{ + // First click is the first part of double-click + // Some platforms don't generate down-less mouse up-event + // (Windows does, GTK+2 doesn't), so that's why we have + // to do this. + m_timeLastMouseUp = ::wxGetLocalTimeMillis(); + + if ( m_text ) + { + m_text->SetFocus(); + } + else + // no need to check for m_widthCustomPaint - that + // area never gets special handling when selected + // (in writable mode, that is) + Refresh(); +} + +void wxComboControlBase::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event)) +{ + OnThemeChange(); + // indentation may also have changed + if ( !(m_iFlags & wxCC_IFLAG_INDENT_SET) ) + m_absIndent = GetNativeTextIndent(); + RecalcAndRefresh(); +} + +// ---------------------------------------------------------------------------- +// popup handling +// ---------------------------------------------------------------------------- + +// Create popup window and the child control +void wxComboControlBase::CreatePopup() +{ + wxComboPopup* popupInterface = m_popupInterface; + wxWindow* popup; + + if ( !m_winPopup ) + m_winPopup = new wxComboPopupWindow( this, wxNO_BORDER ); + + popupInterface->Create(m_winPopup); + m_popup = popup = popupInterface->GetControl(); + + m_popupExtraHandler = new wxComboPopupExtraEventHandler(this); + popup->PushEventHandler( m_popupExtraHandler ); + + // This may be helpful on some platforms + // (eg. it bypasses a wxGTK popupwindow bug where + // window is not initially hidden when it should be) + m_winPopup->Hide(); + + popupInterface->m_iFlags |= wxCP_IFLAG_CREATED; +} + +void wxComboControlBase::SetPopupControl( wxComboPopup* iface ) +{ + delete m_popupInterface; + delete m_winPopup; + + m_popupInterface = iface; + + if ( !iface->LazyCreate() || m_winPopup ) + { + CreatePopup(); + } + else + { + m_popup = (wxWindow*) NULL; + } + + // This must be after creation + if ( m_valueString ) + iface->SetStringValue(m_valueString); + +} + +void wxComboControlBase::OnButtonClick() +{ + // Derived classes can override this method for totally custom + // popup action + ShowPopup(); +} + +void wxComboControlBase::ShowPopup() +{ + wxCHECK_RET( m_popupInterface, wxT("no popup interface set for wxComboControl") ); + wxCHECK_RET( !IsPopupShown(), wxT("popup window already shown") ); + + SetFocus(); + + // Space above and below + int screenHeight; + wxPoint scrPos; + int spaceAbove; + int spaceBelow; + int maxHeightPopup; + wxSize ctrlSz = GetSize(); + + screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ); + scrPos = GetParent()->ClientToScreen(GetPosition()); + + spaceAbove = scrPos.y; + spaceBelow = screenHeight - spaceAbove - ctrlSz.y; + + maxHeightPopup = spaceBelow; + if ( spaceAbove > spaceBelow ) + maxHeightPopup = spaceAbove; + + // Width + int widthPopup = ctrlSz.x + m_extLeft + m_extRight; + + if ( widthPopup < m_widthMinPopup ) + widthPopup = m_widthMinPopup; + + wxWindow* winPopup = m_winPopup; + wxWindow* popup; + + // Need to disable tab traversal of parent + // + // NB: This is to fix a bug in wxMSW. In theory it could also be fixed + // by, for instance, adding check to window.cpp:wxWindowMSW::MSWProcessMessage + // that if transient popup is open, then tab traversal is to be ignored. + // However, I think this code would still be needed for cases where + // transient popup doesn't work yet (wxWinCE?). + wxWindow* parent = GetParent(); + int parentFlags = parent->GetWindowStyle(); + if ( parentFlags & wxTAB_TRAVERSAL ) + { + parent->SetWindowStyle( parentFlags & ~(wxTAB_TRAVERSAL) ); + m_iFlags |= wxCC_IFLAG_PARENT_TAB_TRAVERSAL; + } + + if ( !winPopup ) + { + CreatePopup(); + winPopup = m_winPopup; + popup = m_popup; + } + else + { + popup = m_popup; + } + + wxASSERT( !m_popup || m_popup == popup ); // Consistency check. + + wxSize adjustedSize = m_popupInterface->GetAdjustedSize(widthPopup, + m_heightPopup<=0?DEFAULT_POPUP_HEIGHT:m_heightPopup, + maxHeightPopup); + + popup->SetSize(adjustedSize); + popup->Move(0,0); + m_popupInterface->OnPopup(); + + // + // Reposition and resize popup window + // + + wxSize szp = popup->GetSize(); + + int popupX; + int popupY = scrPos.y + ctrlSz.y; + + int anchorSide = m_anchorSide; + if ( !anchorSide ) + anchorSide = m_btnSide; + + // Anchor popup to the side the dropbutton is on + if ( anchorSide == wxRIGHT ) + popupX = scrPos.x + ctrlSz.x + m_extRight- szp.x; + else + popupX = scrPos.x - m_extLeft; + + if ( spaceBelow < szp.y ) + { + popupY = scrPos.y - szp.y; + } + + // Move to position + //wxLogDebug(wxT("popup scheduled position1: %i,%i"),ptp.x,ptp.y); + //wxLogDebug(wxT("popup position1: %i,%i"),winPopup->GetPosition().x,winPopup->GetPosition().y); + + // Some platforms (GTK) may need these two to be separate + winPopup->SetSize( szp.x, szp.y ); + winPopup->Move( popupX, popupY ); + + //wxLogDebug(wxT("popup position2: %i,%i"),winPopup->GetPosition().x,winPopup->GetPosition().y); + + m_popup = popup; + + // Set string selection (must be this way instead of SetStringSelection) + if ( m_text ) + { + if ( !(m_iFlags & wxCC_NO_TEXT_AUTO_SELECT) ) + m_text->SelectAll(); + + m_popupInterface->SetStringValue( m_text->GetValue() ); + } + else + { + // This is neede since focus/selection indication may change when popup is shown + // FIXME: But in that case, would m_isPopupShown need to go before this? + Refresh(); + } + + // This must be after SetStringValue + m_isPopupShown = true; + + // Show it +#if USE_TRANSIENT_POPUP + ((wxPopupTransientWindow*)winPopup)->Popup(popup); +#else + winPopup->Show(); +#endif + +#if INSTALL_TOPLEV_HANDLER + // Put top level window event handler into place + if ( !m_toplevEvtHandler ) + m_toplevEvtHandler = new wxComboFrameEventHandler(this); + + wxWindow* toplev = ::wxGetTopLevelParent( this ); + wxASSERT( toplev ); + ((wxComboFrameEventHandler*)m_toplevEvtHandler)->OnPopup(); + toplev->PushEventHandler( m_toplevEvtHandler ); +#endif + +} + +void wxComboControlBase::OnPopupDismiss() +{ + // Just in case, avoid double dismiss + if ( !m_isPopupShown ) + return; + + // *Must* set this before focus etc. + m_isPopupShown = false; + + // Inform popup control itself + m_popupInterface->OnDismiss(); + + if ( m_popupExtraHandler ) + ((wxComboPopupExtraEventHandler*)m_popupExtraHandler)->OnPopupDismiss(); + +#if INSTALL_TOPLEV_HANDLER + // Remove top level window event handler + if ( m_toplevEvtHandler ) + { + wxWindow* toplev = ::wxGetTopLevelParent( this ); + if ( toplev ) + toplev->RemoveEventHandler( m_toplevEvtHandler ); + } +#endif + + m_timeCanAcceptClick = ::wxGetLocalTimeMillis() + 150; + + // If cursor not on dropdown button, then clear its state + // (technically not required by all ports, but do it for all just in case) + if ( !m_btnArea.Inside(ScreenToClient(::wxGetMousePosition())) ) + m_btnState = 0; + + // Return parent's tab traversal flag. + // See ShowPopup for notes. + if ( m_iFlags & wxCC_IFLAG_PARENT_TAB_TRAVERSAL ) + { + wxWindow* parent = GetParent(); + parent->SetWindowStyle( parent->GetWindowStyle() | wxTAB_TRAVERSAL ); + m_iFlags &= ~(wxCC_IFLAG_PARENT_TAB_TRAVERSAL); + } + + // refresh control (necessary even if m_text) + Refresh(); + +#if !wxUSE_POPUPWIN + SetFocus(); +#endif + +} + +void wxComboControlBase::HidePopup() +{ + // Should be able to call this without popup interface + //wxCHECK_RET( m_popupInterface, _T("no popup interface") ); + if ( !m_isPopupShown ) + return; + + // transfer value and show it in textctrl, if any + SetValue( m_popupInterface->GetStringValue() ); + +#if USE_TRANSIENT_POPUP + ((wxPopupTransientWindow*)m_winPopup)->Dismiss(); +#else + m_winPopup->Hide(); +#endif + + OnPopupDismiss(); +} + +// ---------------------------------------------------------------------------- +// customization methods +// ---------------------------------------------------------------------------- + +void wxComboControlBase::SetButtonPosition( int width, int height, + int side, int spacingX ) +{ + m_btnWid = width; + m_btnHei = height; + m_btnSide = side; + m_btnSpacingX = spacingX; + + RecalcAndRefresh(); +} + +void wxComboControlBase::SetButtonBitmaps( const wxBitmap& bmpNormal, + bool blankButtonBg, + const wxBitmap& bmpPressed, + const wxBitmap& bmpHover, + const wxBitmap& bmpDisabled ) +{ + m_bmpNormal = bmpNormal; + m_blankButtonBg = blankButtonBg; + + if ( bmpPressed.Ok() ) + m_bmpPressed = bmpPressed; + else + m_bmpPressed = bmpNormal; + + if ( bmpHover.Ok() ) + m_bmpHover = bmpHover; + else + m_bmpHover = bmpNormal; + + if ( bmpDisabled.Ok() ) + m_bmpDisabled = bmpDisabled; + else + m_bmpDisabled = bmpNormal; + + RecalcAndRefresh(); +} + +void wxComboControlBase::SetCustomPaintWidth( int width ) +{ + if ( m_text ) + { + // move textctrl accordingly + wxRect r = m_text->GetRect(); + int inc = width - m_widthCustomPaint; + r.x += inc; + r.width -= inc; + m_text->SetSize( r ); + } + + m_widthCustomPaint = width; + + RecalcAndRefresh(); +} + +void wxComboControlBase::SetTextIndent( int indent ) +{ + if ( indent < 0 ) + { + m_absIndent = GetNativeTextIndent(); + m_iFlags &= ~(wxCC_IFLAG_INDENT_SET); + } + else + { + m_absIndent = indent; + m_iFlags |= wxCC_IFLAG_INDENT_SET; + } + + RecalcAndRefresh(); +} + +wxCoord wxComboControlBase::GetNativeTextIndent() const +{ + return DEFAULT_TEXT_INDENT; +} + +// ---------------------------------------------------------------------------- +// methods forwarded to wxTextCtrl +// ---------------------------------------------------------------------------- + +wxString wxComboControlBase::GetValue() const +{ + if ( m_text ) + return m_text->GetValue(); + return m_valueString; +} + +void wxComboControlBase::SetValue(const wxString& value) +{ + if ( m_text ) + { + m_text->SetValue(value); + if ( !(m_iFlags & wxCC_NO_TEXT_AUTO_SELECT) ) + m_text->SelectAll(); + } + + // Since wxComboPopup may want to paint the combo as well, we need + // to set the string value here (as well as sometimes in ShowPopup). + if ( m_valueString != value && m_popupInterface ) + { + m_popupInterface->SetStringValue(value); + } + + m_valueString = value; + + Refresh(); +} + +void wxComboControlBase::Copy() +{ + if ( m_text ) + m_text->Copy(); +} + +void wxComboControlBase::Cut() +{ + if ( m_text ) + m_text->Cut(); +} + +void wxComboControlBase::Paste() +{ + if ( m_text ) + m_text->Paste(); +} + +void wxComboControlBase::SetInsertionPoint(long pos) +{ + if ( m_text ) + m_text->SetInsertionPoint(pos); +} + +void wxComboControlBase::SetInsertionPointEnd() +{ + if ( m_text ) + m_text->SetInsertionPointEnd(); +} + +long wxComboControlBase::GetInsertionPoint() const +{ + if ( m_text ) + return m_text->GetInsertionPoint(); + + return 0; +} + +long wxComboControlBase::GetLastPosition() const +{ + if ( m_text ) + return m_text->GetLastPosition(); + + return 0; +} + +void wxComboControlBase::Replace(long from, long to, const wxString& value) +{ + if ( m_text ) + m_text->Replace(from, to, value); +} + +void wxComboControlBase::Remove(long from, long to) +{ + if ( m_text ) + m_text->Remove(from, to); +} + +void wxComboControlBase::SetSelection(long from, long to) +{ + if ( m_text ) + m_text->SetSelection(from, to); +} + +void wxComboControlBase::Undo() +{ + if ( m_text ) + m_text->Undo(); +} + +#endif // wxUSE_COMBOCONTROL diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp index 788e0bdffe..a748c5e5de 100644 --- a/src/common/popupcmn.cpp +++ b/src/common/popupcmn.cpp @@ -436,7 +436,7 @@ void wxPopupComboWindow::PositionNearCombo() void wxPopupComboWindow::OnDismiss() { - m_combo->OnDismiss(); + m_combo->OnPopupDismiss(); } void wxPopupComboWindow::OnKeyDown(wxKeyEvent& event) diff --git a/src/generic/combog.cpp b/src/generic/combog.cpp new file mode 100644 index 0000000000..3b62ca9bc5 --- /dev/null +++ b/src/generic/combog.cpp @@ -0,0 +1,364 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: combog.cpp +// Purpose: Generic wxComboControl +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// RCS-ID: $Id$ +// Copyright: (c) 2005 Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_COMBOCONTROL + +#ifndef WX_PRECOMP + #include "wx/log.h" + #include "wx/combobox.h" + #include "wx/dcclient.h" + #include "wx/settings.h" +#endif + +#include "wx/dcbuffer.h" + +#include "wx/combo.h" + + +// ---------------------------------------------------------------------------- +// Some constant adjustments to make the generic more bearable + +#if defined(__WXUNIVERSAL__) + +#define TEXTCTRLXADJUST 0 // position adjustment for wxTextCtrl, with zero indent +#define TEXTCTRLYADJUST 0 +#define TEXTXADJUST 0 // how much is read-only text's x adjusted +#define DEFAULT_DROPBUTTON_WIDTH 19 + +#elif defined(__WXMSW__) + +#define TEXTCTRLXADJUST 2 // position adjustment for wxTextCtrl, with zero indent +#define TEXTCTRLYADJUST 3 +#define TEXTXADJUST 0 // how much is read-only text's x adjusted +#define DEFAULT_DROPBUTTON_WIDTH 17 + +#elif defined(__WXGTK__) + +#define TEXTCTRLXADJUST -1 // position adjustment for wxTextCtrl, with zero indent +#define TEXTCTRLYADJUST 0 +#define TEXTXADJUST 1 // how much is read-only text's x adjusted +#define DEFAULT_DROPBUTTON_WIDTH 23 + +#elif defined(__WXMAC__) + +#define TEXTCTRLXADJUST 0 // position adjustment for wxTextCtrl, with zero indent +#define TEXTCTRLYADJUST 0 +#define TEXTXADJUST 0 // how much is read-only text's x adjusted +#define DEFAULT_DROPBUTTON_WIDTH 19 + +#else + +#define TEXTCTRLXADJUST 0 // position adjustment for wxTextCtrl, with zero indent +#define TEXTCTRLYADJUST 0 +#define TEXTXADJUST 0 // how much is read-only text's x adjusted +#define DEFAULT_DROPBUTTON_WIDTH 19 + +#endif + + +// ============================================================================ +// implementation +// ============================================================================ + +// Only implement if no native or it wasn't fully featured +#ifndef wxCOMBOCONTROL_FULLY_FEATURED + + +// ---------------------------------------------------------------------------- +// wxGenericComboControl +// ---------------------------------------------------------------------------- + +BEGIN_EVENT_TABLE(wxGenericComboControl, wxComboControlBase) + EVT_PAINT(wxGenericComboControl::OnPaintEvent) + EVT_MOUSE_EVENTS(wxGenericComboControl::OnMouseEvent) +END_EVENT_TABLE() + + +IMPLEMENT_DYNAMIC_CLASS(wxGenericComboControl, wxComboControlBase) + +void wxGenericComboControl::Init() +{ +} + +bool wxGenericComboControl::Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + + // Set border + long border = style & wxBORDER_MASK; + + if ( !border ) + { +#if defined(__WXUNIVERSAL__) + border = wxBORDER_SIMPLE; +#elif defined(__WXMSW__) + // For XP, have 1-width custom border, for older version use sunken + if ( wxUxThemeEngine::GetIfActive() ) + { + border = wxBORDER_NONE; + m_widthCustomBorder = 1; + } + else + border = wxBORDER_SUNKEN; +#elif defined(__WXGTK__) + border = wxBORDER_NONE; + //m_widthCustomBorder = 2; + m_widthCustomBorder = 1; +#else + border = wxBORDER_SIMPLE; +#endif + + style = (style & ~(wxBORDER_MASK)) | border; + } + +#if defined(__WXGTK__) + Customize( wxCC_BUTTON_OUTSIDE_BORDER | + wxCC_NO_TEXT_AUTO_SELECT ); +#endif + + if ( style & wxCC_STD_BUTTON ) + m_iFlags |= wxCC_POPUP_ON_MOUSE_UP; + + // create main window + if ( !wxComboControlBase::Create(parent, + id, + value, + wxDefaultPosition, + wxDefaultSize, + style | wxFULL_REPAINT_ON_RESIZE, + wxDefaultValidator, + name) ) + return false; + + // Create textctrl, if necessary + CreateTextCtrl( wxNO_BORDER, validator ); + + // Add keyboard input handlers for main control and textctrl + InstallInputHandlers( true ); + + // Set background + SetBackgroundStyle( wxBG_STYLE_CUSTOM ); // for double-buffering + + // SetSize should be called last + SetSize(pos.x,pos.y,size.x,size.y); + + return true; +} + +wxGenericComboControl::~wxGenericComboControl() +{ +} + +void wxGenericComboControl::OnResize() +{ + + // Recalculates button and textctrl areas + CalculateAreas(DEFAULT_DROPBUTTON_WIDTH); + +#if 0 + // Move separate button control, if any, to correct position + if ( m_btn ) + { + wxSize sz = GetClientSize(); + m_btn->SetSize( m_btnArea.x + m_btnSpacingX, + (sz.y-m_btnSize.y)/2, + m_btnSize.x, + m_btnSize.y ); + } +#endif + + // Move textctrl, if any, accordingly + PositionTextCtrl( TEXTCTRLXADJUST, TEXTCTRLYADJUST ); +} + +void wxGenericComboControl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) +{ + wxSize sz = GetClientSize(); + wxBufferedPaintDC dc(this,GetBufferBitmap(sz)); + + const wxRect& rectb = m_btnArea; + wxRect rect = m_tcArea; + + // artificial simple border + if ( m_widthCustomBorder ) + { + int customBorder = m_widthCustomBorder; + + // Set border colour + wxPen pen1( wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT), + customBorder, + wxSOLID ); + dc.SetPen( pen1 ); + + // area around both controls + wxRect rect2(0,0,sz.x,sz.y); + if ( m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE ) + { + rect2 = m_tcArea; + if ( customBorder == 1 ) + { + rect2.Inflate(1); + } + else + { + #ifdef __WXGTK__ + rect2.x -= 1; + rect2.y -= 1; + #else + rect2.x -= customBorder; + rect2.y -= customBorder; + #endif + rect2.width += 1 + customBorder; + rect2.height += 1 + customBorder; + } + } + + dc.SetBrush( *wxTRANSPARENT_BRUSH ); + dc.DrawRectangle(rect2); + } + + wxColour winCol = GetBackgroundColour(); + dc.SetBrush(winCol); + dc.SetPen(winCol); + + //wxLogDebug(wxT("hei: %i tcy: %i tchei: %i"),GetClientSize().y,m_tcArea.y,m_tcArea.height); + //wxLogDebug(wxT("btnx: %i tcx: %i tcwid: %i"),m_btnArea.x,m_tcArea.x,m_tcArea.width); + + // clear main background + dc.DrawRectangle(rect); + + if ( !m_btn ) + // Standard button rendering + DrawButton(dc,rectb,true); + + // paint required portion on the control + if ( !m_text || m_widthCustomPaint ) + { + wxASSERT( m_widthCustomPaint >= 0 ); + + // this is intentionally here to allow drawed rectangle's + // right edge to be hidden + if ( m_text ) + rect.width = m_widthCustomPaint; + + dc.SetFont( GetFont() ); + + dc.SetClippingRegion(rect); + m_popupInterface->PaintComboControl(dc,rect); + } +} + +void wxGenericComboControl::OnMouseEvent( wxMouseEvent& event ) +{ + bool isOnButtonArea = m_btnArea.Inside(event.m_x,event.m_y); + int handlerFlags = isOnButtonArea ? wxCC_MF_ON_BUTTON : 0; + + // Preprocessing fabricates double-clicks and prevents + // (it may also do other common things in future) + if ( PreprocessMouseEvent(event,handlerFlags) ) + return; + + if ( (m_windowStyle & (wxCC_SPECIAL_DCLICK|wxCB_READONLY)) == wxCB_READONLY ) + { + // if no textctrl and no special double-click, then the entire control acts + // as a button + handlerFlags |= wxCC_MF_ON_BUTTON; + if ( HandleButtonMouseEvent(event,handlerFlags) ) + return; + } + else + { + if ( isOnButtonArea || HasCapture() ) + { + if ( HandleButtonMouseEvent(event,handlerFlags) ) + return; + } + else if ( m_btnState ) + { + // otherwise need to clear the hover status + m_btnState = 0; + RefreshRect(m_btnArea); + } + } + + // + // This will handle left_down and left_dclick events outside button in a Windows/GTK-like manner. + // See header file for further information on this method. + HandleNormalMouseEvent(event); + +} + +#ifdef __WXUNIVERSAL__ + +bool wxGenericComboControl::PerformAction(const wxControlAction& action, + long numArg, + const wxString& strArg) +{ + bool processed = false; + if ( action == wxACTION_COMBOBOX_POPUP ) + { + if ( !m_isPopupShown ) + { + ShowPopup(); + + processed = true; + } + } + else if ( action == wxACTION_COMBOBOX_DISMISS ) + { + if ( m_isPopupShown ) + { + HidePopup(); + + processed = true; + } + } + + if ( !processed ) + { + // pass along + return wxControl::PerformAction(action, numArg, strArg); + } + + return true; +} + +#endif // __WXUNIVERSAL__ + +// If native wxComboControl was not defined, then prepare a simple +// front-end so that wxRTTI works as expected. +#ifndef _WX_COMBOCONTROL_H_ +IMPLEMENT_DYNAMIC_CLASS(wxComboControl, wxGenericComboControl) +#endif + +#endif // !wxCOMBOCONTROL_FULLY_FEATURED + +#endif // wxUSE_COMBOCONTROL diff --git a/src/generic/odcombo.cpp b/src/generic/odcombo.cpp new file mode 100644 index 0000000000..ee1741bea2 --- /dev/null +++ b/src/generic/odcombo.cpp @@ -0,0 +1,737 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: odcombo.cpp +// Purpose: wxOwnerDrawnComboBox, wxVListBoxComboPopup +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// RCS-ID: $Id$ +// Copyright: (c) 2005 Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_OWNERDRAWNCOMBOBOX + +#ifndef WX_PRECOMP + #include "wx/log.h" + #include "wx/combobox.h" + #include "wx/dcclient.h" + #include "wx/settings.h" + #include "wx/dialog.h" +#endif + +#include "wx/combo.h" +#include "wx/odcombo.h" + + +// ============================================================================ +// implementation +// ============================================================================ + + +// ---------------------------------------------------------------------------- +// wxVListBoxComboPopup is a wxVListBox customized to act as a popup control +// +// ---------------------------------------------------------------------------- + + +BEGIN_EVENT_TABLE(wxVListBoxComboPopup, wxVListBox) + EVT_MOTION(wxVListBoxComboPopup::OnMouseMove) + EVT_KEY_DOWN(wxVListBoxComboPopup::OnKey) + EVT_LEFT_UP(wxVListBoxComboPopup::OnLeftClick) +END_EVENT_TABLE() + + +wxVListBoxComboPopup::wxVListBoxComboPopup(wxComboControlBase* combo) + : wxVListBox(), + wxComboPopup(combo) +{ + m_widestWidth = 0; + m_avgCharWidth = 0; + m_baseImageWidth = 0; + m_itemHeight = 0; + m_value = -1; + m_itemHover = -1; + m_clientDataItemsType = wxClientData_None; +} + +bool wxVListBoxComboPopup::Create(wxWindow* parent) +{ + if ( !wxVListBox::Create(parent, + wxID_ANY, + wxDefaultPosition, + wxDefaultSize, + wxBORDER_SIMPLE | wxLB_INT_HEIGHT | wxWANTS_CHARS) ) + return false; + + wxASSERT( GetParent()->GetParent() ); + SetFont( GetParent()->GetParent()->GetFont() ); + + wxVListBox::SetItemCount(m_strings.GetCount()); + + // TODO: Move this to SetFont + m_itemHeight = GetCharHeight() + 0; + + return true; +} + +wxVListBoxComboPopup::~wxVListBoxComboPopup() +{ + Clear(); +} + +bool wxVListBoxComboPopup::LazyCreate() +{ + // NB: There is a bug with wxVListBox that can be avoided by creating + // it later (bug causes empty space to be shown if initial selection + // is at the end of a list longer than the control can show at once). + return true; +} + +// paint the control itself +void wxVListBoxComboPopup::PaintComboControl( wxDC& dc, const wxRect& rect ) +{ + if ( !(m_combo->GetWindowStyle() & wxODCB_STD_CONTROL_PAINT) ) + { + m_combo->DrawFocusBackground(dc,rect,0); + if ( m_value >= 0 ) + { + if ( m_combo->OnDrawListItem(dc,rect,m_value,wxCC_PAINTING_CONTROL) ) + return; + } + } + + wxComboPopup::PaintComboControl(dc,rect); +} + +void wxVListBoxComboPopup::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const +{ + dc.SetFont( m_font ); + + bool isHilited = GetSelection() == (int) n; + + // Set correct text colour for selected items + // (must always set the correct colour - atleast GTK may have lost it + // in between calls). + if ( isHilited ) + dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT) ); + else + dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT) ); + + if ( !m_combo->OnDrawListItem(dc,rect,(int)n,0) ) + dc.DrawText( GetString(n), rect.x + 2, rect.y ); +} + +wxCoord wxVListBoxComboPopup::OnMeasureItem(size_t n) const +{ + int itemHeight = m_combo->OnMeasureListItem(n); + if ( itemHeight < 0 ) + itemHeight = m_itemHeight; + + return itemHeight; +} + +void wxVListBoxComboPopup::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const +{ + // we need to render selected and current items differently + if ( IsCurrent(n) ) + { + m_combo->DrawFocusBackground( dc, rect, wxCONTROL_ISSUBMENU|wxCONTROL_SELECTED ); + } + //else: do nothing for the normal items +} + +void wxVListBoxComboPopup::SendComboBoxEvent() +{ + wxCommandEvent evt(wxEVT_COMMAND_COMBOBOX_SELECTED,m_combo->GetId()); + int selection = m_value; + + evt.SetEventObject(m_combo); + evt.SetInt(selection); + + // Set client data, if any + if ( selection >= 0 && (int)m_clientDatas.GetCount() > selection ) + { + void* clientData = m_clientDatas[selection]; + if ( m_clientDataItemsType == wxClientData_Object ) + evt.SetClientObject((wxClientData*)clientData); + else + evt.SetClientData(clientData); + } + + m_combo->GetEventHandler()->AddPendingEvent(evt); +} + +// returns true if key was consumed +bool wxVListBoxComboPopup::HandleKey( int keycode, bool saturate ) +{ + int value = m_value; + int itemCount = GetCount(); + + if ( keycode == WXK_DOWN || keycode == WXK_RIGHT ) + { + value++; + } + else if ( keycode == WXK_UP || keycode == WXK_LEFT ) + { + value--; + } + else if ( keycode == WXK_PAGEDOWN ) + { + value+=10; + } + else if ( keycode == WXK_PAGEUP ) + { + value-=10; + } + /* + else if ( keycode == WXK_END ) + { + value = itemCount-1; + } + else if ( keycode == WXK_HOME ) + { + value = 0; + } + */ + else + return false; + + if ( saturate ) + { + if ( value >= itemCount ) + value = itemCount - 1; + else if ( value < 0 ) + value = 0; + } + else + { + if ( value >= itemCount ) + value -= itemCount; + else if ( value < 0 ) + value += itemCount; + } + + if ( value == m_value ) + // Even if value was same, don't skip the event + // (good for consistency) + return true; + + m_value = value; + + wxString valStr; + if ( value >= 0 ) + m_combo->SetValue(m_strings[value]); + + SendComboBoxEvent(); + + return true; +} + +void wxVListBoxComboPopup::OnComboDoubleClick() +{ + // Cycle on dclick (disable saturation to allow true cycling). + if ( !::wxGetKeyState(WXK_SHIFT) ) + HandleKey(WXK_DOWN,false); + else + HandleKey(WXK_UP,false); +} + +void wxVListBoxComboPopup::OnComboKeyEvent( wxKeyEvent& event ) +{ + // Saturated key movement on + if ( !HandleKey(event.GetKeyCode(),true) ) + event.Skip(); +} + +void wxVListBoxComboPopup::OnPopup() +{ + // *must* set value after size is set (this is because of a vlbox bug) + wxVListBox::SetSelection(m_value); +} + +void wxVListBoxComboPopup::OnMouseMove(wxMouseEvent& event) +{ + // Move selection to cursor if it is inside the popup + int itemHere = GetItemAtPosition(event.GetPosition()); + if ( itemHere >= 0 ) + wxVListBox::SetSelection(itemHere); + + event.Skip(); +} + +void wxVListBoxComboPopup::OnLeftClick(wxMouseEvent& WXUNUSED(event)) +{ + m_value = wxVListBox::GetSelection(); + Dismiss(); + SendComboBoxEvent(); +} + +void wxVListBoxComboPopup::OnKey(wxKeyEvent& event) +{ + // Select item if ENTER is pressed + if ( event.GetKeyCode() == WXK_RETURN || event.GetKeyCode() == WXK_NUMPAD_ENTER ) + { + m_value = wxVListBox::GetSelection(); + Dismiss(); + SendComboBoxEvent(); + } + // Hide popup if ESC is pressed + else if ( event.GetKeyCode() == WXK_ESCAPE ) + Dismiss(); + else + event.Skip(); +} + +void wxVListBoxComboPopup::CheckWidth( int pos ) +{ + wxCoord x = m_combo->OnMeasureListItemWidth(pos); + + if ( x < 0 ) + { + if ( !m_font.Ok() ) + m_font = m_combo->GetFont(); + + wxCoord y; + m_combo->GetTextExtent(m_strings[pos], &x, &y, 0, 0, &m_font); + x += 4; + } + + if ( m_widestWidth < x ) + { + m_widestWidth = x; + } +} + +void wxVListBoxComboPopup::Insert( const wxString& item, int pos ) +{ + // Need to change selection? + wxString strValue; + if ( !(m_combo->GetWindowStyle() & wxCB_READONLY) && + m_combo->GetValue() == item ) + m_value = pos; + + m_strings.Insert(item,pos); + + if ( IsCreated() ) + wxVListBox::SetItemCount( wxVListBox::GetItemCount()+1 ); + + // Calculate width + CheckWidth(pos); +} + +int wxVListBoxComboPopup::Append(const wxString& item) +{ + int pos = (int)m_strings.GetCount(); + + if ( m_combo->GetWindowStyle() & wxCB_SORT ) + { + // Find position + // TODO: Could be optimized with binary search + wxArrayString strings = m_strings; + unsigned int i; + + for ( i=0; i n ) + return m_clientDatas[n]; + + return NULL; +} + +void wxVListBoxComboPopup::Delete( unsigned int item ) +{ + // Remove client data, if set + if ( m_clientDatas.GetCount() ) + { + if ( m_clientDataItemsType == wxClientData_Object ) + delete (wxClientData*) m_clientDatas[item]; + + m_clientDatas.RemoveAt(item); + } + + m_strings.RemoveAt(item); + + if ( IsCreated() ) + wxVListBox::SetItemCount( wxVListBox::GetItemCount()-1 ); +} + +int wxVListBoxComboPopup::FindString(const wxString& s) const +{ + return m_strings.Index(s); +} + +unsigned int wxVListBoxComboPopup::GetCount() const +{ + return m_strings.GetCount(); +} + +wxString wxVListBoxComboPopup::GetString( int item ) const +{ + return m_strings[item]; +} + +void wxVListBoxComboPopup::SetString( int item, const wxString& str ) +{ + m_strings[item] = str; +} + +wxString wxVListBoxComboPopup::GetStringValue() const +{ + if ( m_value >= 0 ) + return m_strings[m_value]; + return wxEmptyString; +} + +void wxVListBoxComboPopup::SetSelection( int item ) +{ + // This seems to be necessary (2.5.3 w/ MingW atleast) + if ( item < -1 || item >= (int)m_strings.GetCount() ) + item = -1; + + m_value = item; + + if ( IsCreated() ) + wxVListBox::SetSelection(item); +} + +void wxVListBoxComboPopup::SetStringValue( const wxString& value ) +{ + int index = m_strings.Index(value); + + m_value = index; + + if ( index >= -1 && index < (int)wxVListBox::GetItemCount() ) + wxVListBox::SetSelection(index); +} + +wxSize wxVListBoxComboPopup::GetAdjustedSize( int minWidth, int prefHeight, int maxHeight ) +{ + int height = 250; + + if ( m_strings.GetCount() ) + { + if ( prefHeight > 0 ) + height = prefHeight; + + if ( height > maxHeight ) + height = maxHeight; + + int totalHeight = GetTotalHeight(); // + 3; + if ( height >= totalHeight ) + { + height = totalHeight; + } + else + { + // Adjust height to a multiple of the height of the first item + // NB: Calculations that take variable height into account + // are unnecessary. + int fih = GetLineHeight(0); + int shown = height/fih; + height = shown * fih; + } + } + else + height = 50; + + // Take scrollbar into account in width calculations + int widestWidth = m_widestWidth + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); + return wxSize(minWidth > widestWidth ? minWidth : widestWidth, + height+2); +} + +void wxVListBoxComboPopup::Populate( int n, const wxString choices[] ) +{ + int i; + + for ( i=0; iGetWindowStyle() & wxCB_SORT ) + m_strings.Sort(); + + // Find initial selection + wxString strValue = m_combo->GetValue(); + if ( strValue.Length() ) + m_value = m_strings.Index(strValue); +} + +// ---------------------------------------------------------------------------- +// wxOwnerDrawnComboBox +// ---------------------------------------------------------------------------- + + +BEGIN_EVENT_TABLE(wxOwnerDrawnComboBox, wxComboControl) +END_EVENT_TABLE() + + +IMPLEMENT_DYNAMIC_CLASS2(wxOwnerDrawnComboBox, wxComboControl, wxControlWithItems) + +void wxOwnerDrawnComboBox::Init() +{ +} + +bool wxOwnerDrawnComboBox::Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + return wxComboControl::Create(parent,id,value,pos,size,style,validator,name); +} + +wxOwnerDrawnComboBox::wxOwnerDrawnComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) + : wxComboControl() +{ + Init(); + + Create(parent,id,value,pos,size,choices,style, validator, name); +} + +bool wxOwnerDrawnComboBox::Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, value, pos, size, chs.GetCount(), + chs.GetStrings(), style, validator, name); +} + +bool wxOwnerDrawnComboBox::Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + int n, + const wxString choices[], + long style, + const wxValidator& validator, + const wxString& name) +{ + + if ( !Create(parent, id, value, pos, size, style, + validator, name) ) + { + return false; + } + + wxVListBoxComboPopup* iface = new wxVListBoxComboPopup(this); + SetPopupControl(iface); + + // m_popupInterface has been overridden as wxVListBoxComboPopup + m_popupInterface = iface; + + // Add initial choices to the wxVListBox + iface->Populate(n,choices); + + return true; +} + +wxOwnerDrawnComboBox::~wxOwnerDrawnComboBox() +{ + if ( m_popupInterface ) + m_popupInterface->ClearClientDatas(); +} + +// ---------------------------------------------------------------------------- +// wxOwnerDrawnComboBox item manipulation methods +// ---------------------------------------------------------------------------- + +void wxOwnerDrawnComboBox::Clear() +{ + wxASSERT( m_popupInterface ); + + m_popupInterface->Clear(); + + GetTextCtrl()->SetValue(wxEmptyString); +} + +void wxOwnerDrawnComboBox::Delete(unsigned int n) +{ + wxCHECK_RET( (n >= 0) && (n < GetCount()), _T("invalid index in wxOwnerDrawnComboBox::Delete") ); + + if ( GetSelection() == (int) n ) + SetValue(wxEmptyString); + + m_popupInterface->Delete(n); +} + +unsigned int wxOwnerDrawnComboBox::GetCount() const +{ + wxASSERT( m_popupInterface ); + return m_popupInterface->GetCount(); +} + +wxString wxOwnerDrawnComboBox::GetString(unsigned int n) const +{ + wxCHECK_MSG( (n >= 0) && (n < GetCount()), wxEmptyString, _T("invalid index in wxOwnerDrawnComboBox::GetString") ); + return m_popupInterface->GetString(n); +} + +void wxOwnerDrawnComboBox::SetString(unsigned int n, const wxString& s) +{ + wxCHECK_RET( (n >= 0) && (n < GetCount()), _T("invalid index in wxOwnerDrawnComboBox::SetString") ); + m_popupInterface->SetString(n,s); +} + +int wxOwnerDrawnComboBox::FindString(const wxString& s) const +{ + wxASSERT( m_popupInterface ); + return m_popupInterface->FindString(s); +} + +void wxOwnerDrawnComboBox::Select(int n) +{ + wxCHECK_RET( (n >= -1) && (n < (int)GetCount()), _T("invalid index in wxOwnerDrawnComboBox::Select") ); + wxASSERT( m_popupInterface ); + + m_popupInterface->SetSelection(n); + + wxString str; + if ( n >= 0 ) + str = m_popupInterface->GetString(n); + + // Refresh text portion in control + if ( m_text ) + m_text->SetValue( str ); + else + m_valueString = str; + + Refresh(); +} + +int wxOwnerDrawnComboBox::GetSelection() const +{ + wxASSERT( m_popupInterface ); + return m_popupInterface->GetSelection(); +} + +int wxOwnerDrawnComboBox::DoAppend(const wxString& item) +{ + wxASSERT( m_popupInterface ); + return m_popupInterface->Append(item); +} + +int wxOwnerDrawnComboBox::DoInsert(const wxString& item, unsigned int pos) +{ + wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list")); + wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index")); + + m_popupInterface->Insert(item,pos); + + return pos; +} + +void wxOwnerDrawnComboBox::DoSetItemClientData(unsigned int n, void* clientData) +{ + wxASSERT(m_popupInterface); + m_popupInterface->SetItemClientData(n,clientData,m_clientDataItemsType); +} + +void* wxOwnerDrawnComboBox::DoGetItemClientData(unsigned int n) const +{ + wxASSERT(m_popupInterface); + return m_popupInterface->GetItemClientData(n); +} + +void wxOwnerDrawnComboBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData) +{ + DoSetItemClientData(n, (void*) clientData); +} + +wxClientData* wxOwnerDrawnComboBox::DoGetItemClientObject(unsigned int n) const +{ + return (wxClientData*) DoGetItemClientData(n); +} + +#endif // wxUSE_OWNERDRAWNCOMBOBOX diff --git a/src/msw/combo.cpp b/src/msw/combo.cpp new file mode 100644 index 0000000000..b006217757 --- /dev/null +++ b/src/msw/combo.cpp @@ -0,0 +1,521 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: combo.cpp +// Purpose: wxMSW wxComboControl +// Author: Jaakko Salli +// Modified by: +// Created: Apr-30-2006 +// RCS-ID: $Id$ +// Copyright: (c) 2005 Jaakko Salli +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_COMBOCONTROL + +#ifndef WX_PRECOMP + #include "wx/log.h" + #include "wx/combobox.h" + #include "wx/dcclient.h" + #include "wx/settings.h" + #include "wx/dialog.h" +#endif + +#include "wx/dcbuffer.h" + +#include "wx/combo.h" + + +#include "wx/msw/uxtheme.h" + +// Change to #if 1 to include tmschema.h for easier testing of theme +// parameters. +#if 0 + #include +#else + //---------------------------------- + #define EP_EDITTEXT 1 + #define ETS_NORMAL 1 + #define ETS_HOT 2 + #define ETS_SELECTED 3 + #define ETS_DISABLED 4 + #define ETS_FOCUSED 5 + #define ETS_READONLY 6 + #define ETS_ASSIST 7 + #define TMT_FILLCOLOR 3802 + #define TMT_TEXTCOLOR 3803 + #define TMT_BORDERCOLOR 3801 + #define TMT_EDGEFILLCOLOR 3808 + //---------------------------------- +#endif + + +#define NATIVE_TEXT_INDENT_XP 4 +#define NATIVE_TEXT_INDENT_CLASSIC 2 + +#define TEXTCTRLXADJUST_XP 1 +#define TEXTCTRLYADJUST_XP 3 +#define TEXTCTRLXADJUST_CLASSIC 1 +#define TEXTCTRLYADJUST_CLASSIC 2 + + +// ============================================================================ +// implementation +// ============================================================================ + + +BEGIN_EVENT_TABLE(wxComboControl, wxComboControlBase) + EVT_PAINT(wxComboControl::OnPaintEvent) + EVT_MOUSE_EVENTS(wxComboControl::OnMouseEvent) +END_EVENT_TABLE() + + +IMPLEMENT_DYNAMIC_CLASS(wxComboControl, wxComboControlBase) + +void wxComboControl::Init() +{ +} + +bool wxComboControl::Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + + // Set border + long border = style & wxBORDER_MASK; + + wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive(); + + if ( !border ) + { + // For XP, have 1-width custom border, for older version use sunken + if ( theme ) + { + border = wxBORDER_NONE; + m_widthCustomBorder = 1; + } + else + border = wxBORDER_SUNKEN; + + style = (style & ~(wxBORDER_MASK)) | border; + } + + // create main window + if ( !wxComboControlBase::Create(parent, + id, + value, + wxDefaultPosition, + wxDefaultSize, + style | wxFULL_REPAINT_ON_RESIZE, + wxDefaultValidator, + name) ) + return false; + + if ( style & wxCC_STD_BUTTON ) + m_iFlags |= wxCC_POPUP_ON_MOUSE_UP; + + // Create textctrl, if necessary + CreateTextCtrl( wxNO_BORDER, validator ); + + // Add keyboard input handlers for main control and textctrl + InstallInputHandlers( true ); + + // Prepare background for double-buffering + SetBackgroundStyle( wxBG_STYLE_CUSTOM ); + + // SetSize should be called last + SetSize(pos.x,pos.y,size.x,size.y); + + return true; +} + +wxComboControl::~wxComboControl() +{ +} + +void wxComboControl::OnThemeChange() +{ + wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive(); + if ( theme ) + { + wxUxThemeHandle hTheme(this, L"COMBOBOX"); + + COLORREF col; + theme->GetThemeColor(hTheme,EP_EDITTEXT,ETS_NORMAL,TMT_FILLCOLOR,&col); + SetBackgroundColour(wxRGBToColour(col)); + theme->GetThemeColor(hTheme,EP_EDITTEXT,ETS_NORMAL,TMT_TEXTCOLOR,&col); + SetForegroundColour(wxRGBToColour(col)); + } + else + { + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); + } +} + +void wxComboControl::OnResize() +{ + // + // Recalculates button and textctrl areas + + int textCtrlXAdjust; + int textCtrlYAdjust; + + if ( wxUxThemeEngine::GetIfActive() ) + { + textCtrlXAdjust = TEXTCTRLXADJUST_XP; + textCtrlYAdjust = TEXTCTRLYADJUST_XP; + } + else + { + textCtrlXAdjust = TEXTCTRLXADJUST_CLASSIC; + textCtrlYAdjust = TEXTCTRLYADJUST_CLASSIC; + } + + // Technically Classic Windows style combo has more narrow button, + // but the native renderer doesn't paint it well like that. + int btnWidth = 17; + CalculateAreas(btnWidth); + + // Position textctrl using standard routine + PositionTextCtrl(textCtrlXAdjust,textCtrlYAdjust); +} + +// Draws non-XP GUI dotted line around the focus area +static void wxMSWDrawFocusRect( wxDC& dc, const wxRect& rect ) +{ +#if !defined(__WXWINCE__) + /* + RECT mswRect; + mswRect.left = rect.x; + mswRect.top = rect.y; + mswRect.right = rect.x + rect.width; + mswRect.bottom = rect.y + rect.height; + HDC hdc = (HDC) dc.GetHDC(); + SetMapMode(hdc,MM_TEXT); // Just in case... + DrawFocusRect(hdc,&mswRect); + */ + // FIXME: Use DrawFocusRect code above (currently it draws solid line + // for caption focus but works ok for other stuff). + // Also, this code below may not work in future wx versions, since + // it employs wxCAP_BUTT hack to have line of width 1. + dc.SetLogicalFunction(wxINVERT); + + wxPen pen(*wxBLACK,1,wxDOT); + pen.SetCap(wxCAP_BUTT); + dc.SetPen(pen); + dc.SetBrush(*wxTRANSPARENT_BRUSH); + + dc.DrawRectangle(rect); + + dc.SetLogicalFunction(wxCOPY); +#else + dc.SetLogicalFunction(wxINVERT); + + dc.SetPen(wxPen(*wxBLACK,1,wxDOT)); + dc.SetBrush(*wxTRANSPARENT_BRUSH); + + dc.DrawRectangle(rect); + + dc.SetLogicalFunction(wxCOPY); +#endif +} + +// draw focus background on area in a way typical on platform +void wxComboControl::DrawFocusBackground( wxDC& dc, const wxRect& rect, int flags ) +{ + wxUxThemeEngine* theme = (wxUxThemeEngine*) NULL; + wxUxThemeHandle hTheme(this, L"COMBOBOX"); + //COLORREF cref; + + wxSize sz = GetClientSize(); + bool isEnabled; + bool isFocused; // also selected + + // For smaller size control (and for disabled background) use less spacing + int focusSpacingX; + int focusSpacingY; + + if ( !(flags & wxCONTROL_ISSUBMENU) ) + { + // Drawing control + isEnabled = IsEnabled(); + isFocused = ShouldDrawFocus(); + + // Windows-style: for smaller size control (and for disabled background) use less spacing + if ( hTheme ) + { + // WinXP Theme + focusSpacingX = isEnabled ? 2 : 1; + focusSpacingY = sz.y > (GetCharHeight()+2) && isEnabled ? 2 : 1; + } + else + { + // Classic Theme + if ( isEnabled ) + { + focusSpacingX = 1; + focusSpacingY = 1; + } + else + { + focusSpacingX = 0; + focusSpacingY = 0; + } + } + } + else + { + // Drawing a list item + isEnabled = true; // they are never disabled + isFocused = flags & wxCONTROL_SELECTED ? true : false; + + focusSpacingX = 0; + focusSpacingY = 0; + } + + // Set the background sub-rectangle for selection, disabled etc + wxRect selRect(rect); + selRect.y += focusSpacingY; + selRect.height -= (focusSpacingY*2); + selRect.x += m_widthCustomPaint + focusSpacingX; + selRect.width -= m_widthCustomPaint + (focusSpacingX*2); + + if ( hTheme ) + theme = wxUxThemeEngine::GetIfActive(); + + wxColour bgCol; + bool drawDottedEdge = false; + + if ( isEnabled ) + { + // If popup is hidden and this control is focused, + // then draw the focus-indicator (selbgcolor background etc.). + if ( isFocused ) + { + #if 0 + // TODO: Proper theme color getting (JMS: I don't know which parts/colors to use, + // those below don't work) + if ( hTheme ) + { + theme->GetThemeColor(hTheme,EP_EDITTEXT,ETS_SELECTED,TMT_TEXTCOLOR,&cref); + dc.SetTextForeground( wxRGBToColour(cref) ); + theme->GetThemeColor(hTheme,EP_EDITTEXT,ETS_SELECTED,TMT_FILLCOLOR,&cref); + bgCol = wxRGBToColour(cref); + } + else + #endif + { + dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT) ); + bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); + if ( m_windowStyle & wxCB_READONLY ) + drawDottedEdge = true; + } + } + else + { + /*if ( hTheme ) + { + theme->GetThemeColor(hTheme,EP_EDITTEXT,ETS_NORMAL,TMT_TEXTCOLOR,&cref); + dc.SetTextForeground( wxRGBToColour(cref) ); + theme->GetThemeColor(hTheme,EP_EDITTEXT,ETS_NORMAL,TMT_FILLCOLOR,&cref); + bgCol = wxRGBToColour(cref); + } + else + {*/ + dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT) ); + bgCol = GetBackgroundColour(); + //} + } + } + else + { + /*if ( hTheme ) + { + theme->GetThemeColor(hTheme,EP_EDITTEXT,ETS_DISABLED,TMT_TEXTCOLOR,&cref); + dc.SetTextForeground( wxRGBToColour(cref) ); + theme->GetThemeColor(hTheme,EP_EDITTEXT,ETS_DISABLED,TMT_EDGEFILLCOLOR,&cref); + bgCol = wxRGBToColour(cref); + } + else + {*/ + dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT) ); + bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); + //} + } + + dc.SetBrush(bgCol); + dc.SetPen(bgCol); + dc.DrawRectangle(selRect); + if ( drawDottedEdge ) + wxMSWDrawFocusRect(dc,selRect); + +} + +void wxComboControl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) +{ + // TODO: Convert drawing in this function to Windows API Code + + wxSize sz = GetClientSize(); + wxBufferedPaintDC dc(this,GetBufferBitmap(sz)); + + const wxRect& rectb = m_btnArea; + wxRect rect = m_tcArea; + bool isEnabled = IsEnabled(); + wxColour bgCol = GetBackgroundColour(); + wxColour fgCol; + + wxUxThemeEngine* theme = NULL; + wxUxThemeHandle hTheme(this, L"COMBOBOX"); + int etsState; + + // area around both controls + wxRect rect2(0,0,sz.x,sz.y); + if ( m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE ) + { + rect2 = m_tcArea; + rect2.Inflate(1); + } + + // Use theme to draw border on XP + if ( hTheme ) + { + theme = wxUxThemeEngine::GetIfActive(); + COLORREF cref; + + // Select correct border colour + if ( !isEnabled ) + etsState = ETS_DISABLED; + else + etsState = ETS_NORMAL; + + if ( m_widthCustomBorder ) + { + theme->GetThemeColor(hTheme,EP_EDITTEXT,etsState,TMT_BORDERCOLOR,&cref); + + // Set border colour + dc.SetPen( wxRGBToColour(cref) ); + + dc.SetBrush( *wxTRANSPARENT_BRUSH ); + dc.DrawRectangle(rect2); + } + + theme->GetThemeColor(hTheme,EP_EDITTEXT,etsState,TMT_TEXTCOLOR,&cref); + fgCol = wxRGBToColour(cref); + } + else + { + // draw regular background + fgCol = GetForegroundColour(); + } + + rect2.Deflate(m_widthCustomBorder); + + dc.SetBrush(bgCol); + dc.SetPen(bgCol); + + // clear main background + dc.DrawRectangle(rect); + + // Button background with theme? + bool drawButBg = true; + if ( hTheme && m_blankButtonBg ) + { + RECT r; + wxCopyRectToRECT(rectb, r); + + // Draw parent background if needed (since button looks like its out of + // the combo, this is preferred). + theme->DrawThemeParentBackground(GetHwndOf(this), + GetHdcOf(dc), + &r); + + drawButBg = false; + } + + // Standard button rendering + DrawButton(dc,rectb,drawButBg); + + // paint required portion on the control + if ( !m_text || m_widthCustomPaint ) + { + wxASSERT( m_widthCustomPaint >= 0 ); + + // this is intentionally here to allow drawed rectangle's + // right edge to be hidden + if ( m_text ) + rect.width = m_widthCustomPaint; + + dc.SetFont( GetFont() ); + + dc.SetClippingRegion(rect); + m_popupInterface->PaintComboControl(dc,rect); + } +} + +void wxComboControl::OnMouseEvent( wxMouseEvent& event ) +{ + bool isOnButtonArea = m_btnArea.Inside(event.m_x,event.m_y); + int handlerFlags = isOnButtonArea ? wxCC_MF_ON_BUTTON : 0; + + // Preprocessing fabricates double-clicks and prevents + // (it may also do other common things in future) + if ( PreprocessMouseEvent(event,isOnButtonArea) ) + return; + + if ( (m_windowStyle & (wxCC_SPECIAL_DCLICK|wxCB_READONLY)) == wxCB_READONLY ) + { + // if no textctrl and no special double-click, then the entire control acts + // as a button + handlerFlags |= wxCC_MF_ON_BUTTON; + if ( HandleButtonMouseEvent(event,handlerFlags) ) + return; + } + else + { + if ( isOnButtonArea || HasCapture() ) + { + if ( HandleButtonMouseEvent(event,handlerFlags) ) + return; + } + else if ( m_btnState ) + { + // otherwise need to clear the hover status + m_btnState = 0; + RefreshRect(m_btnArea); + } + } + + // + // This will handle left_down and left_dclick events outside button in a Windows-like manner. + // See header file for further information on this method. + HandleNormalMouseEvent(event); + +} + +wxCoord wxComboControl::GetNativeTextIndent() const +{ + if ( wxUxThemeEngine::GetIfActive() ) + return NATIVE_TEXT_INDENT_XP; + return NATIVE_TEXT_INDENT_CLASSIC; +} + + +#endif // wxUSE_COMBOCONTROL diff --git a/src/univ/combobox.cpp b/src/univ/combobox.cpp index c785a83a7f..44d250585a 100644 --- a/src/univ/combobox.cpp +++ b/src/univ/combobox.cpp @@ -38,72 +38,12 @@ #endif #include "wx/tooltip.h" -#include "wx/popupwin.h" +#include "wx/combo.h" #include "wx/univ/renderer.h" #include "wx/univ/inphand.h" #include "wx/univ/theme.h" -/* - The keyboard event flow: - - 1. they always come to the text ctrl - 2. it forwards the ones it doesn't process to the wxComboControl - 3. which passes them to the popup window if it is popped up - */ - -// constants -// ---------------------------------------------------------------------------- - -// the margin between the text control and the combo button -static const wxCoord g_comboMargin = 2; - -// ---------------------------------------------------------------------------- -// wxComboButton is just a normal button except that it sends commands to the -// combobox and not its parent -// ---------------------------------------------------------------------------- - -class wxComboButton : public wxBitmapButton -{ -public: - wxComboButton(wxComboControl *combo) - : wxBitmapButton(combo->GetParent(), wxID_ANY, wxNullBitmap, - wxDefaultPosition, wxDefaultSize, - wxBORDER_NONE | wxBU_EXACTFIT) - { - m_combo = combo; - - wxBitmap bmpNormal, bmpFocus, bmpPressed, bmpDisabled; - - GetRenderer()->GetComboBitmaps(&bmpNormal, - &bmpFocus, - &bmpPressed, - &bmpDisabled); - - SetBitmapLabel(bmpNormal); - SetBitmapFocus(bmpFocus.Ok() ? bmpFocus : bmpNormal); - SetBitmapSelected(bmpPressed.Ok() ? bmpPressed : bmpNormal); - SetBitmapDisabled(bmpDisabled.Ok() ? bmpDisabled : bmpNormal); - - SetBestSize(wxDefaultSize); - } - -protected: - void OnButton(wxCommandEvent& WXUNUSED(event)) { m_combo->ShowPopup(); } - - virtual wxSize DoGetBestClientSize() const - { - const wxBitmap& bmp = GetBitmapLabel(); - - return wxSize(bmp.GetWidth(), bmp.GetHeight()); - - } - -private: - wxComboControl *m_combo; - - DECLARE_EVENT_TABLE() -}; // ---------------------------------------------------------------------------- // wxComboListBox is a listbox modified to be used as a popup window in a @@ -114,14 +54,16 @@ class wxComboListBox : public wxListBox, public wxComboPopup { public: // ctor and dtor - wxComboListBox(wxComboControl *combo, int style = 0); + wxComboListBox(wxComboControlBase *combo); virtual ~wxComboListBox(); // implement wxComboPopup methods - virtual bool SetSelection(const wxString& s); - virtual wxControl *GetControl() { return this; } - virtual void OnShow(); - virtual wxCoord GetBestWidth() const; + virtual bool Create(wxWindow* parent); + virtual void SetStringValue(const wxString& s); + virtual wxString GetStringValue() const; + virtual wxWindow *GetControl() { return this; } + virtual void OnPopup(); + virtual wxSize GetAdjustedSize(int minWidth, int prefHeight, int maxHeight); // fix virtual function hiding virtual void SetSelection(int n) { DoSetSelection(n, true); } @@ -133,45 +75,10 @@ public: const wxString& strArg); protected: - // we shouldn't return height too big from here - virtual wxSize DoGetBestClientSize() const; - - // filter mouse move events happening outside the list box - void OnMouseMove(wxMouseEvent& event); - // set m_clicked value from here void OnLeftUp(wxMouseEvent& event); - // called whenever the user selects or activates a listbox item - void OnSelect(wxCommandEvent& event); - private: - // has the mouse been released on this control? - bool m_clicked; - - DECLARE_EVENT_TABLE() -}; - -// ---------------------------------------------------------------------------- -// wxComboTextCtrl is a simple text ctrl which forwards -// wxEVT_COMMAND_TEXT_UPDATED events and all key events to the combobox -// ---------------------------------------------------------------------------- - -class wxComboTextCtrl : public wxTextCtrl -{ -public: - wxComboTextCtrl(wxComboControl *combo, - const wxString& value, - long style, - const wxValidator& validator); - -protected: - void OnKey(wxKeyEvent& event); - void OnText(wxCommandEvent& event); - -private: - wxComboControl *m_combo; - DECLARE_EVENT_TABLE() }; @@ -179,361 +86,60 @@ private: // event tables and such // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxComboButton, wxButton) - EVT_BUTTON(wxID_ANY, wxComboButton::OnButton) -END_EVENT_TABLE() - BEGIN_EVENT_TABLE(wxComboListBox, wxListBox) - EVT_LISTBOX(wxID_ANY, wxComboListBox::OnSelect) - EVT_LISTBOX_DCLICK(wxID_ANY, wxComboListBox::OnSelect) - EVT_MOTION(wxComboListBox::OnMouseMove) EVT_LEFT_UP(wxComboListBox::OnLeftUp) END_EVENT_TABLE() -BEGIN_EVENT_TABLE(wxComboControl, wxControl) - EVT_KEY_DOWN(wxComboControl::OnKey) - EVT_KEY_UP(wxComboControl::OnKey) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxComboTextCtrl, wxTextCtrl) - EVT_KEY_DOWN(wxComboTextCtrl::OnKey) - EVT_KEY_UP(wxComboTextCtrl::OnKey) - EVT_TEXT(wxID_ANY, wxComboTextCtrl::OnText) -END_EVENT_TABLE() - -IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) +IMPLEMENT_DYNAMIC_CLASS2(wxComboBox, wxControl, wxComboControl) // ============================================================================ // implementation // ============================================================================ // ---------------------------------------------------------------------------- -// wxComboControl creation -// ---------------------------------------------------------------------------- - -void wxComboControl::Init() -{ - m_popup = (wxComboPopup *)NULL; - m_winPopup = (wxPopupComboWindow *)NULL; - m_isPopupShown = false; - m_btn = NULL; - m_text = NULL; -} - -bool wxComboControl::Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) -{ - // first create our own window, i.e. the one which will contain all - // subcontrols - style &= ~wxBORDER_NONE; - style |= wxBORDER_SUNKEN; - if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) - return false; - - // create the text control and the button as our siblings (*not* children), - // don't care about size/position here - they will be set in DoMoveWindow() - m_btn = new wxComboButton(this); - m_text = new wxComboTextCtrl(this, - value, - style & wxCB_READONLY ? wxTE_READONLY : 0, - validator); - - // for compatibility with the other ports, the height specified is the - // combined height of the combobox itself and the popup - if ( size.y == wxDefaultCoord ) - { - // ok, use default height for popup too - m_heightPopup = wxDefaultCoord; - } - else - { - m_heightPopup = size.y - DoGetBestSize().y; - } - - SetBestSize(size); - Move(pos); - - // create the popup window immediately here to allow creating the controls - // with parent == GetPopupWindow() from the derived class ctor - m_winPopup = new wxPopupComboWindow(this); - - // have to disable this window to avoid interfering it with message - // processing to the text and the button... but pretend it is enabled to - // make IsEnabled() return true - wxControl::Enable(false); // don't use non virtual Disable() here! - m_isEnabled = true; - - CreateInputHandler(wxINP_HANDLER_COMBOBOX); - - return true; -} - -wxComboControl::~wxComboControl() -{ - // as the button and the text control are the parent's children and not - // ours, we have to delete them manually - they are not deleted - // automatically by wxWidgets when we're deleted - delete m_btn; - delete m_text; - - delete m_winPopup; -} - -// ---------------------------------------------------------------------------- -// geometry stuff -// ---------------------------------------------------------------------------- - -void wxComboControl::DoSetSize(int x, int y, - int width, int WXUNUSED(height), - int sizeFlags) -{ - // combo height is always fixed - wxControl::DoSetSize(x, y, width, DoGetBestSize().y, sizeFlags); -} - -wxSize wxComboControl::DoGetBestClientSize() const -{ - wxSize sizeBtn = m_btn->GetBestSize(), - sizeText = m_text->GetBestSize(); - wxCoord widthPopup = 0; - - if (m_popup) - { - widthPopup = m_popup->GetBestWidth(); - } - - return wxSize(wxMax(sizeText.x + g_comboMargin + sizeBtn.x, widthPopup), - wxMax(sizeBtn.y, sizeText.y)); -} - -void wxComboControl::DoMoveWindow(int x, int y, int width, int height) -{ - wxControl::DoMoveWindow(x, y, width, height); - - // position the subcontrols inside the client area - wxRect rectBorders = GetRenderer()->GetBorderDimensions(GetBorder()); - x += rectBorders.x; - y += rectBorders.y; - width -= rectBorders.x + rectBorders.width; - height -= rectBorders.y + rectBorders.height; - - wxSize sizeBtn = m_btn->GetBestSize(); - - wxCoord wText = width - sizeBtn.x; - wxPoint p = GetParent() ? GetParent()->GetClientAreaOrigin() : wxPoint(0,0); - m_text->SetSize(x - p.x, y - p.y, wText, height); - m_btn->SetSize(x - p.x + wText, y - p.y, sizeBtn.x, height); -} - -// ---------------------------------------------------------------------------- -// operations +// wxComboListBox // ---------------------------------------------------------------------------- -bool wxComboControl::Enable(bool enable) +wxComboListBox::wxComboListBox(wxComboControlBase *combo) + : wxListBox(), + wxComboPopup(combo) { - if ( !wxControl::Enable(enable) ) - return false; - - m_btn->Enable(enable); - m_text->Enable(enable); - - return true; } -bool wxComboControl::Show(bool show) +bool wxComboListBox::Create(wxWindow* parent) { - if ( !wxControl::Show(show) ) + if ( !wxListBox::Create(parent, wxID_ANY, + wxDefaultPosition, wxDefaultSize, + 0, NULL, + wxBORDER_SIMPLE | wxLB_INT_HEIGHT | + m_combo->GetWindowStyle() & wxCB_SORT ? wxLB_SORT : 0) ) return false; - if (m_btn) - m_btn->Show(show); - - if (m_text) - m_text->Show(show); + // we don't react to the mouse events outside the window at all + StopAutoScrolling(); return true; } -#if wxUSE_TOOLTIPS -void wxComboControl::DoSetToolTip(wxToolTip *tooltip) -{ - wxControl::DoSetToolTip(tooltip); - - // Set tool tip for button and text box - if (m_text && m_btn) - { - if (tooltip) - { - const wxString &tip = tooltip->GetTip(); - m_text->SetToolTip(tip); - m_btn->SetToolTip(tip); - } - else - { - m_text->SetToolTip(NULL); - m_btn->SetToolTip(NULL); - } - } -} -#endif // wxUSE_TOOLTIPS - -// ---------------------------------------------------------------------------- -// popup window handling -// ---------------------------------------------------------------------------- - -void wxComboControl::SetPopupControl(wxComboPopup *popup) -{ - m_popup = popup; -} - -void wxComboControl::ShowPopup() -{ - wxCHECK_RET( m_popup, _T("no popup to show in wxComboControl") ); - wxCHECK_RET( !IsPopupShown(), _T("popup window already shown") ); - - wxControl *control = m_popup->GetControl(); - - // size and position the popup window correctly - m_winPopup->SetSize(GetSize().x, - m_heightPopup == wxDefaultCoord ? control->GetBestSize().y - : m_heightPopup); - wxSize sizePopup = m_winPopup->GetClientSize(); - control->SetSize(0, 0, sizePopup.x, sizePopup.y); - - // some controls don't accept the size we give then: e.g. a listbox may - // require more space to show its last row - wxSize sizeReal = control->GetSize(); - if ( sizeReal != sizePopup ) - { - m_winPopup->SetClientSize(sizeReal); - } - - m_winPopup->PositionNearCombo(); - - // show it - m_popup->OnShow(); - m_winPopup->Popup(m_text); - m_text->SelectAll(); - m_popup->SetSelection(m_text->GetValue()); - - m_isPopupShown = true; -} - -void wxComboControl::HidePopup() -{ - wxCHECK_RET( m_popup, _T("no popup to hide in wxComboControl") ); - wxCHECK_RET( IsPopupShown(), _T("popup window not shown") ); - - m_winPopup->Dismiss(); - - m_isPopupShown = false; -} - -void wxComboControl::OnSelect(const wxString& value) -{ - m_text->SetValue(value); - m_text->SelectAll(); - - OnDismiss(); -} - -void wxComboControl::OnDismiss() -{ - HidePopup(); - m_text->SetFocus(); -} - -// ---------------------------------------------------------------------------- -// wxComboTextCtrl -// ---------------------------------------------------------------------------- - -wxComboTextCtrl::wxComboTextCtrl(wxComboControl *combo, - const wxString& value, - long style, - const wxValidator& validator) - : wxTextCtrl(combo->GetParent(), wxID_ANY, value, - wxDefaultPosition, wxDefaultSize, - wxBORDER_NONE | style, - validator) +wxComboListBox::~wxComboListBox() { - m_combo = combo; } -void wxComboTextCtrl::OnText(wxCommandEvent& event) +wxString wxComboListBox::GetStringValue() const { - if ( m_combo->IsPopupShown() ) - { - m_combo->GetPopupControl()->SetSelection(GetValue()); - } - - // we need to make a copy of the event to have the correct originating - // object and id - wxCommandEvent event2 = event; - event2.SetEventObject(m_combo); - event2.SetId(m_combo->GetId()); - - // there is a small incompatibility with wxMSW here: the combobox gets the - // event before the text control in our case which corresponds to SMW - // CBN_EDITUPDATE notification and not CBN_EDITCHANGE one wxMSW currently - // uses - // - // if this is really a problem, we can play games with the event handlers - // to circumvent this - (void)m_combo->ProcessEvent(event2); - - event.Skip(); + return wxListBox::GetStringSelection(); } -// pass the keys we don't process to the combo first -void wxComboTextCtrl::OnKey(wxKeyEvent& event) +void wxComboListBox::SetStringValue(const wxString& value) { - switch ( event.GetKeyCode() ) - { - case WXK_RETURN: - // the popup control gets it first but only if it is shown - if ( !m_combo->IsPopupShown() ) - break; - //else: fall through - - case WXK_UP: - case WXK_DOWN: - case WXK_ESCAPE: - case WXK_PAGEDOWN: - case WXK_PAGEUP: - (void)m_combo->ProcessEvent(event); - return; - } - - event.Skip(); -} - -// ---------------------------------------------------------------------------- -// wxComboListBox -// ---------------------------------------------------------------------------- - -wxComboListBox::wxComboListBox(wxComboControl *combo, int style) - : wxListBox(combo->GetPopupWindow(), wxID_ANY, - wxDefaultPosition, wxDefaultSize, - 0, NULL, - wxBORDER_SIMPLE | wxLB_INT_HEIGHT | style), - wxComboPopup(combo) -{ - // we don't react to the mouse events outside the window at all - StopAutoScrolling(); -} + if ( !value.empty() ) + wxListBox::SetStringSelection(value); + else + wxListBox::SetSelection(-1); -wxComboListBox::~wxComboListBox() -{ -} + /* + // PRE-GLOBAL WXCOMBOCONTROL CODE: -bool wxComboListBox::SetSelection(const wxString& value) -{ // FindItem() would just find the current item for an empty string (it // always matches), but we want to show the first one in such case if ( value.empty() ) @@ -547,36 +153,12 @@ bool wxComboListBox::SetSelection(const wxString& value) else if ( !FindItem(value) ) { // no match att all - return false; } - - return true; -} - -void wxComboListBox::OnSelect(wxCommandEvent& event) -{ - if ( m_clicked ) - { - // first update the combo and close the listbox - m_combo->OnSelect(event.GetString()); - - // next let the user code have the event - - // all fields are already filled by the listbox, just change the event - // type and send it to the combo - wxCommandEvent event2 = event; - event2.SetEventType(wxEVT_COMMAND_COMBOBOX_SELECTED); - event2.SetEventObject(m_combo); - event2.SetId(m_combo->GetId()); - m_combo->ProcessEvent(event2); - } - //else: ignore the events resulting from just moving the mouse initially + */ } -void wxComboListBox::OnShow() +void wxComboListBox::OnPopup() { - // nobody clicked us yet - m_clicked = false; } bool wxComboListBox::PerformAction(const wxControlAction& action, @@ -598,50 +180,26 @@ bool wxComboListBox::PerformAction(const wxControlAction& action, void wxComboListBox::OnLeftUp(wxMouseEvent& event) { // we should dismiss the combo now - m_clicked = true; + // first update the combo and close the listbox + Dismiss(); + m_combo->SetValue(wxListBox::GetStringSelection()); - event.Skip(); -} + // next let the user code have the event + wxCommandEvent evt(wxEVT_COMMAND_COMBOBOX_SELECTED,m_combo->GetId()); + evt.SetInt(wxListBox::GetSelection()); + evt.SetEventObject(m_combo); + m_combo->ProcessEvent(evt); -void wxComboListBox::OnMouseMove(wxMouseEvent& event) -{ - // while a wxComboListBox is shown, it always has capture, so if it doesn't - // we're about to go away anyhow (normally this shouldn't happen at all, - // but I don't put assert here as it just might do on other platforms and - // it doesn't break anything anyhow) - if ( this == wxWindow::GetCapture() ) - { - if ( HitTest(event.GetPosition()) == wxHT_WINDOW_INSIDE ) - { - event.Skip(); - } - //else: popup shouldn't react to the mouse motions outside it, it only - // captures the mouse to be able to detect when it must be - // dismissed, so don't call Skip() - } -} - -wxCoord wxComboListBox::GetBestWidth() const -{ - wxSize size = wxListBox::GetBestSize(); - return size.x; + event.Skip(); } -wxSize wxComboListBox::DoGetBestClientSize() const +wxSize wxComboListBox::GetAdjustedSize(int minWidth, + int WXUNUSED(prefHeight), + int maxHeight) { - // don't return size too big or we risk to not fit on the screen - wxSize size = wxListBox::DoGetBestClientSize(); - wxCoord hChar = GetCharHeight(); - - int nLines = size.y / hChar; - - // 10 is the same limit as used by wxMSW - if ( nLines > 10 ) - { - size.y = 10*hChar; - } - - return size; + wxSize bestSize = wxListBox::GetBestSize(); + return wxSize(wxMax(bestSize.x,minWidth), + wxMin(bestSize.y,maxHeight)); } // ---------------------------------------------------------------------------- @@ -701,13 +259,12 @@ bool wxComboBox::Create(wxWindow *parent, return false; } - wxComboListBox *combolbox = - new wxComboListBox(this, style & wxCB_SORT ? wxLB_SORT : 0); + wxComboListBox *combolbox = new wxComboListBox(this); + SetPopupControl(combolbox); + m_lbox = combolbox; m_lbox->Set(n, choices); - SetPopupControl(combolbox); - return true; } @@ -721,67 +278,71 @@ wxComboBox::~wxComboBox() wxString wxComboBox::GetValue() const { - return GetText()->GetValue(); + return wxComboControl::GetValue(); } void wxComboBox::SetValue(const wxString& value) { - GetText()->SetValue(value); + wxComboControl::SetValue(value); } void wxComboBox::Copy() { - GetText()->Copy(); + if ( GetTextCtrl() ) GetTextCtrl()->Copy(); } void wxComboBox::Cut() { - GetText()->Cut(); + if ( GetTextCtrl() ) GetTextCtrl()->Cut(); } void wxComboBox::Paste() { - GetText()->Paste(); + if ( GetTextCtrl() ) GetTextCtrl()->Paste(); } void wxComboBox::SetInsertionPoint(long pos) { - GetText()->SetInsertionPoint(pos); + if ( GetTextCtrl() ) GetTextCtrl()->SetInsertionPoint(pos); } void wxComboBox::SetInsertionPointEnd() { - GetText()->SetInsertionPointEnd(); + if ( GetTextCtrl() ) GetTextCtrl()->SetInsertionPointEnd(); } long wxComboBox::GetInsertionPoint() const { - return GetText()->GetInsertionPoint(); + if ( GetTextCtrl() ) + return GetTextCtrl()->GetInsertionPoint(); + return -1; } wxTextPos wxComboBox::GetLastPosition() const { - return GetText()->GetLastPosition(); + if ( GetTextCtrl() ) + return GetTextCtrl()->GetLastPosition(); + return -1; } void wxComboBox::Replace(long from, long to, const wxString& value) { - GetText()->Replace(from, to, value); + if ( GetTextCtrl() ) GetTextCtrl()->Replace(from, to, value); } void wxComboBox::Remove(long from, long to) { - GetText()->Remove(from, to); + if ( GetTextCtrl() ) GetTextCtrl()->Remove(from, to); } void wxComboBox::SetSelection(long from, long to) { - GetText()->SetSelection(from, to); + if ( GetTextCtrl() ) GetTextCtrl()->SetSelection(from, to); } void wxComboBox::SetEditable(bool editable) { - GetText()->SetEditable(editable); + if ( GetTextCtrl() ) GetTextCtrl()->SetEditable(editable); } // ---------------------------------------------------------------------------- @@ -791,7 +352,7 @@ void wxComboBox::SetEditable(bool editable) void wxComboBox::Clear() { GetLBox()->Clear(); - GetText()->SetValue(wxEmptyString); + if ( GetTextCtrl() ) GetTextCtrl()->SetValue(wxEmptyString); } void wxComboBox::Delete(unsigned int n) @@ -799,7 +360,7 @@ void wxComboBox::Delete(unsigned int n) wxCHECK_RET( IsValid(n), _T("invalid index in wxComboBox::Delete") ); if (GetSelection() == (int)n) - GetText()->SetValue(wxEmptyString); + if ( GetTextCtrl() ) GetTextCtrl()->SetValue(wxEmptyString); GetLBox()->Delete(n); } @@ -833,7 +394,7 @@ void wxComboBox::SetSelection(int n) wxCHECK_RET( IsValid(n), _T("invalid index in wxComboBox::Select") ); GetLBox()->SetSelection(n); - GetText()->SetValue(GetLBox()->GetString(n)); + if ( GetTextCtrl() ) GetTextCtrl()->SetValue(GetLBox()->GetString(n)); } int wxComboBox::GetSelection() const @@ -845,7 +406,7 @@ int wxComboBox::GetSelection() const // Why oh why is this done this way? // It is not because the value displayed in the text can be found // in the list that it is the item that is selected! - return FindString(GetText()->GetValue()); + return FindString(if ( GetTextCtrl() ) GetTextCtrl()->GetValue()); #endif } @@ -888,38 +449,38 @@ wxClientData* wxComboBox::DoGetItemClientObject(unsigned int n) const bool wxComboBox::IsEditable() const { - return GetText() != NULL && (!HasFlag(wxCB_READONLY) || GetText()->IsEditable()); + return GetTextCtrl() != NULL && (!HasFlag(wxCB_READONLY) || GetTextCtrl()->IsEditable() ); } void wxComboBox::Undo() { if (IsEditable()) - GetText()->Undo(); + if ( GetTextCtrl() ) GetTextCtrl()->Undo(); } void wxComboBox::Redo() { if (IsEditable()) - GetText()->Redo(); + if ( GetTextCtrl() ) GetTextCtrl()->Redo(); } void wxComboBox::SelectAll() { - GetText()->SelectAll(); + if ( GetTextCtrl() ) GetTextCtrl()->SelectAll(); } bool wxComboBox::CanCopy() const { - if (GetText() != NULL) - return GetText()->CanCopy(); + if (GetTextCtrl() != NULL) + return GetTextCtrl()->CanCopy(); else return false; } bool wxComboBox::CanCut() const { - if (GetText() != NULL) - return GetText()->CanCut(); + if (GetTextCtrl() != NULL) + return GetTextCtrl()->CanCut(); else return false; } @@ -927,7 +488,7 @@ bool wxComboBox::CanCut() const bool wxComboBox::CanPaste() const { if (IsEditable()) - return GetText()->CanPaste(); + return GetTextCtrl()->CanPaste(); else return false; } @@ -935,7 +496,7 @@ bool wxComboBox::CanPaste() const bool wxComboBox::CanUndo() const { if (IsEditable()) - return GetText()->CanUndo(); + return GetTextCtrl()->CanUndo(); else return false; } @@ -943,62 +504,12 @@ bool wxComboBox::CanUndo() const bool wxComboBox::CanRedo() const { if (IsEditable()) - return GetText()->CanRedo(); + return GetTextCtrl()->CanRedo(); else return false; } -// ---------------------------------------------------------------------------- -// input handling -// ---------------------------------------------------------------------------- - -void wxComboControl::OnKey(wxKeyEvent& event) -{ - if ( m_isPopupShown ) - { - // pass it to the popped up control - (void)m_popup->GetControl()->ProcessEvent(event); - } - else // no popup - { - event.Skip(); - } -} - -bool wxComboControl::PerformAction(const wxControlAction& action, - long numArg, - const wxString& strArg) -{ - bool processed = false; - if ( action == wxACTION_COMBOBOX_POPUP ) - { - if ( !m_isPopupShown ) - { - ShowPopup(); - - processed = true; - } - } - else if ( action == wxACTION_COMBOBOX_DISMISS ) - { - if ( m_isPopupShown ) - { - HidePopup(); - - processed = true; - } - } - - if ( !processed ) - { - // pass along - return wxControl::PerformAction(action, numArg, strArg); - } - - return true; -} - // ---------------------------------------------------------------------------- // wxStdComboBoxInputHandler // ---------------------------------------------------------------------------- @@ -1037,4 +548,5 @@ bool wxStdComboBoxInputHandler::HandleKey(wxInputConsumer *consumer, return wxStdInputHandler::HandleKey(consumer, event, pressed); } + #endif // wxUSE_COMBOBOX diff --git a/src/wxWindows.dsp b/src/wxWindows.dsp index d6e70d54b4..16fb7ccf3a 100644 --- a/src/wxWindows.dsp +++ b/src/wxWindows.dsp @@ -357,6 +357,10 @@ SOURCE=.\common\colourcmn.cpp # End Source File # Begin Source File +SOURCE=.\common\combocmn.cpp +# End Source File +# Begin Source File + SOURCE=.\common\config.cpp # End Source File # Begin Source File @@ -938,6 +942,10 @@ SOURCE=.\generic\choicdgg.cpp # End Source File # Begin Source File +SOURCE=.\generic\combog.cpp +# End Source File +# Begin Source File + SOURCE=.\generic\datavgen.cpp # End Source File # Begin Source File @@ -998,6 +1006,10 @@ SOURCE=.\generic\numdlgg.cpp # End Source File # Begin Source File +SOURCE=.\generic\odcombo.cpp +# End Source File +# Begin Source File + SOURCE=.\generic\panelg.cpp # End Source File # Begin Source File @@ -1238,6 +1250,10 @@ SOURCE=.\msw\colour.cpp # End Source File # Begin Source File +SOURCE=.\msw\combo.cpp +# End Source File +# Begin Source File + SOURCE=.\msw\combobox.cpp # End Source File # Begin Source File @@ -2123,6 +2139,10 @@ SOURCE=..\include\wx\colour.h # End Source File # Begin Source File +SOURCE=..\include\wx\combo.h +# End Source File +# Begin Source File + SOURCE=..\include\wx\combobox.h # End Source File # Begin Source File @@ -2691,6 +2711,10 @@ SOURCE=..\include\wx\object.h # End Source File # Begin Source File +SOURCE=..\include\wx\odcombo.h +# End Source File +# Begin Source File + SOURCE=..\include\wx\ownerdrw.h # End Source File # Begin Source File @@ -3419,6 +3443,10 @@ SOURCE=..\include\wx\msw\colour.h # End Source File # Begin Source File +SOURCE=..\include\wx\msw\combo.h +# End Source File +# Begin Source File + SOURCE=..\include\wx\msw\combobox.h # End Source File # Begin Source File @@ -3711,6 +3739,10 @@ SOURCE=..\include\wx\msw\scrolbar.h # End Source File # Begin Source File +SOURCE=..\include\wx\msw\seh.h +# End Source File +# Begin Source File + SOURCE=..\include\wx\msw\setup0.h # End Source File # Begin Source File @@ -3851,6 +3883,10 @@ SOURCE=..\include\wx\generic\colrdlgg.h # End Source File # Begin Source File +SOURCE=..\include\wx\generic\combo.h +# End Source File +# Begin Source File + SOURCE=..\include\wx\generic\dataview.h # End Source File # Begin Source File -- 2.45.2