From a92b5dfe8ce92f1686df0bec0ccc61d75ed46100 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 5 Oct 2009 22:54:13 +0000 Subject: [PATCH] Initial wxInfoBar implementation. Add generic implementation, documentation and examples showing the use of the new class in the samples. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- Makefile.in | 24 +++ build/bakefiles/files.bkl | 3 + build/msw/makefile.bcc | 24 +++ build/msw/makefile.gcc | 24 +++ build/msw/makefile.vc | 24 +++ build/msw/makefile.wat | 24 +++ build/msw/wx_adv.dsp | 12 ++ build/msw/wx_core.dsp | 8 + build/msw/wx_vc7_adv.vcproj | 9 + build/msw/wx_vc7_core.vcproj | 6 + build/msw/wx_vc8_adv.vcproj | 12 ++ build/msw/wx_vc8_core.vcproj | 8 + build/msw/wx_vc9_adv.vcproj | 12 ++ build/msw/wx_vc9_core.vcproj | 8 + configure | 54 +++++- configure.in | 5 + docs/changes.txt | 1 + docs/doxygen/mainpages/cat_classes.h | 1 + include/wx/chkconf.h | 8 + include/wx/generic/infobar.h | 107 ++++++++++++ include/wx/infobar.h | 49 ++++++ include/wx/motif/setup0.h | 16 ++ include/wx/msw/setup0.h | 8 + include/wx/msw/wince/setup.h | 8 + include/wx/os2/setup0.h | 8 + include/wx/osx/setup0.h | 8 + include/wx/palmos/setup0.h | 8 + include/wx/setup_inc.h | 8 + include/wx/univ/setup0.h | 8 + interface/wx/infobar.h | 213 ++++++++++++++++++++++++ samples/dialogs/dialogs.cpp | 48 +++++- samples/dialogs/dialogs.h | 12 ++ setup.h.in | 2 + src/generic/infobar.cpp | 235 +++++++++++++++++++++++++++ 34 files changed, 1001 insertions(+), 4 deletions(-) create mode 100644 include/wx/generic/infobar.h create mode 100644 include/wx/infobar.h create mode 100644 interface/wx/infobar.h create mode 100644 src/generic/infobar.cpp diff --git a/Makefile.in b/Makefile.in index aab321119f..37ae7210ff 100644 --- a/Makefile.in +++ b/Makefile.in @@ -3400,6 +3400,7 @@ COND_WXUNIV_0_ADVANCED_HDR = \ wx/generic/gridsel.h \ wx/generic/helpext.h \ wx/generic/hyperlink.h \ + wx/generic/infobar.h \ wx/generic/laywin.h \ wx/generic/notifmsg.h \ wx/generic/propdlg.h \ @@ -3408,6 +3409,7 @@ COND_WXUNIV_0_ADVANCED_HDR = \ wx/generic/wizard.h \ wx/grid.h \ wx/hyperlink.h \ + wx/infobar.h \ wx/joystick.h \ wx/laywin.h \ wx/notifmsg.h \ @@ -3443,6 +3445,7 @@ COND_WXUNIV_1_ADVANCED_HDR = \ wx/generic/gridsel.h \ wx/generic/helpext.h \ wx/generic/hyperlink.h \ + wx/generic/infobar.h \ wx/generic/laywin.h \ wx/generic/notifmsg.h \ wx/generic/propdlg.h \ @@ -3451,6 +3454,7 @@ COND_WXUNIV_1_ADVANCED_HDR = \ wx/generic/wizard.h \ wx/grid.h \ wx/hyperlink.h \ + wx/infobar.h \ wx/joystick.h \ wx/laywin.h \ wx/notifmsg.h \ @@ -5611,6 +5615,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS = \ monodll_gridsel.o \ monodll_helpext.o \ monodll_hyperlinkg.o \ + monodll_infobar.o \ monodll_laywin.o \ monodll_notifmsgg.o \ monodll_odcombo.o \ @@ -5640,6 +5645,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS = \ monodll_gridsel.o \ monodll_helpext.o \ monodll_hyperlinkg.o \ + monodll_infobar.o \ monodll_laywin.o \ monodll_notifmsgg.o \ monodll_odcombo.o \ @@ -7421,6 +7427,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_1 = \ monolib_gridsel.o \ monolib_helpext.o \ monolib_hyperlinkg.o \ + monolib_infobar.o \ monolib_laywin.o \ monolib_notifmsgg.o \ monolib_odcombo.o \ @@ -7450,6 +7457,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_1 = \ monolib_gridsel.o \ monolib_helpext.o \ monolib_hyperlinkg.o \ + monolib_infobar.o \ monolib_laywin.o \ monolib_notifmsgg.o \ monolib_odcombo.o \ @@ -10913,6 +10921,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_2 = \ advdll_gridsel.o \ advdll_helpext.o \ advdll_hyperlinkg.o \ + advdll_infobar.o \ advdll_laywin.o \ advdll_notifmsgg.o \ advdll_odcombo.o \ @@ -10942,6 +10951,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_2 = \ advdll_gridsel.o \ advdll_helpext.o \ advdll_hyperlinkg.o \ + advdll_infobar.o \ advdll_laywin.o \ advdll_notifmsgg.o \ advdll_odcombo.o \ @@ -11007,6 +11017,7 @@ COND_WXUNIV_0___ADVANCED_SRC_OBJECTS_3 = \ advlib_gridsel.o \ advlib_helpext.o \ advlib_hyperlinkg.o \ + advlib_infobar.o \ advlib_laywin.o \ advlib_notifmsgg.o \ advlib_odcombo.o \ @@ -11036,6 +11047,7 @@ COND_WXUNIV_1___ADVANCED_SRC_OBJECTS_3 = \ advlib_gridsel.o \ advlib_helpext.o \ advlib_hyperlinkg.o \ + advlib_infobar.o \ advlib_laywin.o \ advlib_notifmsgg.o \ advlib_odcombo.o \ @@ -18712,6 +18724,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@monodll_hyperlinkg.o: $(srcdir)/src/generic/hyperlinkg.cpp $(MONODLL_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/hyperlinkg.cpp +@COND_USE_GUI_1@monodll_infobar.o: $(srcdir)/src/generic/infobar.cpp $(MONODLL_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/infobar.cpp + @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 @@ -23482,6 +23497,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@monolib_hyperlinkg.o: $(srcdir)/src/generic/hyperlinkg.cpp $(MONOLIB_ODEP) @COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/hyperlinkg.cpp +@COND_USE_GUI_1@monolib_infobar.o: $(srcdir)/src/generic/infobar.cpp $(MONOLIB_ODEP) +@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/infobar.cpp + @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 @@ -31969,6 +31987,9 @@ advdll_helpext.o: $(srcdir)/src/generic/helpext.cpp $(ADVDLL_ODEP) advdll_hyperlinkg.o: $(srcdir)/src/generic/hyperlinkg.cpp $(ADVDLL_ODEP) $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/generic/hyperlinkg.cpp +advdll_infobar.o: $(srcdir)/src/generic/infobar.cpp $(ADVDLL_ODEP) + $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/generic/infobar.cpp + advdll_laywin.o: $(srcdir)/src/generic/laywin.cpp $(ADVDLL_ODEP) $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $(srcdir)/src/generic/laywin.cpp @@ -32293,6 +32314,9 @@ advlib_helpext.o: $(srcdir)/src/generic/helpext.cpp $(ADVLIB_ODEP) advlib_hyperlinkg.o: $(srcdir)/src/generic/hyperlinkg.cpp $(ADVLIB_ODEP) $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/generic/hyperlinkg.cpp +advlib_infobar.o: $(srcdir)/src/generic/infobar.cpp $(ADVLIB_ODEP) + $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/generic/infobar.cpp + advlib_laywin.o: $(srcdir)/src/generic/laywin.cpp $(ADVLIB_ODEP) $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $(srcdir)/src/generic/laywin.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 5b045f8b8d..894d467972 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -2829,6 +2829,7 @@ src/osx/iphone/window.mm src/generic/gridsel.cpp src/generic/helpext.cpp src/generic/hyperlinkg.cpp + src/generic/infobar.cpp src/generic/laywin.cpp src/generic/notifmsgg.cpp src/generic/odcombo.cpp @@ -2860,6 +2861,7 @@ src/osx/iphone/window.mm wx/generic/gridsel.h wx/generic/helpext.h wx/generic/hyperlink.h + wx/generic/infobar.h wx/generic/laywin.h wx/generic/notifmsg.h wx/generic/propdlg.h @@ -2868,6 +2870,7 @@ src/osx/iphone/window.mm wx/generic/wizard.h wx/grid.h wx/hyperlink.h + wx/infobar.h wx/joystick.h wx/laywin.h wx/notifmsg.h diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index 0a09b92557..04a86a036e 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -2091,6 +2091,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gridsel.obj \ $(OBJS)\monodll_helpext.obj \ $(OBJS)\monodll_hyperlinkg.obj \ + $(OBJS)\monodll_infobar.obj \ $(OBJS)\monodll_laywin.obj \ $(OBJS)\monodll_notifmsgg.obj \ $(OBJS)\monodll_odcombo.obj \ @@ -2130,6 +2131,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gridsel.obj \ $(OBJS)\monodll_helpext.obj \ $(OBJS)\monodll_hyperlinkg.obj \ + $(OBJS)\monodll_infobar.obj \ $(OBJS)\monodll_laywin.obj \ $(OBJS)\monodll_notifmsgg.obj \ $(OBJS)\monodll_odcombo.obj \ @@ -2787,6 +2789,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gridsel.obj \ $(OBJS)\monolib_helpext.obj \ $(OBJS)\monolib_hyperlinkg.obj \ + $(OBJS)\monolib_infobar.obj \ $(OBJS)\monolib_laywin.obj \ $(OBJS)\monolib_notifmsgg.obj \ $(OBJS)\monolib_odcombo.obj \ @@ -2826,6 +2829,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gridsel.obj \ $(OBJS)\monolib_helpext.obj \ $(OBJS)\monolib_hyperlinkg.obj \ + $(OBJS)\monolib_infobar.obj \ $(OBJS)\monolib_laywin.obj \ $(OBJS)\monolib_notifmsgg.obj \ $(OBJS)\monolib_odcombo.obj \ @@ -3873,6 +3877,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\advdll_gridsel.obj \ $(OBJS)\advdll_helpext.obj \ $(OBJS)\advdll_hyperlinkg.obj \ + $(OBJS)\advdll_infobar.obj \ $(OBJS)\advdll_laywin.obj \ $(OBJS)\advdll_notifmsgg.obj \ $(OBJS)\advdll_odcombo.obj \ @@ -3912,6 +3917,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\advdll_gridsel.obj \ $(OBJS)\advdll_helpext.obj \ $(OBJS)\advdll_hyperlinkg.obj \ + $(OBJS)\advdll_infobar.obj \ $(OBJS)\advdll_laywin.obj \ $(OBJS)\advdll_notifmsgg.obj \ $(OBJS)\advdll_odcombo.obj \ @@ -3951,6 +3957,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\advlib_gridsel.obj \ $(OBJS)\advlib_helpext.obj \ $(OBJS)\advlib_hyperlinkg.obj \ + $(OBJS)\advlib_infobar.obj \ $(OBJS)\advlib_laywin.obj \ $(OBJS)\advlib_notifmsgg.obj \ $(OBJS)\advlib_odcombo.obj \ @@ -3990,6 +3997,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\advlib_gridsel.obj \ $(OBJS)\advlib_helpext.obj \ $(OBJS)\advlib_hyperlinkg.obj \ + $(OBJS)\advlib_infobar.obj \ $(OBJS)\advlib_laywin.obj \ $(OBJS)\advlib_notifmsgg.obj \ $(OBJS)\advlib_odcombo.obj \ @@ -7714,6 +7722,11 @@ $(OBJS)\monodll_hyperlinkg.obj: ..\..\src\generic\hyperlinkg.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\hyperlinkg.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_infobar.obj: ..\..\src\generic\infobar.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\infobar.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\laywin.cpp @@ -9990,6 +10003,11 @@ $(OBJS)\monolib_hyperlinkg.obj: ..\..\src\generic\hyperlinkg.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\hyperlinkg.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_infobar.obj: ..\..\src\generic\infobar.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\infobar.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\laywin.cpp @@ -13619,6 +13637,9 @@ $(OBJS)\advdll_helpext.obj: ..\..\src\generic\helpext.cpp $(OBJS)\advdll_hyperlinkg.obj: ..\..\src\generic\hyperlinkg.cpp $(CXX) -q -c -P -o$@ $(ADVDLL_CXXFLAGS) ..\..\src\generic\hyperlinkg.cpp +$(OBJS)\advdll_infobar.obj: ..\..\src\generic\infobar.cpp + $(CXX) -q -c -P -o$@ $(ADVDLL_CXXFLAGS) ..\..\src\generic\infobar.cpp + $(OBJS)\advdll_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) -q -c -P -o$@ $(ADVDLL_CXXFLAGS) ..\..\src\generic\laywin.cpp @@ -13730,6 +13751,9 @@ $(OBJS)\advlib_helpext.obj: ..\..\src\generic\helpext.cpp $(OBJS)\advlib_hyperlinkg.obj: ..\..\src\generic\hyperlinkg.cpp $(CXX) -q -c -P -o$@ $(ADVLIB_CXXFLAGS) ..\..\src\generic\hyperlinkg.cpp +$(OBJS)\advlib_infobar.obj: ..\..\src\generic\infobar.cpp + $(CXX) -q -c -P -o$@ $(ADVLIB_CXXFLAGS) ..\..\src\generic\infobar.cpp + $(OBJS)\advlib_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) -q -c -P -o$@ $(ADVLIB_CXXFLAGS) ..\..\src\generic\laywin.cpp diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index 4275624845..1c303f3b92 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -2113,6 +2113,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gridsel.o \ $(OBJS)\monodll_helpext.o \ $(OBJS)\monodll_hyperlinkg.o \ + $(OBJS)\monodll_infobar.o \ $(OBJS)\monodll_laywin.o \ $(OBJS)\monodll_notifmsgg.o \ $(OBJS)\monodll_odcombo.o \ @@ -2152,6 +2153,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gridsel.o \ $(OBJS)\monodll_helpext.o \ $(OBJS)\monodll_hyperlinkg.o \ + $(OBJS)\monodll_infobar.o \ $(OBJS)\monodll_laywin.o \ $(OBJS)\monodll_notifmsgg.o \ $(OBJS)\monodll_odcombo.o \ @@ -2815,6 +2817,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gridsel.o \ $(OBJS)\monolib_helpext.o \ $(OBJS)\monolib_hyperlinkg.o \ + $(OBJS)\monolib_infobar.o \ $(OBJS)\monolib_laywin.o \ $(OBJS)\monolib_notifmsgg.o \ $(OBJS)\monolib_odcombo.o \ @@ -2854,6 +2857,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gridsel.o \ $(OBJS)\monolib_helpext.o \ $(OBJS)\monolib_hyperlinkg.o \ + $(OBJS)\monolib_infobar.o \ $(OBJS)\monolib_laywin.o \ $(OBJS)\monolib_notifmsgg.o \ $(OBJS)\monolib_odcombo.o \ @@ -3929,6 +3933,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\advdll_gridsel.o \ $(OBJS)\advdll_helpext.o \ $(OBJS)\advdll_hyperlinkg.o \ + $(OBJS)\advdll_infobar.o \ $(OBJS)\advdll_laywin.o \ $(OBJS)\advdll_notifmsgg.o \ $(OBJS)\advdll_odcombo.o \ @@ -3968,6 +3973,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\advdll_gridsel.o \ $(OBJS)\advdll_helpext.o \ $(OBJS)\advdll_hyperlinkg.o \ + $(OBJS)\advdll_infobar.o \ $(OBJS)\advdll_laywin.o \ $(OBJS)\advdll_notifmsgg.o \ $(OBJS)\advdll_odcombo.o \ @@ -4011,6 +4017,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\advlib_gridsel.o \ $(OBJS)\advlib_helpext.o \ $(OBJS)\advlib_hyperlinkg.o \ + $(OBJS)\advlib_infobar.o \ $(OBJS)\advlib_laywin.o \ $(OBJS)\advlib_notifmsgg.o \ $(OBJS)\advlib_odcombo.o \ @@ -4050,6 +4057,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\advlib_gridsel.o \ $(OBJS)\advlib_helpext.o \ $(OBJS)\advlib_hyperlinkg.o \ + $(OBJS)\advlib_infobar.o \ $(OBJS)\advlib_laywin.o \ $(OBJS)\advlib_notifmsgg.o \ $(OBJS)\advlib_odcombo.o \ @@ -7984,6 +7992,11 @@ $(OBJS)\monodll_hyperlinkg.o: ../../src/generic/hyperlinkg.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monodll_infobar.o: ../../src/generic/infobar.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monodll_laywin.o: ../../src/generic/laywin.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -10372,6 +10385,11 @@ $(OBJS)\monolib_hyperlinkg.o: ../../src/generic/hyperlinkg.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monolib_infobar.o: ../../src/generic/infobar.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monolib_laywin.o: ../../src/generic/laywin.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -14225,6 +14243,9 @@ $(OBJS)\advdll_helpext.o: ../../src/generic/helpext.cpp $(OBJS)\advdll_hyperlinkg.o: ../../src/generic/hyperlinkg.cpp $(CXX) -c -o $@ $(ADVDLL_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\advdll_infobar.o: ../../src/generic/infobar.cpp + $(CXX) -c -o $@ $(ADVDLL_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\advdll_laywin.o: ../../src/generic/laywin.cpp $(CXX) -c -o $@ $(ADVDLL_CXXFLAGS) $(CPPDEPS) $< @@ -14336,6 +14357,9 @@ $(OBJS)\advlib_helpext.o: ../../src/generic/helpext.cpp $(OBJS)\advlib_hyperlinkg.o: ../../src/generic/hyperlinkg.cpp $(CXX) -c -o $@ $(ADVLIB_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\advlib_infobar.o: ../../src/generic/infobar.cpp + $(CXX) -c -o $@ $(ADVLIB_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\advlib_laywin.o: ../../src/generic/laywin.cpp $(CXX) -c -o $@ $(ADVLIB_CXXFLAGS) $(CPPDEPS) $< diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index 39c20e8f0f..e714cf81fa 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -2283,6 +2283,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gridsel.obj \ $(OBJS)\monodll_helpext.obj \ $(OBJS)\monodll_hyperlinkg.obj \ + $(OBJS)\monodll_infobar.obj \ $(OBJS)\monodll_laywin.obj \ $(OBJS)\monodll_notifmsgg.obj \ $(OBJS)\monodll_odcombo.obj \ @@ -2322,6 +2323,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gridsel.obj \ $(OBJS)\monodll_helpext.obj \ $(OBJS)\monodll_hyperlinkg.obj \ + $(OBJS)\monodll_infobar.obj \ $(OBJS)\monodll_laywin.obj \ $(OBJS)\monodll_notifmsgg.obj \ $(OBJS)\monodll_odcombo.obj \ @@ -2985,6 +2987,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gridsel.obj \ $(OBJS)\monolib_helpext.obj \ $(OBJS)\monolib_hyperlinkg.obj \ + $(OBJS)\monolib_infobar.obj \ $(OBJS)\monolib_laywin.obj \ $(OBJS)\monolib_notifmsgg.obj \ $(OBJS)\monolib_odcombo.obj \ @@ -3024,6 +3027,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gridsel.obj \ $(OBJS)\monolib_helpext.obj \ $(OBJS)\monolib_hyperlinkg.obj \ + $(OBJS)\monolib_infobar.obj \ $(OBJS)\monolib_laywin.obj \ $(OBJS)\monolib_notifmsgg.obj \ $(OBJS)\monolib_odcombo.obj \ @@ -4113,6 +4117,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\advdll_gridsel.obj \ $(OBJS)\advdll_helpext.obj \ $(OBJS)\advdll_hyperlinkg.obj \ + $(OBJS)\advdll_infobar.obj \ $(OBJS)\advdll_laywin.obj \ $(OBJS)\advdll_notifmsgg.obj \ $(OBJS)\advdll_odcombo.obj \ @@ -4152,6 +4157,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\advdll_gridsel.obj \ $(OBJS)\advdll_helpext.obj \ $(OBJS)\advdll_hyperlinkg.obj \ + $(OBJS)\advdll_infobar.obj \ $(OBJS)\advdll_laywin.obj \ $(OBJS)\advdll_notifmsgg.obj \ $(OBJS)\advdll_odcombo.obj \ @@ -4197,6 +4203,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\advlib_gridsel.obj \ $(OBJS)\advlib_helpext.obj \ $(OBJS)\advlib_hyperlinkg.obj \ + $(OBJS)\advlib_infobar.obj \ $(OBJS)\advlib_laywin.obj \ $(OBJS)\advlib_notifmsgg.obj \ $(OBJS)\advlib_odcombo.obj \ @@ -4236,6 +4243,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\advlib_gridsel.obj \ $(OBJS)\advlib_helpext.obj \ $(OBJS)\advlib_hyperlinkg.obj \ + $(OBJS)\advlib_infobar.obj \ $(OBJS)\advlib_laywin.obj \ $(OBJS)\advlib_notifmsgg.obj \ $(OBJS)\advlib_odcombo.obj \ @@ -8080,6 +8088,11 @@ $(OBJS)\monodll_hyperlinkg.obj: ..\..\src\generic\hyperlinkg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\hyperlinkg.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_infobar.obj: ..\..\src\generic\infobar.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\infobar.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monodll_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\laywin.cpp @@ -10356,6 +10369,11 @@ $(OBJS)\monolib_hyperlinkg.obj: ..\..\src\generic\hyperlinkg.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\hyperlinkg.cpp !endif +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_infobar.obj: ..\..\src\generic\infobar.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\infobar.cpp +!endif + !if "$(USE_GUI)" == "1" $(OBJS)\monolib_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\laywin.cpp @@ -13985,6 +14003,9 @@ $(OBJS)\advdll_helpext.obj: ..\..\src\generic\helpext.cpp $(OBJS)\advdll_hyperlinkg.obj: ..\..\src\generic\hyperlinkg.cpp $(CXX) /c /nologo /TP /Fo$@ $(ADVDLL_CXXFLAGS) ..\..\src\generic\hyperlinkg.cpp +$(OBJS)\advdll_infobar.obj: ..\..\src\generic\infobar.cpp + $(CXX) /c /nologo /TP /Fo$@ $(ADVDLL_CXXFLAGS) ..\..\src\generic\infobar.cpp + $(OBJS)\advdll_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) /c /nologo /TP /Fo$@ $(ADVDLL_CXXFLAGS) ..\..\src\generic\laywin.cpp @@ -14096,6 +14117,9 @@ $(OBJS)\advlib_helpext.obj: ..\..\src\generic\helpext.cpp $(OBJS)\advlib_hyperlinkg.obj: ..\..\src\generic\hyperlinkg.cpp $(CXX) /c /nologo /TP /Fo$@ $(ADVLIB_CXXFLAGS) ..\..\src\generic\hyperlinkg.cpp +$(OBJS)\advlib_infobar.obj: ..\..\src\generic\infobar.cpp + $(CXX) /c /nologo /TP /Fo$@ $(ADVLIB_CXXFLAGS) ..\..\src\generic\infobar.cpp + $(OBJS)\advlib_laywin.obj: ..\..\src\generic\laywin.cpp $(CXX) /c /nologo /TP /Fo$@ $(ADVLIB_CXXFLAGS) ..\..\src\generic\laywin.cpp diff --git a/build/msw/makefile.wat b/build/msw/makefile.wat index df0e1f67df..87cb6dc4eb 100644 --- a/build/msw/makefile.wat +++ b/build/msw/makefile.wat @@ -735,6 +735,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_gridsel.obj & $(OBJS)\monodll_helpext.obj & $(OBJS)\monodll_hyperlinkg.obj & + $(OBJS)\monodll_infobar.obj & $(OBJS)\monodll_laywin.obj & $(OBJS)\monodll_notifmsgg.obj & $(OBJS)\monodll_odcombo.obj & @@ -774,6 +775,7 @@ ____ADVANCED_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_gridsel.obj & $(OBJS)\monodll_helpext.obj & $(OBJS)\monodll_hyperlinkg.obj & + $(OBJS)\monodll_infobar.obj & $(OBJS)\monodll_laywin.obj & $(OBJS)\monodll_notifmsgg.obj & $(OBJS)\monodll_odcombo.obj & @@ -1442,6 +1444,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_gridsel.obj & $(OBJS)\monolib_helpext.obj & $(OBJS)\monolib_hyperlinkg.obj & + $(OBJS)\monolib_infobar.obj & $(OBJS)\monolib_laywin.obj & $(OBJS)\monolib_notifmsgg.obj & $(OBJS)\monolib_odcombo.obj & @@ -1481,6 +1484,7 @@ ____ADVANCED_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_gridsel.obj & $(OBJS)\monolib_helpext.obj & $(OBJS)\monolib_hyperlinkg.obj & + $(OBJS)\monolib_infobar.obj & $(OBJS)\monolib_laywin.obj & $(OBJS)\monolib_notifmsgg.obj & $(OBJS)\monolib_odcombo.obj & @@ -2572,6 +2576,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\advdll_gridsel.obj & $(OBJS)\advdll_helpext.obj & $(OBJS)\advdll_hyperlinkg.obj & + $(OBJS)\advdll_infobar.obj & $(OBJS)\advdll_laywin.obj & $(OBJS)\advdll_notifmsgg.obj & $(OBJS)\advdll_odcombo.obj & @@ -2611,6 +2616,7 @@ ____ADVANCED_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\advdll_gridsel.obj & $(OBJS)\advdll_helpext.obj & $(OBJS)\advdll_hyperlinkg.obj & + $(OBJS)\advdll_infobar.obj & $(OBJS)\advdll_laywin.obj & $(OBJS)\advdll_notifmsgg.obj & $(OBJS)\advdll_odcombo.obj & @@ -2656,6 +2662,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\advlib_gridsel.obj & $(OBJS)\advlib_helpext.obj & $(OBJS)\advlib_hyperlinkg.obj & + $(OBJS)\advlib_infobar.obj & $(OBJS)\advlib_laywin.obj & $(OBJS)\advlib_notifmsgg.obj & $(OBJS)\advlib_odcombo.obj & @@ -2695,6 +2702,7 @@ ____ADVANCED_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\advlib_gridsel.obj & $(OBJS)\advlib_helpext.obj & $(OBJS)\advlib_hyperlinkg.obj & + $(OBJS)\advlib_infobar.obj & $(OBJS)\advlib_laywin.obj & $(OBJS)\advlib_notifmsgg.obj & $(OBJS)\advlib_odcombo.obj & @@ -8251,6 +8259,11 @@ $(OBJS)\monodll_hyperlinkg.obj : .AUTODEPEND ..\..\src\generic\hyperlinkg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\monodll_infobar.obj : .AUTODEPEND ..\..\src\generic\infobar.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\monodll_laywin.obj : .AUTODEPEND ..\..\src\generic\laywin.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< @@ -10639,6 +10652,11 @@ $(OBJS)\monolib_hyperlinkg.obj : .AUTODEPEND ..\..\src\generic\hyperlinkg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< !endif +!ifeq USE_GUI 1 +$(OBJS)\monolib_infobar.obj : .AUTODEPEND ..\..\src\generic\infobar.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< +!endif + !ifeq USE_GUI 1 $(OBJS)\monolib_laywin.obj : .AUTODEPEND ..\..\src\generic\laywin.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< @@ -14492,6 +14510,9 @@ $(OBJS)\advdll_helpext.obj : .AUTODEPEND ..\..\src\generic\helpext.cpp $(OBJS)\advdll_hyperlinkg.obj : .AUTODEPEND ..\..\src\generic\hyperlinkg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(ADVDLL_CXXFLAGS) $< +$(OBJS)\advdll_infobar.obj : .AUTODEPEND ..\..\src\generic\infobar.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(ADVDLL_CXXFLAGS) $< + $(OBJS)\advdll_laywin.obj : .AUTODEPEND ..\..\src\generic\laywin.cpp $(CXX) -bt=nt -zq -fo=$^@ $(ADVDLL_CXXFLAGS) $< @@ -14603,6 +14624,9 @@ $(OBJS)\advlib_helpext.obj : .AUTODEPEND ..\..\src\generic\helpext.cpp $(OBJS)\advlib_hyperlinkg.obj : .AUTODEPEND ..\..\src\generic\hyperlinkg.cpp $(CXX) -bt=nt -zq -fo=$^@ $(ADVLIB_CXXFLAGS) $< +$(OBJS)\advlib_infobar.obj : .AUTODEPEND ..\..\src\generic\infobar.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(ADVLIB_CXXFLAGS) $< + $(OBJS)\advlib_laywin.obj : .AUTODEPEND ..\..\src\generic\laywin.cpp $(CXX) -bt=nt -zq -fo=$^@ $(ADVLIB_CXXFLAGS) $< diff --git a/build/msw/wx_adv.dsp b/build/msw/wx_adv.dsp index 93220d846d..59a4f71ca9 100644 --- a/build/msw/wx_adv.dsp +++ b/build/msw/wx_adv.dsp @@ -529,6 +529,10 @@ SOURCE=..\..\src\generic\hyperlinkg.cpp # End Source File # Begin Source File +SOURCE=..\..\src\generic\infobar.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\generic\laywin.cpp # End Source File # Begin Source File @@ -878,6 +882,10 @@ SOURCE=..\..\include\wx\generic\hyperlink.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\generic\infobar.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\generic\laywin.h # End Source File # Begin Source File @@ -950,6 +958,10 @@ SOURCE=..\..\include\wx\hyperlink.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\infobar.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\joystick.h # End Source File # Begin Source File diff --git a/build/msw/wx_core.dsp b/build/msw/wx_core.dsp index 943c51e42b..99b2a21a4b 100644 --- a/build/msw/wx_core.dsp +++ b/build/msw/wx_core.dsp @@ -5327,6 +5327,10 @@ SOURCE=..\..\include\wx\generic\hyperlink.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\generic\infobar.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\generic\laywin.h # End Source File # Begin Source File @@ -6119,6 +6123,10 @@ SOURCE=..\..\include\wx\imagxpm.h # End Source File # Begin Source File +SOURCE=..\..\include\wx\infobar.h +# End Source File +# Begin Source File + SOURCE=..\..\include\wx\joystick.h # End Source File # Begin Source File diff --git a/build/msw/wx_vc7_adv.vcproj b/build/msw/wx_vc7_adv.vcproj index aa30ddbe51..60167949f3 100644 --- a/build/msw/wx_vc7_adv.vcproj +++ b/build/msw/wx_vc7_adv.vcproj @@ -731,6 +731,9 @@ RelativePath="..\..\src\generic\hyperlinkg.cpp"> + + + + + + + + + + + + @@ -1344,6 +1348,10 @@ > + + @@ -1417,6 +1425,10 @@ > + + diff --git a/build/msw/wx_vc8_core.vcproj b/build/msw/wx_vc8_core.vcproj index 5c8a520815..8f288659b4 100644 --- a/build/msw/wx_vc8_core.vcproj +++ b/build/msw/wx_vc8_core.vcproj @@ -6161,6 +6161,10 @@ > + + @@ -6956,6 +6960,10 @@ > + + diff --git a/build/msw/wx_vc9_adv.vcproj b/build/msw/wx_vc9_adv.vcproj index d08a827378..0828623f03 100644 --- a/build/msw/wx_vc9_adv.vcproj +++ b/build/msw/wx_vc9_adv.vcproj @@ -1005,6 +1005,10 @@ > + + @@ -1340,6 +1344,10 @@ > + + @@ -1413,6 +1421,10 @@ > + + diff --git a/build/msw/wx_vc9_core.vcproj b/build/msw/wx_vc9_core.vcproj index 27145847a2..2f038474de 100644 --- a/build/msw/wx_vc9_core.vcproj +++ b/build/msw/wx_vc9_core.vcproj @@ -6157,6 +6157,10 @@ > + + @@ -6952,6 +6956,10 @@ > + + diff --git a/configure b/configure index 19de3a9597..ec55083a72 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 62071 2009-09-24 12:36:34Z JS . +# From configure.in Id. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for wxWidgets 2.9.1. # @@ -1818,6 +1818,7 @@ Optional Features: --enable-headerctrl use wxHeaderCtrl class --enable-hyperlink use wxHyperlinkCtrl class --enable-imaglist use wxImageList class + --enable-infobar use wxInfoBar class --enable-listbook use wxListbook class --enable-listbox use wxListBox class --enable-listctrl use wxListCtrl class @@ -10886,6 +10887,50 @@ fi echo "${ECHO_T}$result" >&6; } + enablestring= + defaultval=$wxUSE_ALL_FEATURES + if test -z "$defaultval"; then + if test x"$enablestring" = xdisable; then + defaultval=yes + else + defaultval=no + fi + fi + + { echo "$as_me:$LINENO: checking for --${enablestring:-enable}-infobar" >&5 +echo $ECHO_N "checking for --${enablestring:-enable}-infobar... $ECHO_C" >&6; } + # Check whether --enable-infobar was given. +if test "${enable_infobar+set}" = set; then + enableval=$enable_infobar; + if test "$enableval" = yes; then + wx_cv_use_infobar='wxUSE_INFOBAR=yes' + else + wx_cv_use_infobar='wxUSE_INFOBAR=no' + fi + +else + + wx_cv_use_infobar='wxUSE_INFOBAR=${'DEFAULT_wxUSE_INFOBAR":-$defaultval}" + +fi + + + eval "$wx_cv_use_infobar" + + if test x"$enablestring" = xdisable; then + if test $wxUSE_INFOBAR = no; then + result=yes + else + result=no + fi + else + result=$wxUSE_INFOBAR + fi + + { echo "$as_me:$LINENO: result: $result" >&5 +echo "${ECHO_T}$result" >&6; } + + enablestring= defaultval=$wxUSE_ALL_FEATURES if test -z "$defaultval"; then @@ -45948,6 +45993,13 @@ _ACEOF fi +if test "$wxUSE_INFOBAR" = "yes"; then + cat >>confdefs.h <<\_ACEOF +#define wxUSE_INFOBAR 1 +_ACEOF + +fi + if test "$wxUSE_LISTBOOK" = "yes"; then cat >>confdefs.h <<\_ACEOF #define wxUSE_LISTBOOK 1 diff --git a/configure.in b/configure.in index 5f7b38cfb0..7d7c54f754 100644 --- a/configure.in +++ b/configure.in @@ -917,6 +917,7 @@ WX_ARG_FEATURE(grid, [ --enable-grid use wxGrid class], wxUSE_ WX_ARG_FEATURE(headerctrl, [ --enable-headerctrl use wxHeaderCtrl class], wxUSE_HEADERCTRL) WX_ARG_FEATURE(hyperlink, [ --enable-hyperlink use wxHyperlinkCtrl class], wxUSE_HYPERLINKCTRL) WX_ARG_FEATURE(imaglist, [ --enable-imaglist use wxImageList class], wxUSE_IMAGLIST) +WX_ARG_FEATURE(infobar, [ --enable-infobar use wxInfoBar class], wxUSE_INFOBAR) WX_ARG_FEATURE(listbook, [ --enable-listbook use wxListbook class], wxUSE_LISTBOOK) WX_ARG_FEATURE(listbox, [ --enable-listbox use wxListBox class], wxUSE_LISTBOX) WX_ARG_FEATURE(listctrl, [ --enable-listctrl use wxListCtrl class], wxUSE_LISTCTRL) @@ -6687,6 +6688,10 @@ if test "$wxUSE_IMAGLIST" = "yes"; then AC_DEFINE(wxUSE_IMAGLIST) fi +if test "$wxUSE_INFOBAR" = "yes"; then + AC_DEFINE(wxUSE_INFOBAR) +fi + if test "$wxUSE_LISTBOOK" = "yes"; then AC_DEFINE(wxUSE_LISTBOOK) USES_CONTROLS=1 diff --git a/docs/changes.txt b/docs/changes.txt index 355904376a..5a34ed263b 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -408,6 +408,7 @@ All: All (GUI): - Added support for showing bitmaps in wxButton. +- Added wxInfoBar. - Added support for corner, row and column headers renderers to wxGrid. - wxWindow::SetAutoLayout() now works for all windows, not just panels. - Support wxListCtrl columns, items and image lists in XRC (Kinaou Hervé). diff --git a/docs/doxygen/mainpages/cat_classes.h b/docs/doxygen/mainpages/cat_classes.h index 97820dfb6a..a43e3ba187 100644 --- a/docs/doxygen/mainpages/cat_classes.h +++ b/docs/doxygen/mainpages/cat_classes.h @@ -239,6 +239,7 @@ The following are a variety of classes that are derived from wxWindow. @li wxHVScrolledWindow: As ::wxScrolledWindow but supports scroll units of variable sizes. @li wxGrid: A grid (table) window +@li wxInfoBar: An information bar usually shown on top of the main window. @li wxSplitterWindow: Window which can be split vertically or horizontally @li wxStatusBar: Implements the status bar on a frame @li wxToolBar: Toolbar class diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h index 0d4f0b008c..29868206a8 100644 --- a/include/wx/chkconf.h +++ b/include/wx/chkconf.h @@ -696,6 +696,14 @@ # endif #endif /* !defined(wxUSE_IMAGLIST) */ +#ifndef wxUSE_INFOBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_INFOBAR must be defined." +# else +# define wxUSE_INFOBAR 0 +# endif +#endif /* !defined(wxUSE_INFOBAR) */ + #ifndef wxUSE_JOYSTICK # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_JOYSTICK must be defined." diff --git a/include/wx/generic/infobar.h b/include/wx/generic/infobar.h new file mode 100644 index 0000000000..9b2109028f --- /dev/null +++ b/include/wx/generic/infobar.h @@ -0,0 +1,107 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/infobar.h +// Purpose: generic wxInfoBar class declaration +// Author: Vadim Zeitlin +// Created: 2009-07-28 +// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $ +// Copyright: (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_INFOBAR_H_ +#define _WX_GENERIC_INFOBAR_H_ + +class WXDLLIMPEXP_FWD_CORE wxBitmapButton; +class WXDLLIMPEXP_FWD_CORE wxStaticBitmap; +class WXDLLIMPEXP_FWD_CORE wxStaticText; + +// ---------------------------------------------------------------------------- +// wxInfoBar +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxInfoBar : public wxInfoBarBase +{ +public: + // the usual ctors and Create() but remember that info bar is created + // hidden + wxInfoBar() { Init(); } + + wxInfoBar(wxWindow *parent, wxWindowID winid = wxID_ANY) + { + Init(); + Create(parent, winid); + } + + bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY); + + + // implement base class methods + // ---------------------------- + + virtual void ShowMessage(const wxString& msg, int flags = wxICON_NONE); + + + // methods specific to this version + // -------------------------------- + + // set the effect(s) to use when showing/hiding the bar, may be + // wxSHOW_EFFECT_NONE to disable any effects entirely + // + // by default, slide to bottom/top is used when it's positioned on the top + // of the window for showing/hiding it and top/bottom when it's positioned + // at the bottom + void SetShowHideEffects(wxShowEffect showEffect, wxShowEffect hideEffect) + { + m_showEffect = showEffect; + m_hideEffect = hideEffect; + } + + // get effect used when showing/hiding the window + wxShowEffect GetShowEffect() const { return m_showEffect; } + wxShowEffect GetHideEffect() const { return m_hideEffect; } + + // set the duration of animation used when showing/hiding the bar, in ms + void SetEffectDuration(int duration) { m_effectDuration = duration; } + + // get the currently used effect animation duration + int GetEffectDuration() const { return m_effectDuration; } + +private: + // common part of all ctors + void Init(); + + // handler for the close button + void OnButton(wxCommandEvent& event); + + // update the parent after we're shown or hidden + void UpdateParent(); + + // change the parent background colour to match that of our sibling + void ChangeParentBackground(); + + // restore the parent background changed by the above function + void RestoreParentBackground(); + + // show/hide the bar + void DoShow(); + void DoHide(); + + + // different controls making up the bar + wxStaticBitmap *m_icon; + wxStaticText *m_text; + wxBitmapButton *m_button; + + // the effects to use when showing/hiding and duration for them + wxShowEffect m_showEffect, + m_hideEffect; + int m_effectDuration; + + // the original parent background colour, before we changed it + wxColour m_origParentBgCol; + + wxDECLARE_NO_COPY_CLASS(wxInfoBar); +}; + +#endif // _WX_GENERIC_INFOBAR_H_ + diff --git a/include/wx/infobar.h b/include/wx/infobar.h new file mode 100644 index 0000000000..ffa7aadcd9 --- /dev/null +++ b/include/wx/infobar.h @@ -0,0 +1,49 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/infobar.h +// Purpose: declaration of wxInfoBarBase defining common API of wxInfoBar +// Author: Vadim Zeitlin +// Created: 2009-07-28 +// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $ +// Copyright: (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_INFOBAR_H_ +#define _WX_INFOBAR_H_ + +#include "wx/defs.h" + +#if wxUSE_INFOBAR + +#include "wx/window.h" + +// ---------------------------------------------------------------------------- +// wxInfoBar shows non-critical but important information to the user +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxInfoBarBase : public wxWindow +{ +public: + // real ctors are provided by the derived classes, just notice that unlike + // most of the other windows, info bar is created hidden and must be + // explicitly shown when it is needed (this is done because it is supposed + // to be shown only intermittently and hiding it after creating it from the + // user code would result in flicker) + wxInfoBarBase() { } + + + // show the info bar with the given message and optionally an icon + virtual void ShowMessage(const wxString& msg, int flags = wxICON_NONE) = 0; + +private: + wxDECLARE_NO_COPY_CLASS(wxInfoBarBase); +}; + +// include platform-dependent implementation +// +// TODO-GTK: implement a native version using GtkInfoBar (GTK+ 2.18+) +#include "wx/generic/infobar.h" + +#endif // wxUSE_INFOBAR + +#endif // _WX_INFOBAR_H_ diff --git a/include/wx/motif/setup0.h b/include/wx/motif/setup0.h index 37aa22eb2a..35117a9acc 100644 --- a/include/wx/motif/setup0.h +++ b/include/wx/motif/setup0.h @@ -570,6 +570,14 @@ // possible in which case setting this to 0 can gain up to 100KB. #define wxUSE_VARIANT 1 +// Support for wxAny class, the successor for wxVariant. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size by a small amount, +// or your compiler cannot for some reason cope with complexity of templates used. +#define wxUSE_ANY 1 + // Support for regular expression matching via wxRegEx class: enable this to // use POSIX regular expressions in your code. You need to compile regex // library from src/regex to use it under Windows. @@ -891,6 +899,14 @@ // enumerated above, then this class is mostly useless too) #define wxUSE_IMAGLIST 1 +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + // Use wxMenu, wxMenuBar, wxMenuItem. // // Default is 1. diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index 9deacf6e96..a83367c838 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -899,6 +899,14 @@ // enumerated above, then this class is mostly useless too) #define wxUSE_IMAGLIST 1 +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + // Use wxMenu, wxMenuBar, wxMenuItem. // // Default is 1. diff --git a/include/wx/msw/wince/setup.h b/include/wx/msw/wince/setup.h index e9d70cee44..8de143f395 100644 --- a/include/wx/msw/wince/setup.h +++ b/include/wx/msw/wince/setup.h @@ -899,6 +899,14 @@ // enumerated above, then this class is mostly useless too) #define wxUSE_IMAGLIST 1 +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + // Use wxMenu, wxMenuBar, wxMenuItem. // // Default is 1. diff --git a/include/wx/os2/setup0.h b/include/wx/os2/setup0.h index 5403761a21..68b80cd00b 100644 --- a/include/wx/os2/setup0.h +++ b/include/wx/os2/setup0.h @@ -899,6 +899,14 @@ // enumerated above, then this class is mostly useless too) #define wxUSE_IMAGLIST 1 +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + // Use wxMenu, wxMenuBar, wxMenuItem. // // Default is 1. diff --git a/include/wx/osx/setup0.h b/include/wx/osx/setup0.h index 2af5514a2f..7b2957c5fb 100644 --- a/include/wx/osx/setup0.h +++ b/include/wx/osx/setup0.h @@ -900,6 +900,14 @@ // enumerated above, then this class is mostly useless too) #define wxUSE_IMAGLIST 1 +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + // Use wxMenu, wxMenuBar, wxMenuItem. // // Default is 1. diff --git a/include/wx/palmos/setup0.h b/include/wx/palmos/setup0.h index 33b7c3fa88..cd01548d64 100644 --- a/include/wx/palmos/setup0.h +++ b/include/wx/palmos/setup0.h @@ -899,6 +899,14 @@ // enumerated above, then this class is mostly useless too) #define wxUSE_IMAGLIST 1 +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + // Use wxMenu, wxMenuBar, wxMenuItem. // // Default is 1. diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h index b014a90b88..7f591cbadc 100644 --- a/include/wx/setup_inc.h +++ b/include/wx/setup_inc.h @@ -895,6 +895,14 @@ // enumerated above, then this class is mostly useless too) #define wxUSE_IMAGLIST 1 +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + // Use wxMenu, wxMenuBar, wxMenuItem. // // Default is 1. diff --git a/include/wx/univ/setup0.h b/include/wx/univ/setup0.h index 7f9cb99638..b57946e6c8 100644 --- a/include/wx/univ/setup0.h +++ b/include/wx/univ/setup0.h @@ -898,6 +898,14 @@ // enumerated above, then this class is mostly useless too) #define wxUSE_IMAGLIST 1 +// Use wxInfoBar class. +// +// Default is 1. +// +// Recommended setting: 1 (but can be disabled without problems as nothing +// depends on it) +#define wxUSE_INFOBAR 1 + // Use wxMenu, wxMenuBar, wxMenuItem. // // Default is 1. diff --git a/interface/wx/infobar.h b/interface/wx/infobar.h new file mode 100644 index 0000000000..70f662b95e --- /dev/null +++ b/interface/wx/infobar.h @@ -0,0 +1,213 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/infobar.h +// Purpose: interface of wxInfoBar +// Author: Vadim Zeitlin +// RCS-ID: $Id$ +// Copyright: (c) 2009 Vadim Zeitlin +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +/** + An info bar is a transient window shown at top or bottom of its parent + window to display non-critical information to the user. + + This class provides another way to show messages to the user, intermediate + between message boxes and status bar messages. The message boxes are modal + and thus interrupt the users work flow and should be used sparingly for + this reason. However status bar messages are often too easy not to notice + at all. An info bar provides a way to present the messages which has a much + higher chance to be noticed by the user but without being annoying. + + Info bar may show an icon (on the left), text message and, optionally, + buttons allowing the user to react to the information presented. It always + has a close button at the right allowing the user to dismiss it so it isn't + necessary to provide a button just to close it. + + wxInfoBar calls its parent wxWindow::Layout() method and assumes that it + will change the parent layout appropriately depending on whether the info + bar itself is shown or hidden. Usually this is achieved by simply using a + sizer for the parent window layout and adding wxInfoBar to this sizer as + one of the items. Considering the usual placement of the info bars, + normally this sizer should be a vertical wxBoxSizer and the bar its first + or last element so the simplest possible example of using this class would + be: + @code + class MyFrame : public wxFrame + { + ... + + wxInfoBar *m_infoBar; + }; + + MyFrame::MyFrame() + { + ... + m_infoBar = new wxInfoBar(this); + + wxSizer *sizer = new wxBoxSizer(wxVERTICAL); + sizer->Add(m_infoBar, wxSizerFlags().Expand()); + ... add other frame controls to the sizer ... + SetSizer(sizer); + } + + void MyFrame::SomeMethod() + { + m_infoBar->ShowMessage("Something happend", wxICON_INFORMATION); + } + @endcode + + See the dialogs sample for more sophisticated examples. + + + Only generic implementation of this class exists currently but it is + planned to provide a native GTK+-based version in future wxWidgets releases + so avoid the use of the methods marked "generic only" for maximal + portability. + + @library{wxadv} + @category{miscwnd} + + @see wxStatusBar, wxMessageDialog + + @since 2.9.1 +*/ +class wxInfoBar : public wxWindow +{ +public: + /** + Default constructor. + + Use Create() for the objects created using this constructor. + */ + wxInfoBar(); + + /** + Constructor creating the info bar window. + + @see Create() + */ + wxInfoBar(wxWindow *parent, wxWindowID winid = wxID_ANY); + + /** + Create the info bar window. + + Notice that unlike most of the other wxWindow-derived classes, + wxInfoBar is created hidden and is only shown when ShowMessage() is + called. This is more convenient as usually the info bar is created to + be shown at some later time and not immediately and so creating it + hidden avoids the need to call Hide() explicitly from the code using + it. + + This should be only called if the object was created using its default + constructor. + + @param parent + A valid parent window pointer. + @param winid + The id of the info bar window, usually unused as currently no + events are generated by this class. + */ + wxInfoBar(wxWindow *parent, wxWindowID winid = wxID_ANY); + + /** + Add a button to be shown in the info bar. + + The button added by this method will be shown to the right of the text + (in LTR layout), with each successive button being added to the right + of the previous one. + + Clicking the button will generate a normal event which can be handled + as usual. Notice that if you wish the info bar to be hidden when the + button is clicked, simply call @c event.Skip() in the button handler to + let the base class handler do it. + + @param btnid + Id of the button. It will be used in the button message clicking + this button will generate. + @param label + The label of the button. It may only be empty if @a btnid is one of + the stock ids in which case the corresponding stock label (see + wxGetStockLabel()) will be used. + */ + void AddButton(wxWindowID btnid, const wxString& label = wxString()); + + /** + Show a message in the bar. + + If the bar is currently hidden, it will be shown. Otherwise its message + will be updated in place. + + @param msg + The text of the message. + @param flags + One of wxICON_NONE (default), wxICON_INFORMATION, wxICON_QUESTION, + wxICON_WARNING or wxICON_ERROR values. These flags have the same + meaning as in wxMessageDialog, i.e. show the corresponding icon in + the bar. + */ + void ShowMessage(const wxString& msg, int flags = wxICON_NONE); + + /** + @name Generic version customization methods. + + All these methods exist in the generic version of the class only. + + The generic version uses wxWindow::ShowWithEffect() function to + progressively show it on the platforms which support it. The methods + here allow to change the default effect used (or disable it entirely) + and change its duration. + */ + //@{ + + /** + Set the effects to use when showing and hiding the bar. + + Either or both of the parameters can be set to wxSHOW_EFFECT_NONE to + disable using effects entirely. + + Notice that if you place the bar at the bottom of the window you should + reverse the effects used for showing and hiding for better appearance. + + @param showEffect + The effect to use when showing the bar. By default, + wxSHOW_EFFECT_SLIDE_TO_BOTTOM which is appropriate for the bars + placed at the top of the window. + @param hideEffect + The effect to use when hiding the bar. By default, + wxSHOW_EFFECT_SLIDE_TO_TOP which is appropriate for the bars placed + at the top of the window. + */ + void SetShowHideEffects(wxShowEffect showEffect, wxShowEffect hideEffect); + + /// Return the effect currently used for showing the bar. + wxShowEffect GetShowEffect() const; + + /// Return the effect currently used for hiding the bar. + wxShowEffect GetHideEffect() const; + + /** + Set the duration of the animation used when showing or hiding the bar. + + By default, 500ms duration is used. + + @param duration + Duration of the animation, in milliseconds. + */ + void SetEffectDuration(int duration); + + /// Return the effect animation duration currently used. + int GetEffectDuration() const; + + /** + Overridden base class methods changes the font of the text message. + + wxInfoBar overrides this method to use the font passed to it for its + text message part. By default a larger and bold version of the standard + font is used. + + This method is generic-only. + */ + virtual bool SetFont(const wxFont& font); + + //@} +}; diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 264246c1df..a45f416b92 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -87,6 +87,10 @@ #include "wx/fdrepdlg.h" #endif // wxUSE_FINDREPLDLG +#if wxUSE_INFOBAR + #include "wx/infobar.h" +#endif // wxUSE_INFOBAR + #include "wx/spinctrl.h" #include "wx/propdlg.h" @@ -134,6 +138,10 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) #if wxUSE_LOG_DIALOG EVT_MENU(DIALOGS_LOG_DIALOG, MyFrame::LogDialog) #endif // wxUSE_LOG_DIALOG +#if wxUSE_INFOBAR + EVT_MENU(DIALOGS_INFOBAR_SIMPLE, MyFrame::InfoBarSimple) + EVT_MENU(DIALOGS_INFOBAR_ADVANCED, MyFrame::InfoBarAdvanced) +#endif // wxUSE_INFOBAR #if wxUSE_TEXTDLG EVT_MENU(DIALOGS_TEXT_ENTRY, MyFrame::TextEntry) @@ -395,9 +403,14 @@ bool MyApp::OnInit() info_menu->Append(DIALOGS_LOG_DIALOG, wxT("&Log dialog\tCtrl-L")); #endif // wxUSE_LOG_DIALOG + #if wxUSE_INFOBAR + info_menu->Append(DIALOGS_INFOBAR_SIMPLE, "Simple &info bar\tCtrl-I"); + info_menu->Append(DIALOGS_INFOBAR_ADVANCED, "&Advanced info bar\tShift-Ctrl-I"); + #endif // wxUSE_INFOBAR + #if wxUSE_MSGDLG info_menu->Append(DIALOGS_MESSAGE_BOX_WXINFO, - wxT("&wxWidgets information\tCtrl-I")); + wxT("&wxWidgets information\tCtrl-W")); #endif // wxUSE_MSGDLG menuDlg->Append(wxID_ANY,wxT("&Informative dialogs"),info_menu); @@ -414,9 +427,9 @@ bool MyApp::OnInit() wxMenu *dialogs_menu = new wxMenu; #if USE_MODAL_PRESENTATION - dialogs_menu->Append(DIALOGS_MODAL, wxT("&Modal dialog\tCtrl-W")); + dialogs_menu->Append(DIALOGS_MODAL, wxT("&Modal dialog\tShift-Ctrl-W")); #endif // USE_MODAL_PRESENTATION - dialogs_menu->AppendCheckItem(DIALOGS_MODELESS, wxT("Mode&less dialog\tCtrl-Z")); + dialogs_menu->AppendCheckItem(DIALOGS_MODELESS, wxT("Mode&less dialog\tShift-Ctrl-Z")); dialogs_menu->Append(DIALOGS_CENTRE_SCREEN, wxT("Centered on &screen\tShift-Ctrl-1")); dialogs_menu->Append(DIALOGS_CENTRE_PARENT, wxT("Centered on &parent\tShift-Ctrl-2")); #if wxUSE_MINIFRAME @@ -510,6 +523,17 @@ MyFrame::MyFrame(const wxString& title) #endif // wxUSE_STATUSBAR m_canvas = new MyCanvas(this); + +#if wxUSE_INFOBAR + m_infoBarSimple = new wxInfoBar(this); + m_infoBarAdvanced = NULL; + + // to use the info bars we need to use sizer for the window layout + wxBoxSizer * const sizer = new wxBoxSizer(wxVERTICAL); + sizer->Add(m_infoBarSimple, wxSizerFlags().Expand()); + sizer->Add(m_canvas, wxSizerFlags(1).Expand()); + SetSizer(sizer); +#endif // wxUSE_INFOBAR } MyFrame::~MyFrame() @@ -653,6 +677,24 @@ void MyFrame::LogDialog(wxCommandEvent& WXUNUSED(event)) } #endif // wxUSE_LOG_DIALOG +#if wxUSE_INFOBAR + +void MyFrame::InfoBarSimple(wxCommandEvent& WXUNUSED(event)) +{ + static int s_count = 0; + m_infoBarSimple->ShowMessage + ( + wxString::Format("Message #%d in the info bar.", ++s_count) + ); +} + +void MyFrame::InfoBarAdvanced(wxCommandEvent& WXUNUSED(event)) +{ +} + +#endif // wxUSE_INFOBAR + + #if wxUSE_MSGDLG void MyFrame::MessageBox(wxCommandEvent& WXUNUSED(event)) { diff --git a/samples/dialogs/dialogs.h b/samples/dialogs/dialogs.h index fe0b0638a9..57a7105b43 100644 --- a/samples/dialogs/dialogs.h +++ b/samples/dialogs/dialogs.h @@ -303,6 +303,11 @@ public: void LogDialog(wxCommandEvent& event); #endif // wxUSE_LOG_DIALOG +#if wxUSE_INFOBAR + void InfoBarSimple(wxCommandEvent& event); + void InfoBarAdvanced(wxCommandEvent& event); +#endif // wxUSE_INFOBAR + #if wxUSE_CHOICEDLG void SingleChoice(wxCommandEvent& event); void MultiChoice(wxCommandEvent& event); @@ -423,6 +428,11 @@ private: // just a window which we use to show the effect of font/colours selection wxWindow *m_canvas; +#if wxUSE_INFOBAR + wxInfoBar *m_infoBarSimple, + *m_infoBarAdvanced; +#endif // wxUSE_INFOBAR + DECLARE_EVENT_TABLE() }; @@ -472,6 +482,8 @@ enum DIALOGS_TIP, DIALOGS_NUM_ENTRY, DIALOGS_LOG_DIALOG, + DIALOGS_INFOBAR_SIMPLE, + DIALOGS_INFOBAR_ADVANCED, DIALOGS_MODAL, DIALOGS_MODELESS, DIALOGS_CENTRE_SCREEN, diff --git a/setup.h.in b/setup.h.in index 0fc38e74c7..75f4246ece 100644 --- a/setup.h.in +++ b/setup.h.in @@ -409,6 +409,8 @@ #define wxUSE_IMAGLIST 0 +#define wxUSE_INFOBAR 0 + #define wxUSE_MENUS 0 #define wxUSE_NOTIFICATION_MESSAGE 0 diff --git a/src/generic/infobar.cpp b/src/generic/infobar.cpp new file mode 100644 index 0000000000..db8708a56b --- /dev/null +++ b/src/generic/infobar.cpp @@ -0,0 +1,235 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/generic/infobar.cpp +// Purpose: generic wxInfoBar implementation +// Author: Vadim Zeitlin +// Created: 2009-07-28 +// RCS-ID: $Id: wxhead.cpp,v 1.10 2009-06-29 10:23:04 zeitlin Exp $ +// Copyright: (c) 2009 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_INFOBAR + +#ifndef WX_PRECOMP + #include "wx/artprov.h" + #include "wx/bmpbuttn.h" + #include "wx/settings.h" + #include "wx/statbmp.h" + #include "wx/stattext.h" +#endif // WX_PRECOMP + +#include "wx/infobar.h" + +#include "wx/scopeguard.h" +#include "wx/sizer.h" + +// ============================================================================ +// implementation +// ============================================================================ + +void wxInfoBar::Init() +{ + m_icon = NULL; + m_text = NULL; + m_button = NULL; + + m_showEffect = wxSHOW_EFFECT_SLIDE_TO_BOTTOM; + m_hideEffect = wxSHOW_EFFECT_SLIDE_TO_TOP; + + // use default effect duration + m_effectDuration = 0; +} + +bool wxInfoBar::Create(wxWindow *parent, wxWindowID winid) +{ + // calling Hide() before Create() ensures that we're created initially + // hidden + Hide(); + if ( !wxWindow::Create(parent, winid) ) + return false; + + // use special, easy to notice, colours + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK)); + SetOwnForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INFOTEXT)); + + // create the controls: icon, text and the button to dismiss the + // message. + + // the icon is not shown unless it's assigned a valid bitmap + m_icon = new wxStaticBitmap(this, wxID_ANY, wxNullBitmap); + + // by default, the text uses a larger, more noticeable, font + m_text = new wxStaticText(this, wxID_ANY, ""); + m_text->SetFont(m_text->GetFont().Bold().Larger()); + + m_button = new wxBitmapButton + ( + this, + wxID_ANY, + wxArtProvider::GetBitmap(wxART_CROSS_MARK), + wxDefaultPosition, + wxDefaultSize, + wxBORDER_NONE + ); + m_button->SetToolTip(_("Hide this notification message.")); + + Connect + ( + wxEVT_COMMAND_BUTTON_CLICKED, + wxCommandEventHandler(wxInfoBar::OnButton), + NULL, + this + ); + + // Center the text inside the sizer. + wxSizer * const sizer = new wxBoxSizer(wxHORIZONTAL); + sizer->AddStretchSpacer(); + sizer->Add(m_icon, wxSizerFlags().Centre().DoubleBorder()); + sizer->Add(m_text, wxSizerFlags().Centre().DoubleBorder()); + sizer->AddStretchSpacer(); + sizer->Add(m_button, wxSizerFlags().Centre().DoubleBorder()); + SetSizer(sizer); + + return true; +} + +void wxInfoBar::UpdateParent() +{ + wxWindow * const parent = wxGetTopLevelParent(GetParent()); + parent->Layout(); +} + +void wxInfoBar::ChangeParentBackground() +{ + wxWindow * const parent = GetParent(); + m_origParentBgCol = parent->GetBackgroundColour(); + + wxSizer * const sizer = GetContainingSizer(); + if ( !sizer ) + return; + + wxWindow *sibling = NULL; + for ( wxSizerItemList::compatibility_iterator + node = sizer->GetChildren().GetFirst(); + node; + node = node->GetNext() ) + { + if ( node->GetData()->GetWindow() == this ) + { + // find the next window following us + for ( node = node->GetNext(); + node; + node = node->GetNext() ) + { + wxSizerItem * const item = node->GetData(); + if ( item->IsWindow() ) + { + sibling = item->GetWindow(); + break; + } + } + + break; + } + } + + if ( sibling ) + parent->SetOwnBackgroundColour(sibling->GetBackgroundColour()); +} + +void wxInfoBar::RestoreParentBackground() +{ + GetParent()->SetOwnBackgroundColour(m_origParentBgCol); +} + +void wxInfoBar::DoHide() +{ + ChangeParentBackground(); + wxON_BLOCK_EXIT_THIS0( wxInfoBar::RestoreParentBackground ); + + HideWithEffect(m_hideEffect, m_effectDuration); + UpdateParent(); +} + +void wxInfoBar::DoShow() +{ + // re-layout the parent first so that the window expands into an already + // unoccupied by the other controls area: for this we need to change our + // internal visibility flag to force Layout() to take us into account (an + // alternative solution to this hack would be to temporarily set + // wxRESERVE_SPACE_EVEN_IF_HIDDEN flag but it's not really batter) + + // just change the internal flag indicating that the window is visible, + // without really showing it + wxWindowBase::Show(); + + // an extra hack: we want the temporarily uncovered area in which we're + // going to expand to look like part of this sibling for a better effect so + // temporarily change the background of our parent to the same colour + ChangeParentBackground(); + wxON_BLOCK_EXIT_THIS0( wxInfoBar::RestoreParentBackground ); + + // adjust the parent layout to account for us + UpdateParent(); + + // reset the flag back before really showing the window or it wouldn't be + // shown at all because it would believe itself already visible + wxWindowBase::Show(false); + + + // finally do really show the window. + ShowWithEffect(m_showEffect, m_effectDuration); +} + +void wxInfoBar::ShowMessage(const wxString& msg, int flags) +{ + // first update the controls + const int icon = flags & wxICON_MASK; + if ( !icon || (icon == wxICON_NONE) ) + { + m_icon->Hide(); + } + else // do show an icon + { + m_icon->SetBitmap(wxArtProvider::GetMessageBoxIcon(icon)); + m_icon->Show(); + } + + // notice the use of EscapeMnemonics() to ensure that "&" come through + // correctly + m_text->SetLabel(wxControl::EscapeMnemonics(msg)); + + + // then show this entire window if not done yet + if ( !IsShown() ) + { + DoShow(); + } + else // we're already shown + { + // just update the layout to correspond to the new message + Layout(); + } +} + +void wxInfoBar::OnButton(wxCommandEvent& WXUNUSED(event)) +{ + DoHide(); +} + +#endif // wxUSE_INFOBAR -- 2.45.2