From 323d36e452c48f1e48ffe48312004d5e224634ca Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin <vadim@wxwidgets.org> Date: Fri, 1 Oct 2010 13:05:36 +0000 Subject: [PATCH] Add wxHAS_BITMAPTOGGLEBUTTON and test for it in the unit test. Not all ports define wxBitmapToggleButton class currently, so add a special symbol which is defined only if this class is indeed available and test for it in the unit test for this class. This fixes the tests compilation under wxX11. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65706 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/doxygen/mainpages/const_cpp.h | 2 ++ include/wx/tglbtn.h | 3 +++ interface/wx/tglbtn.h | 10 ++++++++-- tests/controls/bitmaptogglebuttontest.cpp | 9 +++++++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/doxygen/mainpages/const_cpp.h b/docs/doxygen/mainpages/const_cpp.h index ad4cf3051c..3be48c3555 100644 --- a/docs/doxygen/mainpages/const_cpp.h +++ b/docs/doxygen/mainpages/const_cpp.h @@ -196,6 +196,8 @@ Currently the following symbols exist: have an efficient (CPU-specific) implementation. Notice that the functions themselves are always available but can be prohibitively slow to use when implemented in a generic way, using a critical section.} +@itemdef{wxHAS_BITMAPTOGGLEBUTTON, Defined in @c wx/tglbtn.h if + wxBitmapToggleButton class is available in addition to wxToggleButton.} @itemdef{wxHAS_CONFIG_TEMPLATE_RW, Defined if the currently used compiler supports template Read() and Write() methods in wxConfig.} @itemdef{wxHAS_LARGE_FILES, Defined if wxFile supports files more than 4GB in diff --git a/include/wx/tglbtn.h b/include/wx/tglbtn.h index 63c2757b1c..25c4d10bc4 100644 --- a/include/wx/tglbtn.h +++ b/include/wx/tglbtn.h @@ -76,14 +76,17 @@ protected: #include "wx/univ/tglbtn.h" #elif defined(__WXMSW__) #include "wx/msw/tglbtn.h" + #define wxHAS_BITMAPTOGGLEBUTTON #elif defined(__WXGTK20__) #include "wx/gtk/tglbtn.h" + #define wxHAS_BITMAPTOGGLEBUTTON #elif defined(__WXGTK__) #include "wx/gtk1/tglbtn.h" # elif defined(__WXMOTIF__) #include "wx/motif/tglbtn.h" #elif defined(__WXMAC__) #include "wx/osx/tglbtn.h" + #define wxHAS_BITMAPTOGGLEBUTTON #elif defined(__WXPALMOS__) #include "wx/palmos/tglbtn.h" #elif defined(__WXPM__) diff --git a/interface/wx/tglbtn.h b/interface/wx/tglbtn.h index 53f51a78f2..866be9765e 100644 --- a/interface/wx/tglbtn.h +++ b/interface/wx/tglbtn.h @@ -106,8 +106,14 @@ public: /** @class wxBitmapToggleButton - wxBitmapToggleButton is a wxToggleButton - that contains a bitmap instead of text. + wxBitmapToggleButton is a wxToggleButton that contains a bitmap instead of + text. + + This class is not available in all ports currently (although it is + available in the major ones), test for @c wxHAS_BITMAPTOGGLEBUTTON to + determine whether it can be used (in addition for possibly testing for + @c wxUSE_TOGGLEBTN which can be set to 0 to explicitly disable support for + this class and wxToggleButton). This control emits an update UI event. diff --git a/tests/controls/bitmaptogglebuttontest.cpp b/tests/controls/bitmaptogglebuttontest.cpp index a14230ab4e..b6992aa7d1 100644 --- a/tests/controls/bitmaptogglebuttontest.cpp +++ b/tests/controls/bitmaptogglebuttontest.cpp @@ -15,6 +15,10 @@ #pragma hdrstop #endif +#include "wx/tglbtn.h" + +#ifdef wxHAS_BITMAPTOGGLEBUTTON + #ifndef WX_PRECOMP #include "wx/app.h" #endif // WX_PRECOMP @@ -22,7 +26,6 @@ #include "testableframe.h" #include "wx/uiaction.h" #include "wx/artprov.h" -#include "wx/tglbtn.h" class BitmapToggleButtonTestCase : public CppUnit::TestCase { @@ -116,4 +119,6 @@ void BitmapToggleButtonTestCase::Value() CPPUNIT_ASSERT_EQUAL( 0, frame->GetEventCount() ); } -#endif +#endif // wxHAS_BITMAPTOGGLEBUTTON + +#endif // wxUSE_TOGGLEBTN -- 2.47.2