Merge branch 'generic-dvc'

Add option for using generic wxDataViewCtrl and fixes to make it work
under GTK and Mac.

See https://github.com/wxWidgets/wxWidgets/pull/1680
This commit is contained in:
Vadim Zeitlin
2019-12-17 02:06:15 +01:00
18 changed files with 123 additions and 7 deletions

View File

@@ -411,6 +411,8 @@
#cmakedefine01 wxUSE_TREECTRL #cmakedefine01 wxUSE_TREECTRL
#cmakedefine01 wxUSE_TREELISTCTRL #cmakedefine01 wxUSE_TREELISTCTRL
#cmakedefine01 wxUSE_NATIVE_DATAVIEWCTRL
#cmakedefine01 wxUSE_STATUSBAR #cmakedefine01 wxUSE_STATUSBAR
#cmakedefine01 wxUSE_NATIVE_STATUSBAR #cmakedefine01 wxUSE_NATIVE_STATUSBAR

36
configure vendored
View File

@@ -1249,6 +1249,7 @@ enable_combobox
enable_comboctrl enable_comboctrl
enable_commandlinkbutton enable_commandlinkbutton
enable_dataviewctrl enable_dataviewctrl
enable_nativedvc
enable_datepick enable_datepick
enable_detect_sm enable_detect_sm
enable_dirpicker enable_dirpicker
@@ -2203,6 +2204,7 @@ Optional Features:
--enable-comboctrl use wxComboCtrl class --enable-comboctrl use wxComboCtrl class
--enable-commandlinkbutton use wxCommmandLinkButton class --enable-commandlinkbutton use wxCommmandLinkButton class
--enable-dataviewctrl use wxDataViewCtrl class --enable-dataviewctrl use wxDataViewCtrl class
--disable-nativedvc disable use of native wxDataViewCtrl even if available
--enable-datepick use wxDatePickerCtrl class --enable-datepick use wxDatePickerCtrl class
--enable-detect_sm use code to detect X11 session manager --enable-detect_sm use code to detect X11 session manager
--enable-dirpicker use wxDirPickerCtrl class --enable-dirpicker use wxDirPickerCtrl class
@@ -9719,6 +9721,35 @@ fi
eval "$wx_cv_use_dataviewctrl" 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= enablestring=
defaultval=$wxUSE_ALL_FEATURES defaultval=$wxUSE_ALL_FEATURES
if test -z "$defaultval"; then if test -z "$defaultval"; then
@@ -35900,6 +35931,11 @@ if test "$wxUSE_DATAVIEWCTRL" = "yes"; then
USES_CONTROLS=1 USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dataview" SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dataview"
if test "$wxUSE_NATIVE_DATAVIEWCTRL" = "yes"; then
$as_echo "#define wxUSE_NATIVE_DATAVIEWCTRL 1" >>confdefs.h
fi
fi fi
if test "$wxUSE_IMAGLIST" = "yes"; then if test "$wxUSE_IMAGLIST" = "yes"; then

View File

@@ -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(comboctrl, [ --enable-comboctrl use wxComboCtrl class], wxUSE_COMBOCTRL)
WX_ARG_FEATURE(commandlinkbutton, [ --enable-commandlinkbutton use wxCommmandLinkButton class], wxUSE_COMMANDLINKBUTTON) WX_ARG_FEATURE(commandlinkbutton, [ --enable-commandlinkbutton use wxCommmandLinkButton class], wxUSE_COMMANDLINKBUTTON)
WX_ARG_FEATURE(dataviewctrl,[ --enable-dataviewctrl use wxDataViewCtrl class], wxUSE_DATAVIEWCTRL) 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(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(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) 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) AC_DEFINE(wxUSE_DATAVIEWCTRL)
USES_CONTROLS=1 USES_CONTROLS=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dataview" SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS dataview"
if test "$wxUSE_NATIVE_DATAVIEWCTRL" = "yes"; then
AC_DEFINE(wxUSE_NATIVE_DATAVIEWCTRL)
fi
fi fi
if test "$wxUSE_IMAGLIST" = "yes"; then if test "$wxUSE_IMAGLIST" = "yes"; then

View File

