From 028afa194aebb35b6e07544724bd6ea51e2f2b6a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 15 Dec 2019 16:23:47 +0100 Subject: [PATCH] Add wxUSE_NATIVE_DATAVIEWCTRL build option It defaults to 1, but can be set to 0 to force using the generic version of the control even under GTK or Mac, where the native version is used by default. This can, unfortunately, be useful to work around various but multiple native control limitations. --- build/cmake/setup.h.in | 2 ++ configure | 36 +++++++++++++++++++++++++ configure.in | 5 ++++ docs/doxygen/mainpages/const_cpp.h | 1 + docs/doxygen/mainpages/const_wxusedef.h | 1 + include/wx/android/setup.h | 8 ++++++ include/wx/chkconf.h | 8 ++++++ include/wx/dataview.h | 9 +++++-- include/wx/gtk/setup0.h | 8 ++++++ include/wx/motif/setup0.h | 8 ++++++ include/wx/msw/setup0.h | 8 ++++++ include/wx/osx/setup0.h | 8 ++++++ include/wx/setup_inc.h | 8 ++++++ include/wx/univ/setup0.h | 8 ++++++ setup.h.in | 2 ++ 15 files changed, 118 insertions(+), 2 deletions(-) diff --git a/build/cmake/setup.h.in b/build/cmake/setup.h.in index d8dae8ada1..2b5c6a29a1 100644 --- a/build/cmake/setup.h.in +++ b/build/cmake/setup.h.in @@ -411,6 +411,8 @@ #cmakedefine01 wxUSE_TREECTRL #cmakedefine01 wxUSE_TREELISTCTRL +#cmakedefine01 wxUSE_NATIVE_DATAVIEWCTRL + #cmakedefine01 wxUSE_STATUSBAR #cmakedefine01 wxUSE_NATIVE_STATUSBAR diff --git a/configure b/configure index 79dc46e7a7..5ef2fc76ab 100755 --- a/configure +++ b/configure @@ -1249,6 +1249,7 @@ enable_combobox enable_comboctrl enable_commandlinkbutton enable_dataviewctrl +enable_nativedvc enable_datepick enable_detect_sm enable_dirpicker @@ -2203,6 +2204,7 @@ Optional Features: --enable-comboctrl use wxComboCtrl class --enable-commandlinkbutton use wxCommmandLinkButton class --enable-dataviewctrl use wxDataViewCtrl class + --disable-nativedvc disable use of native wxDataViewCtrl even if available --enable-datepick use wxDatePickerCtrl class --enable-detect_sm use code to detect X11 session manager --enable-dirpicker use wxDirPickerCtrl class @@ -9719,6 +9721,35 @@ fi eval "$wx_cv_use_dataviewctrl" + enablestring=disable + defaultval= + if test -z "$defaultval"; then + if test x"$enablestring" = xdisable; then + defaultval=yes + else + defaultval=no + fi + fi + + # Check whether --enable-nativedvc was given. +if test "${enable_nativedvc+set}" = set; then : + enableval=$enable_nativedvc; + if test "$enableval" = yes; then + wx_cv_use_nativedvc='wxUSE_NATIVE_DATAVIEWCTRL=yes' + else + wx_cv_use_nativedvc='wxUSE_NATIVE_DATAVIEWCTRL=no' + fi + +else + + wx_cv_use_nativedvc='wxUSE_NATIVE_DATAVIEWCTRL=${'DEFAULT_wxUSE_NATIVE_DATAVIEWCTRL":-$defaultval}" + +fi + + + eval "$wx_cv_use_nativedvc" + + enablestring= defaultval=$wxUSE_ALL_FEATURES if test -z "$defaultval"; then @@ -35900,6 +35931,11 @@ if test "$wxUSE_DATAVIEWCTRL" = "yes"; then USES_CONTROLS=1 SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dataview" + + if test "$wxUSE_NATIVE_DATAVIEWCTRL" = "yes"; then + $as_echo "#define wxUSE_NATIVE_DATAVIEWCTRL 1" >>confdefs.h + + fi fi if test "$wxUSE_IMAGLIST" = "yes"; then diff --git a/configure.in b/configure.in index f0ffb613f5..d9579458db 100644 --- a/configure.in +++ b/configure.in @@ -922,6 +922,7 @@ WX_ARG_FEATURE(combobox, [ --enable-combobox use wxComboBox class], wx WX_ARG_FEATURE(comboctrl, [ --enable-comboctrl use wxComboCtrl class], wxUSE_COMBOCTRL) WX_ARG_FEATURE(commandlinkbutton, [ --enable-commandlinkbutton use wxCommmandLinkButton class], wxUSE_COMMANDLINKBUTTON) WX_ARG_FEATURE(dataviewctrl,[ --enable-dataviewctrl use wxDataViewCtrl class], wxUSE_DATAVIEWCTRL) +WX_ARG_DISABLE(nativedvc, [ --disable-nativedvc disable use of native wxDataViewCtrl even if available], wxUSE_NATIVE_DATAVIEWCTRL) WX_ARG_FEATURE(datepick, [ --enable-datepick use wxDatePickerCtrl class], wxUSE_DATEPICKCTRL) WX_ARG_FEATURE(detect_sm, [ --enable-detect_sm use code to detect X11 session manager], wxUSE_DETECT_SM) WX_ARG_FEATURE(dirpicker, [ --enable-dirpicker use wxDirPickerCtrl class], wxUSE_DIRPICKERCTRL) @@ -6834,6 +6835,10 @@ if test "$wxUSE_DATAVIEWCTRL" = "yes"; then AC_DEFINE(wxUSE_DATAVIEWCTRL) USES_CONTROLS=1 SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dataview" + + if test "$wxUSE_NATIVE_DATAVIEWCTRL" = "yes"; then + AC_DEFINE(wxUSE_NATIVE_DATAVIEWCTRL) + fi fi if test "$wxUSE_IMAGLIST" = "yes"; then diff --git a/docs/doxygen/mainpages/const_cpp.h b/docs/doxygen/mainpages/const_cpp.h index 2da7c6989f..ce7a5f1f8e 100644 --- a/docs/doxygen/mainpages/const_cpp.h +++ b/docs/doxygen/mainpages/const_cpp.h @@ -185,6 +185,7 @@ Currently the following symbols exist: decide whether some function should be overloaded for both long and long long types.} @itemdef{wxHAS_MULTIPLE_FILEDLG_FILTERS, Defined if wxFileDialog supports multiple ('|'-separated) filters.} +@itemdef{wxHAS_NATIVE_DATAVIEWCTRL, Defined if native wxDataViewCtrl class is being used (this symbol only exists in wxWidgets 3.1.4 and later).} @itemdef{wxHAS_NATIVE_WINDOW, Defined if wxNativeWindow class is available.} @itemdef{wxHAS_IMAGES_IN_RESOURCES, Defined if Windows resource files or OS/2 resource files are available on the current platform.} diff --git a/docs/doxygen/mainpages/const_wxusedef.h b/docs/doxygen/mainpages/const_wxusedef.h index 6de2a97be9..8124f108c7 100644 --- a/docs/doxygen/mainpages/const_wxusedef.h +++ b/docs/doxygen/mainpages/const_wxusedef.h @@ -175,6 +175,7 @@ library: @itemdef{wxUSE_MINIFRAME, Use wxMiniFrame class.} @itemdef{wxUSE_MOUSEWHEEL, Support mouse wheel events.} @itemdef{wxUSE_MSGDLG, Use wxMessageDialog class and wxMessageBox function.} +@itemdef{wxUSE_NATIVE_DATAVIEWCTRL, Use native wxDataViewCtrl class (this option is new since wxWidgets 3.1.4).} @itemdef{wxUSE_NATIVE_STATUSBAR, Use native wxStatusBar class.} @itemdef{wxUSE_NOTEBOOK, Use wxNotebook and related classes.} @itemdef{wxUSE_NUMBERDLG, Use wxNumberEntryDialog class.} diff --git a/include/wx/android/setup.h b/include/wx/android/setup.h index a1a344adae..f6265dd2ec 100644 --- a/include/wx/android/setup.h +++ b/include/wx/android/setup.h @@ -907,6 +907,14 @@ #define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 0. +// +// Recommended setting: 0, but can be set to 1 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. // diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h index f6f71e20ba..47c9f9c489 100644 --- a/include/wx/chkconf.h +++ b/include/wx/chkconf.h @@ -649,6 +649,14 @@ # endif #endif /* !defined(wxUSE_DATAVIEWCTRL) */ +#ifndef wxUSE_NATIVE_DATAVIEWCTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_NATIVE_DATAVIEWCTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_NATIVE_DATAVIEWCTRL 1 +# endif +#endif /* !defined(wxUSE_NATIVE_DATAVIEWCTRL) */ + #ifndef wxUSE_DATEPICKCTRL # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_DATEPICKCTRL must be defined, please read comment near the top of this file." diff --git a/include/wx/dataview.h b/include/wx/dataview.h index f6bc5a4a93..6558cd05c2 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -33,8 +33,13 @@ class WXDLLIMPEXP_FWD_CORE wxImageList; class wxItemAttr; class WXDLLIMPEXP_FWD_CORE wxHeaderCtrl; -#if !(defined(__WXGTK20__) || defined(__WXOSX__) ) || defined(__WXUNIVERSAL__) -// #if !(defined(__WXOSX__)) || defined(__WXUNIVERSAL__) +#if wxUSE_NATIVE_DATAVIEWCTRL && !defined(__WXUNIVERSAL__) + #if defined(__WXGTK20__) || defined(__WXOSX__) + #define wxHAS_NATIVE_DATAVIEWCTRL + #endif +#endif + +#ifndef wxHAS_NATIVE_DATAVIEWCTRL #define wxHAS_GENERIC_DATAVIEWCTRL #endif diff --git a/include/wx/gtk/setup0.h b/include/wx/gtk/setup0.h index 5045f30ea8..510fe7a81c 100644 --- a/include/wx/gtk/setup0.h +++ b/include/wx/gtk/setup0.h @@ -908,6 +908,14 @@ #define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 0. +// +// Recommended setting: 0, but can be set to 1 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. // diff --git a/include/wx/motif/setup0.h b/include/wx/motif/setup0.h index 5644bfd481..6253a84db7 100644 --- a/include/wx/motif/setup0.h +++ b/include/wx/motif/setup0.h @@ -908,6 +908,14 @@ #define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 0. +// +// Recommended setting: 0, but can be set to 1 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. // diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index 4f03064738..2b8ec97ce6 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -908,6 +908,14 @@ #define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 0. +// +// Recommended setting: 0, but can be set to 1 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. // diff --git a/include/wx/osx/setup0.h b/include/wx/osx/setup0.h index 8daa03e568..f209882d88 100644 --- a/include/wx/osx/setup0.h +++ b/include/wx/osx/setup0.h @@ -914,6 +914,14 @@ #define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 0. +// +// Recommended setting: 0, but can be set to 1 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. // diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h index 6932a2c0db..964e68fe17 100644 --- a/include/wx/setup_inc.h +++ b/include/wx/setup_inc.h @@ -904,6 +904,14 @@ #define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 0. +// +// Recommended setting: 0, but can be set to 1 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. // diff --git a/include/wx/univ/setup0.h b/include/wx/univ/setup0.h index 7e7ff0e8a9..4f8397a674 100644 --- a/include/wx/univ/setup0.h +++ b/include/wx/univ/setup0.h @@ -907,6 +907,14 @@ #define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl +// Use generic version of wxDataViewCtrl even if a native one is available? +// +// Default is 0. +// +// Recommended setting: 0, but can be set to 1 if your program is affected by +// the native control limitations. +#define wxUSE_NATIVE_DATAVIEWCTRL 1 + // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR // below either wxStatusBar95 or a generic wxStatusBar will be used. // diff --git a/setup.h.in b/setup.h.in index 62fd583f36..b2491c00df 100644 --- a/setup.h.in +++ b/setup.h.in @@ -411,6 +411,8 @@ #define wxUSE_TREECTRL 0 #define wxUSE_TREELISTCTRL 0 +#define wxUSE_NATIVE_DATAVIEWCTRL 0 + #define wxUSE_STATUSBAR 0 #define wxUSE_NATIVE_STATUSBAR 0