@@ -185,6 +185,7 @@ Currently the following symbols exist:
decide whether some function should be overloaded for both decide whether some function should be overloaded for both
<code>long</code> and <code>long long</code> types.} <code>long</code> and <code>long long</code> types.}
@itemdef{wxHAS_MULTIPLE_FILEDLG_FILTERS, Defined if wxFileDialog supports multiple ('|'-separated) filters.} @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_NATIVE_WINDOW, Defined if wxNativeWindow class is available.}
@itemdef{wxHAS_IMAGES_IN_RESOURCES, Defined if <a href="http://en.wikipedia.org/wiki/Resource_(Windows)"> @itemdef{wxHAS_IMAGES_IN_RESOURCES, Defined if <a href="http://en.wikipedia.org/wiki/Resource_(Windows)">
Windows resource files</a> or OS/2 resource files are available on the current platform.} Windows resource files</a> or OS/2 resource files are available on the current platform.}

View File

@@ -175,6 +175,7 @@ library:
@itemdef{wxUSE_MINIFRAME, Use wxMiniFrame class.} @itemdef{wxUSE_MINIFRAME, Use wxMiniFrame class.}
@itemdef{wxUSE_MOUSEWHEEL, Support mouse wheel events.} @itemdef{wxUSE_MOUSEWHEEL, Support mouse wheel events.}
@itemdef{wxUSE_MSGDLG, Use wxMessageDialog class and wxMessageBox function.} @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_NATIVE_STATUSBAR, Use native wxStatusBar class.}
@itemdef{wxUSE_NOTEBOOK, Use wxNotebook and related classes.} @itemdef{wxUSE_NOTEBOOK, Use wxNotebook and related classes.}
@itemdef{wxUSE_NUMBERDLG, Use wxNumberEntryDialog class.} @itemdef{wxUSE_NUMBERDLG, Use wxNumberEntryDialog class.}

View File

@@ -907,6 +907,14 @@
#define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREECTRL 1 // wxTreeCtrl
#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl #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 // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR
// below either wxStatusBar95 or a generic wxStatusBar will be used. // below either wxStatusBar95 or a generic wxStatusBar will be used.
// //

View File

@@ -649,6 +649,14 @@
# endif # endif
#endif /* !defined(wxUSE_DATAVIEWCTRL) */ #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 #ifndef wxUSE_DATEPICKCTRL
# ifdef wxABORT_ON_CONFIG_ERROR # ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_DATEPICKCTRL must be defined, please read comment near the top of this file." # error "wxUSE_DATEPICKCTRL must be defined, please read comment near the top of this file."

View File

@@ -33,8 +33,13 @@ class WXDLLIMPEXP_FWD_CORE wxImageList;
class wxItemAttr; class wxItemAttr;
class WXDLLIMPEXP_FWD_CORE wxHeaderCtrl; class WXDLLIMPEXP_FWD_CORE wxHeaderCtrl;
#if !(defined(__WXGTK20__) || defined(__WXOSX__) ) || defined(__WXUNIVERSAL__) #if wxUSE_NATIVE_DATAVIEWCTRL && !defined(__WXUNIVERSAL__)
// #if !(defined(__WXOSX__)) || defined(__WXUNIVERSAL__) #if defined(__WXGTK20__) || defined(__WXOSX__)
#define wxHAS_NATIVE_DATAVIEWCTRL
#endif
#endif
#ifndef wxHAS_NATIVE_DATAVIEWCTRL
#define wxHAS_GENERIC_DATAVIEWCTRL #define wxHAS_GENERIC_DATAVIEWCTRL
#endif #endif

View File

@@ -539,7 +539,7 @@ typedef wxDataViewTextRenderer wxDataViewDateRenderer;
// wxDataViewCheckIconTextRenderer: 3-state checkbox + text + optional icon // wxDataViewCheckIconTextRenderer: 3-state checkbox + text + optional icon
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifndef __WXOSX__ #if defined(wxHAS_GENERIC_DATAVIEWCTRL) || !defined(__WXOSX__)
class WXDLLIMPEXP_CORE wxDataViewCheckIconTextRenderer class WXDLLIMPEXP_CORE wxDataViewCheckIconTextRenderer
: public wxDataViewCustomRenderer : public wxDataViewCustomRenderer
@@ -591,7 +591,7 @@ private:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCheckIconTextRenderer); wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCheckIconTextRenderer);
}; };
#endif // !__WXOSX__ #endif // ! native __WXOSX__
// this class is obsolete, its functionality was merged in // this class is obsolete, its functionality was merged in
// wxDataViewTextRenderer itself now, don't use it any more // wxDataViewTextRenderer itself now, don't use it any more

View File

@@ -908,6 +908,14 @@
#define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREECTRL 1 // wxTreeCtrl
#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl #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 // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR
// below either wxStatusBar95 or a generic wxStatusBar will be used. // below either wxStatusBar95 or a generic wxStatusBar will be used.
// //

View File

@@ -908,6 +908,14 @@
#define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREECTRL 1 // wxTreeCtrl
#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl #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 // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR
// below either wxStatusBar95 or a generic wxStatusBar will be used. // below either wxStatusBar95 or a generic wxStatusBar will be used.
// //

View File

@@ -908,6 +908,14 @@
#define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREECTRL 1 // wxTreeCtrl
#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl #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 // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR
// below either wxStatusBar95 or a generic wxStatusBar will be used. // below either wxStatusBar95 or a generic wxStatusBar will be used.
// //

View File

@@ -914,6 +914,14 @@
#define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREECTRL 1 // wxTreeCtrl
#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl #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 // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR
// below either wxStatusBar95 or a generic wxStatusBar will be used. // below either wxStatusBar95 or a generic wxStatusBar will be used.
// //

View File

@@ -904,6 +904,14 @@
#define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREECTRL 1 // wxTreeCtrl
#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl #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 // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR
// below either wxStatusBar95 or a generic wxStatusBar will be used. // below either wxStatusBar95 or a generic wxStatusBar will be used.
// //

View File

@@ -907,6 +907,14 @@
#define wxUSE_TREECTRL 1 // wxTreeCtrl #define wxUSE_TREECTRL 1 // wxTreeCtrl
#define wxUSE_TREELISTCTRL 1 // wxTreeListCtrl #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 // Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR
// below either wxStatusBar95 or a generic wxStatusBar will be used. // below either wxStatusBar95 or a generic wxStatusBar will be used.
// //

View File

@@ -411,6 +411,8 @@
#define wxUSE_TREECTRL 0 #define wxUSE_TREECTRL 0
#define wxUSE_TREELISTCTRL 0 #define wxUSE_TREELISTCTRL 0
#define wxUSE_NATIVE_DATAVIEWCTRL 0
#define wxUSE_STATUSBAR 0 #define wxUSE_STATUSBAR 0
#define wxUSE_NATIVE_STATUSBAR 0 #define wxUSE_NATIVE_STATUSBAR 0

View File

@@ -2004,7 +2004,7 @@ wxSize wxDataViewDateRenderer::GetSize() const
// wxDataViewCheckIconTextRenderer implementation // wxDataViewCheckIconTextRenderer implementation
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifndef __WXOSX__ #if defined(wxHAS_GENERIC_DATAVIEWCTRL) || !defined(__WXOSX__)
IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxDataViewCheckIconText, WXDLLIMPEXP_ADV) IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxDataViewCheckIconText, WXDLLIMPEXP_ADV)
@@ -2196,7 +2196,7 @@ wxSize wxDataViewCheckIconTextRenderer::GetCheckSize() const
return wxRendererNative::Get().GetCheckBoxSize(GetView()); return wxRendererNative::Get().GetCheckBoxSize(GetView());
} }
#endif // !__WXOSX__ #endif // ! native __WXOSX__
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxDataViewListStore // wxDataViewListStore

View File

@@ -735,7 +735,7 @@ bool wxTreeListModel::IsContainer(const wxDataViewItem& item) const
// adding the item itself) and we can't know whether we're container // adding the item itself) and we can't know whether we're container
// or not by then. Luckily, always returning true doesn't have any // or not by then. Luckily, always returning true doesn't have any
// serious drawbacks for us. // serious drawbacks for us.
#ifdef __WXGTK__ #if defined(__WXGTK__) && defined(wxHAS_NATIVE_DATAVIEWCTRL)
wxUnusedVar(item); wxUnusedVar(item);
return true; return true;