diff --git a/.github/workflows/ci_msw_cross.yml b/.github/workflows/ci_msw_cross.yml
index ff5e6e4c9f..f62ec41e41 100644
--- a/.github/workflows/ci_msw_cross.yml
+++ b/.github/workflows/ci_msw_cross.yml
@@ -68,17 +68,21 @@ jobs:
# versions of MinGW and Wine and is simpler to test with locally than the
# bespoke container used by GitHub Actions by default.
runs-on: ubuntu-latest
- container: debian:testing-slim
+ container: debian:${{ matrix.debian_release }}-slim
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: wxMSW 64 bits
+ debian_release: testing
configure_flags: --disable-compat32
- name: wxMSW 32 bits
+ # Testing doesn't have 32 bit support any more.
+ debian_release: stable
triplet: i686-w64-mingw32
- name: wxMSW/Univ
+ debian_release: testing
configure_flags: --enable-universal --disable-compat32 --disable-debug --disable-optimise
minimal: true
env:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 69caa839d0..78a7ef6a76 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,7 +88,7 @@ math(EXPR wxSOVERSION_MAJOR "${WX_CURRENT} - ${WX_AGE}")
set(wxSOVERSION ${wxSOVERSION_MAJOR}.${WX_AGE}.${WX_REVISION})
set(wxVERSION ${wxMAJOR_VERSION}.${wxMINOR_VERSION}.${wxRELEASE_NUMBER})
-set(wxCOPYRIGHT "2002-2023 wxWidgets")
+set(wxCOPYRIGHT "2002-2024 wxWidgets")
set(wxLANGUAGES C CXX)
if(APPLE AND NOT CMAKE_VERSION VERSION_LESS "3.16")
@@ -97,9 +97,6 @@ endif()
project(wxWidgets VERSION ${wxVERSION} LANGUAGES ${wxLANGUAGES})
-set(CMAKE_CXX_STANDARD 11)
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
-
include(build/cmake/main.cmake)
# Set the default startup project for Visual Studio
diff --git a/Makefile.in b/Makefile.in
index eec415b862..6a0147bd26 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -604,6 +604,7 @@ ALL_BASE_HEADERS = \
wx/lzmastream.h \
wx/localedefs.h \
wx/uilocale.h \
+ wx/fs_data.h \
$(BASE_PLATFORM_HDR) \
wx/fs_inet.h \
wx/protocol/file.h \
@@ -790,6 +791,7 @@ ALL_PORTS_BASE_HEADERS = \
wx/lzmastream.h \
wx/localedefs.h \
wx/uilocale.h \
+ wx/fs_data.h \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
@@ -926,6 +928,7 @@ ALL_BASE_SOURCES = \
src/common/secretstore.cpp \
src/common/lzmastream.cpp \
src/common/uilocale.cpp \
+ src/common/fs_data.cpp \
src/common/fdiodispatcher.cpp \
src/common/selectdispatcher.cpp \
src/unix/appunix.cpp \
@@ -1131,6 +1134,7 @@ MONODLL_OBJECTS = \
monodll_common_secretstore.o \
monodll_lzmastream.o \
monodll_common_uilocale.o \
+ monodll_fs_data.o \
$(__BASE_PLATFORM_SRC_OBJECTS) \
monodll_event.o \
monodll_fs_mem.o \
@@ -1290,6 +1294,7 @@ MONOLIB_OBJECTS = \
monolib_common_secretstore.o \
monolib_lzmastream.o \
monolib_common_uilocale.o \
+ monolib_fs_data.o \
$(__BASE_PLATFORM_SRC_OBJECTS_1) \
monolib_event.o \
monolib_fs_mem.o \
@@ -1418,6 +1423,7 @@ BASEDLL_OBJECTS = \
basedll_common_secretstore.o \
basedll_lzmastream.o \
basedll_common_uilocale.o \
+ basedll_fs_data.o \
$(__BASE_PLATFORM_SRC_OBJECTS_2) \
basedll_event.o \
basedll_fs_mem.o \
@@ -1528,6 +1534,7 @@ BASELIB_OBJECTS = \
baselib_common_secretstore.o \
baselib_lzmastream.o \
baselib_common_uilocale.o \
+ baselib_fs_data.o \
$(__BASE_PLATFORM_SRC_OBJECTS_3) \
baselib_event.o \
baselib_fs_mem.o \
@@ -3893,6 +3900,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \
wx/bmpbndl.h \
wx/filedlgcustomize.h \
wx/compositebookctrl.h \
+ wx/persist/combobox.h \
$(LOWLEVEL_HDR) \
$(GUI_CORE_HEADERS) \
wx/mediactrl.h \
@@ -5542,7 +5550,8 @@ COND_TOOLKIT_QT___GUI_SRC_OBJECTS = \
monodll_qt_treectrl.o \
monodll_paletteg.o \
monodll_qt_datectrl.o \
- monodll_qt_timectrl.o
+ monodll_qt_timectrl.o \
+ monodll_qt_overlay.o
@COND_TOOLKIT_QT@__GUI_SRC_OBJECTS = $(COND_TOOLKIT_QT___GUI_SRC_OBJECTS)
@COND_PLATFORM_UNIX_1@__QT_PLATFORM_SRC_OBJECTS = \
@COND_PLATFORM_UNIX_1@ monodll_unix_dialup.o monodll_unix_joystick.o \
@@ -7307,7 +7316,8 @@ COND_TOOLKIT_QT___GUI_SRC_OBJECTS_1 = \
monolib_qt_treectrl.o \
monolib_paletteg.o \
monolib_qt_datectrl.o \
- monolib_qt_timectrl.o
+ monolib_qt_timectrl.o \
+ monolib_qt_overlay.o
@COND_TOOLKIT_QT@__GUI_SRC_OBJECTS_1 = $(COND_TOOLKIT_QT___GUI_SRC_OBJECTS_1)
@COND_PLATFORM_UNIX_1@__QT_PLATFORM_SRC_OBJECTS_1 = \
@COND_PLATFORM_UNIX_1@ monolib_unix_dialup.o monolib_unix_joystick.o \
@@ -9223,7 +9233,8 @@ COND_TOOLKIT_QT___GUI_SRC_OBJECTS_2 = \
coredll_qt_treectrl.o \
coredll_paletteg.o \
coredll_qt_datectrl.o \
- coredll_qt_timectrl.o
+ coredll_qt_timectrl.o \
+ coredll_qt_overlay.o
@COND_TOOLKIT_QT@__GUI_SRC_OBJECTS_2 = $(COND_TOOLKIT_QT___GUI_SRC_OBJECTS_2)
@COND_PLATFORM_UNIX_1@__QT_PLATFORM_SRC_OBJECTS_2 = \
@COND_PLATFORM_UNIX_1@ coredll_unix_dialup.o coredll_unix_joystick.o \
@@ -10714,7 +10725,8 @@ COND_TOOLKIT_QT___GUI_SRC_OBJECTS_3 = \
corelib_qt_treectrl.o \
corelib_paletteg.o \
corelib_qt_datectrl.o \
- corelib_qt_timectrl.o
+ corelib_qt_timectrl.o \
+ corelib_qt_overlay.o
@COND_TOOLKIT_QT@__GUI_SRC_OBJECTS_3 = $(COND_TOOLKIT_QT___GUI_SRC_OBJECTS_3)
@COND_PLATFORM_UNIX_1@__QT_PLATFORM_SRC_OBJECTS_3 = \
@COND_PLATFORM_UNIX_1@ corelib_unix_dialup.o corelib_unix_joystick.o \
@@ -14975,6 +14987,9 @@ monodll_lzmastream.o: $(srcdir)/src/common/lzmastream.cpp $(MONODLL_ODEP)
monodll_common_uilocale.o: $(srcdir)/src/common/uilocale.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/uilocale.cpp
+monodll_fs_data.o: $(srcdir)/src/common/fs_data.cpp $(MONODLL_ODEP)
+ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/fs_data.cpp
+
monodll_unix_mimetype.o: $(srcdir)/src/unix/mimetype.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/mimetype.cpp
@@ -15815,6 +15830,9 @@ monodll_qt_datectrl.o: $(srcdir)/src/qt/datectrl.cpp $(MONODLL_ODEP)
monodll_qt_timectrl.o: $(srcdir)/src/qt/timectrl.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/qt/timectrl.cpp
+monodll_qt_overlay.o: $(srcdir)/src/qt/overlay.cpp $(MONODLL_ODEP)
+ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/qt/overlay.cpp
+
monodll_mdig.o: $(srcdir)/src/generic/mdig.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
@@ -19724,6 +19742,9 @@ monolib_lzmastream.o: $(srcdir)/src/common/lzmastream.cpp $(MONOLIB_ODEP)
monolib_common_uilocale.o: $(srcdir)/src/common/uilocale.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/uilocale.cpp
+monolib_fs_data.o: $(srcdir)/src/common/fs_data.cpp $(MONOLIB_ODEP)
+ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/fs_data.cpp
+
monolib_unix_mimetype.o: $(srcdir)/src/unix/mimetype.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/mimetype.cpp
@@ -20564,6 +20585,9 @@ monolib_qt_datectrl.o: $(srcdir)/src/qt/datectrl.cpp $(MONOLIB_ODEP)
monolib_qt_timectrl.o: $(srcdir)/src/qt/timectrl.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/qt/timectrl.cpp
+monolib_qt_overlay.o: $(srcdir)/src/qt/overlay.cpp $(MONOLIB_ODEP)
+ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/qt/overlay.cpp
+
monolib_mdig.o: $(srcdir)/src/generic/mdig.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
@@ -24473,6 +24497,9 @@ basedll_lzmastream.o: $(srcdir)/src/common/lzmastream.cpp $(BASEDLL_ODEP)
basedll_common_uilocale.o: $(srcdir)/src/common/uilocale.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/uilocale.cpp
+basedll_fs_data.o: $(srcdir)/src/common/fs_data.cpp $(BASEDLL_ODEP)
+ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/fs_data.cpp
+
basedll_unix_mimetype.o: $(srcdir)/src/unix/mimetype.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/unix/mimetype.cpp
@@ -24953,6 +24980,9 @@ baselib_lzmastream.o: $(srcdir)/src/common/lzmastream.cpp $(BASELIB_ODEP)
baselib_common_uilocale.o: $(srcdir)/src/common/uilocale.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/uilocale.cpp
+baselib_fs_data.o: $(srcdir)/src/common/fs_data.cpp $(BASELIB_ODEP)
+ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/fs_data.cpp
+
baselib_unix_mimetype.o: $(srcdir)/src/unix/mimetype.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/unix/mimetype.cpp
@@ -25991,6 +26021,9 @@ coredll_qt_datectrl.o: $(srcdir)/src/qt/datectrl.cpp $(COREDLL_ODEP)
coredll_qt_timectrl.o: $(srcdir)/src/qt/timectrl.cpp $(COREDLL_ODEP)
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/qt/timectrl.cpp
+coredll_qt_overlay.o: $(srcdir)/src/qt/overlay.cpp $(COREDLL_ODEP)
+ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/qt/overlay.cpp
+
coredll_mdig.o: $(srcdir)/src/generic/mdig.cpp $(COREDLL_ODEP)
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
@@ -29708,6 +29741,9 @@ corelib_qt_datectrl.o: $(srcdir)/src/qt/datectrl.cpp $(CORELIB_ODEP)
corelib_qt_timectrl.o: $(srcdir)/src/qt/timectrl.cpp $(CORELIB_ODEP)
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/qt/timectrl.cpp
+corelib_qt_overlay.o: $(srcdir)/src/qt/overlay.cpp $(CORELIB_ODEP)
+ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/qt/overlay.cpp
+
corelib_mdig.o: $(srcdir)/src/generic/mdig.cpp $(CORELIB_ODEP)
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/mdig.cpp
diff --git a/build/bakefiles/config.bkl b/build/bakefiles/config.bkl
index 52448048e4..3963e7e3f3 100644
--- a/build/bakefiles/config.bkl
+++ b/build/bakefiles/config.bkl
@@ -485,9 +485,9 @@ it if SHARED=1 unless you know what you are doing.
- opengl32.lib glu32.lib
- opengl32.lib glu32.lib
- -lopengl32 -lglu32
+ opengl32.lib
+ opengl32.lib
+ -lopengl32
diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl
index 87edd2c534..352bcb2414 100644
--- a/build/bakefiles/files.bkl
+++ b/build/bakefiles/files.bkl
@@ -477,6 +477,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/generic/paletteg.cpp
src/qt/datectrl.cpp
src/qt/timectrl.cpp
+ src/qt/overlay.cpp
@@ -579,6 +580,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/common/secretstore.cpp
src/common/lzmastream.cpp
src/common/uilocale.cpp
+ src/common/fs_data.cpp
src/common/event.cpp
@@ -754,6 +756,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/lzmastream.h
wx/localedefs.h
wx/uilocale.h
+ wx/fs_data.h
@@ -1321,6 +1324,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/bmpbndl.h
wx/filedlgcustomize.h
wx/compositebookctrl.h
+ wx/persist/combobox.h
diff --git a/build/bakefiles/mac_bundles.bkl b/build/bakefiles/mac_bundles.bkl
index 01a854c8d7..16817ca96d 100644
--- a/build/bakefiles/mac_bundles.bkl
+++ b/build/bakefiles/mac_bundles.bkl
@@ -49,10 +49,10 @@
sed -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_GUI_IDENTIFIER}/org.wxwidgets.$(id)/" \
-e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_EXECUTABLE_NAME}/$(id)/" \
-e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_BUNDLE_NAME}/$(id)/" \
- -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_COPYRIGHT}/Copyright 2002-2023 wxWidgets/" \
+ -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_COPYRIGHT}/Copyright 2002-2024 wxWidgets/" \
-e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_BUNDLE_VERSION}/$(WX_VERSION)/" \
- -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_INFO_STRING}/$(id) version $(WX_VERSION), (c) 2002-2023 wxWidgets/" \
- -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_LONG_VERSION_STRING}/$(WX_VERSION), (c) 2002-2023 wxWidgets/" \
+ -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_INFO_STRING}/$(id) version $(WX_VERSION), (c) 2002-2024 wxWidgets/" \
+ -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_LONG_VERSION_STRING}/$(WX_VERSION), (c) 2002-2024 wxWidgets/" \
-e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_SHORT_VERSION_STRING}/$(WX_RELEASE)/" \
$(BUNDLE_PLIST) >$(BUNDLE)/Info.plist
diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake
index f8111e90e8..80097d10f3 100644
--- a/build/cmake/files.cmake
+++ b/build/cmake/files.cmake
@@ -390,6 +390,7 @@ set(QT_SRC
src/generic/paletteg.cpp
src/qt/datectrl.cpp
src/qt/timectrl.cpp
+ src/qt/overlay.cpp
)
set(MEDIA_QT_SRC
@@ -491,6 +492,7 @@ set(BASE_CMN_SRC
src/generic/fswatcherg.cpp
src/common/lzmastream.cpp
src/common/uilocale.cpp
+ src/common/fs_data.cpp
)
set(BASE_AND_GUI_CMN_SRC
@@ -668,6 +670,7 @@ set(BASE_CMN_HDR
wx/lzmastream.h
wx/localedefs.h
wx/uilocale.h
+ wx/fs_data.h
)
set(NET_UNIX_SRC
@@ -1222,6 +1225,7 @@ set(GUI_CMN_HDR
wx/bmpbndl.h
wx/filedlgcustomize.h
wx/compositebookctrl.h
+ wx/persist/combobox.h
)
set(UNIX_SRC
diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake
index 6396628bf5..5faa49a806 100644
--- a/build/cmake/init.cmake
+++ b/build/cmake/init.cmake
@@ -10,6 +10,25 @@
if(DEFINED wxBUILD_CXX_STANDARD AND NOT wxBUILD_CXX_STANDARD STREQUAL COMPILER_DEFAULT)
set(CMAKE_CXX_STANDARD ${wxBUILD_CXX_STANDARD})
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
+else()
+ # If the standard is not set explicitly, check whether we can use C++11
+ # without any special options.
+ include(CheckCXXSourceCompiles)
+ check_cxx_source_compiles("
+ #include
+ int main() {
+ std::vector v{1,2,3};
+ for (auto& n : v)
+ --n;
+ return v[0];
+ }"
+ wxHAVE_CXX11)
+ if(NOT wxHAVE_CXX11)
+ # If not, request it explicitly and let CMake check if it's supported.
+ set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
+ endif()
endif()
if(MSVC)
@@ -411,7 +430,7 @@ if(wxUSE_GUI)
else()
find_package(OpenGL)
if(OPENGL_FOUND)
- foreach(gltarget OpenGL::GL OpenGL::GLU OpenGL::OpenGL)
+ foreach(gltarget OpenGL::GL OpenGL::OpenGL)
if(TARGET ${gltarget})
set(OPENGL_LIBRARIES ${gltarget} ${OPENGL_LIBRARIES})
endif()
diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake
index 3a569cbd76..a1f2baaaa9 100644
--- a/build/cmake/options.cmake
+++ b/build/cmake/options.cmake
@@ -46,8 +46,6 @@ endif()
# support setting the C++ standard, present it an option to the user
if(DEFINED CMAKE_CXX_STANDARD)
set(wxCXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD})
-elseif(APPLE)
- set(wxCXX_STANDARD_DEFAULT 11)
else()
set(wxCXX_STANDARD_DEFAULT COMPILER_DEFAULT)
endif()
diff --git a/build/cmake/setup.cmake b/build/cmake/setup.cmake
index b352e61c95..59899bff9a 100644
--- a/build/cmake/setup.cmake
+++ b/build/cmake/setup.cmake
@@ -110,7 +110,7 @@ function(wx_check_cxx_source_compiles code res_var)
cmake_pop_check_state()
endfunction()
-# wx_check_cxx_source_compiles( [headers...])
+# wx_check_c_source_compiles( [headers...])
function(wx_check_c_source_compiles code res_var)
set(src)
foreach(header ${ARGN})
diff --git a/build/files b/build/files
index 36f6290a7f..9f214b05ea 100644
--- a/build/files
+++ b/build/files
@@ -379,6 +379,7 @@ QT_SRC=
src/qt/msgdlg.cpp
src/qt/nonownedwnd.cpp
src/qt/notebook.cpp
+ src/qt/overlay.cpp
src/qt/pen.cpp
src/qt/popupwin.cpp
src/qt/printdlg.cpp
@@ -454,6 +455,7 @@ BASE_CMN_SRC =
src/common/filtfind.cpp
src/common/fmapbase.cpp
src/common/fs_arc.cpp
+ src/common/fs_data.cpp
src/common/fs_filter.cpp
src/common/hash.cpp
src/common/hashmap.cpp
@@ -570,6 +572,7 @@ BASE_CMN_HDR =
wx/fontenc.h
wx/fontmap.h
wx/fs_arc.h
+ wx/fs_data.h
wx/fs_filter.h
wx/fs_mem.h
wx/fs_zip.h
@@ -1149,6 +1152,7 @@ GUI_CMN_HDR =
wx/peninfobase.h
wx/persist.h
wx/persist/bookctrl.h
+ wx/persist/combobox.h
wx/persist/dataview.h
wx/persist/splitter.h
wx/persist/toplevel.h
diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc
index d53702447b..3eab28dea9 100644
--- a/build/msw/makefile.gcc
+++ b/build/msw/makefile.gcc
@@ -500,6 +500,7 @@ MONODLL_OBJECTS = \
$(OBJS)\monodll_common_secretstore.o \
$(OBJS)\monodll_lzmastream.o \
$(OBJS)\monodll_common_uilocale.o \
+ $(OBJS)\monodll_fs_data.o \
$(OBJS)\monodll_basemsw.o \
$(OBJS)\monodll_crashrpt.o \
$(OBJS)\monodll_debughlp.o \
@@ -661,6 +662,7 @@ MONOLIB_OBJECTS = \
$(OBJS)\monolib_common_secretstore.o \
$(OBJS)\monolib_lzmastream.o \
$(OBJS)\monolib_common_uilocale.o \
+ $(OBJS)\monolib_fs_data.o \
$(OBJS)\monolib_basemsw.o \
$(OBJS)\monolib_crashrpt.o \
$(OBJS)\monolib_debughlp.o \
@@ -810,6 +812,7 @@ BASEDLL_OBJECTS = \
$(OBJS)\basedll_common_secretstore.o \
$(OBJS)\basedll_lzmastream.o \
$(OBJS)\basedll_common_uilocale.o \
+ $(OBJS)\basedll_fs_data.o \
$(OBJS)\basedll_basemsw.o \
$(OBJS)\basedll_crashrpt.o \
$(OBJS)\basedll_debughlp.o \
@@ -940,6 +943,7 @@ BASELIB_OBJECTS = \
$(OBJS)\baselib_common_secretstore.o \
$(OBJS)\baselib_lzmastream.o \
$(OBJS)\baselib_common_uilocale.o \
+ $(OBJS)\baselib_fs_data.o \
$(OBJS)\baselib_basemsw.o \
$(OBJS)\baselib_crashrpt.o \
$(OBJS)\baselib_debughlp.o \
@@ -5959,7 +5963,7 @@ ifeq ($(USE_OPENGL),1)
$(LIBDIRNAME)\wx$(PORTNAME)$(WXUNIVNAME)$(WX_VERSION_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl$(WXCOMPILER)$(VENDORTAG).dll: $(GLDLL_OBJECTS) $(LIBDIRNAME)\libwxexpat$(WXDEBUGFLAG).a $(LIBDIRNAME)\libwxzlib$(WXDEBUGFLAG).a $(LIBDIRNAME)\libwxregexu$(WXDEBUGFLAG).a $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla) $(__wxlexilla) $(OBJS)\gldll_version_rc.o $(__basedll___depname) $(__coredll___depname) $(__monodll___depname)
$(foreach f,$(subst \,/,$(GLDLL_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp))
@move /y $@.rsp.tmp $@.rsp >nul
- $(CXX) $(LINK_DLL_FLAGS) -fPIC -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--out-implib=$(LIBDIRNAME)\libwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.a $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme $(__WXLIBGLDEP_CORE_p) $(__WXLIBGLDEP_BASE_p) $(__WXLIB_MONO_p) -lopengl32 -lglu32
+ $(CXX) $(LINK_DLL_FLAGS) -fPIC -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--out-implib=$(LIBDIRNAME)\libwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.a $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme $(__WXLIBGLDEP_CORE_p) $(__WXLIBGLDEP_BASE_p) $(__WXLIB_MONO_p) -lopengl32
@-del $@.rsp
endif
endif
@@ -7243,6 +7247,9 @@ $(OBJS)\monodll_lzmastream.o: ../../src/common/lzmastream.cpp
$(OBJS)\monodll_common_uilocale.o: ../../src/common/uilocale.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\monodll_fs_data.o: ../../src/common/fs_data.cpp
+ $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\monodll_basemsw.o: ../../src/msw/basemsw.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@@ -9837,6 +9844,9 @@ $(OBJS)\monolib_lzmastream.o: ../../src/common/lzmastream.cpp
$(OBJS)\monolib_common_uilocale.o: ../../src/common/uilocale.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\monolib_fs_data.o: ../../src/common/fs_data.cpp
+ $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\monolib_basemsw.o: ../../src/msw/basemsw.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@@ -12431,6 +12441,9 @@ $(OBJS)\basedll_lzmastream.o: ../../src/common/lzmastream.cpp
$(OBJS)\basedll_common_uilocale.o: ../../src/common/uilocale.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\basedll_fs_data.o: ../../src/common/fs_data.cpp
+ $(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\basedll_basemsw.o: ../../src/msw/basemsw.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
@@ -12773,6 +12786,9 @@ $(OBJS)\baselib_lzmastream.o: ../../src/common/lzmastream.cpp
$(OBJS)\baselib_common_uilocale.o: ../../src/common/uilocale.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\baselib_fs_data.o: ../../src/common/fs_data.cpp
+ $(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\baselib_basemsw.o: ../../src/msw/basemsw.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc
index 9b3188dd74..3efead9883 100644
--- a/build/msw/makefile.vc
+++ b/build/msw/makefile.vc
@@ -536,6 +536,7 @@ MONODLL_OBJECTS = \
$(OBJS)\monodll_common_secretstore.obj \
$(OBJS)\monodll_lzmastream.obj \
$(OBJS)\monodll_common_uilocale.obj \
+ $(OBJS)\monodll_fs_data.obj \
$(OBJS)\monodll_basemsw.obj \
$(OBJS)\monodll_crashrpt.obj \
$(OBJS)\monodll_debughlp.obj \
@@ -706,6 +707,7 @@ MONOLIB_OBJECTS = \
$(OBJS)\monolib_common_secretstore.obj \
$(OBJS)\monolib_lzmastream.obj \
$(OBJS)\monolib_common_uilocale.obj \
+ $(OBJS)\monolib_fs_data.obj \
$(OBJS)\monolib_basemsw.obj \
$(OBJS)\monolib_crashrpt.obj \
$(OBJS)\monolib_debughlp.obj \
@@ -864,6 +866,7 @@ BASEDLL_OBJECTS = \
$(OBJS)\basedll_common_secretstore.obj \
$(OBJS)\basedll_lzmastream.obj \
$(OBJS)\basedll_common_uilocale.obj \
+ $(OBJS)\basedll_fs_data.obj \
$(OBJS)\basedll_basemsw.obj \
$(OBJS)\basedll_crashrpt.obj \
$(OBJS)\basedll_debughlp.obj \
@@ -1004,6 +1007,7 @@ BASELIB_OBJECTS = \
$(OBJS)\baselib_common_secretstore.obj \
$(OBJS)\baselib_lzmastream.obj \
$(OBJS)\baselib_common_uilocale.obj \
+ $(OBJS)\baselib_fs_data.obj \
$(OBJS)\baselib_basemsw.obj \
$(OBJS)\baselib_crashrpt.obj \
$(OBJS)\baselib_debughlp.obj \
@@ -6436,7 +6440,7 @@ wxstc: $(____wxstc_namedll_DEP) $(____wxstc_namelib_DEP)
!if "$(SHARED)" == "1" && "$(USE_GUI)" == "1" && "$(USE_OPENGL)" == "1"
$(LIBDIRNAME)\wx$(PORTNAME)$(WXUNIVNAME)$(WX_VERSION_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl$(WXCOMPILER)$(VENDORTAG).dll: $(OBJS)\gldll_dummy.obj $(GLDLL_OBJECTS) $(LIBDIRNAME)\wxexpat$(WXDEBUGFLAG).lib $(LIBDIRNAME)\wxzlib$(WXDEBUGFLAG).lib $(LIBDIRNAME)\wxregexu$(WXDEBUGFLAG).lib $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla) $(__wxlexilla) $(OBJS)\gldll_version.res $(__basedll___depname) $(__coredll___depname) $(__monodll___depname)
link /DLL /NOLOGO /OUT:$@ $(__DEBUGINFO_6) /pdb:"$(LIBDIRNAME)\wx$(PORTNAME)$(WXUNIVNAME)$(WX_VERSION_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl$(WXCOMPILER)$(VENDORTAG).pdb" $(__DEBUGINFO_619) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @<<
- $(GLDLL_OBJECTS) $(GLDLL_RESOURCES) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib $(__WXLIBGLDEP_CORE_p) $(__WXLIBGLDEP_BASE_p) $(__WXLIB_MONO_p) opengl32.lib glu32.lib /IMPLIB:$(LIBDIRNAME)\wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib
+ $(GLDLL_OBJECTS) $(GLDLL_RESOURCES) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib $(__WXLIBGLDEP_CORE_p) $(__WXLIBGLDEP_BASE_p) $(__WXLIB_MONO_p) opengl32.lib /IMPLIB:$(LIBDIRNAME)\wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib
<<
!endif
@@ -7700,6 +7704,9 @@ $(OBJS)\monodll_lzmastream.obj: ..\..\src\common\lzmastream.cpp
$(OBJS)\monodll_common_uilocale.obj: ..\..\src\common\uilocale.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\uilocale.cpp
+$(OBJS)\monodll_fs_data.obj: ..\..\src\common\fs_data.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\common\fs_data.cpp
+
$(OBJS)\monodll_basemsw.obj: ..\..\src\msw\basemsw.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\basemsw.cpp
@@ -10294,6 +10301,9 @@ $(OBJS)\monolib_lzmastream.obj: ..\..\src\common\lzmastream.cpp
$(OBJS)\monolib_common_uilocale.obj: ..\..\src\common\uilocale.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\uilocale.cpp
+$(OBJS)\monolib_fs_data.obj: ..\..\src\common\fs_data.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\common\fs_data.cpp
+
$(OBJS)\monolib_basemsw.obj: ..\..\src\msw\basemsw.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\basemsw.cpp
@@ -12888,6 +12898,9 @@ $(OBJS)\basedll_lzmastream.obj: ..\..\src\common\lzmastream.cpp
$(OBJS)\basedll_common_uilocale.obj: ..\..\src\common\uilocale.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\uilocale.cpp
+$(OBJS)\basedll_fs_data.obj: ..\..\src\common\fs_data.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\common\fs_data.cpp
+
$(OBJS)\basedll_basemsw.obj: ..\..\src\msw\basemsw.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) ..\..\src\msw\basemsw.cpp
@@ -13230,6 +13243,9 @@ $(OBJS)\baselib_lzmastream.obj: ..\..\src\common\lzmastream.cpp
$(OBJS)\baselib_common_uilocale.obj: ..\..\src\common\uilocale.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\uilocale.cpp
+$(OBJS)\baselib_fs_data.obj: ..\..\src\common\fs_data.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\common\fs_data.cpp
+
$(OBJS)\baselib_basemsw.obj: ..\..\src\msw\basemsw.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) ..\..\src\msw\basemsw.cpp
diff --git a/build/msw/wx_base.vcxproj b/build/msw/wx_base.vcxproj
index f7ae103688..ec67b604be 100644
--- a/build/msw/wx_base.vcxproj
+++ b/build/msw/wx_base.vcxproj
@@ -622,6 +622,7 @@
$(IntDir)common_%(Filename).obj
$(IntDir)common_%(Filename).obj
+
@@ -841,6 +842,7 @@
+
diff --git a/build/msw/wx_base.vcxproj.filters b/build/msw/wx_base.vcxproj.filters
index fc5b55840e..f0068f6427 100644
--- a/build/msw/wx_base.vcxproj.filters
+++ b/build/msw/wx_base.vcxproj.filters
@@ -123,6 +123,9 @@
Common Sources
+
+ Common Sources
+
Common Sources
@@ -535,6 +538,9 @@
Common Headers
+
+ Common Headers
+
Common Headers
diff --git a/build/msw/wx_core.vcxproj b/build/msw/wx_core.vcxproj
index 5ff159b0b2..746c6ff8d6 100644
--- a/build/msw/wx_core.vcxproj
+++ b/build/msw/wx_core.vcxproj
@@ -1518,6 +1518,7 @@
+
diff --git a/build/msw/wx_core.vcxproj.filters b/build/msw/wx_core.vcxproj.filters
index 3d8baa65f3..4ad1ecdedd 100644
--- a/build/msw/wx_core.vcxproj.filters
+++ b/build/msw/wx_core.vcxproj.filters
@@ -2056,6 +2056,9 @@
Common Headers
+
+ Common Headers
+
Common Headers
diff --git a/build/msw/wx_gl.vcxproj b/build/msw/wx_gl.vcxproj
index 004f7fe46b..4a96394fc8 100644
--- a/build/msw/wx_gl.vcxproj
+++ b/build/msw/wx_gl.vcxproj
@@ -306,7 +306,7 @@
%(AdditionalOptions)
- wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)
+ wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;opengl32.lib;%(AdditionalDependencies)
$(OutDir)$(wxToolkitLibNamePrefix)$(ProjectName).lib
true
$(OutDir);%(AdditionalLibraryDirectories)
@@ -347,7 +347,7 @@
%(AdditionalOptions)
- wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)
+ wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;opengl32.lib;%(AdditionalDependencies)
$(OutDir)$(wxToolkitLibNamePrefix)$(ProjectName).lib
true
$(OutDir);%(AdditionalLibraryDirectories)
@@ -388,7 +388,7 @@
%(AdditionalOptions)
- wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)
+ wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;opengl32.lib;%(AdditionalDependencies)
$(OutDir)$(wxToolkitLibNamePrefix)$(ProjectName).lib
true
$(OutDir);%(AdditionalLibraryDirectories)
@@ -432,7 +432,7 @@
%(AdditionalOptions)
- wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)
+ wxtiff$(wxSuffixDebug).lib;wxjpeg$(wxSuffixDebug).lib;wxpng$(wxSuffixDebug).lib;wxzlib$(wxSuffixDebug).lib;wxregexu$(wxSuffixDebug).lib;wxexpat$(wxSuffixDebug).lib;$(wxToolkitLibNamePrefix)core.lib;$(wxBaseLibNamePrefix).lib;opengl32.lib;%(AdditionalDependencies)
$(OutDir)$(wxToolkitLibNamePrefix)$(ProjectName).lib
true
$(OutDir);%(AdditionalLibraryDirectories)
@@ -494,4 +494,4 @@
-
\ No newline at end of file
+
diff --git a/build/msw/wx_setup.props b/build/msw/wx_setup.props
index c02178f5f1..8aac1ee695 100644
--- a/build/msw/wx_setup.props
+++ b/build/msw/wx_setup.props
@@ -11,6 +11,7 @@
vc
+ u
custom
dynamic
MultiThreadedDLL
diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh
index 8c5de16fc5..3932c09673 100755
--- a/build/tools/before_install.sh
+++ b/build/tools/before_install.sh
@@ -95,7 +95,7 @@ case $(uname -s) in
extra_deps="$extra_deps \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
- libglu1-mesa-dev"
+ "
esac
# Install locales used by our tests to run all the tests instead of
@@ -128,7 +128,7 @@ case $(uname -s) in
fi
if [ -f /etc/redhat-release ]; then
- dnf install -y ${WX_EXTRA_PACKAGES} expat-devel findutils g++ git-core gspell-devel gstreamer1-plugins-base-devel gtk3-devel make libcurl-devel libGLU-devel libjpeg-devel libnotify-devel libpng-devel libSM-devel libsecret-devel libtiff-devel SDL-devel webkit2gtk4.1-devel zlib-devel
+ dnf install -y ${WX_EXTRA_PACKAGES} expat-devel findutils g++ git-core gspell-devel gstreamer1-plugins-base-devel gtk3-devel make libcurl-devel libjpeg-devel libnotify-devel libpng-devel libSM-devel libsecret-devel libtiff-devel SDL-devel webkit2gtk4.1-devel zlib-devel
fi
;;
diff --git a/configure b/configure
index 74ff5ec0d6..7743158c8f 100755
--- a/configure
+++ b/configure
@@ -962,8 +962,6 @@ WAYLAND_EGL_LIBS
WAYLAND_EGL_CFLAGS
EGL_LIBS
EGL_CFLAGS
-GLU_LIBS
-GLU_CFLAGS
GL_LIBS
GL_CFLAGS
SM_LIBS
@@ -1421,8 +1419,6 @@ SM_CFLAGS
SM_LIBS
GL_CFLAGS
GL_LIBS
-GLU_CFLAGS
-GLU_LIBS
EGL_CFLAGS
EGL_LIBS
WAYLAND_EGL_CFLAGS
@@ -2458,8 +2454,6 @@ Some influential environment variables:
SM_LIBS linker flags for SM, overriding pkg-config
GL_CFLAGS C compiler flags for GL, overriding pkg-config
GL_LIBS linker flags for GL, overriding pkg-config
- GLU_CFLAGS C compiler flags for GLU, overriding pkg-config
- GLU_LIBS linker flags for GLU, overriding pkg-config
EGL_CFLAGS C compiler flags for EGL, overriding pkg-config
EGL_LIBS linker flags for EGL, overriding pkg-config
WAYLAND_EGL_CFLAGS
@@ -22922,10 +22916,8 @@ $as_echo "$as_me: WARNING: --enable-macosx_arch is ignored when --enable-univers
if test "x$wxUSE_UNIVERSAL_BINARY" != xyes; then
OSX_ARCH_OPTS=$wxUSE_UNIVERSAL_BINARY
- else OSX_ARCH_OPTS="i386"
- if test "$wxUSE_OSX_COCOA" = 1; then
- OSX_ARCH_OPTS="$OSX_ARCH_OPTS,x86_64"
- fi
+ else
+ OSX_ARCH_OPTS=arm64,x86_64
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for architectures to use in universal binary" >&5
@@ -30212,7 +30204,7 @@ if test "$wxUSE_OPENGL" = "yes" -o "$wxUSE_OPENGL" = "auto"; then
if test "$wxUSE_OSX_COCOA" = 1; then
OPENGL_LIBS="-framework OpenGL -framework AGL"
elif test "$wxUSE_MSW" = 1; then
- OPENGL_LIBS="-lopengl32 -lglu32"
+ OPENGL_LIBS="-lopengl32"
elif test "$wxUSE_X11" = 1 -o "$wxUSE_GTK" = 1 -o "$wxUSE_QT" = 1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL headers" >&5
@@ -30253,10 +30245,6 @@ $as_echo "not found" >&6; }
"
if test "x$ac_cv_header_GL_gl_h" = xyes; then :
- ac_fn_c_check_header_compile "$LINENO" "GL/glu.h" "ac_cv_header_GL_glu_h" "
-"
-if test "x$ac_cv_header_GL_glu_h" = xyes; then :
-
found_gl=0
@@ -30619,369 +30607,8 @@ fi
fi
fi
-
- ac_find_libraries=
-
- fl_pkgname=`echo "GLU" | tr [:upper:] [:lower:]`
-
-
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_PKG_CONFIG+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_path_PKG_CONFIG"; then
- ac_pt_PKG_CONFIG=$PKG_CONFIG
- # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $ac_pt_PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
-if test -n "$ac_pt_PKG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
-$as_echo "$ac_pt_PKG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_pt_PKG_CONFIG" = x; then
- PKG_CONFIG=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- PKG_CONFIG=$ac_pt_PKG_CONFIG
- fi
-else
- PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
-fi
-
-fi
-if test -n "$PKG_CONFIG"; then
- _pkg_min_version=0.9.0
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
-$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
- if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- PKG_CONFIG=""
- fi
-
-fi 6> /dev/null
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLU" >&5
-$as_echo_n "checking for GLU... " >&6; }
-
-if test -n "$PKG_CONFIG"; then
- if test -n "$GLU_CFLAGS"; then
- pkg_cv_GLU_CFLAGS="$GLU_CFLAGS"
- else
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$fl_pkgname\""; } >&5
- ($PKG_CONFIG --exists --print-errors "$fl_pkgname") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_GLU_CFLAGS=`$PKG_CONFIG --cflags "$fl_pkgname" 2>/dev/null`
-else
- pkg_failed=yes
-fi
- fi
-else
- pkg_failed=untried
-fi
-if test -n "$PKG_CONFIG"; then
- if test -n "$GLU_LIBS"; then
- pkg_cv_GLU_LIBS="$GLU_LIBS"
- else
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$fl_pkgname\""; } >&5
- ($PKG_CONFIG --exists --print-errors "$fl_pkgname") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_GLU_LIBS=`$PKG_CONFIG --libs "$fl_pkgname" 2>/dev/null`
-else
- pkg_failed=yes
-fi
- fi
-else
- pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- _pkg_short_errors_supported=yes
-else
- _pkg_short_errors_supported=no
-fi
- if test $_pkg_short_errors_supported = yes; then
- GLU_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$fl_pkgname"`
- else
- GLU_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$fl_pkgname"`
- fi
- # Put the nasty error message in config.log where it belongs
- echo "$GLU_PKG_ERRORS" >&5
-
-
- if test "x$ac_find_libraries" = "x"; then
- if test "xgluBeginCurve" != "x"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gluBeginCurve in -lGLU" >&5
-$as_echo_n "checking for gluBeginCurve in -lGLU... " >&6; }
-if ${ac_cv_lib_GLU_gluBeginCurve+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lGLU $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gluBeginCurve ();
-int
-main ()
-{
-return gluBeginCurve ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_GLU_gluBeginCurve=yes
-else
- ac_cv_lib_GLU_gluBeginCurve=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GLU_gluBeginCurve" >&5
-$as_echo "$ac_cv_lib_GLU_gluBeginCurve" >&6; }
-if test "x$ac_cv_lib_GLU_gluBeginCurve" = xyes; then :
- ac_find_libraries="std"
-fi
-
- fi
- fi
-
- if test "x$ac_find_libraries" = "x"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking elsewhere" >&5
-$as_echo_n "checking elsewhere... " >&6; }
-
- ac_find_libraries=
- for ac_dir in /opt/graphics/OpenGL/lib $SEARCH_LIB
- do
- for ac_extension in a so sl dylib dll.a; do
- if test -f "$ac_dir/libGLU.$ac_extension"; then
- ac_find_libraries=$ac_dir
- break 2
- fi
- done
- done
-
- if test "x$ac_find_libraries" != "x"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- fi
- fi
-
-elif test $pkg_failed = untried; then
-
- if test "x$ac_find_libraries" = "x"; then
- if test "xgluBeginCurve" != "x"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gluBeginCurve in -lGLU" >&5
-$as_echo_n "checking for gluBeginCurve in -lGLU... " >&6; }
-if ${ac_cv_lib_GLU_gluBeginCurve+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lGLU $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gluBeginCurve ();
-int
-main ()
-{
-return gluBeginCurve ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_GLU_gluBeginCurve=yes
-else
- ac_cv_lib_GLU_gluBeginCurve=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GLU_gluBeginCurve" >&5
-$as_echo "$ac_cv_lib_GLU_gluBeginCurve" >&6; }
-if test "x$ac_cv_lib_GLU_gluBeginCurve" = xyes; then :
- ac_find_libraries="std"
-fi
-
- fi
- fi
-
- if test "x$ac_find_libraries" = "x"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking elsewhere" >&5
-$as_echo_n "checking elsewhere... " >&6; }
-
- ac_find_libraries=
- for ac_dir in /opt/graphics/OpenGL/lib $SEARCH_LIB
- do
- for ac_extension in a so sl dylib dll.a; do
- if test -f "$ac_dir/libGLU.$ac_extension"; then
- ac_find_libraries=$ac_dir
- break 2
- fi
- done
- done
-
- if test "x$ac_find_libraries" != "x"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- fi
- fi
-
-else
- GLU_CFLAGS=$pkg_cv_GLU_CFLAGS
- GLU_LIBS=$pkg_cv_GLU_LIBS
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
- ac_find_libraries="std"
-
- eval ac_find_cflags=\$GLU_CFLAGS
- eval fl_libs=\$GLU_LIBS
-
- for fl_path in $fl_libs
- do
- if test `echo "$fl_path" | cut -c 1-2` = "-L"; then
- ac_find_libraries=`echo "$fl_path" | cut -c 3-`
- fi
- done
-
-fi
-
- if test "$ac_find_libraries" != "" ; then
- if test "$ac_find_libraries" != "std" ; then
-
- if test "$ac_find_libraries" = "default location"; then
- ac_path_to_link=""
- else
- echo "$LDFLAGS" | grep "\-L$ac_find_libraries" > /dev/null
- result=$?
- if test $result = 0; then
- ac_path_to_link=""
- else
- ac_path_to_link=" -L$ac_find_libraries"
- fi
- fi
-
- if test "$ac_path_to_link" != " -L/usr/lib" -a \
- "$ac_path_to_link" != "$LDFLAGS_GL" ; then
- LDFLAGS_GL="$LDFLAGS_GL $ac_path_to_link"
- fi
- fi
-
found_gl=1
- OPENGL_LIBS="-lGL -lGLU"
+ OPENGL_LIBS="-lGL"
if test "$WXGTK3" = 1; then
if test "$wxUSE_GLCANVAS_EGL" != "no"; then
@@ -31148,7 +30775,6 @@ $as_echo "$as_me: wxGLCanvas will not have Wayland support" >&6;}
fi
fi
fi
- fi
fi
if test "$found_gl" != 1; then
@@ -31511,7 +31137,7 @@ fi
LDFLAGS_GL="$LDFLAGS_GL $ac_path_to_link"
fi
fi
- OPENGL_LIBS="-lMesaGL -lMesaGLU"
+ OPENGL_LIBS="-lMesaGL"
fi
fi
@@ -31519,10 +31145,6 @@ fi
-fi
-
-
-
if test "x$OPENGL_LIBS" = "x"; then
if test "$wxUSE_OPENGL" = "yes"; then
as_fn_error $? "OpenGL libraries not available" "$LINENO" 5
@@ -43580,10 +43202,7 @@ for subdir in $SUBDIRS; do
makefiles="samples/$subtree/Makefile.in $makefiles"
done
else
- disabled_var=DISABLED_`echo $subdir | tr '[a-z]' '[A-Z]'`
- eval "disabled=\$$disabled_var"
- disabled=/`echo X $disabled | sed 's@ @/|/@g'`/
- makefiles=`(cd $srcdir ; find $subdir -name Makefile.in) | $EGREP -v "$disabled"`
+ makefiles=`(cd $srcdir ; find $subdir -name Makefile.in)`
fi
else
if test ${subdir} = "samples"; then
diff --git a/configure.ac b/configure.ac
index c6e7253811..d02a0c8c93 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1188,10 +1188,14 @@ if test "x$wxUSE_UNIVERSAL_BINARY" != xno ; then
if test "x$wxUSE_UNIVERSAL_BINARY" != xyes; then
OSX_ARCH_OPTS=$wxUSE_UNIVERSAL_BINARY
- else dnl Use all architectures supported
- OSX_ARCH_OPTS="i386"
- if test "$wxUSE_OSX_COCOA" = 1; then
- OSX_ARCH_OPTS="$OSX_ARCH_OPTS,x86_64"
+ else
+ dnl Use default architectures for the universal binaries: x86_64 is
+ dnl currently supported everywhere...
+ OSX_ARCH_OPTS=x86_64
+
+ dnl ... and non-ancient macOS versions also support ARM.
+ if [ `sw_vers -productVersion | sed 's/\..*//'` -gt 10 ]; then
+ OSX_ARCH_OPTS=arm64,$OSX_ARCH_OPTS
fi
fi
@@ -3313,7 +3317,7 @@ if test "$wxUSE_OPENGL" = "yes" -o "$wxUSE_OPENGL" = "auto"; then
if test "$wxUSE_OSX_COCOA" = 1; then
OPENGL_LIBS="-framework OpenGL -framework AGL"
elif test "$wxUSE_MSW" = 1; then
- OPENGL_LIBS="-lopengl32 -lglu32"
+ OPENGL_LIBS="-lopengl32"
elif test "$wxUSE_X11" = 1 -o "$wxUSE_GTK" = 1 -o "$wxUSE_QT" = 1; then
dnl adjust CPPFLAGS to include GL/gl.h location if necessary
@@ -3329,7 +3333,6 @@ if test "$wxUSE_OPENGL" = "yes" -o "$wxUSE_OPENGL" = "auto"; then
fi
AC_CHECK_HEADER(GL/gl.h, [
- AC_CHECK_HEADER(GL/glu.h, [
found_gl=0
WX_FIND_LIB(GL, glBegin, [/opt/graphics/OpenGL/lib])
@@ -3341,21 +3344,8 @@ if test "$wxUSE_OPENGL" = "yes" -o "$wxUSE_OPENGL" = "auto"; then
fi
fi
- dnl don't suppose that libGL and libGLU are always in the
- dnl same directory -- this is not true for some common
- dnl distributions
- WX_FIND_LIB(GLU, gluBeginCurve, [/opt/graphics/OpenGL/lib])
- if test "$ac_find_libraries" != "" ; then
- if test "$ac_find_libraries" != "std" ; then
- WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
- if test "$ac_path_to_link" != " -L/usr/lib" -a \
- "$ac_path_to_link" != "$LDFLAGS_GL" ; then
- LDFLAGS_GL="$LDFLAGS_GL $ac_path_to_link"
- fi
- fi
-
found_gl=1
- OPENGL_LIBS="-lGL -lGLU"
+ OPENGL_LIBS="-lGL"
if test "$WXGTK3" = 1; then
if test "$wxUSE_GLCANVAS_EGL" != "no"; then
@@ -3382,7 +3372,6 @@ if test "$wxUSE_OPENGL" = "yes" -o "$wxUSE_OPENGL" = "auto"; then
fi
fi
fi
- fi
fi
if test "$found_gl" != 1; then
@@ -3394,10 +3383,9 @@ if test "$wxUSE_OPENGL" = "yes" -o "$wxUSE_OPENGL" = "auto"; then
LDFLAGS_GL="$LDFLAGS_GL $ac_path_to_link"
fi
fi
- OPENGL_LIBS="-lMesaGL -lMesaGLU"
+ OPENGL_LIBS="-lMesaGL"
fi
fi
- ],, [ ])
],
[],
[ ])
@@ -8186,12 +8174,7 @@ for subdir in $SUBDIRS; do
done
else
dnl assume that everything compiles for utils &c
- dnl any that shouldn't be built can be added to
- dnl DISABLED_UTILS, DISABLED_DEMOS
- disabled_var=DISABLED_`echo $subdir | tr '[[a-z]]' '[[A-Z]]'`
- eval "disabled=\$$disabled_var"
- disabled=/`echo X $disabled | sed 's@ @/|/@g'`/
- makefiles=`(cd $srcdir ; find $subdir -name Makefile.in) | $EGREP -v "$disabled"`
+ makefiles=`(cd $srcdir ; find $subdir -name Makefile.in)`
fi
else
dnl we build wxBase only
diff --git a/docs/changes.txt b/docs/changes.txt
index e20e6429ac..abc1814055 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -31,6 +31,12 @@ Changes in behaviour not resulting in compilation errors
wxGLAttributes::Samplers(1).SampleBuffers(4) explicitly if you need to keep
using the same attributes that were previously used by default.
+- Default location of file used by wxFileConfig under Unix has changed to
+ XDG-compliant ~/.config/appname.conf instead of ~/.appname but note that
+ any existing files at the old location will still continue to be used.
+ See wxCONFIG_USE_XDG and wxCONFIG_USE_HOME for how to customize this
+ behaviour. You may also find wxFileConfig::MigrateLocalFile() useful.
+
- As first mentioned in 3.0 release notes, the value of wxTHREAD_WAIT_DEFAULT,
used by wxThread::Delete() and Wait() by default, has changed from
wxTHREAD_WAIT_YIELD to wxTHREAD_WAIT_BLOCK for safety and consistency.
@@ -113,6 +119,12 @@ Changes in behaviour which may result in build errors
compatible with the previous wxWidgets versions, but now compare values, and
not pointers, in their Index() member function.
+- All operators (e.g. "==", "+", etc) on wx types are not defined in global
+ scope any more, resulting in much better error messages but also preventing
+ them from implicitly being used with types convertible to wx types. If you
+ really need to use these operators with your own types, please use explicit
+ conversions.
+
- Due to the possibility to construct wxString from std::string_view some
previously valid code, such as "wxstr = {"Hello", 2}", is now ambiguous.
Please use explicit class name, e.g. "wxstr = wxString{"Hello", 2}" to
diff --git a/docs/doxygen/mainpages/const_cpp.h b/docs/doxygen/mainpages/const_cpp.h
index 9c982c3323..5a1df738de 100644
--- a/docs/doxygen/mainpages/const_cpp.h
+++ b/docs/doxygen/mainpages/const_cpp.h
@@ -168,6 +168,10 @@ Currently the following symbols exist:
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_AS_FILECONFIG, Defined if wxConfig is defined as
+ wxFileConfig. This constant is available since wxWidgets 3.3.0.}
+@itemdef{wxHAS_CONFIG_AS_REGCONFIG, Defined if wxConfig is defined as
+ wxRegConfig. This constant is available since wxWidgets 3.3.0.}
@itemdef{wxHAS_CONFIG_TEMPLATE_RW, Defined if the currently used compiler
supports template Read() and Write() methods in wxConfig.}
@itemdef{wxHAS_DEPRECATED_ATTR, Defined if C++14 @c [[deprecated]] attribute is
diff --git a/docs/doxygen/mainpages/copyright.h b/docs/doxygen/mainpages/copyright.h
index 1270b3a2e0..90c5affb13 100644
--- a/docs/doxygen/mainpages/copyright.h
+++ b/docs/doxygen/mainpages/copyright.h
@@ -11,7 +11,7 @@
@section section_copyright wxWidgets Copyrights and Licenses
-Copyright (c) 1992-2023 Julian Smart, Vadim Zeitlin, Stefan Csomor, Robert
+Copyright (c) 1992-2024 Julian Smart, Vadim Zeitlin, Stefan Csomor, Robert
Roebling, and other members of the wxWidgets team, please see the
acknowledgements section below.
diff --git a/docs/doxygen/overviews/filesystem.h b/docs/doxygen/overviews/filesystem.h
index 5a83c97413..ea0cd30c93 100644
--- a/docs/doxygen/overviews/filesystem.h
+++ b/docs/doxygen/overviews/filesystem.h
@@ -73,6 +73,10 @@ The following virtual file system handlers are part of wxWidgets so far:
A handler for archives such as zip
and tar. Include file is wx/fs_arc.h. URLs examples:
"archive.zip#zip:filename", "archive.tar.gz#gzip:#tar:filename".
+@li @b wxDataSchemeFSHandler:
+ A handler for accessing data inlined in URI according to RFC 2397.
+ URI example: "data:text/plain;base64,d3hXaWRnZXRzIGV4YW1wbGU=".
+ Include file is wx/fs_data.h.
@li @b wxFilterFSHandler:
A handler for compression schemes such
as gzip. Header is wx/fs_filter.h. URLs are in the form, e.g.:
diff --git a/docs/doxygen/regen.sh b/docs/doxygen/regen.sh
index efd5b340e5..5e315f2d22 100755
--- a/docs/doxygen/regen.sh
+++ b/docs/doxygen/regen.sh
@@ -215,7 +215,7 @@ if [[ "$1" = "docset" ]]; then
$PLIST_WRITE_CMD $DESTINATIONDIR/$DOCSETNAME/Contents/Info DocSetFeedURL $ATOMDIR/$ATOM
$PLIST_WRITE_CMD $DESTINATIONDIR/$DOCSETNAME/Contents/Info DocSetFallbackURL https://docs.wxwidgets.org
$PLIST_WRITE_CMD $DESTINATIONDIR/$DOCSETNAME/Contents/Info DocSetDescription "API reference and conceptual documentation for wxWidgets 3.0"
- $PLIST_WRITE_CMD $DESTINATIONDIR/$DOCSETNAME/Contents/Info NSHumanReadableCopyright "Copyright 1992-2023 wxWidgets team, Portions 1996 Artificial Intelligence Applications Institute"
+ $PLIST_WRITE_CMD $DESTINATIONDIR/$DOCSETNAME/Contents/Info NSHumanReadableCopyright "Copyright 1992-2024 wxWidgets team, Portions 1996 Artificial Intelligence Applications Institute"
$PLIST_WRITE_CMD $DESTINATIONDIR/$DOCSETNAME/Contents/Info isJavaScriptEnabled true
$PLIST_WRITE_CMD $DESTINATIONDIR/$DOCSETNAME/Contents/Info dashIndexFilePath index.html
$PLIST_WRITE_CMD $DESTINATIONDIR/$DOCSETNAME/Contents/Info DocSetPlatformFamily wx
diff --git a/docs/gtk/install.md b/docs/gtk/install.md
index 4e96a10591..2f87d65bae 100644
--- a/docs/gtk/install.md
+++ b/docs/gtk/install.md
@@ -18,13 +18,38 @@ the following in wxWidgets directory:
$ cd buildgtk
$ ../configure --with-gtk
$ make
+
+It is recommended to use `-jN` option with the last command, where `N` is a
+number of the processors in your system (which can be checked using `nproc`
+command if you are not sure), as this will dramatically speed up the build
+on modern systems. So in practice you should use a command like this:
+
+ $ make -j8
+
+(but don't use it unless you actually have 8 CPUs and enough memory for that
+many parallel compiler invocations).
+
+You may also prefer to add `-s` option to avoid normal output from make and/or
+redirect it you to a log file for further inspection.
+
+You should build at least the smallest possible wxWidgets sample to verify that
+everything is working as intended, by doing
+
+ $ cd samples/minimal
+ $ make
+
+and try running it using `./minimal` command from the same directory.
+
+After confirming that it works, you may want to install wxWidgets by running
+
$ sudo make install
$ sudo ldconfig
(if you get "ldconfig: command not found", try using `/sbin/ldconfig`)
-If you don't do the `make install` part, you can still use the libraries from
-the `buildgtk` directory, but they may not be available to other users.
+but note that this part is optional and you can use the libraries from
+the `buildgtk` directory by running `.../buildgtk/wx-config` script using its
+full path instead of just using `wx-config`.
Note that by default, GTK 3 is used. GTK 2 can be specified
with `--with-gtk=2` configure option.
@@ -47,8 +72,8 @@ Debian and Debian-based distribution these libraries are part of `libgtk-3-dev`
package, while in Fedora and other RPM-based distributions the same package is
known as `gtk3-devel`.
-For OpenGL support, you need `libgl1-mesa-dev` and `libglu1-mesa-dev` packages
-under Debian and `mesa-libGL-devel` and `mesa-libGLU-devel` under Fedora. For
+For OpenGL support, you need `libgl1-mesa-dev` packages
+under Debian and `mesa-libGL-devel` and under Fedora. For
EGL support, `libegl1-mesa-dev` or `mesa-libEGL-devel` is needed.
wxMediaCtrl implementation requires GStreamer and its plugins development
diff --git a/docs/osx/install.md b/docs/osx/install.md
index 2dfb91a3bf..3ffaa899ef 100644
--- a/docs/osx/install.md
+++ b/docs/osx/install.md
@@ -9,11 +9,11 @@ Most OS X developers should start by downloading and installing Xcode
from the App Store. It is a free IDE from Apple that provides
all of the tools you need for working with wxWidgets.
-After Xcode is installed, download wxWidgets-{version}.tar.bz2 and then
+After Xcode is installed, download `wxWidgets-{version}.tar.bz2` and then
double-click on it to unpack it to create a wxWidgets directory.
Next use Terminal (under Applications, Utilities, Terminal) to access a command
-prompt. Use cd to change directories to your wxWidgets directory and execute
+prompt. Use `cd` to change directories to your wxWidgets directory and execute
the following sets of commands from the wxWidgets directory.
mkdir build-cocoa-debug
@@ -21,27 +21,54 @@ the following sets of commands from the wxWidgets directory.
../configure --enable-debug
make
-Build the samples and demos
+It is recommended to use `-jN` option with the last command, where `N` is a
+number of the processors in your system (which can be checked using `sysctl -n
+hw.ncpu` command if you are not sure), as this will dramatically speed up the
+build on modern systems. So in practice you should use a command like this:
+
+ make -j8
+
+(but don't use it unless you actually have 8 CPUs and enough memory for that
+many parallel compiler invocations).
+
+You may also prefer to add `-s` option to avoid normal output from make and/or
+redirect it you to a log file for further inspection.
+
+You should build at least the smallest possible wxWidgets sample to verify that
+everything is working as intended, by doing
+
+ cd samples/minimal
+ make
+
+and then running `minimal.app` from this directory from Finder.
+
+If you'd like to, you can also build all the other samples and demos
cd samples; make;cd ..
cd demos; make;cd ..
-After the compilation completes, use Finder to run the samples and demos
-* Go to build-cocoa-debug/samples to experiment with the Cocoa samples.
-* Go to build-cocoa-debug/demos to experiment with the Cocoa demos.
-* Double-click on the executables which have an icon showing three small squares.
-* The source code for the samples is in wxWidgets/samples
-* The source code for the demos is in wxWidgets/demos
-
-More information about building on macOS is available in the wxWiki.
-Here are two useful links
- * https://wiki.wxwidgets.org/Guides_%26_Tutorials
- * https://wiki.wxwidgets.org/Development:_wxMac
-
Advanced topics {#osx_advanced}
===============
+Building library for distribution
+---------------------------------
+
+When building library for the distribution with your application, you shouldn't
+use `--enable-debug` option above but you may want to use `--disable-sys-libs`
+option to ensure that it has no dependencies on the other libraries available
+on the current system as they might not be present on all systems where the
+application is used.
+
+It is also often desirable to build the final version of the application as
+"universal binary", i.e. a combination of binaries for several different
+architectures. In this case, you should build wxWidgets as universal binary
+too, using `--enable-universal_binary` option. By default, this option enables
+building for the usually wanted set of architectures (currently ARM and Intel)
+but you may override this by listing the architectures you want to use
+explicitly, separating them with commas.
+
+
Installing library {#osx_install}
------------------
diff --git a/include/wx/android/setup.h b/include/wx/android/setup.h
index 361158490a..652b874574 100644
--- a/include/wx/android/setup.h
+++ b/include/wx/android/setup.h
@@ -1334,7 +1334,7 @@
// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL
// headers and libraries to be able to compile the library with wxUSE_GLCANVAS
-// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the
+// set to 1 and, under Windows, also to add opengl32.lib to the
// list of libraries used to link your application when linking to wxWidgets
// statically (although this is done implicitly for Microsoft Visual C++ users).
//
diff --git a/include/wx/aui/auibar.h b/include/wx/aui/auibar.h
index 937f6e5107..8d1a0276f7 100644
--- a/include/wx/aui/auibar.h
+++ b/include/wx/aui/auibar.h
@@ -693,7 +693,6 @@ protected:
bool m_gripperVisible;
bool m_overflowVisible;
- bool RealizeHelper(wxClientDC& dc, bool horizontal);
static bool IsPaneValid(long style, const wxAuiPaneInfo& pane);
bool IsPaneValid(long style) const;
void SetArtFlags() const;
@@ -705,6 +704,8 @@ private:
// Common part of OnLeaveWindow() and OnCaptureLost().
void DoResetMouseState();
+ wxSize RealizeHelper(wxClientDC& dc, wxOrientation orientation);
+
wxDECLARE_EVENT_TABLE();
wxDECLARE_CLASS(wxAuiToolBar);
};
diff --git a/include/wx/aui/auibook.h b/include/wx/aui/auibook.h
index 8f79f8f576..427ac706dd 100644
--- a/include/wx/aui/auibook.h
+++ b/include/wx/aui/auibook.h
@@ -189,6 +189,9 @@ protected:
wxRect m_rect;
size_t m_tabOffset;
unsigned int m_flags;
+
+private:
+ int GetCloseButtonState(const wxAuiNotebookPage& page) const;
};
@@ -210,6 +213,9 @@ public:
void SetRect(const wxRect& rect) { wxAuiTabContainer::SetRect(rect, this); }
+ // Internal helper.
+ void DoShowTab(int idx);
+
protected:
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const override { return wxBORDER_NONE; }
diff --git a/include/wx/aui/framemanager.h b/include/wx/aui/framemanager.h
index da9dff9609..e19325968f 100644
--- a/include/wx/aui/framemanager.h
+++ b/include/wx/aui/framemanager.h
@@ -51,7 +51,8 @@ enum wxAuiManagerOption
wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
wxAUI_MGR_TRANSPARENT_HINT |
wxAUI_MGR_HINT_FADE |
- wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
+ wxAUI_MGR_NO_VENETIAN_BLINDS_FADE |
+ wxAUI_MGR_LIVE_RESIZE
};
@@ -416,7 +417,7 @@ public:
void SetFlags(unsigned int flags);
unsigned int GetFlags() const;
- static bool AlwaysUsesLiveResize();
+ static bool AlwaysUsesLiveResize(const wxWindow* window = nullptr);
bool HasLiveResize() const;
void SetManagedWindow(wxWindow* managedWnd);
@@ -485,8 +486,6 @@ public:
virtual void ShowHint(const wxRect& rect);
virtual void HideHint();
- void OnHintActivate(wxActivateEvent& event);
-
public:
// deprecated -- please use SetManagedWindow()
diff --git a/include/wx/bitmap.h b/include/wx/bitmap.h
index 3a9f63aa1f..2cd62e239d 100644
--- a/include/wx/bitmap.h
+++ b/include/wx/bitmap.h
@@ -18,6 +18,7 @@
#include "wx/gdicmn.h" // for wxBitmapType
#include "wx/colour.h"
#include "wx/image.h"
+#include "wx/variant.h"
class WXDLLIMPEXP_FWD_CORE wxBitmap;
class WXDLLIMPEXP_FWD_CORE wxBitmapHandler;
@@ -28,15 +29,6 @@ class WXDLLIMPEXP_FWD_CORE wxMask;
class WXDLLIMPEXP_FWD_CORE wxPalette;
class WXDLLIMPEXP_FWD_CORE wxPixelDataBase;
-// ----------------------------------------------------------------------------
-// wxVariant support
-// ----------------------------------------------------------------------------
-
-#if wxUSE_VARIANT
-#include "wx/variant.h"
-DECLARE_VARIANT_OBJECT_EXPORTED(wxBitmap,WXDLLIMPEXP_CORE)
-#endif
-
// ----------------------------------------------------------------------------
// wxMask represents the transparent area of the bitmap
// ----------------------------------------------------------------------------
@@ -100,6 +92,9 @@ public:
// Rescale the given bitmap to the requested size.
static void Rescale(wxBitmap& bmp, const wxSize& sizeNeeded);
+
+ // wxVariant support
+ wxDECLARE_VARIANT_OBJECT_EXPORTED(wxBitmap, WXDLLIMPEXP_CORE);
};
@@ -178,6 +173,11 @@ public:
virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
+ // DIP size and logical size are the same thing for ports using scaling,
+ // i.e. where physical and logical sizes are different (e.g. wxGTK and
+ // wxOSX), but we want to have both sets of functions to use them in the
+ // ports where physical and logical sizes are the same (wxMSW).
+
bool CreateWithDIPSize(const wxSize& sz,
double scale,
int depth = wxBITMAP_SCREEN_DEPTH)
@@ -187,6 +187,15 @@ public:
int depth = wxBITMAP_SCREEN_DEPTH)
{ return DoCreate(wxSize(width, height), scale, depth); }
+ bool CreateWithLogicalSize(const wxSize& sz,
+ double scale,
+ int depth = wxBITMAP_SCREEN_DEPTH)
+ { return DoCreate(sz, scale, depth); }
+ bool CreateWithLogicalSize(int width, int height,
+ double scale,
+ int depth = wxBITMAP_SCREEN_DEPTH)
+ { return DoCreate(wxSize(width, height), scale, depth); }
+
virtual int GetHeight() const = 0;
virtual int GetWidth() const = 0;
virtual int GetDepth() const = 0;
diff --git a/include/wx/bmpbndl.h b/include/wx/bmpbndl.h
index 7b60fd9d18..217e2b2afb 100644
--- a/include/wx/bmpbndl.h
+++ b/include/wx/bmpbndl.h
@@ -17,6 +17,7 @@
class wxBitmapBundleImpl;
class WXDLLIMPEXP_FWD_CORE wxIconBundle;
class WXDLLIMPEXP_FWD_CORE wxImageList;
+class WXDLLIMPEXP_FWD_BASE wxVariant;
class WXDLLIMPEXP_FWD_CORE wxWindow;
// ----------------------------------------------------------------------------
@@ -155,6 +156,15 @@ public:
return GetImpl() == other.GetImpl();
}
+ // Allow using wxBitmapBundle with wxVariant
+#if wxUSE_VARIANT
+ friend WXDLLIMPEXP_CORE
+ wxBitmapBundle& operator<<(wxBitmapBundle& value, const wxVariant& variant);
+ friend WXDLLIMPEXP_CORE
+ wxVariant& operator<<(wxVariant& variant, const wxBitmapBundle& value);
+#endif // wxUSE_VARIANT
+
+
// Implementation only from now on.
// Get the bitmap size preferred by the majority of the elements of the
@@ -274,19 +284,4 @@ public:
virtual wxBitmap GetBitmap(const wxSize& size) = 0;
};
-// ----------------------------------------------------------------------------
-// Allow using wxBitmapBundle in wxVariant
-// ----------------------------------------------------------------------------
-
-#if wxUSE_VARIANT
-
-class WXDLLIMPEXP_FWD_BASE wxVariant;
-
-WXDLLIMPEXP_CORE
-wxBitmapBundle& operator<<(wxBitmapBundle& value, const wxVariant& variant);
-WXDLLIMPEXP_CORE
-wxVariant& operator<<(wxVariant& variant, const wxBitmapBundle& value);
-
-#endif // wxUSE_VARIANT
-
#endif // _WX_BMPBNDL_H_
diff --git a/include/wx/brush.h b/include/wx/brush.h
index 13cff58950..1d6b3416b7 100644
--- a/include/wx/brush.h
+++ b/include/wx/brush.h
@@ -102,6 +102,8 @@ extern WXDLLIMPEXP_DATA_CORE(wxBrushList*) wxTheBrushList;
// to compile without warnings which it would otherwise provoke from some
// compilers as it compares elements of different enums
+#if WXWIN_COMPATIBILITY_3_2
+
wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants only")
inline bool operator==(wxBrushStyle s, wxDeprecatedGUIConstants t)
{
@@ -114,4 +116,6 @@ inline bool operator!=(wxBrushStyle s, wxDeprecatedGUIConstants t)
return static_cast(s) != static_cast(t);
}
+#endif // WXWIN_COMPATIBILITY_3_2
+
#endif // _WX_BRUSH_H_BASE_
diff --git a/include/wx/buffer.h b/include/wx/buffer.h
index 294fb4e9d7..053e39a105 100644
--- a/include/wx/buffer.h
+++ b/include/wx/buffer.h
@@ -13,6 +13,10 @@
#include "wx/defs.h"
#include "wx/wxcrtbase.h"
+#if wxUSE_STD_IOSTREAM
+ #include "wx/iosfwrap.h"
+#endif
+
#include // malloc() and free()
class WXDLLIMPEXP_FWD_BASE wxCStrData;
@@ -55,14 +59,70 @@ struct UntypedBufferData
// NB: this is defined in string.cpp and not the (non-existent) buffer.cpp
WXDLLIMPEXP_BASE UntypedBufferData * GetUntypedNullData();
+// Implementation of stream insertion operators: they can't be inline because
+// we don't have full std::ostream declaration here.
+#if wxUSE_STD_IOSTREAM
+WXDLLIMPEXP_BASE std::ostream& OutputCharBuffer(std::ostream&, const char* s);
+WXDLLIMPEXP_BASE std::ostream& OutputWCharBuffer(std::ostream&, const wchar_t* ws);
+#if defined(HAVE_WOSTREAM)
+WXDLLIMPEXP_BASE std::wostream& OutputWCharBuffer(std::wostream&, const wchar_t* ws);
+#endif // defined(HAVE_WOSTREAM)
+#endif // wxUSE_STD_IOSTREAM
+
} // namespace wxPrivate
+// Template used as CRTP base class for wxScopedCharTypeBuffer in order to
+// define overloaded operator<<() for it.
+//
+// By default we don't define any operators, but we do define them for the
+// usual char and wchar_t specializations below.
+template
+struct wxScopedCharTypeBufferStreamSupport
+{
+};
+
+// Suppress the warning about declaring a non-template friend because this is
+// exactly what we want to do here.
+wxGCC_ONLY_WARNING_SUPPRESS(non-template-friend)
+
+template
+struct wxScopedCharTypeBufferStreamSupport
+{
+#if wxUSE_STD_IOSTREAM
+ friend std::ostream& operator<<(std::ostream& oss, const Buffer& buf)
+ {
+ return wxPrivate::OutputCharBuffer(oss, buf.data());
+ }
+#endif // wxUSE_STD_IOSTREAM
+};
+
+template
+struct wxScopedCharTypeBufferStreamSupport
+{
+#if wxUSE_STD_IOSTREAM
+ friend std::ostream& operator<<(std::ostream& oss, const Buffer& buf)
+ {
+ return wxPrivate::OutputWCharBuffer(oss, buf.data());
+ }
+#if defined(HAVE_WOSTREAM)
+ friend std::wostream& operator<<(std::wostream& woss, const Buffer& buf)
+ {
+ return wxPrivate::OutputWCharBuffer(woss, buf.data());
+ }
+#endif // defined(HAVE_WOSTREAM)
+#endif // wxUSE_STD_IOSTREAM
+};
+
+wxGCC_ONLY_WARNING_RESTORE(non-template-friend)
+
+
// Reference-counted character buffer for storing string data. The buffer
// is only valid for as long as the "parent" object that provided the data
// is valid; see wxCharTypeBuffer for persistent variant.
template
class wxScopedCharTypeBuffer
+ : wxScopedCharTypeBufferStreamSupport>
{
public:
typedef T CharType;
@@ -368,6 +428,13 @@ public:
wxCharBuffer(size_t len) : wxCharTypeBufferBase(len) {}
wxCharBuffer(const wxCStrData& cstr);
+
+#if wxUSE_STD_IOSTREAM
+ // Define this to disambiguate between converting to the base class or to
+ // wxString when using operator<<() with the objects of this class.
+ friend WXDLLIMPEXP_BASE
+ std::ostream& operator<<(std::ostream& oss, const wxCharBuffer& buf);
+#endif // wxUSE_STD_IOSTREAM
};
class wxWCharBuffer : public wxCharTypeBuffer
@@ -385,6 +452,16 @@ public:
wxWCharBuffer(size_t len) : wxCharTypeBufferBase(len) {}
wxWCharBuffer(const wxCStrData& cstr);
+
+#if wxUSE_STD_IOSTREAM
+ // See wxCharBuffer for why this is needed.
+ friend WXDLLIMPEXP_BASE
+ std::ostream& operator<<(std::ostream& oss, const wxWCharBuffer& buf);
+#if defined(HAVE_WOSTREAM)
+ friend WXDLLIMPEXP_BASE
+ std::wostream& operator<<(std::wostream& woss, const wxWCharBuffer& buf);
+#endif // defined(HAVE_WOSTREAM)
+#endif // wxUSE_STD_IOSTREAM
};
// wxCharTypeBuffer implicitly convertible to T*, for char and wchar_t,
diff --git a/include/wx/colour.h b/include/wx/colour.h
index 344ecc9741..cf1d679890 100644
--- a/include/wx/colour.h
+++ b/include/wx/colour.h
@@ -13,6 +13,7 @@
#include "wx/defs.h"
#include "wx/gdiobj.h"
+#include "wx/variant.h"
class WXDLLIMPEXP_FWD_CORE wxColour;
@@ -53,15 +54,6 @@ const unsigned char wxALPHA_OPAQUE = 0xff;
#define wxTransparentColour wxColour(0, 0, 0, wxALPHA_TRANSPARENT)
#define wxTransparentColor wxTransparentColour
-// ----------------------------------------------------------------------------
-// wxVariant support
-// ----------------------------------------------------------------------------
-
-#if wxUSE_VARIANT
-#include "wx/variant.h"
-DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLIMPEXP_CORE)
-#endif
-
//-----------------------------------------------------------------------------
// wxColourBase: this class has no data members, just some functions to avoid
// code redundancy in all native wxColour implementations
@@ -188,6 +180,8 @@ public:
wxColour ChangeLightness(int ialpha) const;
wxColour& MakeDisabled(unsigned char brightness = 255);
+ wxDECLARE_VARIANT_OBJECT_EXPORTED(wxColour, WXDLLIMPEXP_CORE);
+
protected:
// Some ports need Init() and while we don't, provide a stub so that the
// ports which don't need it are not forced to define it
diff --git a/include/wx/confbase.h b/include/wx/confbase.h
index 584ca07d89..34e250ce90 100644
--- a/include/wx/confbase.h
+++ b/include/wx/confbase.h
@@ -62,7 +62,9 @@ enum
wxCONFIG_USE_GLOBAL_FILE = 2,
wxCONFIG_USE_RELATIVE_PATH = 4,
wxCONFIG_USE_NO_ESCAPE_CHARACTERS = 8,
- wxCONFIG_USE_SUBDIR = 16
+ wxCONFIG_USE_SUBDIR = 16,
+ wxCONFIG_USE_XDG = 32,
+ wxCONFIG_USE_HOME = 64
};
// ----------------------------------------------------------------------------
diff --git a/include/wx/config.h b/include/wx/config.h
index 177665116d..9a47bdedb4 100644
--- a/include/wx/config.h
+++ b/include/wx/config.h
@@ -23,9 +23,11 @@
#if defined(__WINDOWS__) && wxUSE_CONFIG_NATIVE
#include "wx/msw/regconf.h"
#define wxConfig wxRegConfig
+ #define wxHAS_CONFIG_AS_REGCONFIG
#else // either we're under Unix or wish to always use config files
#include "wx/fileconf.h"
#define wxConfig wxFileConfig
+ #define wxHAS_CONFIG_AS_FILECONFIG
#endif
#endif // wxUSE_CONFIG
diff --git a/include/wx/datetime.h b/include/wx/datetime.h
index 1dba298b12..4f9d5cfab9 100644
--- a/include/wx/datetime.h
+++ b/include/wx/datetime.h
@@ -17,6 +17,8 @@
#include
+#include
+
#include // for INT_MIN
#include "wx/longlong.h"
@@ -44,7 +46,7 @@ struct _SYSTEMTIME;
* ? 2. getdate() function like under Solaris
* + 3. text conversion for wxDateSpan
* + 4. pluggable modules for the workdays calculations
- * 5. wxDateTimeHolidayAuthority for Easter and other christian feasts
+ * 5. wxDateTimeHolidayAuthority Christian feasts outside of US
*/
/*
@@ -1276,6 +1278,8 @@ public:
return wxTimeSpan(*this).Multiply(n);
}
+ friend WXDLLIMPEXP_BASE wxTimeSpan operator*(int n, const wxTimeSpan& ts);
+
// return this timespan with opposite sign
wxTimeSpan Negate() const { return wxTimeSpan(-GetValue()); }
// negate the value of the timespan
@@ -1529,6 +1533,7 @@ public:
{
return wxDateSpan(*this).Multiply(n);
}
+ friend WXDLLIMPEXP_BASE wxDateSpan operator*(int n, const wxDateSpan& ds);
// ds1 == d2 if and only if for every wxDateTime t t + ds1 == t + ds2
inline bool operator==(const wxDateSpan& ds) const
@@ -1599,13 +1604,7 @@ protected:
virtual bool DoIsHoliday(const wxDateTime& dt) const = 0;
// this function should fill the array with all holidays between the two
- // given dates - it is implemented in the base class, but in a very
- // inefficient way (it just iterates over all days and uses IsHoliday() for
- // each of them), so it must be overridden in the derived class where the
- // base class version may be explicitly used if needed
- //
- // returns the number of holidays in the given range and fills holidays
- // array
+ // given dates
virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart,
const wxDateTime& dtEnd,
wxDateTimeArray& holidays) const = 0;
@@ -1625,6 +1624,85 @@ protected:
wxDateTimeArray& holidays) const override;
};
+// https://marian.org/mary/feast-days
+// https://www.omvusa.org/blog/catholic-holy-days-of-obligation/
+class WXDLLIMPEXP_BASE wxDateTimeUSCatholicFeasts : public wxDateTimeHolidayAuthority
+{
+public:
+ // Easter for a given year.
+ // Based on https://www.geeksforgeeks.org/how-to-calculate-the-easter-date-for-a-given-year-using-gauss-algorithm/
+ // Validated against 1600 to 2099, using data from:
+ // https://www.assa.org.au/edm (Astronomical Society of South Australia)
+ // https://www.census.gov/data/software/x13as/genhol/easter-dates.html (US Census Bureau)
+ static wxDateTime GetEaster(int year);
+
+ // Ascension for a given year.
+ // Celebrated on the 40th day of Easter/
+ // the sixth Thursday after Easter Sunday.
+ static wxDateTime GetThursdayAscension(int year)
+ {
+ const wxDateTime ascension = GetEaster(year) + wxDateSpan::Days(39);
+ wxASSERT_MSG(
+ ascension.GetWeekDay() == wxDateTime::WeekDay::Thu,
+ "Error in Ascension calculation!");
+ return ascension;
+ }
+
+ // Ascension for a given year.
+ // Same as traditional Ascension, but moved to the following Sunday.
+ static wxDateTime GetSundayAscension(int year)
+ {
+ const wxDateTime ascension = GetEaster(year) + wxDateSpan::Weeks(6);
+ wxASSERT_MSG(
+ ascension.GetWeekDay() == wxDateTime::WeekDay::Sun,
+ "Error in Ascension calculation!");
+ return ascension;
+ }
+protected:
+ bool DoIsHoliday(const wxDateTime& dt) const override
+ {
+ if (dt.IsSameDate(GetEaster(dt.GetYear())) ||
+ dt.IsSameDate(GetThursdayAscension(dt.GetYear())) )
+ {
+ return true;
+ }
+ for (const auto& feast : m_holyDaysOfObligation)
+ {
+ if (feast.GetMonth() == dt.GetMonth() &&
+ feast.GetDay() == dt.GetDay())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ size_t DoGetHolidaysInRange(const wxDateTime& dtStart,
+ const wxDateTime& dtEnd,
+ wxDateTimeArray& holidays) const override;
+private:
+ static std::vector m_holyDaysOfObligation;
+};
+
+// Christmas and Easter
+class WXDLLIMPEXP_BASE wxDateTimeChristianHolidays : public wxDateTimeUSCatholicFeasts
+{
+protected:
+ bool DoIsHoliday(const wxDateTime& dt) const override
+ {
+ if (dt.IsSameDate(GetEaster(dt.GetYear())) ||
+ (dt.GetMonth() == 12 && dt.GetDay() == 25))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ size_t DoGetHolidaysInRange(const wxDateTime& dtStart,
+ const wxDateTime& dtEnd,
+ wxDateTimeArray& holidays) const override;
+};
+
// ============================================================================
// inline functions implementation
// ============================================================================
@@ -2168,22 +2246,6 @@ inline wxDateSpan wxDateSpan::Subtract(const wxDateSpan& other) const
#undef MODIFY_AND_RETURN
-// ============================================================================
-// binary operators
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// wxTimeSpan operators
-// ----------------------------------------------------------------------------
-
-wxTimeSpan WXDLLIMPEXP_BASE operator*(int n, const wxTimeSpan& ts);
-
-// ----------------------------------------------------------------------------
-// wxDateSpan
-// ----------------------------------------------------------------------------
-
-wxDateSpan WXDLLIMPEXP_BASE operator*(int n, const wxDateSpan& ds);
-
// ============================================================================
// other helper functions
// ============================================================================
diff --git a/include/wx/dc.h b/include/wx/dc.h
index 26402a5859..b89c38130f 100644
--- a/include/wx/dc.h
+++ b/include/wx/dc.h
@@ -128,6 +128,8 @@ public:
virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) = 0;
#endif
+ virtual bool CanDrawUsingClientDC(const wxWindow* window) const = 0;
+
static void Set(wxDCFactory *factory);
static wxDCFactory *Get();
@@ -154,6 +156,8 @@ public:
#if wxUSE_PRINTING_ARCHITECTURE
virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) override;
#endif
+
+ virtual bool CanDrawUsingClientDC(const wxWindow* window) const override;
};
//-----------------------------------------------------------------------------
diff --git a/include/wx/dcclient.h b/include/wx/dcclient.h
index 28391d1266..ced769ce34 100644
--- a/include/wx/dcclient.h
+++ b/include/wx/dcclient.h
@@ -36,6 +36,8 @@ class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC
public:
wxClientDC(wxWindow *win);
+ static bool CanBeUsedForDrawing(const wxWindow* window);
+
protected:
wxClientDC(wxDCImpl *impl) : wxWindowDC(impl) { }
diff --git a/include/wx/defs.h b/include/wx/defs.h
index 707ad778a8..5359e120fc 100644
--- a/include/wx/defs.h
+++ b/include/wx/defs.h
@@ -782,19 +782,22 @@ typedef short int WXTYPE;
#define wxDEFINE_COMPARISON(op, T1, T2, cmp) \
- inline bool operator op(T1 x, T2 y) { return cmp(x, y, op); }
+ friend bool operator op(T1 x, T2 y) { return cmp(x, y, op); }
#define wxDEFINE_COMPARISON_REV(op, T1, T2, cmp, oprev) \
- inline bool operator op(T2 y, T1 x) { return cmp(x, y, oprev); }
+ friend bool operator op(T2 y, T1 x) { return cmp(x, y, oprev); }
#define wxDEFINE_COMPARISON_BY_REV(op, T1, T2, oprev) \
- inline bool operator op(T1 x, T2 y) { return y oprev x; }
+ friend bool operator op(T1 x, T2 y) { return y oprev x; }
/*
Define all 6 comparison operators (==, !=, <, <=, >, >=) for the given
types in the specified order. The implementation is provided by the cmp
macro. Normally wxDEFINE_ALL_COMPARISONS should be used as comparison
operators are usually symmetric.
+
+ Note that comparison operators are defined as hidden friends and so this
+ macro can only be used inside the class declaration.
*/
#define wxDEFINE_COMPARISONS(T1, T2, cmp) \
wxFOR_ALL_COMPARISONS_3(wxDEFINE_COMPARISON, T1, T2, cmp)
@@ -803,6 +806,9 @@ typedef short int WXTYPE;
Define all 6 comparison operators (==, !=, <, <=, >, >=) for the given
types in the specified order, implemented in terms of existing operators
for the reverse order.
+
+ Note that comparison operators are defined as hidden friends and so this
+ macro can only be used inside the class declaration.
*/
#define wxDEFINE_COMPARISONS_BY_REV(T1, T2) \
wxFOR_ALL_COMPARISONS_2_REV(wxDEFINE_COMPARISON_BY_REV, T1, T2)
diff --git a/include/wx/dfb/dcclient.h b/include/wx/dfb/dcclient.h
index 98655e4fd3..f195829f14 100644
--- a/include/wx/dfb/dcclient.h
+++ b/include/wx/dfb/dcclient.h
@@ -51,6 +51,9 @@ public:
wxClientDCImpl(wxDC *owner) : wxWindowDCImpl(owner) { }
wxClientDCImpl(wxDC *owner, wxWindow *win);
+ static bool
+ CanBeUsedForDrawing(const wxWindow* WXUNUSED(window)) { return true; }
+
wxDECLARE_DYNAMIC_CLASS(wxClientDCImpl);
wxDECLARE_NO_COPY_CLASS(wxClientDCImpl);
};
diff --git a/include/wx/dvrenderers.h b/include/wx/dvrenderers.h
index 8832396fca..e44e874d6f 100644
--- a/include/wx/dvrenderers.h
+++ b/include/wx/dvrenderers.h
@@ -67,6 +67,8 @@ public:
return !IsSameAs(other);
}
+ wxDECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_CORE);
+
private:
wxString m_text;
wxBitmapBundle m_bitmap;
@@ -74,8 +76,6 @@ private:
wxDECLARE_DYNAMIC_CLASS(wxDataViewIconText);
};
-DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_CORE)
-
// ----------------------------------------------------------------------------
// wxDataViewCheckIconText: value class used by wxDataViewCheckIconTextRenderer
// ----------------------------------------------------------------------------
@@ -94,14 +94,14 @@ public:
wxCheckBoxState GetCheckedState() const { return m_checkedState; }
void SetCheckedState(wxCheckBoxState state) { m_checkedState = state; }
+ wxDECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewCheckIconText, WXDLLIMPEXP_CORE);
+
private:
wxCheckBoxState m_checkedState;
wxDECLARE_DYNAMIC_CLASS(wxDataViewCheckIconText);
};
-DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewCheckIconText, WXDLLIMPEXP_CORE)
-
// ----------------------------------------------------------------------------
// wxDataViewRendererBase
// ----------------------------------------------------------------------------
diff --git a/include/wx/fileconf.h b/include/wx/fileconf.h
index 87f698a38f..31971df83e 100644
--- a/include/wx/fileconf.h
+++ b/include/wx/fileconf.h
@@ -123,6 +123,24 @@ public:
return GetLocalFile(szFile, style).GetFullPath();
}
+ // Function to migrate, i.e. move, an existing local config file to another
+ // location. Old and new style determine the existing and new file paths.
+ struct MigrationResult
+ {
+ // If empty, it means the old file wasn't found and nothing was done.
+ wxString oldPath;
+
+ // The name of the new file.
+ wxString newPath;
+
+ // If empty, means the file was successfully migrated.
+ wxString error;
+ };
+ static MigrationResult
+ MigrateLocalFile(const wxString& name,
+ int newStyle,
+ int oldStyle = wxCONFIG_USE_HOME);
+
// ctor & dtor
// New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or
// wxCONFIG_USE_GLOBAL_FILE to say which files should be used.
diff --git a/include/wx/font.h b/include/wx/font.h
index 0daab9c91e..b3aa02cd1e 100644
--- a/include/wx/font.h
+++ b/include/wx/font.h
@@ -671,6 +671,8 @@ extern WXDLLIMPEXP_DATA_CORE(wxFontList*) wxTheFontList;
// to compile without warnings which it would otherwise provoke from some
// compilers as it compares elements of different enums
+#if WXWIN_COMPATIBILITY_3_2
+
wxDEPRECATED_MSG("use wxFONTFAMILY_XXX constants") \
inline bool operator==(wxFontFamily s, wxDeprecatedGUIConstants t)
{ return static_cast(s) == static_cast(t); }
@@ -690,4 +692,6 @@ wxDEPRECATED_MSG("use wxFONTWEIGHT_XXX constants") \
inline bool operator!=(wxFontWeight s, wxDeprecatedGUIConstants t)
{ return static_cast(s) != static_cast(t); }
+#endif // WXWIN_COMPATIBILITY_3_2
+
#endif // _WX_FONT_H_BASE_
diff --git a/include/wx/fs_data.h b/include/wx/fs_data.h
new file mode 100644
index 0000000000..eea524a425
--- /dev/null
+++ b/include/wx/fs_data.h
@@ -0,0 +1,31 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fs_data.h
+// Purpose: DATA scheme file system.
+// Author: Vyacheslav Lisovski
+// Copyright: (c) 2023 Vyacheslav Lisovski
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FS_DATA_H_
+#define _WX_FS_DATA_H_
+
+#include "wx/defs.h"
+
+#if wxUSE_FILESYSTEM
+
+#include "wx/filesys.h"
+
+// ----------------------------------------------------------------------------
+// wxDataSchemeFSHandler
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxDataSchemeFSHandler : public wxFileSystemHandler
+{
+public:
+ virtual bool CanOpen(const wxString& location) override;
+ virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) override;
+};
+
+#endif // wxUSE_FILESYSTEM
+
+#endif // _WX_FS_DATA_H_
diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h
index 30a54326c2..8cc8f5f492 100644
--- a/include/wx/gdicmn.h
+++ b/include/wx/gdicmn.h
@@ -295,6 +295,102 @@ public:
wxSize& operator/=(double i) { x = wxRound(x/i); y = wxRound(y/i); return *this; }
wxSize& operator*=(double i) { x = wxRound(x*i); y = wxRound(y*i); return *this; }
+ friend bool operator==(const wxSize& s1, const wxSize& s2)
+ {
+ return s1.x == s2.x && s1.y == s2.y;
+ }
+
+ friend bool operator!=(const wxSize& s1, const wxSize& s2)
+ {
+ return s1.x != s2.x || s1.y != s2.y;
+ }
+
+ friend wxSize operator+(const wxSize& s1, const wxSize& s2)
+ {
+ return wxSize(s1.x + s2.x, s1.y + s2.y);
+ }
+
+ friend wxSize operator-(const wxSize& s1, const wxSize& s2)
+ {
+ return wxSize(s1.x - s2.x, s1.y - s2.y);
+ }
+
+ friend wxSize operator/(const wxSize& s, int i)
+ {
+ return wxSize(s.x / i, s.y / i);
+ }
+
+ friend wxSize operator*(const wxSize& s, int i)
+ {
+ return wxSize(s.x * i, s.y * i);
+ }
+
+ friend wxSize operator*(int i, const wxSize& s)
+ {
+ return wxSize(s.x * i, s.y * i);
+ }
+
+ friend wxSize operator/(const wxSize& s, unsigned int i)
+ {
+ return wxSize(s.x / i, s.y / i);
+ }
+
+ friend wxSize operator*(const wxSize& s, unsigned int i)
+ {
+ return wxSize(s.x * i, s.y * i);
+ }
+
+ friend wxSize operator*(unsigned int i, const wxSize& s)
+ {
+ return wxSize(s.x * i, s.y * i);
+ }
+
+ friend wxSize operator/(const wxSize& s, long i)
+ {
+ return wxSize(s.x / i, s.y / i);
+ }
+
+ friend wxSize operator*(const wxSize& s, long i)
+ {
+ return wxSize(int(s.x * i), int(s.y * i));
+ }
+
+ friend wxSize operator*(long i, const wxSize& s)
+ {
+ return wxSize(int(s.x * i), int(s.y * i));
+ }
+
+ friend wxSize operator/(const wxSize& s, unsigned long i)
+ {
+ return wxSize(int(s.x / i), int(s.y / i));
+ }
+
+ friend wxSize operator*(const wxSize& s, unsigned long i)
+ {
+ return wxSize(int(s.x * i), int(s.y * i));
+ }
+
+ friend wxSize operator*(unsigned long i, const wxSize& s)
+ {
+ return wxSize(int(s.x * i), int(s.y * i));
+ }
+
+ friend wxSize operator/(const wxSize& s, double i)
+ {
+ return wxSize(wxRound(s.x / i), wxRound(s.y / i));
+ }
+
+ friend wxSize operator*(const wxSize& s, double i)
+ {
+ return wxSize(wxRound(s.x * i), wxRound(s.y * i));
+ }
+
+ friend wxSize operator*(double i, const wxSize& s)
+ {
+ return wxSize(wxRound(s.x * i), wxRound(s.y * i));
+ }
+
+
void IncTo(const wxSize& sz)
{ if ( sz.x > x ) x = sz.x; if ( sz.y > y ) y = sz.y; }
void DecTo(const wxSize& sz)
@@ -350,103 +446,6 @@ public:
int GetY() const { return y; }
};
-inline bool operator==(const wxSize& s1, const wxSize& s2)
-{
- return s1.x == s2.x && s1.y == s2.y;
-}
-
-inline bool operator!=(const wxSize& s1, const wxSize& s2)
-{
- return s1.x != s2.x || s1.y != s2.y;
-}
-
-inline wxSize operator+(const wxSize& s1, const wxSize& s2)
-{
- return wxSize(s1.x + s2.x, s1.y + s2.y);
-}
-
-inline wxSize operator-(const wxSize& s1, const wxSize& s2)
-{
- return wxSize(s1.x - s2.x, s1.y - s2.y);
-}
-
-inline wxSize operator/(const wxSize& s, int i)
-{
- return wxSize(s.x / i, s.y / i);
-}
-
-inline wxSize operator*(const wxSize& s, int i)
-{
- return wxSize(s.x * i, s.y * i);
-}
-
-inline wxSize operator*(int i, const wxSize& s)
-{
- return wxSize(s.x * i, s.y * i);
-}
-
-inline wxSize operator/(const wxSize& s, unsigned int i)
-{
- return wxSize(s.x / i, s.y / i);
-}
-
-inline wxSize operator*(const wxSize& s, unsigned int i)
-{
- return wxSize(s.x * i, s.y * i);
-}
-
-inline wxSize operator*(unsigned int i, const wxSize& s)
-{
- return wxSize(s.x * i, s.y * i);
-}
-
-inline wxSize operator/(const wxSize& s, long i)
-{
- return wxSize(s.x / i, s.y / i);
-}
-
-inline wxSize operator*(const wxSize& s, long i)
-{
- return wxSize(int(s.x * i), int(s.y * i));
-}
-
-inline wxSize operator*(long i, const wxSize& s)
-{
- return wxSize(int(s.x * i), int(s.y * i));
-}
-
-inline wxSize operator/(const wxSize& s, unsigned long i)
-{
- return wxSize(int(s.x / i), int(s.y / i));
-}
-
-inline wxSize operator*(const wxSize& s, unsigned long i)
-{
- return wxSize(int(s.x * i), int(s.y * i));
-}
-
-inline wxSize operator*(unsigned long i, const wxSize& s)
-{
- return wxSize(int(s.x * i), int(s.y * i));
-}
-
-inline wxSize operator/(const wxSize& s, double i)
-{
- return wxSize(wxRound(s.x / i), wxRound(s.y / i));
-}
-
-inline wxSize operator*(const wxSize& s, double i)
-{
- return wxSize(wxRound(s.x * i), wxRound(s.y * i));
-}
-
-inline wxSize operator*(double i, const wxSize& s)
-{
- return wxSize(wxRound(s.x * i), wxRound(s.y * i));
-}
-
-
-
// ---------------------------------------------------------------------------
// Point classes: with real or integer coordinates
// ---------------------------------------------------------------------------
@@ -469,102 +468,134 @@ public:
wxRealPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; }
wxRealPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; }
+
+ wxRealPoint& operator/=(int i) { x *= i; y *= i; return *this; }
+ wxRealPoint& operator*=(int i) { x /= i; y /= i; return *this; }
+ wxRealPoint& operator/=(double f) { x /= f; y /= f; return *this; }
+ wxRealPoint& operator*=(double f) { x *= f; y *= f; return *this; }
+
+ friend bool operator==(const wxRealPoint& p1, const wxRealPoint& p2)
+ {
+ return wxIsSameDouble(p1.x, p2.x) && wxIsSameDouble(p1.y, p2.y);
+ }
+
+ friend bool operator!=(const wxRealPoint& p1, const wxRealPoint& p2)
+ {
+ return !(p1 == p2);
+ }
+
+ friend wxRealPoint operator+(const wxRealPoint& p1, const wxRealPoint& p2)
+ {
+ return wxRealPoint(p1.x + p2.x, p1.y + p2.y);
+ }
+
+ friend wxRealPoint operator-(const wxRealPoint& p1, const wxRealPoint& p2)
+ {
+ return wxRealPoint(p1.x - p2.x, p1.y - p2.y);
+ }
+
+ friend wxRealPoint operator+(const wxRealPoint& pt, const wxSize& sz)
+ {
+ return wxRealPoint(pt.x + sz.GetWidth(), pt.y + sz.GetHeight());
+ }
+
+ friend wxRealPoint operator-(const wxRealPoint& pt, const wxSize& sz)
+ {
+ return wxRealPoint(pt.x - sz.GetWidth(), pt.y - sz.GetHeight());
+ }
+
+ friend wxRealPoint operator+(const wxSize& sz, const wxRealPoint& pt)
+ {
+ return wxRealPoint(sz.GetWidth() + pt.x, sz.GetHeight() + pt.y);
+ }
+
+ friend wxRealPoint operator-(const wxSize& sz, const wxRealPoint& pt)
+ {
+ return wxRealPoint(sz.GetWidth() - pt.x, sz.GetHeight() - pt.y);
+ }
+
+ friend wxRealPoint operator-(const wxRealPoint& pt)
+ {
+ return wxRealPoint(-pt.x, -pt.y);
+ }
+
+ friend wxRealPoint operator/(const wxRealPoint& p, int i)
+ {
+ return wxRealPoint(p.x / i, p.y / i);
+ }
+
+ friend wxRealPoint operator*(const wxRealPoint& p, int i)
+ {
+ return wxRealPoint(p.x * i, p.y * i);
+ }
+
+ friend wxRealPoint operator*(int i, const wxRealPoint& p)
+ {
+ return wxRealPoint(p.x * i, p.y * i);
+ }
+
+ friend wxRealPoint operator/(const wxRealPoint& p, unsigned int i)
+ {
+ return wxRealPoint(p.x / i, p.y / i);
+ }
+
+ friend wxRealPoint operator*(const wxRealPoint& p, unsigned int i)
+ {
+ return wxRealPoint(p.x * i, p.y * i);
+ }
+
+ friend wxRealPoint operator*(unsigned int i, const wxRealPoint& p)
+ {
+ return wxRealPoint(p.x * i, p.y * i);
+ }
+
+ friend wxRealPoint operator/(const wxRealPoint& p, long i)
+ {
+ return wxRealPoint(p.x / i, p.y / i);
+ }
+
+ friend wxRealPoint operator*(const wxRealPoint& p, long i)
+ {
+ return wxRealPoint(p.x * i, p.y * i);
+ }
+
+ friend wxRealPoint operator*(long i, const wxRealPoint& p)
+ {
+ return wxRealPoint(p.x * i, p.y * i);
+ }
+
+ friend wxRealPoint operator/(const wxRealPoint& p, unsigned long i)
+ {
+ return wxRealPoint(p.x / i, p.y / i);
+ }
+
+ friend wxRealPoint operator*(const wxRealPoint& p, unsigned long i)
+ {
+ return wxRealPoint(p.x * i, p.y * i);
+ }
+
+ friend wxRealPoint operator*(unsigned long i, const wxRealPoint& p)
+ {
+ return wxRealPoint(p.x * i, p.y * i);
+ }
+
+ friend wxRealPoint operator/(const wxRealPoint& p, double f)
+ {
+ return wxRealPoint(p.x / f, p.y / f);
+ }
+
+ friend wxRealPoint operator*(const wxRealPoint& p, double f)
+ {
+ return wxRealPoint(p.x * f, p.y * f);
+ }
+
+ friend wxRealPoint operator*(double f, const wxRealPoint& p)
+ {
+ return wxRealPoint(p.x * f, p.y * f);
+ }
};
-inline bool operator==(const wxRealPoint& p1, const wxRealPoint& p2)
-{
- return wxIsSameDouble(p1.x, p2.x) && wxIsSameDouble(p1.y, p2.y);
-}
-
-inline bool operator!=(const wxRealPoint& p1, const wxRealPoint& p2)
-{
- return !(p1 == p2);
-}
-
-inline wxRealPoint operator+(const wxRealPoint& p1, const wxRealPoint& p2)
-{
- return wxRealPoint(p1.x + p2.x, p1.y + p2.y);
-}
-
-
-inline wxRealPoint operator-(const wxRealPoint& p1, const wxRealPoint& p2)
-{
- return wxRealPoint(p1.x - p2.x, p1.y - p2.y);
-}
-
-
-inline wxRealPoint operator/(const wxRealPoint& s, int i)
-{
- return wxRealPoint(s.x / i, s.y / i);
-}
-
-inline wxRealPoint operator*(const wxRealPoint& s, int i)
-{
- return wxRealPoint(s.x * i, s.y * i);
-}
-
-inline wxRealPoint operator*(int i, const wxRealPoint& s)
-{
- return wxRealPoint(s.x * i, s.y * i);
-}
-
-inline wxRealPoint operator/(const wxRealPoint& s, unsigned int i)
-{
- return wxRealPoint(s.x / i, s.y / i);
-}
-
-inline wxRealPoint operator*(const wxRealPoint& s, unsigned int i)
-{
- return wxRealPoint(s.x * i, s.y * i);
-}
-
-inline wxRealPoint operator*(unsigned int i, const wxRealPoint& s)
-{
- return wxRealPoint(s.x * i, s.y * i);
-}
-
-inline wxRealPoint operator/(const wxRealPoint& s, long i)
-{
- return wxRealPoint(s.x / i, s.y / i);
-}
-
-inline wxRealPoint operator*(const wxRealPoint& s, long i)
-{
- return wxRealPoint(s.x * i, s.y * i);
-}
-
-inline wxRealPoint operator*(long i, const wxRealPoint& s)
-{
- return wxRealPoint(s.x * i, s.y * i);
-}
-
-inline wxRealPoint operator/(const wxRealPoint& s, unsigned long i)
-{
- return wxRealPoint(s.x / i, s.y / i);
-}
-
-inline wxRealPoint operator*(const wxRealPoint& s, unsigned long i)
-{
- return wxRealPoint(s.x * i, s.y * i);
-}
-
-inline wxRealPoint operator*(unsigned long i, const wxRealPoint& s)
-{
- return wxRealPoint(s.x * i, s.y * i);
-}
-
-inline wxRealPoint operator*(const wxRealPoint& s, double i)
-{
- return wxRealPoint(s.x * i, s.y * i);
-}
-
-inline wxRealPoint operator*(double i, const wxRealPoint& s)
-{
- return wxRealPoint(s.x * i, s.y * i);
-}
-
-
// ----------------------------------------------------------------------------
// wxPoint: 2D point with integer coordinates
// ----------------------------------------------------------------------------
@@ -587,6 +618,134 @@ public:
wxPoint& operator+=(const wxSize& s) { x += s.GetWidth(); y += s.GetHeight(); return *this; }
wxPoint& operator-=(const wxSize& s) { x -= s.GetWidth(); y -= s.GetHeight(); return *this; }
+ wxPoint& operator/=(int i) { x /= i; y /= i; return *this; }
+ wxPoint& operator*=(int i) { x *= i; y *= i; return *this; }
+ wxPoint& operator/=(double f) { x = wxRound(x/f); y = wxRound(y/f); return *this; }
+ wxPoint& operator*=(double f) { x = wxRound(x*f); y = wxRound(y*f); return *this; }
+
+ // comparison
+ friend bool operator==(const wxPoint& p1, const wxPoint& p2)
+ {
+ return p1.x == p2.x && p1.y == p2.y;
+ }
+
+ friend bool operator!=(const wxPoint& p1, const wxPoint& p2)
+ {
+ return !(p1 == p2);
+ }
+
+
+ // arithmetic operations (component wise)
+ friend wxPoint operator+(const wxPoint& p1, const wxPoint& p2)
+ {
+ return wxPoint(p1.x + p2.x, p1.y + p2.y);
+ }
+
+ friend wxPoint operator-(const wxPoint& p1, const wxPoint& p2)
+ {
+ return wxPoint(p1.x - p2.x, p1.y - p2.y);
+ }
+
+ friend wxPoint operator+(const wxPoint& p, const wxSize& s)
+ {
+ return wxPoint(p.x + s.x, p.y + s.y);
+ }
+
+ friend wxPoint operator-(const wxPoint& p, const wxSize& s)
+ {
+ return wxPoint(p.x - s.x, p.y - s.y);
+ }
+
+ friend wxPoint operator+(const wxSize& s, const wxPoint& p)
+ {
+ return wxPoint(p.x + s.x, p.y + s.y);
+ }
+
+ friend wxPoint operator-(const wxSize& s, const wxPoint& p)
+ {
+ return wxPoint(s.x - p.x, s.y - p.y);
+ }
+
+ friend wxPoint operator-(const wxPoint& p)
+ {
+ return wxPoint(-p.x, -p.y);
+ }
+
+ friend wxPoint operator/(const wxPoint& p, int i)
+ {
+ return wxPoint(p.x / i, p.y / i);
+ }
+
+ friend wxPoint operator*(const wxPoint& p, int i)
+ {
+ return wxPoint(p.x * i, p.y * i);
+ }
+
+ friend wxPoint operator*(int i, const wxPoint& p)
+ {
+ return wxPoint(p.x * i, p.y * i);
+ }
+
+ friend wxPoint operator/(const wxPoint& p, unsigned int i)
+ {
+ return wxPoint(p.x / i, p.y / i);
+ }
+
+ friend wxPoint operator*(const wxPoint& p, unsigned int i)
+ {
+ return wxPoint(p.x * i, p.y * i);
+ }
+
+ friend wxPoint operator*(unsigned int i, const wxPoint& p)
+ {
+ return wxPoint(p.x * i, p.y * i);
+ }
+
+ friend wxPoint operator/(const wxPoint& p, long i)
+ {
+ return wxPoint(p.x / i, p.y / i);
+ }
+
+ friend wxPoint operator*(const wxPoint& p, long i)
+ {
+ return wxPoint(int(p.x * i), int(p.y * i));
+ }
+
+ friend wxPoint operator*(long i, const wxPoint& p)
+ {
+ return wxPoint(int(p.x * i), int(p.y * i));
+ }
+
+ friend wxPoint operator/(const wxPoint& p, unsigned long i)
+ {
+ return wxPoint(p.x / i, p.y / i);
+ }
+
+ friend wxPoint operator*(const wxPoint& p, unsigned long i)
+ {
+ return wxPoint(int(p.x * i), int(p.y * i));
+ }
+
+ friend wxPoint operator*(unsigned long i, const wxPoint& p)
+ {
+ return wxPoint(int(p.x * i), int(p.y * i));
+ }
+
+ friend wxPoint operator/(const wxPoint& p, double f)
+ {
+ return wxPoint(wxRound(p.x / f), wxRound(p.y / f));
+ }
+
+ friend wxPoint operator*(const wxPoint& p, double f)
+ {
+ return wxPoint(int(p.x * f), int(p.y * f));
+ }
+
+ friend wxPoint operator*(double f, const wxPoint& p)
+ {
+ return wxPoint(int(p.x * f), int(p.y * f));
+ }
+
// check if both components are set/initialized
bool IsFullySpecified() const { return x != wxDefaultCoord && y != wxDefaultCoord; }
@@ -601,124 +760,6 @@ public:
};
-// comparison
-inline bool operator==(const wxPoint& p1, const wxPoint& p2)
-{
- return p1.x == p2.x && p1.y == p2.y;
-}
-
-inline bool operator!=(const wxPoint& p1, const wxPoint& p2)
-{
- return !(p1 == p2);
-}
-
-
-// arithmetic operations (component wise)
-inline wxPoint operator+(const wxPoint& p1, const wxPoint& p2)
-{
- return wxPoint(p1.x + p2.x, p1.y + p2.y);
-}
-
-inline wxPoint operator-(const wxPoint& p1, const wxPoint& p2)
-{
- return wxPoint(p1.x - p2.x, p1.y - p2.y);
-}
-
-inline wxPoint operator+(const wxPoint& p, const wxSize& s)
-{
- return wxPoint(p.x + s.x, p.y + s.y);
-}
-
-inline wxPoint operator-(const wxPoint& p, const wxSize& s)
-{
- return wxPoint(p.x - s.x, p.y - s.y);
-}
-
-inline wxPoint operator+(const wxSize& s, const wxPoint& p)
-{
- return wxPoint(p.x + s.x, p.y + s.y);
-}
-
-inline wxPoint operator-(const wxSize& s, const wxPoint& p)
-{
- return wxPoint(s.x - p.x, s.y - p.y);
-}
-
-inline wxPoint operator-(const wxPoint& p)
-{
- return wxPoint(-p.x, -p.y);
-}
-
-inline wxPoint operator/(const wxPoint& s, int i)
-{
- return wxPoint(s.x / i, s.y / i);
-}
-
-inline wxPoint operator*(const wxPoint& s, int i)
-{
- return wxPoint(s.x * i, s.y * i);
-}
-
-inline wxPoint operator*(int i, const wxPoint& s)
-{
- return wxPoint(s.x * i, s.y * i);
-}
-
-inline wxPoint operator/(const wxPoint& s, unsigned int i)
-{
- return wxPoint(s.x / i, s.y / i);
-}
-
-inline wxPoint operator*(const wxPoint& s, unsigned int i)
-{
- return wxPoint(s.x * i, s.y * i);
-}
-
-inline wxPoint operator*(unsigned int i, const wxPoint& s)
-{
- return wxPoint(s.x * i, s.y * i);
-}
-
-inline wxPoint operator/(const wxPoint& s, long i)
-{
- return wxPoint(s.x / i, s.y / i);
-}
-
-inline wxPoint operator*(const wxPoint& s, long i)
-{
- return wxPoint(int(s.x * i), int(s.y * i));
-}
-
-inline wxPoint operator*(long i, const wxPoint& s)
-{
- return wxPoint(int(s.x * i), int(s.y * i));
-}
-
-inline wxPoint operator/(const wxPoint& s, unsigned long i)
-{
- return wxPoint(s.x / i, s.y / i);
-}
-
-inline wxPoint operator*(const wxPoint& s, unsigned long i)
-{
- return wxPoint(int(s.x * i), int(s.y * i));
-}
-
-inline wxPoint operator*(unsigned long i, const wxPoint& s)
-{
- return wxPoint(int(s.x * i), int(s.y * i));
-}
-
-inline wxPoint operator*(const wxPoint& s, double i)
-{
- return wxPoint(int(s.x * i), int(s.y * i));
-}
-
-inline wxPoint operator*(double i, const wxPoint& s)
-{
- return wxPoint(int(s.x * i), int(s.y * i));
-}
-
WX_DECLARE_LIST_WITH_DECL(wxPoint, wxPointList, class WXDLLIMPEXP_CORE);
// ---------------------------------------------------------------------------
@@ -845,9 +886,24 @@ public:
// like Union() but don't ignore empty rectangles
wxRect& operator+=(const wxRect& rect);
+ friend WXDLLIMPEXP_CORE wxRect operator+(const wxRect& r1, const wxRect& r2);
// intersections of two rectangles not testing for empty rectangles
wxRect& operator*=(const wxRect& rect);
+ friend WXDLLIMPEXP_CORE wxRect operator*(const wxRect& r1, const wxRect& r2);
+
+ // compare rectangles
+ friend bool operator==(const wxRect& r1, const wxRect& r2)
+ {
+ return (r1.x == r2.x) && (r1.y == r2.y) &&
+ (r1.width == r2.width) && (r1.height == r2.height);
+ }
+
+ friend bool operator!=(const wxRect& r1, const wxRect& r2)
+ {
+ return !(r1 == r2);
+ }
+
// centre this rectangle in the given (usually, but not necessarily,
// larger) one
@@ -877,24 +933,6 @@ public:
};
-// compare rectangles
-inline bool operator==(const wxRect& r1, const wxRect& r2)
-{
- return (r1.x == r2.x) && (r1.y == r2.y) &&
- (r1.width == r2.width) && (r1.height == r2.height);
-}
-
-inline bool operator!=(const wxRect& r1, const wxRect& r2)
-{
- return !(r1 == r2);
-}
-
-// like Union() but don't treat empty rectangles specially
-WXDLLIMPEXP_CORE wxRect operator+(const wxRect& r1, const wxRect& r2);
-
-// intersections of two rectangles
-WXDLLIMPEXP_CORE wxRect operator*(const wxRect& r1, const wxRect& r2);
-
// define functions which couldn't be defined above because of declarations
// order
inline void wxSize::IncBy(const wxPoint& pt) { IncBy(pt.x, pt.y); }
diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h
index 72c625e590..047823e56e 100644
--- a/include/wx/generic/grid.h
+++ b/include/wx/generic/grid.h
@@ -2284,6 +2284,8 @@ public:
void ClearSelection();
+ bool CopySelection();
+
bool IsInSelection( int row, int col ) const;
bool IsInSelection( const wxGridCellCoords& coords ) const
diff --git a/include/wx/generic/icon.h b/include/wx/generic/icon.h
index 0138dfeb5b..14fe70acfe 100644
--- a/include/wx/generic/icon.h
+++ b/include/wx/generic/icon.h
@@ -51,6 +51,8 @@ public:
// ctors, assignment operators...), but it's ok to have such function
void CopyFromBitmap(const wxBitmap& bmp);
+ wxDECLARE_VARIANT_OBJECT_EXPORTED(wxIcon, WXDLLIMPEXP_CORE);
+
private:
wxDECLARE_DYNAMIC_CLASS(wxIcon);
};
diff --git a/include/wx/generic/splitter.h b/include/wx/generic/splitter.h
index 2294f431e4..f2fbe2a906 100644
--- a/include/wx/generic/splitter.h
+++ b/include/wx/generic/splitter.h
@@ -131,6 +131,9 @@ public:
// Is the window split?
bool IsSplit() const { return (m_windowTwo != nullptr); }
+ // Return true if wxSP_LIVE_UPDATE is always used.
+ bool AlwaysUsesLiveUpdate() const;
+
// Sets the border size
void SetBorderSize(int WXUNUSED(width)) { }
diff --git a/include/wx/generic/treectlg.h b/include/wx/generic/treectlg.h
index 7e98c1c1da..8475561619 100644
--- a/include/wx/generic/treectlg.h
+++ b/include/wx/generic/treectlg.h
@@ -243,7 +243,7 @@ protected:
*m_key_current,
// A hint to select a parent item after deleting a child
*m_select_me;
- unsigned short m_indent;
+ unsigned int m_indent;
int m_lineHeight;
wxPen m_dottedPen;
wxBrush m_hilightBrush,
@@ -357,6 +357,8 @@ protected:
virtual wxSize DoGetBestSize() const override;
private:
+ void OnDPIChanged(wxDPIChangedEvent& event);
+
void OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
{
InitVisualAttributes();
diff --git a/include/wx/geometry.h b/include/wx/geometry.h
index 34a414ff01..58ec552b56 100644
--- a/include/wx/geometry.h
+++ b/include/wx/geometry.h
@@ -71,6 +71,60 @@ public :
inline bool operator==(const wxPoint2DInt& pt) const;
inline bool operator!=(const wxPoint2DInt& pt) const;
+ friend wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
+ {
+ return wxPoint2DInt( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y );
+ }
+
+ friend wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
+ {
+ return wxPoint2DInt( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y );
+ }
+
+
+ friend wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
+ {
+ return wxPoint2DInt( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y );
+ }
+
+ friend wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt)
+ {
+ return wxPoint2DInt( pt.m_x * n , pt.m_y * n );
+ }
+
+ friend wxPoint2DInt operator*(wxDouble n , const wxPoint2DInt& pt)
+ {
+ return wxPoint2DInt( static_cast(pt.m_x * n) ,
+ static_cast(pt.m_y * n) );
+ }
+
+ friend wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n)
+ {
+ return wxPoint2DInt( pt.m_x * n , pt.m_y * n );
+ }
+
+ friend wxPoint2DInt operator*(const wxPoint2DInt& pt , wxDouble n)
+ {
+ return wxPoint2DInt( static_cast(pt.m_x * n) ,
+ static_cast(pt.m_y * n) );
+ }
+
+ friend wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
+ {
+ return wxPoint2DInt( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y );
+ }
+
+ friend wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n)
+ {
+ return wxPoint2DInt( pt.m_x / n , pt.m_y / n );
+ }
+
+ friend wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n)
+ {
+ return wxPoint2DInt( static_cast(pt.m_x / n) ,
+ static_cast(pt.m_y / n) );
+ }
+
#if wxUSE_STREAMS
void WriteTo( wxDataOutputStream &stream ) const;
void ReadFrom( wxDataInputStream &stream );
@@ -80,17 +134,6 @@ public :
wxInt32 m_y;
};
-inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
-inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
-inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
-inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt);
-inline wxPoint2DInt operator*(wxDouble n , const wxPoint2DInt& pt);
-inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n);
-inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxDouble n);
-inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2);
-inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n);
-inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n);
-
inline wxPoint2DInt::wxPoint2DInt()
{
m_x = 0;
@@ -209,60 +252,6 @@ inline bool wxPoint2DInt::operator!=(const wxPoint2DInt& pt) const
return m_x != pt.m_x || m_y != pt.m_y;
}
-inline wxPoint2DInt operator+(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
-{
- return wxPoint2DInt( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y );
-}
-
-inline wxPoint2DInt operator-(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
-{
- return wxPoint2DInt( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y );
-}
-
-
-inline wxPoint2DInt operator*(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
-{
- return wxPoint2DInt( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y );
-}
-
-inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt)
-{
- return wxPoint2DInt( pt.m_x * n , pt.m_y * n );
-}
-
-inline wxPoint2DInt operator*(wxDouble n , const wxPoint2DInt& pt)
-{
- return wxPoint2DInt( static_cast(pt.m_x * n) ,
- static_cast(pt.m_y * n) );
-}
-
-inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n)
-{
- return wxPoint2DInt( pt.m_x * n , pt.m_y * n );
-}
-
-inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxDouble n)
-{
- return wxPoint2DInt( static_cast(pt.m_x * n) ,
- static_cast(pt.m_y * n) );
-}
-
-inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2)
-{
- return wxPoint2DInt( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y );
-}
-
-inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n)
-{
- return wxPoint2DInt( pt.m_x / n , pt.m_y / n );
-}
-
-inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n)
-{
- return wxPoint2DInt( static_cast(pt.m_x / n) ,
- static_cast(pt.m_y / n) );
-}
-
// wxPoint2Ds represent a point or a vector in a 2d coordinate system
class WXDLLIMPEXP_CORE wxPoint2DDouble
@@ -307,21 +296,61 @@ public :
inline bool operator==(const wxPoint2DDouble& pt) const;
inline bool operator!=(const wxPoint2DDouble& pt) const;
+ friend wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
+ {
+ return wxPoint2DDouble( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y );
+ }
+
+ friend wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
+ {
+ return wxPoint2DDouble( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y );
+ }
+
+
+ friend wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
+ {
+ return wxPoint2DDouble( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y );
+ }
+
+ friend wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt)
+ {
+ return wxPoint2DDouble( pt.m_x * n , pt.m_y * n );
+ }
+
+ friend wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt)
+ {
+ return wxPoint2DDouble( pt.m_x * n , pt.m_y * n );
+ }
+
+ friend wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n)
+ {
+ return wxPoint2DDouble( pt.m_x * n , pt.m_y * n );
+ }
+
+ friend wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n)
+ {
+ return wxPoint2DDouble( pt.m_x * n , pt.m_y * n );
+ }
+
+ friend wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
+ {
+ return wxPoint2DDouble( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y );
+ }
+
+ friend wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n)
+ {
+ return wxPoint2DDouble( pt.m_x / n , pt.m_y / n );
+ }
+
+ friend wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n)
+ {
+ return wxPoint2DDouble( pt.m_x / n , pt.m_y / n );
+ }
+
wxDouble m_x;
wxDouble m_y;
};
-inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
-inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
-inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
-inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt);
-inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt);
-inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n);
-inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n);
-inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2);
-inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n);
-inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n);
-
inline wxPoint2DDouble::wxPoint2DDouble()
{
m_x = 0.0;
@@ -426,57 +455,6 @@ inline bool wxPoint2DDouble::operator!=(const wxPoint2DDouble& pt) const
return !(*this == pt);
}
-inline wxPoint2DDouble operator+(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
-{
- return wxPoint2DDouble( pt1.m_x + pt2.m_x , pt1.m_y + pt2.m_y );
-}
-
-inline wxPoint2DDouble operator-(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
-{
- return wxPoint2DDouble( pt1.m_x - pt2.m_x , pt1.m_y - pt2.m_y );
-}
-
-
-inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
-{
- return wxPoint2DDouble( pt1.m_x * pt2.m_x , pt1.m_y * pt2.m_y );
-}
-
-inline wxPoint2DDouble operator*(wxDouble n , const wxPoint2DDouble& pt)
-{
- return wxPoint2DDouble( pt.m_x * n , pt.m_y * n );
-}
-
-inline wxPoint2DDouble operator*(wxInt32 n , const wxPoint2DDouble& pt)
-{
- return wxPoint2DDouble( pt.m_x * n , pt.m_y * n );
-}
-
-inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxDouble n)
-{
- return wxPoint2DDouble( pt.m_x * n , pt.m_y * n );
-}
-
-inline wxPoint2DDouble operator*(const wxPoint2DDouble& pt , wxInt32 n)
-{
- return wxPoint2DDouble( pt.m_x * n , pt.m_y * n );
-}
-
-inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt1 , const wxPoint2DDouble& pt2)
-{
- return wxPoint2DDouble( pt1.m_x / pt2.m_x , pt1.m_y / pt2.m_y );
-}
-
-inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxDouble n)
-{
- return wxPoint2DDouble( pt.m_x / n , pt.m_y / n );
-}
-
-inline wxPoint2DDouble operator/(const wxPoint2DDouble& pt , wxInt32 n)
-{
- return wxPoint2DDouble( pt.m_x / n , pt.m_y / n );
-}
-
// wxRect2Ds are an axis-aligned rectangles, each side of the rect is parallel to the x- or m_y- axis. The rectangle is either defined by the
// top left and bottom right corner, or by the top left corner and size. A point is contained within the rectangle if
// left <= x < right and top <= m_y < bottom , thus it is a half open interval.
diff --git a/include/wx/gtk/checkbox.h b/include/wx/gtk/checkbox.h
index c98615db7b..fdfa4a7b1e 100644
--- a/include/wx/gtk/checkbox.h
+++ b/include/wx/gtk/checkbox.h
@@ -59,6 +59,8 @@ protected:
private:
typedef wxCheckBoxBase base_type;
+ virtual void GTKRemoveBorder() override;
+
GtkWidget *m_widgetCheckbox;
GtkWidget *m_widgetLabel;
diff --git a/include/wx/gtk/control.h b/include/wx/gtk/control.h
index 684c3a5f41..d6a7721955 100644
--- a/include/wx/gtk/control.h
+++ b/include/wx/gtk/control.h
@@ -87,6 +87,8 @@ protected:
wxSize GTKGetEntryMargins(GtkEntry* entry) const;
private:
+ virtual void GTKRemoveBorder() override;
+
wxDECLARE_DYNAMIC_CLASS(wxControl);
};
diff --git a/include/wx/gtk/dc.h b/include/wx/gtk/dc.h
index 472c90fe11..dd9baf9725 100644
--- a/include/wx/gtk/dc.h
+++ b/include/wx/gtk/dc.h
@@ -64,6 +64,8 @@ class wxClientDCImpl: public wxGTKCairoDCImpl
public:
wxClientDCImpl(wxClientDC* owner, wxWindow* window);
+ static bool CanBeUsedForDrawing(const wxWindow* window);
+
wxDECLARE_NO_COPY_CLASS(wxClientDCImpl);
};
//-----------------------------------------------------------------------------
diff --git a/include/wx/gtk/dcclient.h b/include/wx/gtk/dcclient.h
index 6b42e90467..f6d6f3ed5d 100644
--- a/include/wx/gtk/dcclient.h
+++ b/include/wx/gtk/dcclient.h
@@ -150,6 +150,9 @@ public:
virtual void DoGetSize(int *width, int *height) const override;
+ static bool
+ CanBeUsedForDrawing(const wxWindow* WXUNUSED(window)) { return true; }
+
wxDECLARE_ABSTRACT_CLASS(wxClientDCImpl);
};
diff --git a/include/wx/gtk/private/event.h b/include/wx/gtk/private/event.h
index 851fd93710..9811422df3 100644
--- a/include/wx/gtk/private/event.h
+++ b/include/wx/gtk/private/event.h
@@ -62,7 +62,7 @@ template void InitMouseEvent(wxWindowGTK *win,
// Some no-window widgets, notably GtkEntry on GTK3, have a GdkWindow
// covering part of their area. Event coordinates from that window are
// not relative to the widget, so do the conversion here.
- if (!gtk_widget_get_has_window(win->m_widget) &&
+ if (win->m_wxwindow == nullptr && !gtk_widget_get_has_window(win->m_widget) &&
gtk_widget_get_window(win->m_widget) == gdk_window_get_parent(gdk_event->window))
{
GtkAllocation a;
diff --git a/include/wx/gtk/setup.h b/include/wx/gtk/setup.h
index 6804b46097..7a75f1e1ea 100644
--- a/include/wx/gtk/setup.h
+++ b/include/wx/gtk/setup.h
@@ -1334,7 +1334,7 @@
// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL
// headers and libraries to be able to compile the library with wxUSE_GLCANVAS
-// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the
+// set to 1 and, under Windows, also to add opengl32.lib to the
// list of libraries used to link your application when linking to wxWidgets
// statically (although this is done implicitly for Microsoft Visual C++ users).
//
diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h
index f0c94d8d2a..0b26076a09 100644
--- a/include/wx/gtk/window.h
+++ b/include/wx/gtk/window.h
@@ -466,6 +466,7 @@ protected:
private:
void Init();
+ virtual void GTKRemoveBorder();
// return true if this window must have a non-null parent, false if it can
// be created without parent (normally only top level windows but in wxGTK
diff --git a/include/wx/headerctrl.h b/include/wx/headerctrl.h
index b13abd9052..31b4d66edf 100644
--- a/include/wx/headerctrl.h
+++ b/include/wx/headerctrl.h
@@ -343,6 +343,9 @@ protected:
virtual const wxHeaderColumn& GetColumn(unsigned int idx) const override;
virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle) override;
+ virtual void UpdateColumnVisibility(unsigned int idx, bool show) override;
+ virtual void UpdateColumnsOrder(const wxArrayInt& order) override;
+
// and define another one to be overridden in the derived classes: it
// should return the best width for the given column contents or -1 if not
// implemented, we use it to implement UpdateColumnWidthToFit()
diff --git a/include/wx/icon.h b/include/wx/icon.h
index dbc1ed5f4b..d8576e9e04 100644
--- a/include/wx/icon.h
+++ b/include/wx/icon.h
@@ -11,7 +11,7 @@
#define _WX_ICON_H_BASE_
#include "wx/iconloc.h"
-
+#include "wx/variant.h"
// a more readable way to tell
#define wxICON_SCREEN_DEPTH (-1)
@@ -57,15 +57,5 @@
#define wxICON_IS_BITMAP
#endif
-//-----------------------------------------------------------------------------
-// wxVariant support
-//-----------------------------------------------------------------------------
-
-#if wxUSE_VARIANT
-#include "wx/variant.h"
-DECLARE_VARIANT_OBJECT_EXPORTED(wxIcon,WXDLLIMPEXP_CORE)
-#endif
-
-
#endif
// _WX_ICON_H_BASE_
diff --git a/include/wx/image.h b/include/wx/image.h
index 0f1ad39a29..8e34f651a2 100644
--- a/include/wx/image.h
+++ b/include/wx/image.h
@@ -18,6 +18,7 @@
#include "wx/gdicmn.h"
#include "wx/hashmap.h"
#include "wx/arrstr.h"
+#include "wx/variant.h"
#if wxUSE_STREAMS
# include "wx/stream.h"
@@ -98,15 +99,6 @@ class WXDLLIMPEXP_FWD_CORE wxImageHandler;
class WXDLLIMPEXP_FWD_CORE wxImage;
class WXDLLIMPEXP_FWD_CORE wxPalette;
-//-----------------------------------------------------------------------------
-// wxVariant support
-//-----------------------------------------------------------------------------
-
-#if wxUSE_VARIANT
-#include "wx/variant.h"
-DECLARE_VARIANT_OBJECT_EXPORTED(wxImage,WXDLLIMPEXP_CORE)
-#endif
-
//-----------------------------------------------------------------------------
// wxImageHandler
//-----------------------------------------------------------------------------
@@ -594,6 +586,9 @@ public:
static HSVValue RGBtoHSV(const RGBValue& rgb);
static RGBValue HSVtoRGB(const HSVValue& hsv);
+ // wxVariant support
+ wxDECLARE_VARIANT_OBJECT_EXPORTED(wxImage, WXDLLIMPEXP_CORE);
+
protected:
static wxList sm_handlers;
diff --git a/include/wx/log.h b/include/wx/log.h
index 9dfd9117aa..83e08f7e10 100644
--- a/include/wx/log.h
+++ b/include/wx/log.h
@@ -341,6 +341,19 @@ protected:
#endif // WXWIN_COMPATIBILITY_3_0
};
+// Special kind of trivial formatter which simply uses the message unchanged.
+class wxLogFormatterNone : public wxLogFormatter
+{
+public:
+ wxLogFormatterNone() = default;
+
+ virtual wxString Format(wxLogLevel WXUNUSED(level),
+ const wxString& msg,
+ const wxLogRecordInfo& WXUNUSED(info)) const override
+ {
+ return msg;
+ }
+};
// ----------------------------------------------------------------------------
// derive from this class to redirect (or suppress, or ...) log messages
@@ -665,6 +678,10 @@ public:
// get the string contents with all messages logged
const wxString& GetBuffer() const { return m_str; }
+ // clear all the messages, this, in particular, prevents them from being
+ // flushed
+ void Clear() { m_str.clear(); }
+
// show the buffer contents to the user in the best possible way (this uses
// wxMessageOutputMessageBox) and clear it
virtual void Flush() override;
@@ -748,6 +765,41 @@ private:
bool m_flagOld; // the previous value of the wxLog::ms_doLog
};
+// ----------------------------------------------------------------------------
+// Collect all logged messages into a (multiline) string.
+// ----------------------------------------------------------------------------
+
+// This class is supposed to be used as a local variable and collects, without
+// showing them, all the messages logged during its lifetime.
+class wxLogCollector
+{
+public:
+ wxLogCollector()
+ : m_logOrig{wxLog::SetActiveTarget(&m_logBuf)}
+ {
+ delete m_logBuf.SetFormatter(new wxLogFormatterNone{});
+ }
+
+ ~wxLogCollector()
+ {
+ // Don't flush the messages in the buffer.
+ m_logBuf.Clear();
+
+ wxLog::SetActiveTarget(m_logOrig);
+ }
+
+ const wxString& GetMessages() const
+ {
+ return m_logBuf.GetBuffer();
+ }
+
+private:
+ wxLogBuffer m_logBuf;
+ wxLog* const m_logOrig;
+
+ wxDECLARE_NO_COPY_CLASS(wxLogCollector);
+};
+
// ----------------------------------------------------------------------------
// chaining log target: installs itself as a log target and passes all
// messages to the real log target given to it in the ctor but also forwards
diff --git a/include/wx/longlong.h b/include/wx/longlong.h
index ff735a8fcd..6762ad08fa 100644
--- a/include/wx/longlong.h
+++ b/include/wx/longlong.h
@@ -197,6 +197,8 @@ public:
{ return wxLongLongNative(m_ll + ll.m_ll); }
wxLongLongNative& operator+=(const wxLongLongNative& ll)
{ m_ll += ll.m_ll; return *this; }
+ friend wxLongLongNative operator+(long l, const wxLongLongNative& ll)
+ { return ll + l; }
wxLongLongNative operator+(const wxLongLong_t ll) const
{ return wxLongLongNative(m_ll + ll); }
@@ -221,6 +223,10 @@ public:
{ return wxLongLongNative(m_ll - ll.m_ll); }
wxLongLongNative& operator-=(const wxLongLongNative& ll)
{ m_ll -= ll.m_ll; return *this; }
+ friend wxLongLongNative operator-(long l, const wxLongLongNative& ll)
+ {
+ return wxLongLongNative(l) - ll;
+ }
wxLongLongNative operator-(const wxLongLong_t ll) const
{ return wxLongLongNative(m_ll - ll); }
@@ -314,6 +320,13 @@ public:
bool operator>=(long l) const
{ return m_ll >= l; }
+ friend bool operator<(long l, const wxLongLongNative& ll) { return ll > l; }
+ friend bool operator>(long l, const wxLongLongNative& ll) { return ll < l; }
+ friend bool operator<=(long l, const wxLongLongNative& ll) { return ll >= l; }
+ friend bool operator>=(long l, const wxLongLongNative& ll) { return ll <= l; }
+ friend bool operator==(long l, const wxLongLongNative& ll) { return ll == l; }
+ friend bool operator!=(long l, const wxLongLongNative& ll) { return ll != l; }
+
// miscellaneous
// return the string representation of this number
@@ -421,6 +434,8 @@ public:
{ return wxULongLongNative(m_ll + ll.m_ll); }
wxULongLongNative& operator+=(const wxULongLongNative& ll)
{ m_ll += ll.m_ll; return *this; }
+ friend wxULongLongNative operator+(unsigned long l, const wxULongLongNative& ull)
+ { return ull + l; }
wxULongLongNative operator+(const wxULongLong_t ll) const
{ return wxULongLongNative(m_ll + ll); }
@@ -440,6 +455,10 @@ public:
{ return wxULongLongNative(m_ll - ll.m_ll); }
wxULongLongNative& operator-=(const wxULongLongNative& ll)
{ m_ll -= ll.m_ll; return *this; }
+ friend wxULongLongNative operator-(unsigned long l, const wxULongLongNative& ull)
+ {
+ return wxULongLongNative(l - ull.m_ll);
+ }
wxULongLongNative operator-(const wxULongLong_t ll) const
{ return wxULongLongNative(m_ll - ll); }
@@ -533,6 +552,13 @@ public:
bool operator>=(unsigned long l) const
{ return m_ll >= l; }
+ friend bool operator<(unsigned long l, const wxULongLongNative& ull) { return ull > l; }
+ friend bool operator>(unsigned long l, const wxULongLongNative& ull) { return ull < l; }
+ friend bool operator<=(unsigned long l, const wxULongLongNative& ull) { return ull >= l; }
+ friend bool operator>=(unsigned long l, const wxULongLongNative& ull) { return ull <= l; }
+ friend bool operator==(unsigned long l, const wxULongLongNative& ull) { return ull == l; }
+ friend bool operator!=(unsigned long l, const wxULongLongNative& ull) { return ull != l; }
+
// miscellaneous
// return the string representation of this number
@@ -696,6 +722,8 @@ public:
wxLongLongWx operator+(long l) const;
wxLongLongWx& operator+=(long l);
+ friend wxLongLongWx operator+(long l, const wxLongLongWx& ll) { return ll + l; }
+
// pre increment operator
wxLongLongWx& operator++();
@@ -709,6 +737,10 @@ public:
// subtraction
wxLongLongWx operator-(const wxLongLongWx& ll) const;
wxLongLongWx& operator-=(const wxLongLongWx& ll);
+ friend wxLongLongWx operator-(long l, const wxLongLongWx& ll)
+ {
+ return wxLongLongWx(l) - ll;
+ }
// pre decrement operator
wxLongLongWx& operator--();
@@ -761,6 +793,13 @@ public:
bool operator<=(long l) const { return *this < l || *this == l; }
bool operator>=(long l) const { return *this > l || *this == l; }
+ friend bool operator<(long l, const wxLongLongWx& ll) { return ll > l; }
+ friend bool operator>(long l, const wxLongLongWx& ll) { return ll < l; }
+ friend bool operator<=(long l, const wxLongLongWx& ll) { return ll >= l; }
+ friend bool operator>=(long l, const wxLongLongWx& ll) { return ll <= l; }
+ friend bool operator==(long l, const wxLongLongWx& ll) { return ll == l; }
+ friend bool operator!=(long l, const wxLongLongWx& ll) { return ll != l; }
+
// multiplication
wxLongLongWx operator*(const wxLongLongWx& ll) const;
wxLongLongWx& operator*=(const wxLongLongWx& ll);
@@ -795,7 +834,14 @@ public:
class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxLongLongWx&);
friend WXDLLIMPEXP_BASE
class wxTextInputStream& operator>>(class wxTextInputStream&, wxLongLongWx&);
-#endif
+
+#if wxUSE_LONGLONG_NATIVE
+ friend WXDLLIMPEXP_BASE
+ class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxLongLong_t value);
+ friend WXDLLIMPEXP_BASE
+ class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxLongLong_t &value);
+#endif // wxUSE_LONGLONG_NATIVE
+#endif // wxUSE_STREAMS
private:
// long is at least 32 bits, so represent our 64bit number as 2 longs
@@ -920,6 +966,8 @@ public:
wxULongLongWx& operator+=(const wxULongLongWx& ll);
wxULongLongWx operator+(unsigned long l) const;
wxULongLongWx& operator+=(unsigned long l);
+ friend wxULongLongWx operator+(unsigned long l, const wxULongLongWx& ull)
+ { return ull + l; }
// pre increment operator
wxULongLongWx& operator++();
@@ -931,6 +979,13 @@ public:
wxLongLongWx operator-(const wxULongLongWx& ll) const;
wxULongLongWx& operator-=(const wxULongLongWx& ll);
+ friend wxLongLongWx operator-(unsigned long l, const wxULongLongWx& ull)
+ {
+ const wxULongLongWx ret = wxULongLongWx(l) - ull;
+ return wxLongLongWx((wxInt32)ret.GetHi(),ret.GetLo());
+ }
+
+
// pre decrement operator
wxULongLongWx& operator--();
@@ -977,6 +1032,13 @@ public:
bool operator<=(unsigned long l) const { return *this < l || *this == l; }
bool operator>=(unsigned long l) const { return *this > l || *this == l; }
+ friend bool operator<(unsigned long l, const wxULongLongWx& ull) { return ull > l; }
+ friend bool operator>(unsigned long l, const wxULongLongWx& ull) { return ull < l; }
+ friend bool operator<=(unsigned long l, const wxULongLongWx& ull) { return ull >= l; }
+ friend bool operator>=(unsigned long l, const wxULongLongWx& ull) { return ull <= l; }
+ friend bool operator==(unsigned long l, const wxULongLongWx& ull) { return ull == l; }
+ friend bool operator!=(unsigned long l, const wxULongLongWx& ull) { return ull != l; }
+
// multiplication
wxULongLongWx operator*(const wxULongLongWx& ll) const;
wxULongLongWx& operator*=(const wxULongLongWx& ll);
@@ -1011,7 +1073,14 @@ public:
class wxTextOutputStream& operator<<(class wxTextOutputStream&, const wxULongLongWx&);
friend WXDLLIMPEXP_BASE
class wxTextInputStream& operator>>(class wxTextInputStream&, wxULongLongWx&);
-#endif
+
+#if wxUSE_LONGLONG_NATIVE
+ friend WXDLLIMPEXP_BASE
+ class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxULongLong_t value);
+ friend WXDLLIMPEXP_BASE
+ class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxULongLong_t &value);
+#endif // wxUSE_LONGLONG_NATIVE
+#endif // wxUSE_STREAMS
private:
// long is at least 32 bits, so represent our 64bit number as 2 longs
@@ -1031,48 +1100,6 @@ private:
#endif // wxUSE_LONGLONG_WX
-// ----------------------------------------------------------------------------
-// binary operators
-// ----------------------------------------------------------------------------
-
-inline bool operator<(long l, const wxLongLong& ll) { return ll > l; }
-inline bool operator>(long l, const wxLongLong& ll) { return ll < l; }
-inline bool operator<=(long l, const wxLongLong& ll) { return ll >= l; }
-inline bool operator>=(long l, const wxLongLong& ll) { return ll <= l; }
-inline bool operator==(long l, const wxLongLong& ll) { return ll == l; }
-inline bool operator!=(long l, const wxLongLong& ll) { return ll != l; }
-
-inline wxLongLong operator+(long l, const wxLongLong& ll) { return ll + l; }
-inline wxLongLong operator-(long l, const wxLongLong& ll)
-{
- return wxLongLong(l) - ll;
-}
-
-inline bool operator<(unsigned long l, const wxULongLong& ull) { return ull > l; }
-inline bool operator>(unsigned long l, const wxULongLong& ull) { return ull < l; }
-inline bool operator<=(unsigned long l, const wxULongLong& ull) { return ull >= l; }
-inline bool operator>=(unsigned long l, const wxULongLong& ull) { return ull <= l; }
-inline bool operator==(unsigned long l, const wxULongLong& ull) { return ull == l; }
-inline bool operator!=(unsigned long l, const wxULongLong& ull) { return ull != l; }
-
-inline wxULongLong operator+(unsigned long l, const wxULongLong& ull) { return ull + l; }
-
-inline wxLongLong operator-(unsigned long l, const wxULongLong& ull)
-{
- const wxULongLong ret = wxULongLong(l) - ull;
- return wxLongLong((wxInt32)ret.GetHi(),ret.GetLo());
-}
-
-#if wxUSE_LONGLONG_NATIVE && wxUSE_STREAMS
-
-WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxULongLong_t value);
-WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &stream, wxLongLong_t value);
-
-WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxULongLong_t &value);
-WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &stream, wxLongLong_t &value);
-
-#endif
-
// ----------------------------------------------------------------------------
// Specialize numeric_limits<> for our long long wrapper classes.
// ----------------------------------------------------------------------------
diff --git a/include/wx/msw/bitmap.h b/include/wx/msw/bitmap.h
index 403e6e91c1..6b5cd6efe6 100644
--- a/include/wx/msw/bitmap.h
+++ b/include/wx/msw/bitmap.h
@@ -157,6 +157,14 @@ public:
int depth = wxBITMAP_SCREEN_DEPTH)
{ return CreateWithDIPSize(wxSize(width, height), scale, depth); }
+ bool CreateWithLogicalSize(const wxSize& sz,
+ double scale,
+ int depth = wxBITMAP_SCREEN_DEPTH);
+ bool CreateWithLogicalSize(int width, int height,
+ double scale,
+ int depth = wxBITMAP_SCREEN_DEPTH)
+ { return CreateWithLogicalSize(wxSize(width, height), scale, depth); }
+
virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = nullptr) const;
diff --git a/include/wx/msw/dcclient.h b/include/wx/msw/dcclient.h
index d6eaffda58..01f2cca210 100644
--- a/include/wx/msw/dcclient.h
+++ b/include/wx/msw/dcclient.h
@@ -56,6 +56,9 @@ public:
virtual void DoGetSize(int *width, int *height) const override;
+ static bool
+ CanBeUsedForDrawing(const wxWindow* WXUNUSED(window)) { return true; }
+
protected:
void InitDC();
diff --git a/include/wx/msw/filedlg.h b/include/wx/msw/filedlg.h
index 6a01c8356b..7c97723dd7 100644
--- a/include/wx/msw/filedlg.h
+++ b/include/wx/msw/filedlg.h
@@ -19,6 +19,7 @@ class wxFileDialogMSWData;
class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase
{
public:
+ wxFileDialog() = default;
wxFileDialog(wxWindow *parent,
const wxString& message = wxASCII_STR(wxFileSelectorPromptStr),
const wxString& defaultDir = wxEmptyString,
@@ -78,7 +79,7 @@ private:
// Extra data, possibly null if not needed, use MSWData() to access it if
// it should be created on demand.
- wxFileDialogMSWData* m_data;
+ wxFileDialogMSWData* m_data = nullptr;
wxDECLARE_DYNAMIC_CLASS(wxFileDialog);
diff --git a/include/wx/msw/icon.h b/include/wx/msw/icon.h
index bb13e27d98..fea6ff68a4 100644
--- a/include/wx/msw/icon.h
+++ b/include/wx/msw/icon.h
@@ -77,6 +77,8 @@ public:
// ctors, assignment operators...), but it's ok to have such function
void CopyFromBitmap(const wxBitmap& bmp);
+ wxDECLARE_VARIANT_OBJECT_EXPORTED(wxIcon, WXDLLIMPEXP_CORE);
+
protected:
virtual wxGDIImageRefData *CreateData() const override
{
diff --git a/include/wx/msw/setup.h b/include/wx/msw/setup.h
index 00db9d875d..c503c75a9b 100644
--- a/include/wx/msw/setup.h
+++ b/include/wx/msw/setup.h
@@ -1334,7 +1334,7 @@
// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL
// headers and libraries to be able to compile the library with wxUSE_GLCANVAS
-// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the
+// set to 1 and, under Windows, also to add opengl32.lib to the
// list of libraries used to link your application when linking to wxWidgets
// statically (although this is done implicitly for Microsoft Visual C++ users).
//
diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h
index add141eb0e..22b9b0d52a 100644
--- a/include/wx/osx/cocoa/private.h
+++ b/include/wx/osx/cocoa/private.h
@@ -221,7 +221,7 @@ public :
virtual void controlTextDidChange();
virtual void AdjustClippingView(wxScrollBar* horizontal, wxScrollBar* vertical) override;
- virtual void UseClippingView(bool clip) override;
+ virtual void UseClippingView() override;
virtual WXWidget GetContainer() const override { return m_osxClipView ? m_osxClipView : m_osxView; }
protected:
diff --git a/include/wx/osx/core/private.h b/include/wx/osx/core/private.h
index 6c16eaf783..f4c478497a 100644
--- a/include/wx/osx/core/private.h
+++ b/include/wx/osx/core/private.h
@@ -368,7 +368,7 @@ public :
// scrolling views need a clip subview that acts as parent for native children
// (except for the scollbars) which are children of the view itself
virtual void AdjustClippingView(wxScrollBar* horizontal, wxScrollBar* vertical);
- virtual void UseClippingView(bool clip);
+ virtual void UseClippingView();
// returns native view which acts as a parent for native children
virtual WXWidget GetContainer() const;
diff --git a/include/wx/osx/dcclient.h b/include/wx/osx/dcclient.h
index d5840ad98a..be16886f1b 100644
--- a/include/wx/osx/dcclient.h
+++ b/include/wx/osx/dcclient.h
@@ -54,6 +54,9 @@ public:
wxClientDCImpl( wxDC *owner, wxWindow *window );
virtual ~wxClientDCImpl();
+ static bool
+ CanBeUsedForDrawing(const wxWindow* WXUNUSED(window)) { return false; }
+
private:
wxDECLARE_CLASS(wxClientDCImpl);
wxDECLARE_NO_COPY_CLASS(wxClientDCImpl);
diff --git a/include/wx/osx/setup.h b/include/wx/osx/setup.h
index d2d1045532..298b64233e 100644
--- a/include/wx/osx/setup.h
+++ b/include/wx/osx/setup.h
@@ -1341,7 +1341,7 @@
// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL
// headers and libraries to be able to compile the library with wxUSE_GLCANVAS
-// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the
+// set to 1 and, under Windows, also to add opengl32.lib to the
// list of libraries used to link your application when linking to wxWidgets
// statically (although this is done implicitly for Microsoft Visual C++ users).
//
diff --git a/include/wx/osx/window.h b/include/wx/osx/window.h
index e19241d430..a5f5e2c359 100644
--- a/include/wx/osx/window.h
+++ b/include/wx/osx/window.h
@@ -224,7 +224,7 @@ public:
// returns true if children have to clipped to the content area
// (e.g., scrolled windows)
bool MacClipChildren() const { return m_clipChildren ; }
- void MacSetClipChildren( bool clip );
+ void MacSetClipChildren();
// returns true if the grandchildren need to be clipped to the children's content area
// (e.g., splitter windows)
diff --git a/include/wx/pen.h b/include/wx/pen.h
index 6ae4df8f62..db76b9641d 100644
--- a/include/wx/pen.h
+++ b/include/wx/pen.h
@@ -133,6 +133,8 @@ extern WXDLLIMPEXP_DATA_CORE(wxPenList*) wxThePenList;
// to compile without warnings which it would otherwise provoke from some
// compilers as it compares elements of different enums
+#if WXWIN_COMPATIBILITY_3_2
+
wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants")
inline bool operator==(wxPenStyle s, wxDeprecatedGUIConstants t)
{
@@ -145,4 +147,6 @@ inline bool operator!=(wxPenStyle s, wxDeprecatedGUIConstants t)
return static_cast(s) != static_cast(t);
}
+#endif // WXWIN_COMPATIBILITY_3_2
+
#endif // _WX_PEN_H_BASE_
diff --git a/include/wx/platform.h b/include/wx/platform.h
index b77b5bd86c..8597797767 100644
--- a/include/wx/platform.h
+++ b/include/wx/platform.h
@@ -455,6 +455,9 @@
# ifndef MAC_OS_X_VERSION_10_16
# define MAC_OS_X_VERSION_10_16 101600
# endif
+ /*
+ Note that since macOS 11 there is no more "X" in the names.
+ */
# ifndef MAC_OS_VERSION_11_0
# define MAC_OS_VERSION_11_0 110000
# endif
diff --git a/include/wx/private/overlay.h b/include/wx/private/overlay.h
index fc95d53722..fed674b014 100644
--- a/include/wx/private/overlay.h
+++ b/include/wx/private/overlay.h
@@ -21,6 +21,8 @@
#elif defined(__WXGTK3__)
#define wxHAS_NATIVE_OVERLAY 1
#define wxHAS_GENERIC_OVERLAY 1
+#elif defined(__WXQT__)
+ #define wxHAS_NATIVE_OVERLAY 1
#else
#define wxHAS_GENERIC_OVERLAY 1
#endif
diff --git a/include/wx/propgrid/advprops.h b/include/wx/propgrid/advprops.h
index 7ae62397d1..4a77d5b275 100644
--- a/include/wx/propgrid/advprops.h
+++ b/include/wx/propgrid/advprops.h
@@ -113,6 +113,8 @@ public:
Init( cpv.m_type, cpv.m_colour );
}
+ wxDECLARE_VARIANT_OBJECT_EXPORTED(wxColourPropertyValue, WXDLLIMPEXP_PROPGRID);
+
private:
wxDECLARE_DYNAMIC_CLASS(wxColourPropertyValue);
};
@@ -121,8 +123,6 @@ private:
bool WXDLLIMPEXP_PROPGRID
operator==(const wxColourPropertyValue&, const wxColourPropertyValue&);
-DECLARE_VARIANT_OBJECT_EXPORTED(wxColourPropertyValue, WXDLLIMPEXP_PROPGRID)
-
// -----------------------------------------------------------------------
// Property representing wxFont.
@@ -136,7 +136,16 @@ public:
const wxFont& value = wxFont());
virtual ~wxFontProperty() = default;
virtual void OnSetValue() override;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual wxVariant ChildChanged( wxVariant& thisValue,
int childIndex,
wxVariant& childValue ) const override;
@@ -150,8 +159,8 @@ protected:
#if WXWIN_COMPATIBILITY_3_2
// If set, then match from list is searched for a custom colour.
-wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_TRANSLATE_CUSTOM is intended for internal use.")
-constexpr wxPGPropertyFlags wxPG_PROP_TRANSLATE_CUSTOM = wxPG_PROP_RESERVED_1;
+wxDEPRECATED_MSG("wxPG_PROP_TRANSLATE_CUSTOM is intended for internal use.")
+constexpr wxPGPropertyFlags wxPG_PROP_TRANSLATE_CUSTOM = wxPGPropertyFlags::Reserved_1;
#endif // WXWIN_COMPATIBILITY_3_2
// Has dropdown list of wxWidgets system colours. Value used is
@@ -168,23 +177,60 @@ public:
virtual ~wxSystemColourProperty() = default;
virtual void OnSetValue() override;
- virtual bool IntToValue(wxVariant& variant,
- int number,
- int argFlags = 0) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use IntToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool IntToValue(wxVariant& variant, int number,
+ int flags) const override
+ {
+ m_oldIntToValueCalled = true;
+ return IntToValue(variant, number, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool IntToValue(wxVariant& variant, int number,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
// Override in derived class to customize how colours are printed as
// strings.
- virtual wxString ColourToString( const wxColour& col, int index,
- int argFlags = 0 ) const;
+#if WXWIN_COMPATIBILITY_3_2
+ mutable bool m_oldColourToStringCalled = false;
+ wxString ColourToStringWithCheck(const wxColour& col, int index,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ wxDEPRECATED_BUT_USED_INTERNALLY_MSG("use ColourToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ColourToString(const wxColour& col, int index,
+ int flags) const
+ {
+ m_oldColourToStringCalled = true;
+ return ColourToString(col, index, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ColourToString(const wxColour& col, int index,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
// Returns index of entry that triggers colour picker dialog
// (default is last).
virtual int GetCustomColourIndex() const;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ int flags) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool OnEvent( wxPropertyGrid* propgrid,
wxWindow* primary, wxEvent& event ) override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
@@ -240,7 +286,16 @@ public:
const wxColour& value = *wxWHITE );
virtual ~wxColourProperty() = default;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual wxColour GetColour( int index ) const override;
protected:
@@ -262,7 +317,16 @@ class WXDLLIMPEXP_PROPGRID wxCursorProperty : public wxEnumProperty
int value = 0 );
virtual ~wxCursorProperty() = default;
- virtual wxString ValueToString(wxVariant& value, int argFlags = 0) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual wxSize OnMeasureImage( int item ) const override;
virtual void OnCustomPaint( wxDC& dc,
const wxRect& rect, wxPGPaintData& paintdata ) override;
@@ -332,10 +396,27 @@ public:
virtual ~wxMultiChoiceProperty() = default;
virtual void OnSetValue() override;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
- virtual bool StringToValue(wxVariant& variant,
- const wxString& text,
- int argFlags = 0) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ int flags) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
wxArrayInt GetValueAsArrayInt() const
@@ -382,10 +463,27 @@ public:
virtual ~wxDateProperty() = default;
virtual void OnSetValue() override;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
- virtual bool StringToValue(wxVariant& variant,
- const wxString& text,
- int argFlags = 0) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ int flags) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
diff --git a/include/wx/propgrid/private.h b/include/wx/propgrid/private.h
index 67f17edbd5..72c3ca23f9 100644
--- a/include/wx/propgrid/private.h
+++ b/include/wx/propgrid/private.h
@@ -188,31 +188,29 @@ wxDECLARE_EVENT(wxEVT_PG_COLS_RESIZED, wxPropertyGridEvent);
// Flags used only internally
// wxBoolProperty, wxFlagsProperty specific flags
-constexpr wxPGPropertyFlags wxPG_PROP_USE_CHECKBOX = wxPG_PROP_RESERVED_1;
+constexpr wxPGPropertyFlags wxPGPropertyFlags_UseCheckBox = wxPGPropertyFlags::Reserved_1;
// DCC = Double Click Cycles
-constexpr wxPGPropertyFlags wxPG_PROP_USE_DCC = wxPG_PROP_RESERVED_2;
+constexpr wxPGPropertyFlags wxPGPropertyFlags_UseDCC = wxPGPropertyFlags::Reserved_2;
// wxStringProperty flag
-constexpr wxPGPropertyFlags wxPG_PROP_PASSWORD = wxPG_PROP_RESERVED_2;
+constexpr wxPGPropertyFlags wxPGPropertyFlags_Password = wxPGPropertyFlags::Reserved_2;
-#if !WXWIN_COMPATIBILITY_3_2
// wxColourProperty flag - if set, then match from list is searched for a custom colour.
-constexpr wxPGPropertyFlags wxPG_PROP_TRANSLATE_CUSTOM = wxPG_PROP_RESERVED_1;
+constexpr wxPGPropertyFlags wxPGPropertyFlags_TranslateCustom = wxPGPropertyFlags::Reserved_1;
// wxCursorProperty, wxSystemColourProperty - If set, then selection of choices is static
// and should not be changed (i.e. returns nullptr in GetPropertyChoices).
-constexpr wxPGPropertyFlags wxPG_PROP_STATIC_CHOICES = wxPG_PROP_RESERVED_1;
+constexpr wxPGPropertyFlags wxPGPropertyFlags_StaticChoices = wxPGPropertyFlags::Reserved_1;
-// wxSystemColourProperty - wxEnumProperty based classes cannot use wxPG_PROP_RESERVED_1
-constexpr wxPGPropertyFlags wxPG_PROP_HIDE_CUSTOM_COLOUR = wxPG_PROP_RESERVED_2;
-constexpr wxPGPropertyFlags wxPG_PROP_COLOUR_HAS_ALPHA = wxPG_PROP_RESERVED_3;
+// wxSystemColourProperty - wxEnumProperty based classes cannot use wxPGPropertyFlags::Reserved_1
+constexpr wxPGPropertyFlags wxPGPropertyFlags_HideCustomColour = wxPGPropertyFlags::Reserved_2;
+constexpr wxPGPropertyFlags wxPGPropertyFlags_ColourHasAlpha = wxPGPropertyFlags::Reserved_3;
// wxFileProperty - if set, full path is shown in wxFileProperty.
-constexpr wxPGPropertyFlags wxPG_PROP_SHOW_FULL_FILENAME = wxPG_PROP_RESERVED_1;
+constexpr wxPGPropertyFlags wxPGPropertyFlags_ShowFullFileName = wxPGPropertyFlags::Reserved_1;
// wxLongStringProperty - flag used to mark that edit button
// should be enabled even in the read-only mode.
-constexpr wxPGPropertyFlags wxPG_PROP_ACTIVE_BTN = wxPG_PROP_RESERVED_3;
-#endif // !WXWIN_COMPATIBILITY_3_2
+constexpr wxPGPropertyFlags wxPGPropertyFlags_ActiveButton = wxPGPropertyFlags::Reserved_3;
#endif // _WX_PROPGRID_PRIVATE_H_
diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h
index 935c81d2e1..0676e79c5f 100644
--- a/include/wx/propgrid/property.h
+++ b/include/wx/propgrid/property.h
@@ -304,129 +304,229 @@ protected:
std::unordered_map m_map;
};
-
-// -----------------------------------------------------------------------
-
-enum wxPGPropertyFlags
+enum class wxPGPropertyFlags : int
{
+ // No flags.
+ Null = 0,
-// Indicates bold font.
-wxPG_PROP_MODIFIED = 0x0001,
+ // Indicates bold font.
+ Modified = 0x0001,
-// Disables ('greyed' text and editor does not activate) property.
-wxPG_PROP_DISABLED = 0x0002,
+ // Disables ('greyed' text and editor does not activate) property.
+ Disabled = 0x0002,
-// Hider button will hide this property.
-wxPG_PROP_HIDDEN = 0x0004,
+ // Hider button will hide this property.
+ Hidden = 0x0004,
-// This property has custom paint image just in front of its value.
-// If property only draws custom images into a popup list, then this
-// flag should not be set.
-wxPG_PROP_CUSTOMIMAGE = 0x0008,
+ // This property has custom paint image just in front of its value.
+ // If property only draws custom images into a popup list, then this
+ // flag should not be set.
+ CustomImage = 0x0008,
-// Do not create text based editor for this property (but button-triggered
-// dialog and choice are ok).
-wxPG_PROP_NOEDITOR = 0x0010,
+ // Do not create text based editor for this property (but button-triggered
+ // dialog and choice are ok).
+ NoEditor = 0x0010,
-// Property is collapsed, ie. its children are hidden.
-wxPG_PROP_COLLAPSED = 0x0020,
+ // Property is collapsed, ie. it's children are hidden.
+ Collapsed = 0x0020,
-// If property is selected, then indicates that validation failed for pending
-// value.
-// If property is not selected, that indicates that the actual property
-// value has failed validation (NB: this behaviour is not currently supported,
-// but may be used in future).
-wxPG_PROP_INVALID_VALUE = 0x0040,
+ // If property is selected, then indicates that validation failed for pending
+ // value.
+ // If property is not selected, that indicates that the actual property
+ // value has failed validation (NB: this behaviour is not currently supported,
+ // but may be used in future).
+ InvalidValue = 0x0040,
-// 0x0080,
+ // 0x0080,
-// Switched via SetWasModified(). Temporary flag - only used when
-// setting/changing property value.
-wxPG_PROP_WAS_MODIFIED = 0x0200,
+ // Switched via SetWasModified(). Temporary flag - only used when
+ // setting/changing property value.
+ WasModified = 0x0200,
-// If set, then child properties (if any) are private, and should be
-// "invisible" to the application.
-wxPG_PROP_AGGREGATE = 0x0400,
+ // If set, then child properties (if any) are private, and should be
+ // "invisible" to the application.
+ Aggregate = 0x0400,
-// If set, then child properties (if any) are copies and should not
-// be deleted in dtor.
-wxPG_PROP_CHILDREN_ARE_COPIES = 0x0800,
+ // If set, then child properties (if any) are copies and should not
+ // be deleted in dtor.
+ ChildrenAreCopies = 0x0800,
-// Classifies this item as a non-category.
-// Used for faster item type identification.
-wxPG_PROP_PROPERTY = 0x1000,
+ // Classifies this item as a non-category.
+ // Used for faster item type identification.
+ Property = 0x1000,
-// Classifies this item as a category.
-// Used for faster item type identification.
-wxPG_PROP_CATEGORY = 0x2000,
+ // Classifies this item as a category.
+ // Used for faster item type identification.
+ Category = 0x2000,
-// Classifies this item as a property that has children,
-//but is not aggregate (i.e. children are not private).
-wxPG_PROP_MISC_PARENT = 0x4000,
+ // Classifies this item as a property that has children,
+ //but is not aggregate (i.e. children are not private).
+ MiscParent = 0x4000,
-// Property is read-only. Editor is still created for wxTextCtrl-based
-// property editors. For others, editor is not usually created because
-// they do implement wxTE_READONLY style or equivalent.
-wxPG_PROP_READONLY = 0x8000,
+ // Property is read-only. Editor is still created for wxTextCtrl-based
+ // property editors. For others, editor is not usually created because
+ // they do implement wxTE_READONLY style or equivalent.
+ ReadOnly = 0x8000,
-//
-// NB: FLAGS ABOVE 0x8000 CANNOT BE USED WITH PROPERTY ITERATORS
-//
+ //
+ // NB: FLAGS ABOVE 0x8000 CANNOT BE USED WITH PROPERTY ITERATORS
+ //
-// Property's value is composed from values of child properties.
-// This flag cannot be used with property iterators.
-wxPG_PROP_COMPOSED_VALUE = 0x00010000,
+ // Property's value is composed from values of child properties.
+ // This flag cannot be used with property iterators.
+ ComposedValue = 0x00010000,
-// Common value of property is selectable in editor.
-// This flag cannot be used with property iterators.
-wxPG_PROP_USES_COMMON_VALUE = 0x00020000,
+ // Common value of property is selectable in editor.
+ // This flag cannot be used with property iterators.
+ UsesCommonValue = 0x00020000,
-// Property can be set to unspecified value via editor.
-// Currently, this applies to following properties:
-// - wxIntProperty, wxUIntProperty, wxFloatProperty, wxEditEnumProperty:
-// Clear the text field
-// This flag cannot be used with property iterators.
-// See wxPGProperty::SetAutoUnspecified().
-wxPG_PROP_AUTO_UNSPECIFIED = 0x00040000,
+ // Property can be set to unspecified value via editor.
+ // Currently, this applxPGies to following properties:
+ // - wxIntProperty, wxUIntProperty, wxFloatProperty, wxEditEnumProperty:
+ // Clear the text field
+ // This flag cannot be used with property iterators.
+ // See wxPGProperty::SetAutoUnspecified().
+ AutoUnspecified = 0x00040000,
-// For internal use only.
-wxPG_PROP_RESERVED_1 = 0x00080000,
+ // Indicates that the property is being deleted and should be ignored.
+ BeingDeleted = 0x00080000,
-// For internal use only.
-wxPG_PROP_RESERVED_2 = 0x00100000,
+ // If set, full path is shown in wxFileProperty.
+ ShowFullFileName = 0x00100000,
-// Indicates that the property is being deleted and should be ignored.
-wxPG_PROP_BEING_DELETED = 0x00200000,
+ // For internal use only.
+ Reserved_1 = 0x10000000,
-// For internal use only.
-wxPG_PROP_RESERVED_3 = 0x00400000
+ // For internal use only.
+ Reserved_2 = 0x20000000,
+
+ // For internal use only.
+ Reserved_3 = 0x40000000,
+
+ // Topmost flag.
+ Max = ShowFullFileName,
+
+ // Property with children must have one of these set, otherwise iterators
+ // will not work correctly.
+ // Code should automatically take care of this, however.
+ ParentalFlags = Aggregate | Category | MiscParent,
+
+ // Combination of flags that can be stored by GetFlagsAsString
+ StringStoredFlags = Disabled | Hidden | NoEditor | Collapsed
};
+constexpr wxPGPropertyFlags operator|(wxPGPropertyFlags a, wxPGPropertyFlags b)
+{
+ return static_cast(static_cast(a) | static_cast(b));
+}
+
+inline wxPGPropertyFlags operator|=(wxPGPropertyFlags & a, wxPGPropertyFlags b)
+{
+ return a = a | b;
+}
+
+constexpr wxPGPropertyFlags operator&(wxPGPropertyFlags a, wxPGPropertyFlags b)
+{
+ return static_cast(static_cast(a) & static_cast(b));
+}
+
+inline wxPGPropertyFlags operator&=(wxPGPropertyFlags & a, wxPGPropertyFlags b)
+{
+ return a = a & b;
+}
+
+constexpr wxPGPropertyFlags operator^(wxPGPropertyFlags a, wxPGPropertyFlags b)
+{
+ return static_cast(static_cast(a) ^ static_cast(b));
+}
+
+constexpr wxPGPropertyFlags operator~(wxPGPropertyFlags a)
+{
+ return static_cast(~static_cast(a));
+}
+
+constexpr bool operator!(wxPGPropertyFlags a)
+{
+ return static_cast(a) == 0;
+}
+
+// We need these operators with int arguments for interoperability
+// with wxPG_ITERATOR_FLAGS as plain enumeration).
+// =====
+constexpr int operator<<(wxPGPropertyFlags a, int n)
+{
+ return static_cast(a) << n;
+}
+
+constexpr int operator|(wxPGPropertyFlags a, int b)
+{
+ return static_cast(a) | b;
+}
+
+constexpr int operator|(int a, wxPGPropertyFlags b)
+{
+ return a | static_cast(b);
+}
+
+constexpr int operator&(int a, wxPGPropertyFlags b)
+{
+ return a & static_cast(b);
+}
+// =====
+
#if WXWIN_COMPATIBILITY_3_2
+wxDEPRECATED_MSG("use wxPGPropertyFlags::Modified instead")
+constexpr wxPGPropertyFlags wxPG_PROP_MODIFIED = wxPGPropertyFlags::Modified;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::Disabled instead")
+constexpr wxPGPropertyFlags wxPG_PROP_DISABLED = wxPGPropertyFlags::Disabled;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::Hidden instead")
+constexpr wxPGPropertyFlags wxPG_PROP_HIDDEN = wxPGPropertyFlags::Hidden;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::CustomImage instead")
+constexpr wxPGPropertyFlags wxPG_PROP_CUSTOMIMAGE = wxPGPropertyFlags::CustomImage;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::NoEditor instead")
+constexpr wxPGPropertyFlags wxPG_PROP_NOEDITOR = wxPGPropertyFlags::NoEditor;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::Collapsed instead")
+constexpr wxPGPropertyFlags wxPG_PROP_COLLAPSED = wxPGPropertyFlags::Collapsed;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::InvalidValue instead")
+constexpr wxPGPropertyFlags wxPG_PROP_INVALID_VALUE = wxPGPropertyFlags::InvalidValue;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::WasModified instead")
+constexpr wxPGPropertyFlags wxPG_PROP_WAS_MODIFIED = wxPGPropertyFlags::WasModified;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::Aggregate instead")
+constexpr wxPGPropertyFlags wxPG_PROP_AGGREGATE = wxPGPropertyFlags::Aggregate;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::ChildrenAreCopies instead")
+constexpr wxPGPropertyFlags wxPG_PROP_CHILDREN_ARE_COPIES = wxPGPropertyFlags::ChildrenAreCopies;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::Property instead")
+constexpr wxPGPropertyFlags wxPG_PROP_PROPERTY = wxPGPropertyFlags::Property;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::Category instead")
+constexpr wxPGPropertyFlags wxPG_PROP_CATEGORY = wxPGPropertyFlags::Category;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::MiscParent instead")
+constexpr wxPGPropertyFlags wxPG_PROP_MISC_PARENT = wxPGPropertyFlags::MiscParent;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::ReadOnly instead")
+constexpr wxPGPropertyFlags wxPG_PROP_READONLY = wxPGPropertyFlags::ReadOnly;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::ComposedValue instead")
+constexpr wxPGPropertyFlags wxPG_PROP_COMPOSED_VALUE = wxPGPropertyFlags::ComposedValue;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::UsesCommonValue instead")
+constexpr wxPGPropertyFlags wxPG_PROP_USES_COMMON_VALUE = wxPGPropertyFlags::UsesCommonValue;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::AutoUnspecified instead")
+constexpr wxPGPropertyFlags wxPG_PROP_AUTO_UNSPECIFIED = wxPGPropertyFlags::AutoUnspecified;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::BeingDeleted instead")
+constexpr wxPGPropertyFlags wxPG_PROP_BEING_DELETED = wxPGPropertyFlags::BeingDeleted;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::ParentalFlags instead")
+constexpr wxPGPropertyFlags wxPG_PROP_PARENTAL_FLAGS = wxPGPropertyFlags::ParentalFlags;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::StringStoredFlags instead")
+constexpr wxPGPropertyFlags wxPG_STRING_STORED_FLAGS = wxPGPropertyFlags::StringStoredFlags;
+wxDEPRECATED_MSG("use wxPGPropertyFlags::Max instead")
+constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPGPropertyFlags::Max;
+
// Indicates bits usable by derived properties.
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_CLASS_SPECIFIC_1 in intended for internal use only.")
-constexpr wxPGPropertyFlags wxPG_PROP_CLASS_SPECIFIC_1 = wxPG_PROP_RESERVED_1;
+constexpr wxPGPropertyFlags wxPG_PROP_CLASS_SPECIFIC_1 = wxPGPropertyFlags::Reserved_1;
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_CLASS_SPECIFIC_2 in intended for internal use only.")
-constexpr wxPGPropertyFlags wxPG_PROP_CLASS_SPECIFIC_2 = wxPG_PROP_RESERVED_2;
+constexpr wxPGPropertyFlags wxPG_PROP_CLASS_SPECIFIC_2 = wxPGPropertyFlags::Reserved_2;
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_CLASS_SPECIFIC_3 in intended for internal use only.")
-constexpr wxPGPropertyFlags wxPG_PROP_CLASS_SPECIFIC_3 = wxPG_PROP_RESERVED_3;
+constexpr wxPGPropertyFlags wxPG_PROP_CLASS_SPECIFIC_3 = wxPGPropertyFlags::Reserved_3;
#endif // WXWIN_COMPATIBILITY_3_2
-// Topmost flag.
-constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPG_PROP_AUTO_UNSPECIFIED;
-
-// Property with children must have one of these set, otherwise iterators
-// will not work correctly.
-// Code should automatically take care of this, however.
-#define wxPG_PROP_PARENTAL_FLAGS \
- ((wxPGPropertyFlags)(wxPG_PROP_AGGREGATE | \
- wxPG_PROP_CATEGORY | \
- wxPG_PROP_MISC_PARENT))
-
-// Combination of flags that can be stored by GetFlagsAsString
-#define wxPG_STRING_STORED_FLAGS \
- (wxPG_PROP_DISABLED|wxPG_PROP_HIDDEN|wxPG_PROP_NOEDITOR|wxPG_PROP_COLLAPSED)
-
// -----------------------------------------------------------------------
// Helpers to mark macros as deprecated
@@ -729,10 +829,10 @@ public:
// Simple interface constructor.
wxPGChoices( wxPGChoicesData* data )
+ : m_data(data)
{
wxCHECK_RET(data, "Data pointer cannot be null");
- m_data = data;
- data->IncRef();
+ m_data->IncRef();
}
// Destructor.
@@ -950,7 +1050,12 @@ class WXDLLIMPEXP_PROPGRID wxPGProperty : public wxObject
wxDECLARE_ABSTRACT_CLASS(wxPGProperty);
public:
+#if WXWIN_COMPATIBILITY_3_0
typedef wxUint32 FlagType;
+#elif WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use wxPGPropertyFlags type instead")
+ typedef wxUint32 FlagType;
+#endif // WXWIN_COMPATIBILITY_3_0, WXWIN_COMPATIBILITY_3_2
// Virtual destructor.
// It is customary for derived properties to implement this.
@@ -983,9 +1088,9 @@ public:
// null wxVariant in normal cases). Translated value must be assigned
// back to it.
// text - Text to be translated into variant.
- // argFlags - If wxPG_FULL_VALUE is set, returns complete, storable value instead
+ // flags - If wxPGPropValFormatFlags::FullValue is set, returns complete, storable value instead
// of displayable one (they may be different).
- // If wxPG_COMPOSITE_FRAGMENT is set, text is interpreted as a part of
+ // If wxPGPropValFormatFlags::CompositeFragment is set, text is interpreted as a part of
// composite property string value (as generated by ValueToString()
// called with this same flag).
// Returns true if resulting wxVariant value was different.
@@ -994,9 +1099,19 @@ public:
// You might want to take into account that m_value is Null variant
// if property value is unspecified (which is usually only case if
// you explicitly enabled that sort behaviour).
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const;
+#if WXWIN_COMPATIBILITY_3_2
+ mutable bool m_oldStringToValueCalled = false;
+ bool StringToValueWithCheck(wxVariant& variant, const wxString& text, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ wxDEPRECATED_BUT_USED_INTERNALLY_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool StringToValue( wxVariant& variant, const wxString& text,
+ int flags ) const
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
// Converts integer (possibly a choice selection) into wxVariant value
// appropriate for this property.
@@ -1004,7 +1119,7 @@ public:
// variant - On function entry this is the old value (should not be null wxVariant
// in normal cases). Translated value must be assigned back to it.
// number - Integer to be translated into variant.
- // argFlags - If wxPG_FULL_VALUE is set, returns complete, storable value
+ // flags - If wxPGPropValFormatFlags::FullValue is set, returns complete, storable value
// instead of displayable one.
// Returns true if resulting wxVariant value was different.
// Remarks
@@ -1017,36 +1132,69 @@ public:
// - You might want to take into account that m_value is Null variant
// if property value is unspecified (which is usually only case if
// you explicitly enabled that sort behaviour).
- virtual bool IntToValue( wxVariant& value,
- int number,
- int argFlags = 0 ) const;
+#if WXWIN_COMPATIBILITY_3_2
+ mutable bool m_oldIntToValueCalled = false;
+ bool IntToValueWithCheck(wxVariant& variant, int number, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ wxDEPRECATED_BUT_USED_INTERNALLY_MSG("use IntToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool IntToValue(wxVariant& value, int number, int flags) const
+ {
+ m_oldIntToValueCalled = true;
+ return IntToValue(value, number, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool IntToValue(wxVariant& value, int number,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
// Converts property value into a text representation.
// Parameters:
// value - Value to be converted.
- // argFlags - If 0 (default value), then displayed string is returned.
- // If wxPG_FULL_VALUE is set, returns complete, storable string value
- // instead of displayable. If wxPG_EDITABLE_VALUE is set, returns
+ // flags - If wxPGPropValFormatFlags::Null (default value), then displayed string is returned.
+ // If wxPGPropValFormatFlags::FullValue is set, returns complete, storable string value
+ // instead of displayable. If wxPGPropValFormatFlags::EditableValue is set, returns
// string value that must be editable in textctrl. If
- // wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to
+ // wxPGPropValFormatFlags::CompositeFragment is set, returns text that is appropriate to
// display as a part of string property's composite text
// representation.
// Default implementation calls GenerateComposedValue().
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+#if WXWIN_COMPATIBILITY_3_2
+ mutable bool m_oldValueToStringCalled = false;
+ wxString ValueToStringWithCheck(wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ wxDEPRECATED_BUT_USED_INTERNALLY_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
// Converts string to a value, and if successful, calls SetValue() on it.
// Default behaviour is to do nothing.
// Returns true if value was changed.
- bool SetValueFromString( const wxString& text, int flags = wxPG_PROGRAMMATIC_VALUE );
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use SetValueFromString with 'flags' argument as wxPGPropValFormatFlags")
+ bool SetValueFromString(const wxString& text, int flags)
+ {
+ return SetValueFromString(text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ bool SetValueFromString(const wxString& text, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::ProgrammaticValue);
// Converts integer to a value, and if successful, calls SetValue() on it.
// Default behaviour is to do nothing.
// Parameters:
// value - Int to get the value from.
- // flags - If has wxPG_FULL_VALUE, then the value given is a actual value
+ // flags - If has wxPGPropValFormatFlags::FullValue, then the value given is a actual value
// and not an index.
// Returns true if value was changed.
- bool SetValueFromInt( long value, int flags = 0 );
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use SetValueFromInt with 'flags' argument as wxPGPropValFormatFlags")
+ bool SetValueFromInt(long value, int flags)
+ {
+ return SetValueFromInt(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ bool SetValueFromInt(long value, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null);
// Returns size of the custom painted image in front of property.
// This method must be overridden to return non-default value if
@@ -1197,7 +1345,7 @@ public:
// values of a font).
bool AreChildrenComponents() const
{
- return (m_flags & (wxPG_PROP_COMPOSED_VALUE|wxPG_PROP_AGGREGATE)) != 0;
+ return !!(m_flags & (wxPGPropertyFlags::ComposedValue|wxPGPropertyFlags::Aggregate));
}
// Deletes children of the property.
@@ -1219,7 +1367,7 @@ public:
// Common values are disabled by the default for all properties.
void EnableCommonValue( bool enable = true )
{
- ChangeFlag(wxPG_PROP_USES_COMMON_VALUE, enable);
+ ChangeFlag(wxPGPropertyFlags::UsesCommonValue, enable);
}
// Composes text from values of child properties.
@@ -1277,18 +1425,28 @@ public:
}
// Returns text representation of property's value.
- // argFlags - If 0 (default value), then displayed string is returned.
- // If wxPG_FULL_VALUE is set, returns complete, storable string value
- // instead of displayable. If wxPG_EDITABLE_VALUE is set, returns
+ // flags - If wxPGPropValFormatFlags::Null (default value), then displayed string is returned.
+ // If wxPGPropValFormatFlags::FullValue is set, returns complete, storable string value
+ // instead of displayable. If wxPGPropValFormatFlags::EditableValue is set, returns
// string value that must be editable in textctrl. If
- // wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to
+ // wxPGPropValFormatFlags::CompositeFragment is set, returns text that is appropriate to
// display as a part of string property's composite text
// representation.
// In older versions, this function used to be overridden to convert
// property's value into a string representation. This function is
// now handled by ValueToString(), and overriding this function now
// will result in run-time assertion failure.
- virtual wxString GetValueAsString( int argFlags = 0 ) const;
+#if WXWIN_COMPATIBILITY_3_2
+ mutable bool m_oldGetValueAsString = false;
+ wxString GetValueAsStringWithCheck(wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ wxDEPRECATED_BUT_USED_INTERNALLY_MSG("use GetValueAsString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString GetValueAsString(int flags) const
+ {
+ m_oldGetValueAsString = true;
+ return GetValueAsString(static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString GetValueAsString(wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
// Returns wxPGCell of given column.
// Const version of this member function returns 'default'
@@ -1311,7 +1469,12 @@ public:
// Returns property's displayed text.
wxString GetDisplayedString() const
{
- return GetValueAsString(0);
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ return GetValueAsStringWithCheck(wxPGPropValFormatFlags::Null);
+#else
+ return GetValueAsString(wxPGPropValFormatFlags::Null);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
}
// Returns property's hint text (shown in empty value cell).
@@ -1348,25 +1511,35 @@ public:
#if WXWIN_COMPATIBILITY_3_0
// Returns non-zero if property has given flag set.
- FlagType HasFlag( wxPGPropertyFlags flag ) const
+ wxDEPRECATED_MSG("use HasFlag() with 'flag' argument as wxPGPropertyFlags")
+ FlagType HasFlag( FlagType flag ) const
{
- return ( m_flags & flag );
- }
-#else
- // Returns true if property has given flag set.
- bool HasFlag(wxPGPropertyFlags flag) const
- {
- return (m_flags & flag) != 0;
+ return ( static_cast(m_flags) & flag );
}
#endif
// Returns true if property has given flag set.
- bool HasFlag(FlagType flag) const
+ bool HasFlag(wxPGPropertyFlags flag) const
{
- return (m_flags & flag) != 0;
+ return !!(m_flags & flag);
}
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use HasFlag() with 'flag' argument as wxPGPropertyFlags")
+ // Returns true if property has given flag set.
+ bool HasFlag(int flag) const
+ {
+ return HasFlag(static_cast(flag));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
// Returns true if property has all given flags set.
- bool HasFlagsExact(FlagType flags) const
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use HasFlagExact() with 'flags' argument as wxPGPropertyFlags")
+ bool HasFlagsExact(int flags) const
+ {
+ return HasFlagsExact(static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ bool HasFlagsExact(wxPGPropertyFlags flags) const
{
return (m_flags & flags) == flags;
}
@@ -1385,7 +1558,7 @@ public:
wxDEPRECATED_MSG("Use HasFlag or HasFlagsExact functions instead.")
FlagType GetFlags() const
{
- return m_flags;
+ return static_cast(m_flags);
}
#endif
@@ -1425,7 +1598,7 @@ public:
int InsertChoice( const wxString& label, int index, int value = wxPG_INVALID_VALUE );
// Returns true if this property is actually a wxPropertyCategory.
- bool IsCategory() const { return (m_flags & wxPG_PROP_CATEGORY) != 0; }
+ bool IsCategory() const { return !!(m_flags & wxPGPropertyFlags::Category); }
// Returns true if this property is actually a wxRootProperty.
bool IsRoot() const { return (m_parent == nullptr); }
@@ -1467,7 +1640,7 @@ public:
// Returns true if containing grid uses wxPG_EX_AUTO_UNSPECIFIED_VALUES.
bool UsesAutoUnspecified() const
{
- return (m_flags & wxPG_PROP_AUTO_UNSPECIFIED) != 0;
+ return !!(m_flags & wxPGPropertyFlags::AutoUnspecified);
}
// Returns bitmap that appears next to value text. Only returns non-null
@@ -1492,9 +1665,16 @@ public:
unsigned int GetDepth() const { return (unsigned int)m_depth; }
// Gets flags as a'|' delimited string. Note that flag names are not
- // prepended with 'wxPG_PROP_'.
+ // prepended with 'wxPGPropertyFlags'.
// flagmask - String will only be made to include flags combined by this parameter.
- wxString GetFlagsAsString( FlagType flagsMask ) const;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use GetFlagsAsString() with 'flags' argument as wxPGPropertyFlags")
+ wxString GetFlagsAsString( int flagsMask ) const
+ {
+ return GetFlagsAsString(static_cast(flagsMask));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ wxString GetFlagsAsString(wxPGPropertyFlags flagsMask) const;
// Returns position in parent's array.
unsigned int GetIndexInParent() const
@@ -1517,13 +1697,13 @@ public:
// Returns true if property has visible children.
bool IsExpanded() const
- { return (!(m_flags & wxPG_PROP_COLLAPSED) && HasAnyChild()); }
+ { return (!(m_flags & wxPGPropertyFlags::Collapsed) && HasAnyChild()); }
// Returns true if all parents expanded.
bool IsVisible() const;
// Returns true if property is enabled.
- bool IsEnabled() const { return !(m_flags & wxPG_PROP_DISABLED); }
+ bool IsEnabled() const { return !(m_flags & wxPGPropertyFlags::Disabled); }
// If property's editor is created this forces its recreation.
// Useful in SetAttribute etc. Returns true if actually did anything.
@@ -1549,7 +1729,7 @@ public:
// by default).
void SetAutoUnspecified( bool enable = true )
{
- ChangeFlag(wxPG_PROP_AUTO_UNSPECIFIED, enable);
+ ChangeFlag(wxPGPropertyFlags::AutoUnspecified, enable);
}
// Sets property's background colour.
@@ -1624,13 +1804,13 @@ public:
}
// Sets flags from a '|' delimited string. Note that flag names are not
- // prepended with 'wxPG_PROP_'.
+ // prepended with 'wxPGPropertyFlags'.
void SetFlagsFromString( const wxString& str );
// Sets property's "is it modified?" flag. Affects children recursively.
void SetModifiedStatus( bool modified )
{
- SetFlagRecursively(wxPG_PROP_MODIFIED, modified);
+ SetFlagRecursively(wxPGPropertyFlags::Modified, modified);
}
// Call in OnEvent(), OnButtonClick() etc. to change the property value
@@ -1671,14 +1851,14 @@ public:
void SetExpanded( bool expanded )
{
- ChangeFlag(wxPG_PROP_COLLAPSED, !expanded);
+ ChangeFlag(wxPGPropertyFlags::Collapsed, !expanded);
}
// Sets or clears given property flag. Mainly for internal use.
// Setting a property flag never has any side-effect, and is
// intended almost exclusively for internal use. So, for
// example, if you want to disable a property, call
- // Enable(false) instead of setting wxPG_PROP_DISABLED flag.
+ // Enable(false) instead of setting wxPGPropertyFlags::Disabled flag.
void ChangeFlag( wxPGPropertyFlags flag, bool set )
{
if ( set )
@@ -1707,14 +1887,21 @@ public:
void SetName( const wxString& newName );
// Changes what sort of parent this property is for its children.
- // flag - Use one of the following values: wxPG_PROP_MISC_PARENT (for
- // generic parents), wxPG_PROP_CATEGORY (for categories), or
- // wxPG_PROP_AGGREGATE (for derived property classes with private
+ // flag - Use one of the following values: wxPGPropertyFlags::MiscParent (for
+ // generic parents), wxPGPropertyFlags::Category (for categories), or
+ // wxPGPropertyFlags::Aggregate (for derived property classes with private
// children).
// You generally do not need to call this function.
- void SetParentalType( int flag )
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use SetParentalType() with 'flag' argument as wxPGPropertyFlags")
+ void SetParentalType(int flag)
{
- m_flags &= ~(wxPG_PROP_PROPERTY|wxPG_PROP_PARENTAL_FLAGS);
+ SetParentalType(static_cast(flag));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ void SetParentalType(wxPGPropertyFlags flag)
+ {
+ m_flags &= ~(wxPGPropertyFlags::Property | wxPGPropertyFlags::ParentalFlags);
m_flags |= flag;
}
@@ -1781,7 +1968,7 @@ public:
// (i.e. cancel 'true' returned by StringToValue() or IntToValue()).
void SetWasModified( bool set = true )
{
- ChangeFlag(wxPG_PROP_WAS_MODIFIED, set);
+ ChangeFlag(wxPGPropertyFlags::WasModified, set);
}
// Returns property's help or description text.
@@ -1801,7 +1988,7 @@ public:
// Adds a private child property. If you use this instead of
// wxPropertyGridInterface::Insert() or
// wxPropertyGridInterface::AppendIn(), then property's parental
- // type will automatically be set up to wxPG_PROP_AGGREGATE. In other
+ // type will automatically be set up to wxPGPropertyFlags::Aggregate. In other
// words, all properties of this property will become private.
void AddPrivateChild( wxPGProperty* prop );
@@ -1910,17 +2097,38 @@ protected:
// preparedCell.
// ignoreWithFlags - Properties with any one of these flags are skipped.
// recursively - If true, apply this operation recursively in child properties.
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use AdaptiveSetCell() with 'ignoreWithFlags' argument as wxPGPropertyFlags")
void AdaptiveSetCell( unsigned int firstCol,
unsigned int lastCol,
const wxPGCell& preparedCell,
const wxPGCell& srcData,
wxPGCellData* unmodCellData,
- FlagType ignoreWithFlags,
- bool recursively );
+ int ignoreWithFlags,
+ bool recursively )
+ {
+ AdaptiveSetCell(firstCol, lastCol, preparedCell, srcData, unmodCellData,
+ static_cast(ignoreWithFlags), recursively);
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ void AdaptiveSetCell(unsigned int firstCol,
+ unsigned int lastCol,
+ const wxPGCell& preparedCell,
+ const wxPGCell& srcData,
+ wxPGCellData* unmodCellData,
+ wxPGPropertyFlags ignoreWithFlags,
+ bool recursively);
// Clear cells associated with property.
// recursively - If true, apply this operation recursively in child properties.
- void ClearCells(FlagType ignoreWithFlags, bool recursively);
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ClearCells() with 'ignoreWithFlags' argument as wxPGPropertyFlags")
+ void ClearCells(int ignoreWithFlags, bool recursively)
+ {
+ ClearCells(static_cast(ignoreWithFlags), recursively);
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ void ClearCells(wxPGPropertyFlags ignoreWithFlags, bool recursively);
// Makes sure m_cells has size of column+1 (or more).
void EnsureCells( unsigned int column );
@@ -1937,10 +2145,20 @@ protected:
int index = -1,
bool correct_mode = true );
- void DoGenerateComposedValue( wxString& text,
- int argFlags = wxPG_VALUE_IS_CURRENT,
- const wxVariantList* valueOverrides = nullptr,
- wxPGHashMapS2S* childResults = nullptr ) const;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use DoGenerateComposedValue with 'flags' argument as wxPGPropValFormatFlags")
+ void DoGenerateComposedValue(wxString& text, int flags,
+ const wxVariantList* valueOverrides,
+ wxPGHashMapS2S* childResults) const
+ {
+ DoGenerateComposedValue(text, static_cast(flags),
+ valueOverrides, childResults);
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ void DoGenerateComposedValue(wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::ValueIsCurrent,
+ const wxVariantList* valueOverrides = nullptr,
+ wxPGHashMapS2S* childResults = nullptr) const;
bool DoHide( bool hide, wxPGPropertyValuesFlags flags );
@@ -1989,7 +2207,17 @@ protected:
m_flags |= flag;
}
- void ClearFlag( FlagType flag ) { m_flags &= ~(flag); }
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ClearFlag() with 'flag' argument as wxPGPropertyFlags")
+ void ClearFlag( int flag )
+ {
+ ClearFlag(static_cast(flag));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ void ClearFlag(wxPGPropertyFlags flag)
+ {
+ m_flags &= ~(flag);
+ }
// Called when the property is being removed from the grid and/or
// page state (but *not* when it is also deleted).
@@ -2041,7 +2269,7 @@ protected:
// If not -1, then overrides m_value
int m_commonValue;
- FlagType m_flags;
+ wxPGPropertyFlags m_flags;
// Maximum length (for string properties). Could be in some sort of
// wxBaseStringProperty, but currently, for maximum flexibility and
@@ -2106,10 +2334,17 @@ public:
wxPGRootProperty( const wxString& name = wxS("") );
virtual ~wxPGRootProperty() = default;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue( wxVariant&, const wxString&, int ) const override
{
return false;
}
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue( wxVariant&, const wxString&, wxPGPropValFormatFlags ) const override
+ {
+ return false;
+ }
protected:
};
@@ -2132,8 +2367,24 @@ public:
int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const;
- virtual wxString ValueToString( wxVariant& value, int argFlags ) const override;
- virtual wxString GetValueAsString( int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value, wxPGPropValFormatFlags flags) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use GetValueAsString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString GetValueAsString(int flags) const override
+ {
+ m_oldGetValueAsString = true;
+ return GetValueAsString(static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString GetValueAsString(wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
protected:
void SetTextColIndex( unsigned int colInd )
diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h
index 8e8a5ba597..25387ea632 100644
--- a/include/wx/propgrid/propgrid.h
+++ b/include/wx/propgrid/propgrid.h
@@ -250,7 +250,7 @@ wxPG_EX_HELP_AS_TOOLTIPS = 0x00010000,
wxPG_EX_NATIVE_DOUBLE_BUFFERING = 0x00080000,
// Set this style to let user have ability to set values of properties to
-// unspecified state. Same as setting wxPG_PROP_AUTO_UNSPECIFIED for
+// unspecified state. Same as setting wxPGPropertyFlags::AutoUnspecified for
// all properties.
wxPG_EX_AUTO_UNSPECIFIED_VALUES = 0x00200000,
@@ -438,7 +438,7 @@ private:
// These are used with wxPropertyGrid::AddActionTrigger() and
// wxPropertyGrid::ClearActionTriggers().
-enum class wxPGKeyboardActions
+enum class wxPGKeyboardAction
{
#if WXWIN_COMPATIBILITY_3_2
Invalid = 0,
@@ -471,22 +471,25 @@ enum class wxPGKeyboardActions
};
#if WXWIN_COMPATIBILITY_3_2
-wxDEPRECATED_MSG("use wxPGKeyboardActions::Invalid instead")
-constexpr wxPGKeyboardActions wxPG_ACTION_INVALID { wxPGKeyboardActions::Invalid };
-wxDEPRECATED_MSG("use wxPGKeyboardActions::NextProperty instead")
-constexpr wxPGKeyboardActions wxPG_ACTION_NEXT_PROPERTY { wxPGKeyboardActions::NextProperty };
-wxDEPRECATED_MSG("use wxPGKeyboardActions::PrevProperty instead")
-constexpr wxPGKeyboardActions wxPG_ACTION_PREV_PROPERTY { wxPGKeyboardActions::PrevProperty };
-wxDEPRECATED_MSG("use wxPGKeyboardActions::ExpandProperty instead")
-constexpr wxPGKeyboardActions wxPG_ACTION_EXPAND_PROPERTY { wxPGKeyboardActions::ExpandProperty };
-wxDEPRECATED_MSG("use wxPGKeyboardActions::CollapseProperty instead")
-constexpr wxPGKeyboardActions wxPG_ACTION_COLLAPSE_PROPERTY { wxPGKeyboardActions::CollapseProperty };
-wxDEPRECATED_MSG("use wxPGKeyboardActions::CancelEdit instead")
-constexpr wxPGKeyboardActions wxPG_ACTION_CANCEL_EDIT { wxPGKeyboardActions::CancelEdit };
-wxDEPRECATED_MSG("use wxPGKeyboardActions::Edit instead")
-constexpr wxPGKeyboardActions wxPG_ACTION_EDIT { wxPGKeyboardActions::Edit };
-wxDEPRECATED_MSG("use wxPGKeyboardActions::PressButton instead")
-constexpr wxPGKeyboardActions wxPG_ACTION_PRESS_BUTTON { wxPGKeyboardActions::PressButton };
+wxDEPRECATED_MSG("use wxPGKeyboardAction type instead")
+typedef wxPGKeyboardAction wxPGKeyboardActions;
+
+wxDEPRECATED_MSG("use wxPGKeyboardAction::Invalid instead")
+constexpr wxPGKeyboardAction wxPG_ACTION_INVALID { wxPGKeyboardAction::Invalid };
+wxDEPRECATED_MSG("use wxPGKeyboardAction::NextProperty instead")
+constexpr wxPGKeyboardAction wxPG_ACTION_NEXT_PROPERTY { wxPGKeyboardAction::NextProperty };
+wxDEPRECATED_MSG("use wxPGKeyboardAction::PrevProperty instead")
+constexpr wxPGKeyboardAction wxPG_ACTION_PREV_PROPERTY { wxPGKeyboardAction::PrevProperty };
+wxDEPRECATED_MSG("use wxPGKeyboardAction::ExpandProperty instead")
+constexpr wxPGKeyboardAction wxPG_ACTION_EXPAND_PROPERTY { wxPGKeyboardAction::ExpandProperty };
+wxDEPRECATED_MSG("use wxPGKeyboardAction::CollapseProperty instead")
+constexpr wxPGKeyboardAction wxPG_ACTION_COLLAPSE_PROPERTY { wxPGKeyboardAction::CollapseProperty };
+wxDEPRECATED_MSG("use wxPGKeyboardAction::CancelEdit instead")
+constexpr wxPGKeyboardAction wxPG_ACTION_CANCEL_EDIT { wxPGKeyboardAction::CancelEdit };
+wxDEPRECATED_MSG("use wxPGKeyboardAction::Edit instead")
+constexpr wxPGKeyboardAction wxPG_ACTION_EDIT { wxPGKeyboardAction::Edit };
+wxDEPRECATED_MSG("use wxPGKeyboardAction::PressButton instead")
+constexpr wxPGKeyboardAction wxPG_ACTION_PRESS_BUTTON { wxPGKeyboardAction::PressButton };
#endif // WXWIN_COMPATIBILITY_3_2
// -----------------------------------------------------------------------
@@ -585,20 +588,20 @@ public:
// Adds given key combination to trigger given action.
// Here is a sample code to make Enter key press move focus to
// the next property.
- // propGrid->AddActionTrigger(wxPGKeyboardActions::NextProperty, WXK_RETURN);
+ // propGrid->AddActionTrigger(wxPGKeyboardAction::NextProperty, WXK_RETURN);
// propGrid->DedicateKey(WXK_RETURN);
// action - Which action to trigger. See @ref propgrid_keyboard_actions.
// keycode - Which keycode triggers the action.
// modifiers - Which key event modifiers, in addition to keycode, are needed to
// trigger the action.
#if WXWIN_COMPATIBILITY_3_2
- wxDEPRECATED_MSG("use AddActionTrigger with 'action' argument as wxPGKeyboardActions")
+ wxDEPRECATED_MSG("use AddActionTrigger with 'action' argument as wxPGKeyboardAction")
void AddActionTrigger(int action, int keycode, int modifiers)
{
- AddActionTrigger(static_cast(action), keycode, modifiers);
+ AddActionTrigger(static_cast(action), keycode, modifiers);
}
#endif // WXWIN_COMPATIBILITY_3_2
- void AddActionTrigger(wxPGKeyboardActions action, int keycode, int modifiers = 0);
+ void AddActionTrigger(wxPGKeyboardAction action, int keycode, int modifiers = 0);
// Dedicates a specific keycode to wxPropertyGrid. This means that such
// key presses will not be redirected to editor controls.
@@ -632,13 +635,13 @@ public:
// Clears action triggers for given action.
#if WXWIN_COMPATIBILITY_3_2
- wxDEPRECATED_MSG("use ClearActionTriggers with wxPGKeyboardActions argument")
+ wxDEPRECATED_MSG("use ClearActionTriggers with wxPGKeyboardAction argument")
void ClearActionTriggers(int action)
{
- ClearActionTriggers(static_cast(action));
+ ClearActionTriggers(static_cast(action));
}
#endif // WXWIN_COMPATIBILITY_3_2
- void ClearActionTriggers(wxPGKeyboardActions action);
+ void ClearActionTriggers(wxPGKeyboardAction action);
// Forces updating the value of property from the editor control.
// Note that wxEVT_PG_CHANGING and wxEVT_PG_CHANGED are dispatched using
@@ -1032,8 +1035,15 @@ public:
// Returns (visual) text representation of the unspecified
// property value.
- // argFlags - For internal use only.
- wxString GetUnspecifiedValueText( int argFlags = 0 ) const;
+ // flags - For internal use only.
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use GetUnspecifiedValueText with 'flags' argument as wxPGPropValFormatFlags")
+ wxString GetUnspecifiedValueText(int flags) const
+ {
+ return GetUnspecifiedValueText(static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ wxString GetUnspecifiedValueText(wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
// Set virtual width for this particular page. Width -1 indicates that the
// virtual width should be disabled.
@@ -1300,10 +1310,10 @@ public:
// Called to indicate property and editor has valid value now.
void OnValidationFailureReset( wxPGProperty* property )
{
- if ( property && property->HasFlag(wxPG_PROP_INVALID_VALUE) )
+ if ( property && property->HasFlag(wxPGPropertyFlags::InvalidValue) )
{
DoOnValidationFailureReset(property);
- property->ClearFlag(wxPG_PROP_INVALID_VALUE);
+ property->ClearFlag(wxPGPropertyFlags::InvalidValue);
}
m_validationInfo.ClearFailureMessage();
}
@@ -1337,7 +1347,7 @@ public:
wxVariant& invalidValue );
// Override to customize resetting of property validation failure status.
- // Property is guaranteed to have flag wxPG_PROP_INVALID_VALUE set.
+ // Property is guaranteed to have flag wxPGPropertyFlags::InvalidValue set.
virtual void DoOnValidationFailureReset( wxPGProperty* property );
int GetSpacingY() const { return m_spacingy; }
@@ -1512,7 +1522,7 @@ protected:
wxPGValidationInfo m_validationInfo;
// Actions and keys that trigger them.
- std::unordered_map> m_actionTriggers;
+ std::unordered_map> m_actionTriggers;
// Appearance of currently active editor.
wxPGCell m_editorAppearance;
@@ -1768,14 +1778,14 @@ protected:
unsigned int bottomItemY,
const wxRect* itemsRect = nullptr );
- // Translate wxKeyEvent to wxPGKeyboardActions::XXX
- std::pair KeyEventToActions(const wxKeyEvent& event) const;
+ // Translate wxKeyEvent to wxPGKeyboardAction::XXX
+ std::pair KeyEventToActions(const wxKeyEvent& event) const;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use single-argument function KeyEventToActions(event)")
- wxPGKeyboardActions KeyEventToActions(wxKeyEvent &event, wxPGKeyboardActions* pSecond) const;
+ wxPGKeyboardAction KeyEventToActions(wxKeyEvent &event, wxPGKeyboardAction* pSecond) const;
#endif // WXWIN_COMPATIBILITY_3_2
- wxPGKeyboardActions KeyEventToAction(wxKeyEvent& event) const;
+ wxPGKeyboardAction KeyEventToAction(wxKeyEvent& event) const;
void ImprovedClientToScreen( int* px, int* py ) const;
@@ -1869,7 +1879,7 @@ protected:
private:
- bool ButtonTriggerKeyTest(wxPGKeyboardActions action, wxKeyEvent& event);
+ bool ButtonTriggerKeyTest(wxPGKeyboardAction action, wxKeyEvent& event);
wxDECLARE_EVENT_TABLE();
};
diff --git a/include/wx/propgrid/propgriddefs.h b/include/wx/propgrid/propgriddefs.h
index 6febe05ce3..0ee66de466 100644
--- a/include/wx/propgrid/propgriddefs.h
+++ b/include/wx/propgrid/propgriddefs.h
@@ -212,36 +212,93 @@ constexpr bool operator!=(wxPGPropertyValuesFlags a, int b)
// -----------------------------------------------------------------------
-// Misc. argument flags.
-enum wxPG_MISC_ARG_FLAGS
+// Miscellaneous property value format flags
+enum class wxPGPropValFormatFlags : int
{
+ // No flags.
+ Null = 0,
+
// Get/Store full value instead of displayed value.
- wxPG_FULL_VALUE = 0x00000001,
+ FullValue = 0x00000001,
// Perform special action in case of unsuccessful conversion.
- wxPG_REPORT_ERROR = 0x00000002,
+ ReportError = 0x00000002,
- wxPG_PROPERTY_SPECIFIC = 0x00000004,
+ PropertySpecific = 0x00000004,
// Get/Store editable value instead of displayed one (should only be
// different in the case of common values)
- wxPG_EDITABLE_VALUE = 0x00000008,
+ EditableValue = 0x00000008,
// Used when dealing with fragments of composite string value
- wxPG_COMPOSITE_FRAGMENT = 0x00000010,
+ CompositeFragment = 0x00000010,
// Means property for which final string value is for cannot really be
// edited.
- wxPG_UNEDITABLE_COMPOSITE_FRAGMENT = 0x00000020,
+ UneditableCompositeFragment = 0x00000020,
// ValueToString() called from GetValueAsString()
// (guarantees that input wxVariant value is current own value)
- wxPG_VALUE_IS_CURRENT = 0x00000040,
+ ValueIsCurrent = 0x00000040,
// Value is being set programmatically (i.e. not by user)
- wxPG_PROGRAMMATIC_VALUE = 0x00000080
+ ProgrammaticValue = 0x00000080
};
+constexpr wxPGPropValFormatFlags operator&(wxPGPropValFormatFlags a, wxPGPropValFormatFlags b)
+{
+ return static_cast(static_cast(a) & static_cast(b));
+}
+
+constexpr wxPGPropValFormatFlags operator|(wxPGPropValFormatFlags a, wxPGPropValFormatFlags b)
+{
+ return static_cast(static_cast(a) | static_cast(b));
+}
+
+inline wxPGPropValFormatFlags operator|=(wxPGPropValFormatFlags& a, wxPGPropValFormatFlags b)
+{
+ return a = a | b;
+}
+
+constexpr bool operator!(wxPGPropValFormatFlags a)
+{
+ return static_cast(a) == 0;
+}
+
+#if WXWIN_COMPATIBILITY_3_2
+constexpr int operator&(int a, wxPGPropValFormatFlags b)
+{
+ return a & static_cast(b);
+}
+
+constexpr int operator|(int a, wxPGPropValFormatFlags b)
+{
+ return a | static_cast(b);
+}
+
+inline int operator|=(int& a, wxPGPropValFormatFlags b)
+{
+ return a = a | static_cast(b);
+}
+
+wxDEPRECATED_MSG("use wxPGPropValFormatFlags::FullValue instead")
+constexpr wxPGPropValFormatFlags wxPG_FULL_VALUE { wxPGPropValFormatFlags::FullValue };
+wxDEPRECATED_MSG("use wxPGPropValFormatFlags::ReportError instead")
+constexpr wxPGPropValFormatFlags wxPG_REPORT_ERROR { wxPGPropValFormatFlags::ReportError };
+wxDEPRECATED_MSG("use wxPGPropValFormatFlags::PropertySpecific instead")
+constexpr wxPGPropValFormatFlags wxPG_PROPERTY_SPECIFIC { wxPGPropValFormatFlags::PropertySpecific };
+wxDEPRECATED_MSG("use wxPGPropValFormatFlags::EditableValue instead")
+constexpr wxPGPropValFormatFlags wxPG_EDITABLE_VALUE { wxPGPropValFormatFlags::EditableValue };
+wxDEPRECATED_MSG("use wxPGPropValFormatFlags::CompositeFragment instead")
+constexpr wxPGPropValFormatFlags wxPG_COMPOSITE_FRAGMENT { wxPGPropValFormatFlags::CompositeFragment };
+wxDEPRECATED_MSG("use wxPGPropValFormatFlags::UneditableCompositeFragment instead")
+constexpr wxPGPropValFormatFlags wxPG_UNEDITABLE_COMPOSITE_FRAGMENT { wxPGPropValFormatFlags::UneditableCompositeFragment };
+wxDEPRECATED_MSG("use wxPGPropValFormatFlags::ValueIsCurrent instead")
+constexpr wxPGPropValFormatFlags wxPG_VALUE_IS_CURRENT { wxPGPropValFormatFlags::ValueIsCurrent };
+wxDEPRECATED_MSG("use wxPGPropValFormatFlags::ProgrammaticValue instead")
+constexpr wxPGPropValFormatFlags wxPG_PROGRAMMATIC_VALUE { wxPGPropValFormatFlags::ProgrammaticValue };
+#endif // WXWIN_COMPATIBILITY_3_2
+
// -----------------------------------------------------------------------
// wxPGProperty::SetValue() flags
diff --git a/include/wx/propgrid/propgridiface.h b/include/wx/propgrid/propgridiface.h
index ac229bcf2f..ff392782bf 100644
--- a/include/wx/propgrid/propgridiface.h
+++ b/include/wx/propgrid/propgridiface.h
@@ -331,7 +331,7 @@ public:
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty)
- if ( !p->HasAnyChild() || p->HasFlag(wxPG_PROP_AGGREGATE) )
+ if ( !p->HasAnyChild() || p->HasFlag(wxPGPropertyFlags::Aggregate) )
return wxNullProperty;
return p->Item(0);
@@ -410,12 +410,24 @@ public:
// only properties without given flags are stored.
// flags - Property flags to use.
// iterFlags - Iterator flags to use. Default is everything expect private children.
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use GetPropertiesWithFlag() with 'flags' argument as wxPGPropertyFlags")
void GetPropertiesWithFlag( wxArrayPGProperty* targetArr,
- wxPGProperty::FlagType flags,
+ int flags,
bool inverse = false,
int iterFlags = wxPG_ITERATE_PROPERTIES |
wxPG_ITERATE_HIDDEN |
- wxPG_ITERATE_CATEGORIES) const;
+ wxPG_ITERATE_CATEGORIES) const
+ {
+ GetPropertiesWithFlag(targetArr, static_cast(flags), inverse, iterFlags);
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ void GetPropertiesWithFlag(wxArrayPGProperty* targetArr,
+ wxPGPropertyFlags flags,
+ bool inverse = false,
+ int iterFlags = wxPG_ITERATE_PROPERTIES |
+ wxPG_ITERATE_HIDDEN |
+ wxPG_ITERATE_CATEGORIES) const;
// Returns value of given attribute. If none found, returns null wxVariant.
wxVariant GetPropertyAttribute( wxPGPropArg id,
@@ -652,7 +664,7 @@ public:
bool IsPropertyEnabled( wxPGPropArg id ) const
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
- return !p->HasFlag(wxPG_PROP_DISABLED);
+ return !p->HasFlag(wxPGPropertyFlags::Disabled);
}
// Returns true if given property is expanded.
@@ -664,11 +676,7 @@ public:
bool IsPropertyModified( wxPGPropArg id ) const
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
-#if WXWIN_COMPATIBILITY_3_0
- return p->HasFlag(wxPG_PROP_MODIFIED)?true:false;
-#else
- return p->HasFlag(wxPG_PROP_MODIFIED);
-#endif
+ return p->HasFlag(wxPGPropertyFlags::Modified);
}
// Returns true if property is selected.
@@ -683,7 +691,7 @@ public:
bool IsPropertyShown( wxPGPropArg id ) const
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
- return !p->HasFlag(wxPG_PROP_HIDDEN);
+ return !p->HasFlag(wxPGPropertyFlags::Hidden);
}
// Returns true if property value is set to unspecified.
@@ -789,22 +797,22 @@ public:
// Sets an attribute for this property.
// name - Text identifier of attribute. See @ref propgrid_property_attributes.
// value - Value of attribute.
- // argFlags - Optional. Use wxPGPropertyValuesFlags::Recurse to set the attribute to child
+ // flags - Optional. Use wxPGPropertyValuesFlags::Recurse to set the attribute to child
// properties recursively.
// Setting attribute's value to null wxVariant will simply remove it
// from property's set of attributes.
#if WXWIN_COMPATIBILITY_3_2
- wxDEPRECATED_MSG("use SetPropertyAttribute with argFlags argument as wxPGPropertyValuesFlags")
+ wxDEPRECATED_MSG("use SetPropertyAttribute with 'flags' argument as wxPGPropertyValuesFlags")
void SetPropertyAttribute(wxPGPropArg id, const wxString& attrName,
- wxVariant value, long argFlags)
+ wxVariant value, long flags)
{
- DoSetPropertyAttribute(id, attrName, value, static_cast(argFlags));
+ DoSetPropertyAttribute(id, attrName, value, static_cast(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
void SetPropertyAttribute(wxPGPropArg id, const wxString& attrName, wxVariant value,
- wxPGPropertyValuesFlags argFlags = wxPGPropertyValuesFlags::DontRecurse)
+ wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse)
{
- DoSetPropertyAttribute(id, attrName, value, argFlags);
+ DoSetPropertyAttribute(id, attrName, value, flags);
}
// Sets property attribute for all applicable properties.
// Be sure to use this method only after all properties have been
@@ -1228,7 +1236,7 @@ protected:
// Intermediate version needed due to wxVariant copying inefficiency
void DoSetPropertyAttribute( wxPGPropArg id,
const wxString& name,
- wxVariant& value, wxPGPropertyValuesFlags argFlags );
+ wxVariant& value, wxPGPropertyValuesFlags flags );
// Empty string object to return from member functions returning const
// wxString&.
diff --git a/include/wx/propgrid/propgridpagestate.h b/include/wx/propgrid/propgridpagestate.h
index 67f93869a1..7c0576543c 100644
--- a/include/wx/propgrid/propgridpagestate.h
+++ b/include/wx/propgrid/propgridpagestate.h
@@ -213,54 +213,54 @@ enum wxPG_ITERATOR_FLAGS
// Iterate through 'normal' property items (does not include children of
// aggregate or hidden items by default).
-wxPG_ITERATE_PROPERTIES = wxPG_PROP_PROPERTY |
- wxPG_PROP_MISC_PARENT |
- wxPG_PROP_AGGREGATE |
- wxPG_PROP_COLLAPSED |
- wxPG_IT_CHILDREN(wxPG_PROP_MISC_PARENT) |
- wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY),
+wxPG_ITERATE_PROPERTIES = wxPGPropertyFlags::Property |
+ wxPGPropertyFlags::MiscParent |
+ wxPGPropertyFlags::Aggregate |
+ wxPGPropertyFlags::Collapsed |
+ wxPG_IT_CHILDREN(wxPGPropertyFlags::MiscParent) |
+ wxPG_IT_CHILDREN(wxPGPropertyFlags::Category),
// Iterate children of collapsed parents, and individual items that are hidden.
-wxPG_ITERATE_HIDDEN = wxPG_PROP_HIDDEN |
- wxPG_IT_CHILDREN(wxPG_PROP_COLLAPSED),
+wxPG_ITERATE_HIDDEN = wxPGPropertyFlags::Hidden |
+ wxPG_IT_CHILDREN(wxPGPropertyFlags::Collapsed),
// Iterate children of parent that is an aggregate property (ie has fixed
// children).
-wxPG_ITERATE_FIXED_CHILDREN = wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE) |
+wxPG_ITERATE_FIXED_CHILDREN = wxPG_IT_CHILDREN(wxPGPropertyFlags::Aggregate) |
wxPG_ITERATE_PROPERTIES,
// Iterate categories.
// Note that even without this flag, children of categories are still iterated
// through.
-wxPG_ITERATE_CATEGORIES = wxPG_PROP_CATEGORY |
- wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY) |
- wxPG_PROP_COLLAPSED,
+wxPG_ITERATE_CATEGORIES = wxPGPropertyFlags::Category |
+ wxPG_IT_CHILDREN(wxPGPropertyFlags::Category) |
+ wxPGPropertyFlags::Collapsed,
-wxPG_ITERATE_ALL_PARENTS = wxPG_PROP_MISC_PARENT |
- wxPG_PROP_AGGREGATE |
- wxPG_PROP_CATEGORY,
+wxPG_ITERATE_ALL_PARENTS = static_cast(wxPGPropertyFlags::MiscParent |
+ wxPGPropertyFlags::Aggregate |
+ wxPGPropertyFlags::Category),
wxPG_ITERATE_ALL_PARENTS_RECURSIVELY = wxPG_ITERATE_ALL_PARENTS |
wxPG_IT_CHILDREN(
wxPG_ITERATE_ALL_PARENTS),
-wxPG_ITERATOR_FLAGS_ALL = wxPG_PROP_PROPERTY |
- wxPG_PROP_MISC_PARENT |
- wxPG_PROP_AGGREGATE |
- wxPG_PROP_HIDDEN |
- wxPG_PROP_CATEGORY |
- wxPG_PROP_COLLAPSED,
+wxPG_ITERATOR_FLAGS_ALL = static_cast(wxPGPropertyFlags::Property |
+ wxPGPropertyFlags::MiscParent |
+ wxPGPropertyFlags::Aggregate |
+ wxPGPropertyFlags::Hidden |
+ wxPGPropertyFlags::Category |
+ wxPGPropertyFlags::Collapsed),
wxPG_ITERATOR_MASK_OP_ITEM = wxPG_ITERATOR_FLAGS_ALL,
-// (wxPG_PROP_MISC_PARENT|wxPG_PROP_AGGREGATE|wxPG_PROP_CATEGORY)
+// (wxPGPropertyFlags::MiscParent|wxPGPropertyFlags::Aggregate|wxPGPropertyFlags::Category)
wxPG_ITERATOR_MASK_OP_PARENT = wxPG_ITERATOR_FLAGS_ALL,
// Combines all flags needed to iterate through visible properties
// (ie. hidden properties and children of collapsed parents are skipped).
-wxPG_ITERATE_VISIBLE = static_cast(wxPG_ITERATE_PROPERTIES) |
- wxPG_PROP_CATEGORY |
- wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE),
+wxPG_ITERATE_VISIBLE = wxPG_ITERATE_PROPERTIES |
+ wxPGPropertyFlags::Category |
+ wxPG_IT_CHILDREN(wxPGPropertyFlags::Aggregate),
// Iterate all items.
wxPG_ITERATE_ALL = wxPG_ITERATE_VISIBLE |
@@ -276,21 +276,21 @@ wxPG_ITERATE_DEFAULT = wxPG_ITERATE_NORMAL
};
+inline void wxPGCreateIteratorMasks(int flags, wxPGPropertyFlags& itemExMask, wxPGPropertyFlags& parentExMask)
+{
+ itemExMask = static_cast((flags ^ wxPG_ITERATOR_MASK_OP_ITEM) &
+ wxPG_ITERATOR_MASK_OP_ITEM & 0xFFFF);
+ parentExMask = static_cast(((flags >> 16) ^ wxPG_ITERATOR_MASK_OP_PARENT) &
+ wxPG_ITERATOR_MASK_OP_PARENT & 0xFFFF);
+}
-#define wxPG_ITERATOR_CREATE_MASKS(FLAGS, A, B) \
- A = (FLAGS ^ wxPG_ITERATOR_MASK_OP_ITEM) & \
- wxPG_ITERATOR_MASK_OP_ITEM & 0xFFFF; \
- B = ((FLAGS>>16) ^ wxPG_ITERATOR_MASK_OP_PARENT) & \
- wxPG_ITERATOR_MASK_OP_PARENT & 0xFFFF;
-
-
-// Macro to test if children of PWC should be iterated through
-#define wxPG_ITERATOR_PARENTEXMASK_TEST(PWC, PARENTMASK) \
- ( \
- !PWC->HasFlag(PARENTMASK) && \
- PWC->HasAnyChild() \
- )
-
+#if WXWIN_COMPATIBILITY_3_2
+#ifdef wxPG_MUST_DEPRECATE_MACRO_NAME
+#pragma deprecated(wxPG_ITERATOR_CREATE_MASKS)
+#endif
+#define wxPG_ITERATOR_CREATE_MASKS wxPG_DEPRECATED_MACRO_VALUE(wxPGCreateIteratorMasks,\
+ "wxPG_ITERATOR_CREATE_MASKS is deprecated. Call wxPGCreateIteratorMasks instead.")
+#endif // WXWIN_COMPATIBILITY_3_2
// Base for wxPropertyGridIterator classes.
class WXDLLIMPEXP_PROPGRID wxPropertyGridIteratorBase
@@ -337,8 +337,8 @@ private:
wxPGProperty* m_baseParent;
// Masks are used to quickly exclude items
- wxPGProperty::FlagType m_itemExMask;
- wxPGProperty::FlagType m_parentExMask;
+ wxPGPropertyFlags m_itemExMask;
+ wxPGPropertyFlags m_parentExMask;
};
template
@@ -640,7 +640,7 @@ protected:
void DoLimitPropertyEditing(wxPGProperty* p, bool limit = true)
{
- p->SetFlagRecursively(wxPG_PROP_NOEDITOR, limit);
+ p->SetFlagRecursively(wxPGPropertyFlags::NoEditor, limit);
}
bool DoSelectProperty(wxPGProperty* p, wxPGSelectPropertyFlags flags = wxPGSelectPropertyFlags::Null);
@@ -813,7 +813,6 @@ protected:
bool m_dontCenterSplitter;
private:
- // Only inits arrays, doesn't migrate things or such.
void InitNonCatMode();
};
diff --git a/include/wx/propgrid/props.h b/include/wx/propgrid/props.h
index 3a4c3f513e..59a5391dad 100644
--- a/include/wx/propgrid/props.h
+++ b/include/wx/propgrid/props.h
@@ -99,10 +99,28 @@ public:
const wxString& value = wxString() );
virtual ~wxStringProperty() = default;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool StringToValue( wxVariant& variant, const wxString& text,
+ int flags ) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
@@ -115,18 +133,27 @@ protected:
// -----------------------------------------------------------------------
// Constants used with NumericValidation<>().
-enum wxPGNumericValidationConstants
+enum class wxPGNumericValidationMode
{
// Instead of modifying the value, show an error message.
- wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE = 0,
+ ErrorMessage,
// Modify value, but stick with the limitations.
- wxPG_PROPERTY_VALIDATION_SATURATE = 1,
+ Saturate,
// Modify value, wrap around on overflow.
- wxPG_PROPERTY_VALIDATION_WRAP = 2
+ Wrap
};
+#if WXWIN_COMPATIBILITY_3_2
+wxDEPRECATED_MSG("use wxPGNumericValidationMode::ErrorMessage instead")
+constexpr wxPGNumericValidationMode wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE { wxPGNumericValidationMode::ErrorMessage };
+wxDEPRECATED_MSG("use wxPGNumericValidationMode::Saturate instead")
+constexpr wxPGNumericValidationMode wxPG_PROPERTY_VALIDATION_SATURATE { wxPGNumericValidationMode::Saturate };
+wxDEPRECATED_MSG("use wxPGNumericValidationMode::Wrap instead")
+constexpr wxPGNumericValidationMode wxPG_PROPERTY_VALIDATION_WRAP { wxPGNumericValidationMode::Wrap };
+#endif // WXWIN_COMPATIBILITY_3_2
+
// -----------------------------------------------------------------------
#if wxUSE_VALIDATORS
@@ -135,13 +162,22 @@ enum wxPGNumericValidationConstants
class WXDLLIMPEXP_PROPGRID wxNumericPropertyValidator : public wxTextValidator
{
public:
- enum NumericType
+ enum class NumericType
{
- Signed = 0,
+ Signed,
Unsigned,
Float
};
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use NumericType::Signed instead")
+ static const NumericType Signed = NumericType::Signed;
+ wxDEPRECATED_MSG("use NumericType::Unsigned instead")
+ static const NumericType Unsigned = NumericType::Unsigned;
+ wxDEPRECATED_MSG("use NumericType::Float instead")
+ static const NumericType Float = NumericType::Float;
+#endif // WXWIN_COMPATIBILITY_3_2
+
wxNumericPropertyValidator( NumericType numericType, int base = 10 );
virtual ~wxNumericPropertyValidator() = default;
virtual bool Validate(wxWindow* parent) override;
@@ -164,9 +200,16 @@ public:
bool UseSpinMotion() const { return m_spinMotion; }
// Common validation code - for internal use.
+#if WXWIN_COMPATIBILITY_3_2
template
+ wxDEPRECATED_MSG("use DoNumericValidation with 'mode' argument as wxPGNumericValidationMode")
bool DoNumericValidation(T& value, wxPGValidationInfo* pValidationInfo,
int mode, T defMin, T defMax) const;
+#endif // WXWIN_COMPATIBILITY_3_2
+
+ template
+ bool DoNumericValidation(T& value, wxPGValidationInfo* pValidationInfo,
+ wxPGNumericValidationMode mode, T defMin, T defMax) const;
protected:
wxNumericProperty(const wxString& label, const wxString& name);
@@ -194,15 +237,39 @@ public:
const wxString& name,
const wxLongLong& value );
#endif
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ int flags) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const override;
- virtual bool IntToValue( wxVariant& variant,
- int number,
- int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use IntToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool IntToValue(wxVariant& variant, int number, int flags) const override
+ {
+ m_oldIntToValueCalled = true;
+ return IntToValue(variant, number, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool IntToValue(wxVariant& variant, int number,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
static wxValidator* GetClassValidator();
virtual wxValidator* DoGetValidator() const override;
virtual wxVariant AddSpinStepValue(long stepScale) const override;
@@ -213,22 +280,12 @@ private:
static bool DoValidation( const wxNumericProperty* property,
wxLongLong& value,
wxPGValidationInfo* pValidationInfo,
- int mode =
- wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE );
-
-#if defined(wxLongLong_t)
- static bool DoValidation( const wxNumericProperty* property,
- wxLongLong_t& value,
- wxPGValidationInfo* pValidationInfo,
- int mode =
- wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE );
-#endif // wxLongLong_t
+ wxPGNumericValidationMode = wxPGNumericValidationMode::ErrorMessage);
#endif // wxUSE_LONGLONG
static bool DoValidation(const wxNumericProperty* property,
long& value,
wxPGValidationInfo* pValidationInfo,
- int mode =
- wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
+ wxPGNumericValidationMode mode = wxPGNumericValidationMode::ErrorMessage);
};
// -----------------------------------------------------------------------
@@ -248,17 +305,42 @@ public:
const wxString& name,
const wxULongLong& value );
#endif
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ int flags) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const override;
virtual wxValidator* DoGetValidator () const override;
- virtual bool IntToValue( wxVariant& variant,
- int number,
- int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use IntToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool IntToValue(wxVariant& variant, int number,
+ int flags) const override
+ {
+ m_oldIntToValueCalled = true;
+ return IntToValue(variant, number, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool IntToValue(wxVariant& variant, int number,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual wxVariant AddSpinStepValue(long stepScale) const override;
protected:
@@ -273,18 +355,12 @@ private:
static bool DoValidation(const wxNumericProperty* property,
wxULongLong& value,
wxPGValidationInfo* pValidationInfo,
- int mode =wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
-#if defined(wxULongLong_t)
- static bool DoValidation(const wxNumericProperty* property,
- wxULongLong_t& value,
- wxPGValidationInfo* pValidationInfo,
- int mode =wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
-#endif // wxULongLong_t
+ wxPGNumericValidationMode = wxPGNumericValidationMode::ErrorMessage);
#endif // wxUSE_LONGLONG
static bool DoValidation(const wxNumericProperty* property,
long& value,
wxPGValidationInfo* pValidationInfo,
- int mode = wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
+ wxPGNumericValidationMode mode = wxPGNumericValidationMode::ErrorMessage);
};
// -----------------------------------------------------------------------
@@ -299,10 +375,27 @@ public:
double value = 0.0 );
virtual ~wxFloatProperty() = default;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ int flags) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
virtual bool ValidateValue( wxVariant& value,
@@ -320,7 +413,7 @@ private:
static bool DoValidation(const wxNumericProperty* property,
double& value,
wxPGValidationInfo* pValidationInfo,
- int mode = wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
+ wxPGNumericValidationMode mode = wxPGNumericValidationMode::ErrorMessage);
};
// -----------------------------------------------------------------------
@@ -335,12 +428,37 @@ public:
bool value = false );
virtual ~wxBoolProperty() = default;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const override;
- virtual bool IntToValue( wxVariant& variant,
- int number, int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ int flags) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use IntToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool IntToValue(wxVariant& variant, int number, int flags) const override
+ {
+ m_oldIntToValueCalled = true;
+ return IntToValue(variant, number, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool IntToValue(wxVariant& variant, int number,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
};
@@ -349,8 +467,8 @@ public:
#if WXWIN_COMPATIBILITY_3_2
// If set, then selection of choices is static and should not be
// changed (i.e. returns nullptr in GetPropertyChoices).
-wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_STATIC_CHOICES is intended for internal use.")
-constexpr wxPGPropertyFlags wxPG_PROP_STATIC_CHOICES = wxPG_PROP_RESERVED_1;
+wxDEPRECATED_MSG("wxPG_PROP_STATIC_CHOICES is intended for internal use.")
+constexpr wxPGPropertyFlags wxPG_PROP_STATIC_CHOICES = wxPGPropertyFlags::Reserved_1;
#endif // WXWIN_COMPATIBILITY_3_2
// Represents a single selection from a list of choices
@@ -401,18 +519,41 @@ public:
size_t GetItemCount() const { return m_choices.GetCount(); }
virtual void OnSetValue() override;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ int flags) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const override;
- // If wxPG_FULL_VALUE is not set in flags, then the value is interpreted
+ // If wxPGPropValFormatFlags::FullValue is not set in flags, then the value is interpreted
// as index to choices list. Otherwise, it is actual value.
- virtual bool IntToValue( wxVariant& variant,
- int number,
- int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use IntToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool IntToValue(wxVariant& variant, int number, int flags) const override
+ {
+ m_oldIntToValueCalled = true;
+ return IntToValue(variant, number, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool IntToValue(wxVariant& variant, int number,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
//
// Additional virtuals
@@ -434,25 +575,38 @@ protected:
wxDEPRECATED_MSG("use ValueFromString_(wxVariant&, int*, const wxString&, int) function instead")
bool ValueFromString_( wxVariant& value,
const wxString& text,
- int argFlags ) const
+ int flags ) const
{
- return ValueFromString_(value, nullptr, text, argFlags);
+ return ValueFromString_(value, nullptr, text, static_cast(flags));
}
wxDEPRECATED_MSG("use ValueFromInt_(wxVariant&, int*, int, int) function instead")
- bool ValueFromInt_( wxVariant& value, int intVal, int argFlags ) const
+ bool ValueFromInt_( wxVariant& value, int intVal, int flags ) const
{
- return ValueFromInt_(value, nullptr, intVal, argFlags);
+ return ValueFromInt_(value, nullptr, intVal, static_cast(flags));
}
wxDEPRECATED_MSG("don't use ResetNextIndex() function")
static void ResetNextIndex() { }
#endif
// Converts text to value and returns corresponding index in the collection
- bool ValueFromString_(wxVariant& value,
- int* pIndex,
- const wxString& text,
- int argFlags) const;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueFromString_ with 'flags' argument as wxPGPropValFormatFlags")
+ bool ValueFromString_(wxVariant& value, int* pIndex,
+ const wxString& text, int flags) const
+ {
+ return ValueFromString_(value, pIndex, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ bool ValueFromString_(wxVariant& value, int* pIndex,
+ const wxString& text, wxPGPropValFormatFlags flags) const;
// Converts number to value and returns corresponding index in the collection
- bool ValueFromInt_(wxVariant& value, int* pIndex, int intVal, int argFlags) const;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueFromInt_ with 'flags' argument as wxPGPropValFormatFlags")
+ bool ValueFromInt_(wxVariant& value, int* pIndex, int intVal, int flags) const
+ {
+ return ValueFromInt_(value, pIndex, intVal, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ bool ValueFromInt_(wxVariant& value, int* pIndex, int intVal, wxPGPropValFormatFlags flags) const;
private:
// This is private so that classes are guaranteed to use GetIndex
@@ -496,9 +650,17 @@ public:
virtual ~wxEditEnumProperty() = default;
void OnSetValue() override;
- bool StringToValue(wxVariant& variant,
- const wxString& text,
- int argFlags = 0) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
+ bool StringToValue(wxVariant& variant, const wxString& text,
+ int flags) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
bool ValidateValue(wxVariant& value,
wxPGValidationInfo& validationInfo) const override;
@@ -538,10 +700,27 @@ public:
virtual ~wxFlagsProperty () = default;
virtual void OnSetValue() override;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int flags ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ int flags) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags) const override;
virtual wxVariant ChildChanged( wxVariant& thisValue,
int childIndex,
wxVariant& childValue ) const override;
@@ -595,8 +774,8 @@ protected:
#if WXWIN_COMPATIBILITY_3_2
// Indicates first bit usable by derived properties.
-wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_SHOW_FULL_FILENAME is intended for internal use.")
-constexpr wxPGPropertyFlags wxPG_PROP_SHOW_FULL_FILENAME = wxPG_PROP_RESERVED_1;
+wxDEPRECATED_MSG("wxPG_PROP_SHOW_FULL_FILENAME is intended for internal use.")
+constexpr wxPGPropertyFlags wxPG_PROP_SHOW_FULL_FILENAME = wxPGPropertyFlags::Reserved_1;
#endif // WXWIN_COMPATIBILITY_3_2
// Like wxLongStringProperty, but the button triggers file selector instead.
@@ -611,10 +790,26 @@ public:
virtual ~wxFileProperty() = default;
virtual void OnSetValue() override;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ int flags) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
static wxValidator* GetClassValidator();
@@ -637,8 +832,8 @@ protected:
#if WXWIN_COMPATIBILITY_3_2
// Flag used in wxLongStringProperty to mark that edit button
// should be enabled even in the read-only mode.
-wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_ACTIVE_BTN is intended for internal use.")
-constexpr wxPGPropertyFlags wxPG_PROP_ACTIVE_BTN = wxPG_PROP_RESERVED_3;
+wxDEPRECATED_MSG("wxPG_PROP_ACTIVE_BTN is intended for internal use.")
+constexpr wxPGPropertyFlags wxPG_PROP_ACTIVE_BTN = wxPGPropertyFlags::Reserved_3;
#endif // WXWIN_COMPATIBILITY_3_2
// Like wxStringProperty, but has a button that triggers a small text
@@ -653,10 +848,27 @@ public:
const wxString& value = wxString() );
virtual ~wxLongStringProperty() = default;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ int flags) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
protected:
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) override;
@@ -675,9 +887,27 @@ public:
const wxString& value = wxString() );
virtual ~wxDirProperty() = default;
- virtual wxString ValueToString(wxVariant& value, int argFlags = 0) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue(wxVariant& variant, const wxString& text,
- int argFlags = 0) const override;
+ int flags) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_0
virtual bool DoSetAttribute(const wxString& name, wxVariant& value) override;
#endif // WXWIN_COMPATIBILITY_3_0
@@ -700,10 +930,27 @@ public:
virtual ~wxArrayStringProperty() = default;
virtual void OnSetValue() override;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
+ virtual wxString ValueToString(wxVariant& value, int flags) const override
+ {
+ m_oldValueToStringCalled = true;
+ return ValueToString(value, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ int flags) const override
+ {
+ m_oldStringToValueCalled = true;
+ return StringToValue(variant, text, static_cast(flags));
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
// Implement in derived class for custom array-to-string conversion.
diff --git a/include/wx/qt/control.h b/include/wx/qt/control.h
index 7483292594..f4ccca7c81 100644
--- a/include/wx/qt/control.h
+++ b/include/wx/qt/control.h
@@ -24,13 +24,6 @@ public:
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxControlNameStr));
- virtual wxSize DoGetBestSize() const override;
-
-protected:
- bool QtCreateControl( wxWindow *parent, wxWindowID id, const wxPoint &pos,
- const wxSize &size, long style, const wxValidator &validator,
- const wxString &name );
-
private:
wxDECLARE_DYNAMIC_CLASS(wxControl);
};
diff --git a/include/wx/qt/dcclient.h b/include/wx/qt/dcclient.h
index 76dd03e15e..d0957f19d2 100644
--- a/include/wx/qt/dcclient.h
+++ b/include/wx/qt/dcclient.h
@@ -23,7 +23,10 @@ public:
~wxWindowDCImpl();
protected:
- wxWindow *m_window;
+ std::unique_ptr m_pict;
+
+ // @true if m_qtPainter is owned by the window, @false otherwise (default).
+ bool m_isWindowPainter = false;
private:
wxDECLARE_CLASS(wxWindowDCImpl);
@@ -37,10 +40,10 @@ public:
wxClientDCImpl( wxDC *owner );
wxClientDCImpl( wxDC *owner, wxWindow *win );
- ~wxClientDCImpl();
-private:
- std::unique_ptr m_pict;
+ static bool
+ CanBeUsedForDrawing(const wxWindow* WXUNUSED(window)) { return false; }
+private:
wxDECLARE_CLASS(wxClientDCImpl);
wxDECLARE_NO_COPY_CLASS(wxClientDCImpl);
};
@@ -51,6 +54,7 @@ class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxWindowDCImpl
public:
wxPaintDCImpl( wxDC *owner );
wxPaintDCImpl( wxDC *owner, wxWindow *win );
+
private:
wxDECLARE_CLASS(wxPaintDCImpl);
wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl);
diff --git a/include/wx/qt/frame.h b/include/wx/qt/frame.h
index 3c1db1e60b..ccf652cc38 100644
--- a/include/wx/qt/frame.h
+++ b/include/wx/qt/frame.h
@@ -13,7 +13,6 @@
#include "wx/frame.h"
class QMainWindow;
-class QScrollArea;
class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase
{
@@ -51,7 +50,6 @@ public:
virtual void RemoveChild( wxWindowBase *child ) override;
QMainWindow *GetQMainWindow() const;
- virtual QScrollArea *QtGetScrollBarsContainer() const override;
protected:
virtual wxPoint GetClientAreaOrigin() const override;
diff --git a/include/wx/qt/listbox.h b/include/wx/qt/listbox.h
index a8b072d568..58e8358111 100644
--- a/include/wx/qt/listbox.h
+++ b/include/wx/qt/listbox.h
@@ -10,7 +10,6 @@
class QListWidget;
class QModelIndex;
-class QScrollArea;
class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
{
@@ -87,8 +86,6 @@ protected:
virtual int DoListHitTest(const wxPoint& point) const override;
- virtual QScrollArea *QtGetScrollBarsContainer() const override;
-
#if wxUSE_CHECKLISTBOX
bool m_hasCheckBoxes;
#endif // wxUSE_CHECKLISTBOX
diff --git a/include/wx/qt/private/winevent.h b/include/wx/qt/private/winevent.h
index f4db66dfd0..fb1fc431e1 100644
--- a/include/wx/qt/private/winevent.h
+++ b/include/wx/qt/private/winevent.h
@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
-// Name: include/wx/qt/winevent_qt.h
+// Name: include/wx/qt/private/winevent.h
// Purpose: QWidget to wxWindow event handler
// Author: Javier Torres, Peter Most
// Created: 21.06.10
@@ -371,7 +371,7 @@ protected:
virtual bool winEvent ( MSG * message, long * result ) { }
virtual bool x11Event ( XEvent * event ) { } */
- virtual bool event(QEvent *event)
+ virtual bool event(QEvent *event) override
{
if (event->type() == QEvent::Gesture)
{
diff --git a/include/wx/qt/statusbar.h b/include/wx/qt/statusbar.h
index 38a4eba722..3aef7d675b 100644
--- a/include/wx/qt/statusbar.h
+++ b/include/wx/qt/statusbar.h
@@ -10,15 +10,12 @@
#include "wx/statusbr.h"
-class QLabel;
class QStatusBar;
-template < class T > class QList;
-
class WXDLLIMPEXP_CORE wxStatusBar : public wxStatusBarBase
{
public:
- wxStatusBar();
+ wxStatusBar() = default;
wxStatusBar(wxWindow *parent, wxWindowID winid = wxID_ANY,
long style = wxSTB_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxStatusBarNameStr));
@@ -27,12 +24,11 @@ public:
long style = wxSTB_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxStatusBarNameStr));
+ virtual void SetStatusWidths(int n, const int widths_field[]) override;
virtual bool GetFieldRect(int i, wxRect& rect) const override;
virtual void SetMinHeight(int height) override;
virtual int GetBorderX() const override;
virtual int GetBorderY() const override;
- virtual void Refresh( bool eraseBackground = true,
- const wxRect *rect = nullptr ) override;
QStatusBar *GetQStatusBar() const { return m_qtStatusBar; }
QWidget *GetHandle() const override;
@@ -41,11 +37,10 @@ protected:
virtual void DoUpdateStatusText(int number) override;
private:
- void Init();
void UpdateFields();
- QStatusBar *m_qtStatusBar;
- wxVector m_qtPanes;
+ QStatusBar *m_qtStatusBar = nullptr;
+ std::vector m_qtPanes;
wxDECLARE_DYNAMIC_CLASS(wxStatusBar);
};
diff --git a/include/wx/qt/textctrl.h b/include/wx/qt/textctrl.h
index 7b24c03773..48b7ec46a8 100644
--- a/include/wx/qt/textctrl.h
+++ b/include/wx/qt/textctrl.h
@@ -8,7 +8,6 @@
#ifndef _WX_QT_TEXTCTRL_H_
#define _WX_QT_TEXTCTRL_H_
-class QScrollArea;
class wxQtEdit;
class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase
@@ -93,8 +92,6 @@ protected:
virtual bool DoLoadFile(const wxString& file, int fileType) override;
virtual bool DoSaveFile(const wxString& file, int fileType) override;
- virtual QScrollArea *QtGetScrollBarsContainer() const override;
-
// From wxTextEntry:
virtual wxWindow *GetEditableWindow() override { return this; }
diff --git a/include/wx/qt/window.h b/include/wx/qt/window.h
index 17cc930fa9..b0f55efb33 100644
--- a/include/wx/qt/window.h
+++ b/include/wx/qt/window.h
@@ -14,46 +14,37 @@
class QShortcut;
template < class T > class QList;
-class QWidget;
-class QScrollArea;
-class QScrollBar;
-class QPicture;
+class QAbstractScrollArea;
class QPainter;
+class QPicture;
+class QScrollBar;
+class QWidget;
+class QCloseEvent;
+class QContextMenuEvent;
+class QEvent;
+class QFocusEvent;
+class QKeyEvent;
class QPaintEvent;
class QResizeEvent;
class QWheelEvent;
-class QKeyEvent;
class QMouseEvent;
-class QEvent;
class QMoveEvent;
-class QEvent;
-class QEvent;
-class QCloseEvent;
-class QContextMenuEvent;
-class QFocusEvent;
-class WXDLLIMPEXP_FWD_CORE wxScrollBar;
class WXDLLIMPEXP_FWD_CORE wxQtShortcutHandler;
/* wxQt specific notes:
*
* Remember to implement the Qt object getters on all subclasses:
* - GetHandle() returns the Qt object
- * - QtGetScrollBarsContainer() returns the widget where scrollbars are placed
- * For example, for wxFrame, GetHandle() is the QMainWindow,
- * QtGetScrollBarsContainer() is the central widget and QtGetContainer() is a widget
- * in a layout inside the central widget that also contains the scrollbars.
- * Return 0 from QtGetScrollBarsContainer() to disable SetScrollBar() and friends
- * for wxWindow subclasses.
*
*
- * Event handling is achieved by using the template class wxQtEventForwarder
- * found in winevent_qt.(h|cpp) to send all Qt events here to QtHandleXXXEvent()
- * methods. All these methods receive the Qt event and the handler. This is
- * done because events of the containers (the scrolled part of the window) are
- * sent to the same wxWindow instance, that must be able to differentiate them
- * as some events need different handling (paintEvent) depending on that.
+ * Event handling is achieved by using the template class wxQtEventSignalHandler
+ * found in winevent.h to send all Qt events here to QtHandleXXXEvent() methods.
+ * All these methods receive the Qt event and the handler. This is done because
+ * events of the containers (the scrolled part of the window) are sent to the
+ * same wxWindow instance, that must be able to differentiate them as some events
+ * need different handling (paintEvent) depending on that.
* We pass the QWidget pointer to all event handlers for consistency.
*/
class WXDLLIMPEXP_CORE wxWindowQt : public wxWindowBase
@@ -75,7 +66,8 @@ public:
long style = 0,
const wxString& name = wxASCII_STR(wxPanelNameStr));
- // Used by all window classes in the widget creation process.
+ // Derived classes have to call PostCreation() explicitly if they don't call
+ // our Create() method during widget creation process.
void PostCreation( bool generic = true );
void AddChild( wxWindowBase *child ) override;
@@ -136,6 +128,9 @@ public:
virtual bool SetBackgroundColour(const wxColour& colour) override;
virtual bool SetForegroundColour(const wxColour& colour) override;
+ virtual void SetDoubleBuffered(bool on) override;
+ virtual bool IsDoubleBuffered() const override;
+
QWidget *GetHandle() const override;
#if wxUSE_DRAG_AND_DROP
@@ -152,7 +147,7 @@ public:
// wxQt implementation internals:
- // Caller maintains ownership of pict - window will NOT delete it
+ // Takes ownership of pict - window will delete it
void QtSetPicture( QPicture* pict );
QPainter *QtGetPainter();
@@ -178,8 +173,6 @@ public:
virtual void QtHandleShortcut ( int command );
#endif // wxUSE_ACCEL
- virtual QScrollArea *QtGetScrollBarsContainer() const;
-
#if wxUSE_TOOLTIPS
// applies tooltip to the widget.
virtual void QtApplyToolTip(const wxString& text);
@@ -210,6 +203,8 @@ protected:
virtual void DoSetClientSize(int width, int height) override;
virtual void DoGetClientSize(int *width, int *height) const override;
+ virtual wxSize DoGetBestSize() const override;
+
virtual void DoMoveWindow(int x, int y, int width, int height) override;
#if wxUSE_TOOLTIPS
@@ -225,14 +220,13 @@ protected:
// itself.
virtual QWidget* QtGetParentWidget() const { return GetHandle(); }
- QWidget *m_qtWindow;
+ QWidget *m_qtWindow;
+ QAbstractScrollArea *m_qtContainer; // either nullptr or the same as m_qtWindow pointer
+ // if m_qtWindow derives from QAbstractScrollArea,
+ // e.g. QListWidget and QTextEdit.
private:
void Init();
- QScrollArea *m_qtContainer; // either nullptr or the same as m_qtWindow pointer
-
- QScrollBar *m_horzScrollBar; // owned by m_qtWindow when allocated
- QScrollBar *m_vertScrollBar; // owned by m_qtWindow when allocated
// Return the viewport of m_qtContainer, if it's used, or just m_qtWindow.
//
@@ -240,11 +234,10 @@ private:
QWidget *QtGetClientWidget() const;
QScrollBar *QtGetScrollBar( int orientation ) const;
- QScrollBar *QtSetScrollBar( int orientation, QScrollBar *scrollBar=nullptr );
bool QtSetBackgroundStyle();
- QPicture *m_qtPicture; // not owned
+ std::unique_ptr m_qtPicture; // owned by this window
std::unique_ptr m_qtPainter; // always allocated
bool m_mouseInside;
diff --git a/include/wx/scrolwin.h b/include/wx/scrolwin.h
index c612997aab..abedfb8e44 100644
--- a/include/wx/scrolwin.h
+++ b/include/wx/scrolwin.h
@@ -439,7 +439,7 @@ public:
m_targetWindow = this;
#ifdef __WXMAC__
- this->MacSetClipChildren(true);
+ this->MacSetClipChildren();
#endif
// by default, we're scrollable in both directions (but if one of the
diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h
index a0d6bf7299..4888a0c146 100644
--- a/include/wx/setup_inc.h
+++ b/include/wx/setup_inc.h
@@ -1330,7 +1330,7 @@
// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL
// headers and libraries to be able to compile the library with wxUSE_GLCANVAS
-// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the
+// set to 1 and, under Windows, also to add opengl32.lib to the
// list of libraries used to link your application when linking to wxWidgets
// statically (although this is done implicitly for Microsoft Visual C++ users).
//
diff --git a/include/wx/sharedptr.h b/include/wx/sharedptr.h
index ba332ac2cf..1b88a77ee6 100644
--- a/include/wx/sharedptr.h
+++ b/include/wx/sharedptr.h
@@ -110,6 +110,18 @@ public:
bool unique() const { return (m_ref ? m_ref->m_count == 1 : true); }
long use_count() const { return (m_ref ? (long)m_ref->m_count : 0); }
+ template
+ friend bool operator == (wxSharedPtr const &a, wxSharedPtr const &b )
+ {
+ return a.get() == b.get();
+ }
+
+ template
+ friend bool operator != (wxSharedPtr const &a, wxSharedPtr const &b )
+ {
+ return a.get() != b.get();
+ }
+
private:
struct reftype
@@ -154,16 +166,4 @@ private:
}
};
-template
-bool operator == (wxSharedPtr const &a, wxSharedPtr const &b )
-{
- return a.get() == b.get();
-}
-
-template
-bool operator != (wxSharedPtr const &a, wxSharedPtr const &b )
-{
- return a.get() != b.get();
-}
-
#endif // _WX_SHAREDPTR_H_
diff --git a/include/wx/statusbr.h b/include/wx/statusbr.h
index f27a225dcb..8a4506a8d4 100644
--- a/include/wx/statusbr.h
+++ b/include/wx/statusbr.h
@@ -17,6 +17,7 @@
#include "wx/control.h"
#include "wx/list.h"
#include "wx/dynarray.h"
+#include "wx/weakref.h"
extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusBarNameStr[];
@@ -84,6 +85,11 @@ public:
// really restored anything
bool PopText();
+ // set/get the control (child of the wxStatusBar) that will be shown in
+ // this pane.
+ void SetFieldControl(wxWindow* win) { m_control = win; }
+ wxWindow* GetFieldControl() const { return m_control; }
+
private:
int m_nStyle;
int m_nWidth; // may be negative, indicating a variable-width field
@@ -97,6 +103,9 @@ private:
// is the currently shown value shown with ellipsis in the status bar?
bool m_bEllipsized;
+
+ // remember the control that will be shown in this pane. Updated by SetFieldControl().
+ wxWindowRef m_control;
};
// This is preserved for compatibility, but is not supposed to be used by the
@@ -173,6 +182,14 @@ public:
wxSize GetBorders() const
{ return wxSize(GetBorderX(), GetBorderY()); }
+ // controls
+ // --------
+
+ // Add a control (child of the wxStatusBar) to be shown at the specified
+ // field position #n. Note that you must delete the control to remove it
+ // from the status bar, as simply passing _nullptr_ will not do that.
+ bool AddFieldControl(int n, wxWindow* win);
+
// miscellaneous
// -------------
@@ -192,6 +209,9 @@ protected:
// display
virtual void DoUpdateStatusText(int number) = 0;
+ // Position the added controls (added by AddFieldControl()), if any, in
+ // their corresponding destination.
+ void OnSize(wxSizeEvent& event);
// wxWindow overrides:
diff --git a/include/wx/stdpaths.h b/include/wx/stdpaths.h
index 3a0d5e5227..49b0333153 100644
--- a/include/wx/stdpaths.h
+++ b/include/wx/stdpaths.h
@@ -51,6 +51,7 @@ public:
enum Dir
{
Dir_Cache,
+ Dir_Config,
Dir_Documents,
Dir_Desktop,
Dir_Downloads,
@@ -184,6 +185,11 @@ public:
bool UsesAppInfo(int info) const { return (m_usedAppInfo & info) != 0; }
+ // append application information determined by m_usedAppInfo to dir
+ wxNODISCARD
+ wxString AppendAppInfo(const wxString& dir) const;
+
+
void SetFileLayout(FileLayout layout)
{
m_fileLayout = layout;
@@ -203,10 +209,6 @@ protected:
// path separator or dot (.) is not already at the end of dir
static wxString AppendPathComponent(const wxString& dir, const wxString& component);
- // append application information determined by m_usedAppInfo to dir
- wxString AppendAppInfo(const wxString& dir) const;
-
-
// combination of AppInfo_XXX flags used by AppendAppInfo()
int m_usedAppInfo;
diff --git a/include/wx/string.h b/include/wx/string.h
index aed2ca6e5e..094327d7c9 100644
--- a/include/wx/string.h
+++ b/include/wx/string.h
@@ -261,6 +261,43 @@ public:
// "*(c_str() + 2)" work
inline wxUniChar operator*() const;
+ // we also need to provide the operators for comparison with wxCStrData to
+ // resolve ambiguity between operator(const wxChar *,const wxString &) and
+ // operator(const wxChar *, const wxChar *) for "p == s.c_str()"
+ //
+ // notice that these are (shallow) pointer comparisons, not (deep) string ones
+#define wxCMP_CHAR_CSTRDATA(p, s, op) p op s.AsChar()
+#define wxCMP_WCHAR_CSTRDATA(p, s, op) p op s.AsWChar()
+
+ wxDEFINE_ALL_COMPARISONS(const wchar_t *, const wxCStrData&, wxCMP_WCHAR_CSTRDATA)
+#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
+ wxDEFINE_ALL_COMPARISONS(const char *, const wxCStrData&, wxCMP_CHAR_CSTRDATA)
+#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
+
+#undef wxCMP_CHAR_CSTRDATA
+#undef wxCMP_WCHAR_CSTRDATA
+
+#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
+ // we need to define those to allow "size_t pos = p - s.c_str()" where p is
+ // some pointer into the string
+ friend size_t operator-(const char *p, const wxCStrData& cs)
+ {
+ return p - cs.AsChar();
+ }
+#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
+
+ friend size_t operator-(const wchar_t *p, const wxCStrData& cs)
+ {
+ return p - cs.AsWChar();
+ }
+
+#if wxUSE_STD_IOSTREAM
+ friend WXDLLIMPEXP_BASE std::ostream& operator<<(std::ostream&, const wxCStrData&);
+#if defined(HAVE_WOSTREAM)
+ friend WXDLLIMPEXP_BASE std::wostream& operator<<(std::wostream&, const wxCStrData&);
+#endif // defined(HAVE_WOSTREAM)
+#endif // wxUSE_STD_IOSTREAM
+
private:
// the wxString this object was returned for
const wxString *m_str;
@@ -834,6 +871,8 @@ public:
iterator operator+(ptrdiff_t n) const
{ return iterator(str(), wxStringOperations::AddToIter(m_cur, n)); }
+ friend iterator operator+(ptrdiff_t n, iterator i)
+ { return i + n; }
iterator operator-(ptrdiff_t n) const
{ return iterator(str(), wxStringOperations::AddToIter(m_cur, -n)); }
@@ -888,6 +927,8 @@ public:
const_iterator operator+(ptrdiff_t n) const
{ return const_iterator(str(), wxStringOperations::AddToIter(m_cur, n)); }
+ friend const_iterator operator+(ptrdiff_t n, const_iterator i)
+ { return i + n; }
const_iterator operator-(ptrdiff_t n) const
{ return const_iterator(str(), wxStringOperations::AddToIter(m_cur, -n)); }
@@ -931,6 +972,8 @@ public:
iterator operator+(ptrdiff_t n) const
{ return iterator(wxStringOperations::AddToIter(m_cur, n)); }
+ friend iterator operator+(ptrdiff_t n, iterator i)
+ { return i + n; }
iterator operator-(ptrdiff_t n) const
{ return iterator(wxStringOperations::AddToIter(m_cur, -n)); }
@@ -966,6 +1009,8 @@ public:
const_iterator operator+(ptrdiff_t n) const
{ return const_iterator(wxStringOperations::AddToIter(m_cur, n)); }
+ friend const_iterator operator+(ptrdiff_t n, const_iterator i)
+ { return i + n; }
const_iterator operator-(ptrdiff_t n) const
{ return const_iterator(wxStringOperations::AddToIter(m_cur, -n)); }
@@ -1057,6 +1102,8 @@ public:
reverse_iterator_impl operator+(ptrdiff_t n) const
{ return reverse_iterator_impl(m_cur - n); }
+ friend iterator operator+(ptrdiff_t n, reverse_iterator_impl i)
+ { return i + n; }
reverse_iterator_impl operator-(ptrdiff_t n) const
{ return reverse_iterator_impl(m_cur + n); }
reverse_iterator_impl operator+=(ptrdiff_t n)
@@ -2019,6 +2066,33 @@ public:
friend wxString WXDLLIMPEXP_BASE operator+(const wchar_t *pwz,
const wxString& string);
+ friend wxString operator+(const wxString& string, wxUniCharRef ch)
+ { return string + (wxUniChar)ch; }
+ friend wxString operator+(const wxString& string, char ch)
+ { return string + wxUniChar(ch); }
+ friend wxString operator+(const wxString& string, wchar_t ch)
+ { return string + wxUniChar(ch); }
+ friend wxString operator+(wxUniCharRef ch, const wxString& string)
+ { return (wxUniChar)ch + string; }
+ friend wxString operator+(char ch, const wxString& string)
+ { return wxUniChar(ch) + string; }
+ friend wxString operator+(wchar_t ch, const wxString& string)
+ { return wxUniChar(ch) + string; }
+
+
+ friend wxString operator+(const wxString& string, const wxScopedWCharBuffer& buf)
+ { return string + (const wchar_t *)buf; }
+ friend wxString operator+(const wxScopedWCharBuffer& buf, const wxString& string)
+ { return (const wchar_t *)buf + string; }
+
+#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
+ friend wxString operator+(const wxString& string, const wxScopedCharBuffer& buf)
+ { return string + (const char *)buf; }
+ friend wxString operator+(const wxScopedCharBuffer& buf, const wxString& string)
+ { return (const char *)buf + string; }
+#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
+
+
// stream-like functions
// insert an int into string
wxString& operator<<(int i)
@@ -2114,6 +2188,83 @@ public:
bool IsSameAs(int c, bool compareWithCase = true) const
{ return IsSameAs(wxUniChar(c), compareWithCase); }
+ // comparison operators: these are always case sensitive
+
+ // With C strings (narrow and wide):
+
+ #define wxCMP_WXCHAR_STRING(p, s, op) 0 op s.Cmp(p)
+
+ wxDEFINE_ALL_COMPARISONS(const wchar_t *, const wxString&, wxCMP_WXCHAR_STRING)
+#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
+ wxDEFINE_ALL_COMPARISONS(const char *, const wxString&, wxCMP_WXCHAR_STRING)
+#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
+
+ #undef wxCMP_WXCHAR_STRING
+
+ // With wxString itself and related types.
+ friend bool operator==(const wxString& s1, const wxString& s2)
+ { return s1.IsSameAs(s2); }
+ friend bool operator!=(const wxString& s1, const wxString& s2)
+ { return !s1.IsSameAs(s2); }
+ friend bool operator< (const wxString& s1, const wxString& s2)
+ { return s1.Cmp(s2) < 0; }
+ friend bool operator> (const wxString& s1, const wxString& s2)
+ { return s1.Cmp(s2) > 0; }
+ friend bool operator<=(const wxString& s1, const wxString& s2)
+ { return s1.Cmp(s2) <= 0; }
+ friend bool operator>=(const wxString& s1, const wxString& s2)
+ { return s1.Cmp(s2) >= 0; }
+
+ friend bool operator==(const wxString& s1, const wxCStrData& s2)
+ { return s1 == s2.AsString(); }
+ friend bool operator==(const wxCStrData& s1, const wxString& s2)
+ { return s1.AsString() == s2; }
+ friend bool operator!=(const wxString& s1, const wxCStrData& s2)
+ { return s1 != s2.AsString(); }
+ friend bool operator!=(const wxCStrData& s1, const wxString& s2)
+ { return s1.AsString() != s2; }
+
+ friend bool operator==(const wxString& s1, const wxScopedWCharBuffer& s2)
+ { return (s1.Cmp((const wchar_t *)s2) == 0); }
+ friend bool operator==(const wxScopedWCharBuffer& s1, const wxString& s2)
+ { return (s2.Cmp((const wchar_t *)s1) == 0); }
+ friend bool operator!=(const wxString& s1, const wxScopedWCharBuffer& s2)
+ { return (s1.Cmp((const wchar_t *)s2) != 0); }
+ friend bool operator!=(const wxScopedWCharBuffer& s1, const wxString& s2)
+ { return (s2.Cmp((const wchar_t *)s1) != 0); }
+
+#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
+ friend bool operator==(const wxString& s1, const wxScopedCharBuffer& s2)
+ { return (s1.Cmp((const char *)s2) == 0); }
+ friend bool operator==(const wxScopedCharBuffer& s1, const wxString& s2)
+ { return (s2.Cmp((const char *)s1) == 0); }
+ friend bool operator!=(const wxString& s1, const wxScopedCharBuffer& s2)
+ { return (s1.Cmp((const char *)s2) != 0); }
+ friend bool operator!=(const wxScopedCharBuffer& s1, const wxString& s2)
+ { return (s2.Cmp((const char *)s1) != 0); }
+#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
+
+ // comparison with char
+ friend bool operator==(const wxUniChar& c, const wxString& s) { return s.IsSameAs(c); }
+ friend bool operator==(const wxUniCharRef& c, const wxString& s) { return s.IsSameAs(c); }
+ friend bool operator==(char c, const wxString& s) { return s.IsSameAs(c); }
+ friend bool operator==(wchar_t c, const wxString& s) { return s.IsSameAs(c); }
+ friend bool operator==(int c, const wxString& s) { return s.IsSameAs(c); }
+ friend bool operator==(const wxString& s, const wxUniChar& c) { return s.IsSameAs(c); }
+ friend bool operator==(const wxString& s, const wxUniCharRef& c) { return s.IsSameAs(c); }
+ friend bool operator==(const wxString& s, char c) { return s.IsSameAs(c); }
+ friend bool operator==(const wxString& s, wchar_t c) { return s.IsSameAs(c); }
+ friend bool operator!=(const wxUniChar& c, const wxString& s) { return !s.IsSameAs(c); }
+ friend bool operator!=(const wxUniCharRef& c, const wxString& s) { return !s.IsSameAs(c); }
+ friend bool operator!=(char c, const wxString& s) { return !s.IsSameAs(c); }
+ friend bool operator!=(wchar_t c, const wxString& s) { return !s.IsSameAs(c); }
+ friend bool operator!=(int c, const wxString& s) { return !s.IsSameAs(c); }
+ friend bool operator!=(const wxString& s, const wxUniChar& c) { return !s.IsSameAs(c); }
+ friend bool operator!=(const wxString& s, const wxUniCharRef& c) { return !s.IsSameAs(c); }
+ friend bool operator!=(const wxString& s, char c) { return !s.IsSameAs(c); }
+ friend bool operator!=(const wxString& s, wchar_t c) { return !s.IsSameAs(c); }
+
+
// simple sub-string extraction
// return substring starting at nFirst of length nCount (or till the end
// if nCount = default value)
@@ -3482,6 +3633,13 @@ public:
wxString& operator+=(unsigned char ch) { return *this += wxUniChar(ch); }
wxString& operator+=(wchar_t ch) { return *this += wxUniChar(ch); }
+#if wxUSE_STD_IOSTREAM
+ friend WXDLLIMPEXP_BASE std::ostream& operator<<(std::ostream&, const wxString&);
+#if defined(HAVE_WOSTREAM)
+ friend WXDLLIMPEXP_BASE std::wostream& operator<<(std::wostream&, const wxString&);
+#endif // defined(HAVE_WOSTREAM)
+#endif // wxUSE_STD_IOSTREAM
+
private:
#if !wxUSE_UTF8_LOCALE_ONLY
int DoPrintfWchar(const wxChar *format, ...);
@@ -3626,48 +3784,6 @@ private:
friend class wxStringInternalBufferLength;
};
-// string iterator operators that satisfy STL Random Access Iterator
-// requirements:
-inline wxString::iterator operator+(ptrdiff_t n, wxString::iterator i)
- { return i + n; }
-inline wxString::const_iterator operator+(ptrdiff_t n, wxString::const_iterator i)
- { return i + n; }
-inline wxString::reverse_iterator operator+(ptrdiff_t n, wxString::reverse_iterator i)
- { return i + n; }
-inline wxString::const_reverse_iterator operator+(ptrdiff_t n, wxString::const_reverse_iterator i)
- { return i + n; }
-
-// notice that even though for many compilers the friend declarations above are
-// enough, from the point of view of C++ standard we must have the declarations
-// here as friend ones are not injected in the enclosing namespace and without
-// them the code fails to compile with conforming compilers such as xlC or g++4
-wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2);
-#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
-wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const char *psz);
-#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
-wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wchar_t *pwz);
-#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
-wxString WXDLLIMPEXP_BASE operator+(const char *psz, const wxString& string);
-#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
-wxString WXDLLIMPEXP_BASE operator+(const wchar_t *pwz, const wxString& string);
-
-wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxUniChar ch);
-wxString WXDLLIMPEXP_BASE operator+(wxUniChar ch, const wxString& string);
-
-inline wxString operator+(const wxString& string, wxUniCharRef ch)
- { return string + (wxUniChar)ch; }
-inline wxString operator+(const wxString& string, char ch)
- { return string + wxUniChar(ch); }
-inline wxString operator+(const wxString& string, wchar_t ch)
- { return string + wxUniChar(ch); }
-inline wxString operator+(wxUniCharRef ch, const wxString& string)
- { return (wxUniChar)ch + string; }
-inline wxString operator+(char ch, const wxString& string)
- { return wxUniChar(ch) + string; }
-inline wxString operator+(wchar_t ch, const wxString& string)
- { return wxUniChar(ch) + string; }
-
-
#define wxGetEmptyString() wxString()
// ----------------------------------------------------------------------------
@@ -4005,95 +4121,9 @@ public:
// ---------------------------------------------------------------------------
-// wxString comparison functions: operator versions are always case sensitive
+// wxString iterators comparisons
// ---------------------------------------------------------------------------
-// comparison with C-style narrow and wide strings.
-#define wxCMP_WXCHAR_STRING(p, s, op) 0 op s.Cmp(p)
-
-wxDEFINE_ALL_COMPARISONS(const wchar_t *, const wxString&, wxCMP_WXCHAR_STRING)
-#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
-wxDEFINE_ALL_COMPARISONS(const char *, const wxString&, wxCMP_WXCHAR_STRING)
-#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
-
-#undef wxCMP_WXCHAR_STRING
-
-inline bool operator==(const wxString& s1, const wxString& s2)
- { return s1.IsSameAs(s2); }
-inline bool operator!=(const wxString& s1, const wxString& s2)
- { return !s1.IsSameAs(s2); }
-inline bool operator< (const wxString& s1, const wxString& s2)
- { return s1.Cmp(s2) < 0; }
-inline bool operator> (const wxString& s1, const wxString& s2)
- { return s1.Cmp(s2) > 0; }
-inline bool operator<=(const wxString& s1, const wxString& s2)
- { return s1.Cmp(s2) <= 0; }
-inline bool operator>=(const wxString& s1, const wxString& s2)
- { return s1.Cmp(s2) >= 0; }
-
-inline bool operator==(const wxString& s1, const wxCStrData& s2)
- { return s1 == s2.AsString(); }
-inline bool operator==(const wxCStrData& s1, const wxString& s2)
- { return s1.AsString() == s2; }
-inline bool operator!=(const wxString& s1, const wxCStrData& s2)
- { return s1 != s2.AsString(); }
-inline bool operator!=(const wxCStrData& s1, const wxString& s2)
- { return s1.AsString() != s2; }
-
-inline bool operator==(const wxString& s1, const wxScopedWCharBuffer& s2)
- { return (s1.Cmp((const wchar_t *)s2) == 0); }
-inline bool operator==(const wxScopedWCharBuffer& s1, const wxString& s2)
- { return (s2.Cmp((const wchar_t *)s1) == 0); }
-inline bool operator!=(const wxString& s1, const wxScopedWCharBuffer& s2)
- { return (s1.Cmp((const wchar_t *)s2) != 0); }
-inline bool operator!=(const wxScopedWCharBuffer& s1, const wxString& s2)
- { return (s2.Cmp((const wchar_t *)s1) != 0); }
-
-#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
-inline bool operator==(const wxString& s1, const wxScopedCharBuffer& s2)
- { return (s1.Cmp((const char *)s2) == 0); }
-inline bool operator==(const wxScopedCharBuffer& s1, const wxString& s2)
- { return (s2.Cmp((const char *)s1) == 0); }
-inline bool operator!=(const wxString& s1, const wxScopedCharBuffer& s2)
- { return (s1.Cmp((const char *)s2) != 0); }
-inline bool operator!=(const wxScopedCharBuffer& s1, const wxString& s2)
- { return (s2.Cmp((const char *)s1) != 0); }
-#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
-
-inline wxString operator+(const wxString& string, const wxScopedWCharBuffer& buf)
- { return string + (const wchar_t *)buf; }
-inline wxString operator+(const wxScopedWCharBuffer& buf, const wxString& string)
- { return (const wchar_t *)buf + string; }
-
-#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
-inline wxString operator+(const wxString& string, const wxScopedCharBuffer& buf)
- { return string + (const char *)buf; }
-inline wxString operator+(const wxScopedCharBuffer& buf, const wxString& string)
- { return (const char *)buf + string; }
-#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
-
-// comparison with char
-inline bool operator==(const wxUniChar& c, const wxString& s) { return s.IsSameAs(c); }
-inline bool operator==(const wxUniCharRef& c, const wxString& s) { return s.IsSameAs(c); }
-inline bool operator==(char c, const wxString& s) { return s.IsSameAs(c); }
-inline bool operator==(wchar_t c, const wxString& s) { return s.IsSameAs(c); }
-inline bool operator==(int c, const wxString& s) { return s.IsSameAs(c); }
-inline bool operator==(const wxString& s, const wxUniChar& c) { return s.IsSameAs(c); }
-inline bool operator==(const wxString& s, const wxUniCharRef& c) { return s.IsSameAs(c); }
-inline bool operator==(const wxString& s, char c) { return s.IsSameAs(c); }
-inline bool operator==(const wxString& s, wchar_t c) { return s.IsSameAs(c); }
-inline bool operator!=(const wxUniChar& c, const wxString& s) { return !s.IsSameAs(c); }
-inline bool operator!=(const wxUniCharRef& c, const wxString& s) { return !s.IsSameAs(c); }
-inline bool operator!=(char c, const wxString& s) { return !s.IsSameAs(c); }
-inline bool operator!=(wchar_t c, const wxString& s) { return !s.IsSameAs(c); }
-inline bool operator!=(int c, const wxString& s) { return !s.IsSameAs(c); }
-inline bool operator!=(const wxString& s, const wxUniChar& c) { return !s.IsSameAs(c); }
-inline bool operator!=(const wxString& s, const wxUniCharRef& c) { return !s.IsSameAs(c); }
-inline bool operator!=(const wxString& s, char c) { return !s.IsSameAs(c); }
-inline bool operator!=(const wxString& s, wchar_t c) { return !s.IsSameAs(c); }
-
-
-// wxString iterators comparisons
inline bool wxString::const_iterator::operator==(const iterator& i) const
{ return *this == const_iterator(i); }
inline bool wxString::const_iterator::operator!=(const iterator& i) const
@@ -4120,22 +4150,6 @@ inline bool wxString::iterator::operator<=(const const_iterator& i) const
inline bool wxString::iterator::operator>=(const const_iterator& i) const
{ return i <= *this; }
-// we also need to provide the operators for comparison with wxCStrData to
-// resolve ambiguity between operator(const wxChar *,const wxString &) and
-// operator(const wxChar *, const wxChar *) for "p == s.c_str()"
-//
-// notice that these are (shallow) pointer comparisons, not (deep) string ones
-#define wxCMP_CHAR_CSTRDATA(p, s, op) p op s.AsChar()
-#define wxCMP_WCHAR_CSTRDATA(p, s, op) p op s.AsWChar()
-
-wxDEFINE_ALL_COMPARISONS(const wchar_t *, const wxCStrData&, wxCMP_WCHAR_CSTRDATA)
-#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
-wxDEFINE_ALL_COMPARISONS(const char *, const wxCStrData&, wxCMP_CHAR_CSTRDATA)
-#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
-
-#undef wxCMP_CHAR_CSTRDATA
-#undef wxCMP_WCHAR_CSTRDATA
-
// ----------------------------------------------------------------------------
// Implement hashing using C++11 std::hash<>.
// ----------------------------------------------------------------------------
@@ -4158,27 +4172,6 @@ namespace std
// Implementation only from here until the end of file
// ---------------------------------------------------------------------------
-#if wxUSE_STD_IOSTREAM
-
-#include "wx/iosfwrap.h"
-
-WXDLLIMPEXP_BASE std::ostream& operator<<(std::ostream&, const wxString&);
-WXDLLIMPEXP_BASE std::ostream& operator<<(std::ostream&, const wxCStrData&);
-#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
-WXDLLIMPEXP_BASE std::ostream& operator<<(std::ostream&, const wxScopedCharBuffer&);
-#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
-WXDLLIMPEXP_BASE std::ostream& operator<<(std::ostream&, const wxScopedWCharBuffer&);
-
-#if defined(HAVE_WOSTREAM)
-
-WXDLLIMPEXP_BASE std::wostream& operator<<(std::wostream&, const wxString&);
-WXDLLIMPEXP_BASE std::wostream& operator<<(std::wostream&, const wxCStrData&);
-WXDLLIMPEXP_BASE std::wostream& operator<<(std::wostream&, const wxScopedWCharBuffer&);
-
-#endif // defined(HAVE_WOSTREAM)
-
-#endif // wxUSE_STD_IOSTREAM
-
// ---------------------------------------------------------------------------
// wxCStrData implementation
// ---------------------------------------------------------------------------
@@ -4264,24 +4257,6 @@ inline wxUniChar wxCStrData::operator[](size_t n) const
return (*m_str)[m_offset + n];
}
-// ----------------------------------------------------------------------------
-// more wxCStrData operators
-// ----------------------------------------------------------------------------
-
-#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
-// we need to define those to allow "size_t pos = p - s.c_str()" where p is
-// some pointer into the string
-inline size_t operator-(const char *p, const wxCStrData& cs)
-{
- return p - cs.AsChar();
-}
-#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
-
-inline size_t operator-(const wchar_t *p, const wxCStrData& cs)
-{
- return p - cs.AsWChar();
-}
-
// ----------------------------------------------------------------------------
// implementation of wx[W]CharBuffer inline methods using wxCStrData
// ----------------------------------------------------------------------------
diff --git a/include/wx/unichar.h b/include/wx/unichar.h
index 19a0c6d1fb..c02facd83f 100644
--- a/include/wx/unichar.h
+++ b/include/wx/unichar.h
@@ -162,6 +162,9 @@ public:
#undef wxDEFINE_UNICHAR_OPERATOR
#undef wxDEFINE_UNCHAR_CMP_WITH_INT
+ wxDEFINE_COMPARISONS_BY_REV(char, const wxUniChar&)
+ wxDEFINE_COMPARISONS_BY_REV(wchar_t, const wxUniChar&)
+
// this is needed for expressions like 'Z'-c
int operator-(const wxUniChar& c) const { return m_value - c.m_value; }
int operator-(char c) const { return m_value - From8bit(c); }
@@ -290,12 +293,23 @@ public:
#undef wxDEFINE_UNICHARREF_OPERATOR
#undef wxDEFINE_UNICHARREF_CMP_WITH_INT
+ // Comparison operators for the case when wxUniChar(Ref) is the second
+ // operand implemented in terms of member comparison functions
+ wxDEFINE_COMPARISONS_BY_REV(char, const wxUniCharRef&)
+ wxDEFINE_COMPARISONS_BY_REV(wchar_t, const wxUniCharRef&)
+
+ wxDEFINE_COMPARISONS_BY_REV(const wxUniChar&, const wxUniCharRef&)
+
// for expressions like c-'A':
int operator-(const wxUniCharRef& c) const { return UniChar() - c.UniChar(); }
int operator-(const wxUniChar& c) const { return UniChar() - c; }
int operator-(char c) const { return UniChar() - c; }
int operator-(unsigned char c) const { return UniChar() - c; }
int operator-(wchar_t c) const { return UniChar() - c; }
+ friend int operator-(char c1, const wxUniCharRef& c2) { return -(c2 - c1); }
+ friend int operator-(const wxUniChar& c1, const wxUniCharRef& c2) { return -(c2 - c1); }
+ friend int operator-(wchar_t c1, const wxUniCharRef& c2) { return -(c2 - c1); }
+
private:
#if wxUSE_UNICODE_UTF8
@@ -365,21 +379,4 @@ void swap(wxUniCharRef&& lhs, wxUniCharRef&& rhs)
rhs = tmp;
}
-
-// Comparison operators for the case when wxUniChar(Ref) is the second operand
-// implemented in terms of member comparison functions
-
-wxDEFINE_COMPARISONS_BY_REV(char, const wxUniChar&)
-wxDEFINE_COMPARISONS_BY_REV(char, const wxUniCharRef&)
-
-wxDEFINE_COMPARISONS_BY_REV(wchar_t, const wxUniChar&)
-wxDEFINE_COMPARISONS_BY_REV(wchar_t, const wxUniCharRef&)
-
-wxDEFINE_COMPARISONS_BY_REV(const wxUniChar&, const wxUniCharRef&)
-
-// for expressions like c-'A':
-inline int operator-(char c1, const wxUniCharRef& c2) { return -(c2 - c1); }
-inline int operator-(const wxUniChar& c1, const wxUniCharRef& c2) { return -(c2 - c1); }
-inline int operator-(wchar_t c1, const wxUniCharRef& c2) { return -(c2 - c1); }
-
#endif /* _WX_UNICHAR_H_ */
diff --git a/include/wx/univ/setup.h b/include/wx/univ/setup.h
index 79d04c63ef..0464646037 100644
--- a/include/wx/univ/setup.h
+++ b/include/wx/univ/setup.h
@@ -1334,7 +1334,7 @@
// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL
// headers and libraries to be able to compile the library with wxUSE_GLCANVAS
-// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the
+// set to 1 and, under Windows, also to add opengl32.lib to the
// list of libraries used to link your application when linking to wxWidgets
// statically (although this is done implicitly for Microsoft Visual C++ users).
//
diff --git a/include/wx/unix/glx11.h b/include/wx/unix/glx11.h
index b0e4c89cf9..cad490a878 100644
--- a/include/wx/unix/glx11.h
+++ b/include/wx/unix/glx11.h
@@ -99,6 +99,8 @@ public:
private:
GLXFBConfig *m_fbc;
void* m_vi;
+
+ bool m_swapIntervalSet = false;
};
// ----------------------------------------------------------------------------
diff --git a/include/wx/utils.h b/include/wx/utils.h
index f63215f5b3..47c5e356e6 100644
--- a/include/wx/utils.h
+++ b/include/wx/utils.h
@@ -763,19 +763,24 @@ void WXDLLIMPEXP_CORE wxGetMousePosition( int* x, int* y );
wxDisplayType type;
};
WXDLLIMPEXP_CORE wxDisplayInfo wxGetDisplayInfo();
+
+ inline struct _XDisplay *wxGetX11Display()
+ {
+ const auto& info = wxGetDisplayInfo();
+ return info.type == wxDisplayX11 ? (_XDisplay*)info.dpy : nullptr;
+ }
#endif
#ifdef __X__
WXDLLIMPEXP_CORE WXDisplay *wxGetDisplay();
WXDLLIMPEXP_CORE bool wxSetDisplay(const wxString& display_name);
WXDLLIMPEXP_CORE wxString wxGetDisplayName();
-#endif // X or GTK+
-// use this function instead of the functions above in implementation code
-inline struct _XDisplay *wxGetX11Display()
-{
- return (_XDisplay *)wxGetDisplay();
-}
+ inline struct _XDisplay *wxGetX11Display()
+ {
+ return (_XDisplay *)wxGetDisplay();
+ }
+#endif // X
#endif // X11 || wxGTK
diff --git a/include/wx/valgen.h b/include/wx/valgen.h
index 8f26bd1740..c3d0faaab8 100644
--- a/include/wx/valgen.h
+++ b/include/wx/valgen.h
@@ -16,6 +16,7 @@
class WXDLLIMPEXP_FWD_BASE wxDateTime;
class WXDLLIMPEXP_FWD_BASE wxFileName;
+class WXDLLIMPEXP_FWD_CORE wxColour;
// ----------------------------------------------------------------------------
// wxGenericValidator performs data transfer between many standard controls and
@@ -33,6 +34,7 @@ public:
// wxCheckBox, wxRadioButton, wx(Bitmap)ToggleButton
wxGenericValidator(bool* val);
// wxChoice, wxGauge, wxRadioBox, wxScrollBar, wxSlider, wxSpinButton
+ // single-selection wxListBox
wxGenericValidator(int* val);
// wxComboBox, wxTextCtrl, wxButton, wxStaticText (read-only)
wxGenericValidator(wxString* val);
@@ -48,6 +50,10 @@ public:
wxGenericValidator(float* val);
// wxTextCtrl
wxGenericValidator(double* val);
+ // wxColourPickerCtrl
+ wxGenericValidator(wxColour* val);
+ // wxCheckBox
+ wxGenericValidator(wxCheckBoxState* val);
wxGenericValidator(const wxGenericValidator& copyFrom);
@@ -83,6 +89,8 @@ protected:
wxFileName* m_pFileName;
float* m_pFloat;
double* m_pDouble;
+ wxColour* m_pColour;
+ wxCheckBoxState* m_pCheckBoxState;
private:
wxDECLARE_CLASS(wxGenericValidator);
diff --git a/include/wx/variant.h b/include/wx/variant.h
index 4d5f1fe44c..74a623a1ce 100644
--- a/include/wx/variant.h
+++ b/include/wx/variant.h
@@ -470,7 +470,16 @@ REGISTER_WXANY_CONVERSION(T, CLASSNAME)
#endif // wxUSE_ANY/!wxUSE_ANY
+// Note: these macros must be used inside "classname" declaration.
+#define wxDECLARE_VARIANT_OBJECT(classname) \
+ wxDECLARE_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
+#define wxDECLARE_VARIANT_OBJECT_EXPORTED(classname,expdecl) \
+ friend expdecl classname& operator<<(classname &object, const wxVariant &variant); \
+ friend expdecl wxVariant& operator<<(wxVariant &variant, const classname &object)
+
+// These macros are deprecated, consider using wxDECLARE_VARIANT_OBJECT() above
+// instead.
#define DECLARE_VARIANT_OBJECT(classname) \
DECLARE_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
@@ -478,6 +487,13 @@ REGISTER_WXANY_CONVERSION(T, CLASSNAME)
expdecl classname& operator << ( classname &object, const wxVariant &variant ); \
expdecl wxVariant& operator << ( wxVariant &variant, const classname &object );
+// These macros use "wx" prefix and require a semicolon after them for
+// consistency with the rest of wx macros, but are otherwise the same as the
+// older IMPLEMENT_VARIANT_XXX macros.
+#define wxIMPLEMENT_VARIANT_OBJECT(classname) \
+ IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE) \
+ struct wxDummyVariantStructFwdDecl /* to force a semicolon */
+
#define IMPLEMENT_VARIANT_OBJECT(classname) \
IMPLEMENT_VARIANT_OBJECT_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
@@ -578,6 +594,13 @@ bool classname##VariantData::Eq(wxVariantData& data) const \
extern wxVariant WXDLLIMPEXP_BASE wxNullVariant;
-#endif // wxUSE_VARIANT
+#else // !wxUSE_VARIANT
+
+// Define these macros to allow using them without checking for wxUSE_VARIANT
+// and simply do nothing in them in this case.
+#define wxDECLARE_VARIANT_OBJECT(classname)
+#define wxDECLARE_VARIANT_OBJECT_EXPORTED(classname,expdecl)
+
+#endif // wxUSE_VARIANT/!wxUSE_VARIANT
#endif // _WX_VARIANT_H_
diff --git a/include/wx/windowid.h b/include/wx/windowid.h
index a6618b6188..2d448169d6 100644
--- a/include/wx/windowid.h
+++ b/include/wx/windowid.h
@@ -74,6 +74,57 @@ public:
return *this;
}
+ // comparison operators
+ friend bool operator==(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs)
+ {
+ return lhs.GetValue() == rhs.GetValue();
+ }
+
+ friend bool operator==(const wxWindowIDRef& lhs, int rhs)
+ {
+ return lhs.GetValue() == rhs;
+ }
+
+ friend bool operator==(const wxWindowIDRef& lhs, long rhs)
+ {
+ return lhs.GetValue() == rhs;
+ }
+
+ friend bool operator==(int lhs, const wxWindowIDRef& rhs)
+ {
+ return rhs == lhs;
+ }
+
+ friend bool operator==(long lhs, const wxWindowIDRef& rhs)
+ {
+ return rhs == lhs;
+ }
+
+ friend bool operator!=(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs)
+ {
+ return !(lhs == rhs);
+ }
+
+ friend bool operator!=(const wxWindowIDRef& lhs, int rhs)
+ {
+ return !(lhs == rhs);
+ }
+
+ friend bool operator!=(const wxWindowIDRef& lhs, long rhs)
+ {
+ return !(lhs == rhs);
+ }
+
+ friend bool operator!=(int lhs, const wxWindowIDRef& rhs)
+ {
+ return !(lhs == rhs);
+ }
+
+ friend bool operator!=(long lhs, const wxWindowIDRef& rhs)
+ {
+ return !(lhs == rhs);
+ }
+
// access to the stored id value
wxWindowID GetValue() const
{
@@ -114,57 +165,6 @@ private:
wxWindowID m_id;
};
-// comparison operators
-inline bool operator==(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs)
-{
- return lhs.GetValue() == rhs.GetValue();
-}
-
-inline bool operator==(const wxWindowIDRef& lhs, int rhs)
-{
- return lhs.GetValue() == rhs;
-}
-
-inline bool operator==(const wxWindowIDRef& lhs, long rhs)
-{
- return lhs.GetValue() == rhs;
-}
-
-inline bool operator==(int lhs, const wxWindowIDRef& rhs)
-{
- return rhs == lhs;
-}
-
-inline bool operator==(long lhs, const wxWindowIDRef& rhs)
-{
- return rhs == lhs;
-}
-
-inline bool operator!=(const wxWindowIDRef& lhs, const wxWindowIDRef& rhs)
-{
- return !(lhs == rhs);
-}
-
-inline bool operator!=(const wxWindowIDRef& lhs, int rhs)
-{
- return !(lhs == rhs);
-}
-
-inline bool operator!=(const wxWindowIDRef& lhs, long rhs)
-{
- return !(lhs == rhs);
-}
-
-inline bool operator!=(int lhs, const wxWindowIDRef& rhs)
-{
- return !(lhs == rhs);
-}
-
-inline bool operator!=(long lhs, const wxWindowIDRef& rhs)
-{
- return !(lhs == rhs);
-}
-
// ----------------------------------------------------------------------------
// wxIdManager
// ----------------------------------------------------------------------------
diff --git a/include/wx/withimages.h b/include/wx/withimages.h
index bec093d6d0..93744d0288 100644
--- a/include/wx/withimages.h
+++ b/include/wx/withimages.h
@@ -145,14 +145,32 @@ public:
{
wxSize size;
- // Prefer to use the image list here if we have it because we must have
- // already decided for the best size to use when creating it.
- //
- // Otherwise we need to compute the best size here ourselves.
- if ( m_imageList )
- size = m_imageList->GetSize();
- else if ( !m_images.empty() )
- size = wxBitmapBundle::GetConsensusSizeFor(window, m_images);
+ if ( !m_images.empty() )
+ {
+ // This is a micro-optimization: if we have an image list here, we
+ // must have created it ourselves, as e.g. wxGenericTreeCtrl does,
+ // and then we must already have determined the correct size to use
+ // for the current window DPI and can just return it.
+ if ( m_imageList )
+ {
+ // Note that we shouldn't scale it by DPI factor here because
+ // we had already taken it into account when (re)creating it.
+ size = m_imageList->GetSize();
+ }
+ else
+ {
+ // Otherwise we need to compute the best size here ourselves.
+ size = wxBitmapBundle::GetConsensusSizeFor(window, m_images);
+ }
+ }
+ else if ( m_imageList )
+ {
+ // But if we have just the user-provided image list, we need to
+ // scale its size by the DPI scale because the bitmaps from it will
+ // be scaled when they are drawn (they should have scaling factor
+ // of 1, as for anything else wxBitmapBundle must be used).
+ size = m_imageList->GetSize() * window->GetDPIScaleFactor();
+ }
return size;
}
diff --git a/include/wx/x11/dcclient.h b/include/wx/x11/dcclient.h
index beca1247de..7c477ed34f 100644
--- a/include/wx/x11/dcclient.h
+++ b/include/wx/x11/dcclient.h
@@ -153,6 +153,9 @@ public:
wxClientDCImpl( wxDC *owner ) : wxWindowDCImpl( owner ) { }
wxClientDCImpl( wxDC *owner, wxWindow *win );
+ static bool
+ CanBeUsedForDrawing(const wxWindow* WXUNUSED(window)) { return true; }
+
protected:
virtual void DoGetSize(int *width, int *height) const;
diff --git a/include/wx/xml/xml.h b/include/wx/xml/xml.h
index 485f706932..f65db2edf5 100644
--- a/include/wx/xml/xml.h
+++ b/include/wx/xml/xml.h
@@ -21,6 +21,8 @@
#include "wx/textbuf.h"
#include "wx/versioninfo.h"
+#include
+
#ifdef WXMAKINGDLL_XML
#define WXDLLIMPEXP_XML WXEXPORT
#elif defined(WXUSINGDLL)
@@ -227,21 +229,17 @@ class WXDLLIMPEXP_XML wxXmlDocument : public wxObject
{
public:
wxXmlDocument();
- wxXmlDocument(const wxString& filename,
- const wxString& encoding = wxT("UTF-8"));
- wxXmlDocument(wxInputStream& stream,
- const wxString& encoding = wxT("UTF-8"));
- virtual ~wxXmlDocument() { wxDELETE(m_docNode); }
+ wxXmlDocument(const wxString& filename);
+ wxXmlDocument(wxInputStream& stream);
+ ~wxXmlDocument() = default;
wxXmlDocument(const wxXmlDocument& doc);
wxXmlDocument& operator=(const wxXmlDocument& doc);
// Parses .xml file and loads data. Returns TRUE on success, FALSE
// otherwise.
- virtual bool Load(const wxString& filename,
- const wxString& encoding = wxT("UTF-8"), int flags = wxXMLDOC_NONE);
- virtual bool Load(wxInputStream& stream,
- const wxString& encoding = wxT("UTF-8"), int flags = wxXMLDOC_NONE);
+ bool Load(const wxString& filename, int flags = wxXMLDOC_NONE);
+ bool Load(wxInputStream& stream, int flags = wxXMLDOC_NONE);
// Saves document as .xml file.
virtual bool Save(const wxString& filename, int indentstep = 2) const;
@@ -252,7 +250,7 @@ public:
// Returns root node of the document.
wxXmlNode *GetRoot() const;
// Returns the document node.
- wxXmlNode *GetDocumentNode() const { return m_docNode; }
+ wxXmlNode *GetDocumentNode() const { return m_docNode.get(); }
// Returns version of document (may be empty).
@@ -267,8 +265,8 @@ public:
wxString GetEOL() const { return m_eol; }
// Write-access methods:
- wxXmlNode *DetachDocumentNode() { wxXmlNode *old=m_docNode; m_docNode=nullptr; return old; }
- void SetDocumentNode(wxXmlNode *node) { wxDELETE(m_docNode); m_docNode = node; }
+ wxXmlNode *DetachDocumentNode() { return m_docNode.release(); }
+ void SetDocumentNode(wxXmlNode *node) { m_docNode.reset(node); }
wxXmlNode *DetachRoot();
void SetRoot(wxXmlNode *node);
void SetVersion(const wxString& version) { m_version = version; }
@@ -279,13 +277,43 @@ public:
static wxVersionInfo GetLibraryVersionInfo();
+#ifdef WXWIN_COMPATIBILITY_3_2
+ wxDEPRECATED_MSG("Remove encoding parameter from the call")
+ wxXmlDocument(const wxString& filename,
+ const wxString& WXUNUSED(encoding))
+ : wxXmlDocument(filename)
+ {
+ }
+
+ wxDEPRECATED_MSG("Remove encoding parameter from the call")
+ wxXmlDocument(wxInputStream& stream,
+ const wxString& WXUNUSED(encoding))
+ : wxXmlDocument(stream)
+ {
+ }
+
+ wxDEPRECATED_MSG("Remove encoding parameter from the call")
+ bool Load(const wxString& filename,
+ const wxString& WXUNUSED(encoding), int flags = wxXMLDOC_NONE)
+ {
+ return Load(filename, flags);
+ }
+
+ wxDEPRECATED_MSG("Remove encoding parameter from the call")
+ bool Load(wxInputStream& stream,
+ const wxString& WXUNUSED(encoding), int flags = wxXMLDOC_NONE)
+ {
+ return Load(stream, flags);
+ }
+#endif // WXWIN_COMPATIBILITY_3_2
+
private:
wxString m_version;
wxString m_fileEncoding;
wxXmlDoctype m_doctype;
- wxXmlNode *m_docNode;
- wxTextFileType m_fileType;
- wxString m_eol;
+ std::unique_ptr m_docNode;
+ wxTextFileType m_fileType = wxTextFileType_Unix;
+ wxString m_eol = wxS("\n");
void DoCopy(const wxXmlDocument& doc);
diff --git a/interface/wx/aboutdlg.h b/interface/wx/aboutdlg.h
index 84cf275683..a245c872d8 100644
--- a/interface/wx/aboutdlg.h
+++ b/interface/wx/aboutdlg.h
@@ -37,7 +37,7 @@
aboutInfo.SetName("MyApp");
aboutInfo.SetVersion(MY_APP_VERSION_STRING);
aboutInfo.SetDescription(_("My wxWidgets-based application!"));
- aboutInfo.SetCopyright("(C) 1992-2023");
+ aboutInfo.SetCopyright("(C) 1992-2024");
aboutInfo.SetWebSite("http://myapp.org");
aboutInfo.AddDeveloper("My Self");
diff --git a/interface/wx/aui/auibook.h b/interface/wx/aui/auibook.h
index c8d6510f78..d00f54140e 100644
--- a/interface/wx/aui/auibook.h
+++ b/interface/wx/aui/auibook.h
@@ -114,6 +114,9 @@ enum wxAuiNotebookOption
Double clicked on the tabs background area. Processes a @c wxEVT_AUINOTEBOOK_BG_DCLICK event.
@endEventTable
+ Please see the note in wxAuiNotebookEvent documentation about handling
+ these events.
+
@library{wxaui}
@category{aui}
*/
@@ -712,6 +715,13 @@ public:
This class is used by the events generated by wxAuiNotebook.
+ Please note that most events generated by wxAuiNotebook are handled by the
+ notebook object itself, i.e. they do _not_ propagate upwards to the
+ notebook parent window, in spite of being command events. In order to
+ handle these events you should use wxEvtHandler::Bind() to connect to the
+ events on the notebook object itself and don't forget to use
+ wxEvent::Skip() to ensure that the notebook still processes them too.
+
@beginEventEmissionTable{wxAuiNotebookEvent}
@event{EVT_AUINOTEBOOK_PAGE_CLOSE(id, func)}
A page is about to be closed. Processes a @c wxEVT_AUINOTEBOOK_PAGE_CLOSE event.
diff --git a/interface/wx/aui/framemanager.h b/interface/wx/aui/framemanager.h
index 359aecfc04..14f573eeb1 100644
--- a/interface/wx/aui/framemanager.h
+++ b/interface/wx/aui/framemanager.h
@@ -45,12 +45,14 @@ enum wxAuiManagerOption
wxAUI_MGR_NO_VENETIAN_BLINDS_FADE = 1 << 7,
/// When a docked pane is resized, its content is refreshed in live (instead of moving
/// the border alone and refreshing the content at the end).
+ /// Since wxWidgets 3.3.0 this flag is included in the default flags.
wxAUI_MGR_LIVE_RESIZE = 1 << 8,
/// Default behaviour.
wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
wxAUI_MGR_TRANSPARENT_HINT |
wxAUI_MGR_HINT_FADE |
- wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
+ wxAUI_MGR_NO_VENETIAN_BLINDS_FADE |
+ wxAUI_MGR_LIVE_RESIZE
};
/**
@@ -134,7 +136,9 @@ enum wxAuiManagerOption
appearing partially transparent hint.
@style{wxAUI_MGR_RECTANGLE_HINT}
The possible location for docking is indicated by a rectangular
- outline.
+ outline. Note that this flag doesn't work, i.e. doesn't show any
+ hint in wxGTK and wxOSX, please use one of the hint flags above
+ instead.
@style{wxAUI_MGR_HINT_FADE}
The translucent area where the pane could be docked appears gradually.
@style{wxAUI_MGR_NO_VENETIAN_BLINDS_FADE}
@@ -142,7 +146,11 @@ enum wxAuiManagerOption
docking hint immediately.
@style{wxAUI_MGR_LIVE_RESIZE}
When a docked pane is resized, its content is refreshed in live (instead of moving
- the border alone and refreshing the content at the end).
+ the border alone and refreshing the content at the end). Note that
+ this flag is included in wxAUI_MGR_DEFAULT and so needs to be
+ explicitly turned off if you don't need. Also note that it is
+ always enabled in wxGTK3 and wxOSX ports as non-live resizing is not
+ implemented in them.
@style{wxAUI_MGR_DEFAULT}
Default behaviour, combines: wxAUI_MGR_ALLOW_FLOATING | wxAUI_MGR_TRANSPARENT_HINT |
wxAUI_MGR_HINT_FADE | wxAUI_MGR_NO_VENETIAN_BLINDS_FADE.
@@ -213,12 +221,16 @@ public:
If this function returns true, ::wxAUI_MGR_LIVE_RESIZE flag is ignored
and live resize is always used, whether it's specified or not.
- Currently this is the case for wxOSX and wxGTK3 ports, as live resizing
- is the only implemented method there.
+ Currently this is the case for wxOSX and wxGTK3 when using Wayland, as
+ live resizing is the only implemented method there. See
+ wxClientDC::CanBeUsedForDrawing() for more details.
+
+ @param window The associated window, may be null (this parameter was
+ added in wxWidgets 3.3.0)
@since 3.1.4
*/
- static bool AlwaysUsesLiveResize();
+ static bool AlwaysUsesLiveResize(const wxWindow* window);
/**
This function is used by controls to calculate the drop hint rectangle.
diff --git a/interface/wx/bitmap.h b/interface/wx/bitmap.h
index 8ab0897534..2d3eff7d05 100644
--- a/interface/wx/bitmap.h
+++ b/interface/wx/bitmap.h
@@ -494,6 +494,10 @@ public:
Create a bitmap specifying its size in DPI-independent pixels and the
scale factor to use.
+ This should be used when the bitmap size is fixed (e.g. at
+ compile-time) and not if it comes from wxWindow::GetSize() or other
+ similar functions -- use CreateWithLogicalSize() in the latter case.
+
The physical size of the bitmap is obtained by multiplying the given
@a size by @a scale and rounding it to the closest integer.
@@ -524,6 +528,43 @@ public:
double scale,
int depth = wxBITMAP_SCREEN_DEPTH);
+ /**
+ Create a bitmap specifying its size in logical pixels and the scale
+ factor to use.
+
+ This should be typically used when creating bitmaps associated to a
+ window area, e.g. to create a bitmap covering the entire window the
+ @a size parameter should be wxWindow::GetClientSize() and @a scale
+ should be the wxWindow::GetDPIScaleFactor().
+
+ The physical size of the bitmap created by this function depends on the
+ platform and will be the same as @a size on the platforms for which
+ `wxHAS_DPI_INDEPENDENT_PIXELS` is not defined (e.g. wxMSW) or @a size
+ multiplied by @a scale for those where it is (e.g. wxGTK3 and wxOSX).
+ In other words, this function is the same as CreateWithDIPSize() if
+ `wxHAS_DPI_INDEPENDENT_PIXELS` is defined, but not otherwise.
+
+ @param size
+ The size of the bitmap in logical pixels. Both width and
+ height must be strictly positive.
+ @param scale
+ Scale factor used by the bitmap, see SetScaleFactor().
+ @param depth
+ The number of bits used to represent each bitmap pixel.
+
+ @return @true if the creation was successful.
+
+ @since 3.3.0
+ */
+ bool CreateWithLogicalSize(const wxSize& size,
+ double scale,
+ int depth = wxBITMAP_SCREEN_DEPTH);
+
+ /// @overload
+ bool CreateWithLogicalSize(int width, int height,
+ double scale,
+ int depth = wxBITMAP_SCREEN_DEPTH);
+
/**
Create a bitmap with a scale factor.
diff --git a/interface/wx/config.h b/interface/wx/config.h
index 4b9e052ab1..f0169b693e 100644
--- a/interface/wx/config.h
+++ b/interface/wx/config.h
@@ -6,14 +6,61 @@
/////////////////////////////////////////////////////////////////////////////
-// Flags for constructor style parameter
+/// Flags for wxConfig constructor style parameter.
enum
{
wxCONFIG_USE_LOCAL_FILE = 1,
wxCONFIG_USE_GLOBAL_FILE = 2,
wxCONFIG_USE_RELATIVE_PATH = 4,
wxCONFIG_USE_NO_ESCAPE_CHARACTERS = 8,
- wxCONFIG_USE_SUBDIR = 16
+
+ /**
+ Use subdirectory for the local configuration file location.
+
+ Specifying this flag changes the default local configuration file
+ location to `~/.appname/appname.conf`. Please note that this path is
+ _not_ affected by layout set using wxStandardPaths::SetFileLayout() and
+ it is recommended to use wxCONFIG_USE_XDG flag in addition to this file
+ on contemporary Linux systems.
+
+ @since 2.8.2
+ */
+ wxCONFIG_USE_SUBDIR = 16,
+
+ /**
+ Always use XDG-compliant file location on Unix systems.
+
+ If wxCONFIG_USE_SUBDIR is not specified, using this flag has the same
+ effect as calling wxStandardPaths::SetFileLayout() with
+ wxStandardPaths::FileLayout_XDG, i.e. it changes the default local
+ configuration file location to `~/.config/appname.conf`.
+
+ In combination with wxCONFIG_USE_SUBDIR, this flag changes the default
+ configuration file location to ~/.config/appname/appname.conf`.
+
+ If neither this flag nor wxCONFIG_USE_HOME is specified, XDG-compliant
+ configuration file path will be used by default, but if there is an
+ existing file in the home directory, then it will continue to be used
+ instead.
+
+ @since 3.3.0
+ */
+ wxCONFIG_USE_XDG = 32,
+
+ /**
+ Use home directory for the local file location on Unix systems.
+
+ Using this flag is not recommended, it exists only for compatibility
+ with the previous wxWidgets versions which created configuration files
+ in the home directory (i.e. `~/.appname`) by default.
+
+ Note that any already existing files in the home directory will still
+ be used, even if this file is not specified, unless wxCONFIG_USE_XDG is
+ used.
+
+ @since 3.3.0
+ */
+ wxCONFIG_USE_HOME = 64
};
@@ -30,7 +77,9 @@ enum
with the registry under Windows or text-based config files under Unix.
To make writing the portable code even easier, wxWidgets provides a typedef
wxConfig which is mapped onto the native wxConfigBase implementation on the
- given platform: i.e. wxRegConfig under Windows and wxFileConfig otherwise.
+ given platform: i.e. wxRegConfig under Windows (in this case
+ `wxHAS_CONFIG_AS_REGCONFIG` preprocessor symbol is defined) and
+ wxFileConfig otherwise (in this case `wxHAS_CONFIG_AS_FILECONFIG` is).
See @ref overview_config for a description of all features of this class.
@@ -296,14 +345,16 @@ public:
@n For wxFileConfig you can also add @c wxCONFIG_USE_RELATIVE_PATH by
logically or'ing it to either of the _FILE options to tell
wxFileConfig to use relative instead of absolute paths.
- @n On non-VMS Unix systems, the default local configuration file is
- "~/.appname". However, this path may be also used as user data
+ @n On Unix-like systems, the default local configuration file is
+ `~/.appname` unless wxStandardPaths::SetFileLayout() is called with
+ wxStandardPaths::FileLayout_XDG parameter in which case the default
+ becomes `~/.config/appname.conf`.
+ @n Note that this default path may be also used as user data
directory (see wxStandardPaths::GetUserDataDir()) if the
- application has several data files. In this case
- @c wxCONFIG_USE_SUBDIR flag, which changes the default local
- configuration file to "~/.appname/appname" should be used. Notice
- that this flag is ignored if @a localFilename is provided.
- @c wxCONFIG_USE_SUBDIR is new since wxWidgets version 2.8.2.
+ application has several data files. In this case it is recommended
+ to use ::wxCONFIG_USE_XDG flag (available since wxWidgets 3.3.0)
+ and/or older ::wxCONFIG_USE_SUBDIR (available since 2.8.2) to
+ change the default local configuration file location.
@n For wxFileConfig, you can also add
@c wxCONFIG_USE_NO_ESCAPE_CHARACTERS which will turn off character
escaping for the values of entries stored in the config file: for
diff --git a/interface/wx/datetime.h b/interface/wx/datetime.h
index 5e6aec720c..2987a863a8 100644
--- a/interface/wx/datetime.h
+++ b/interface/wx/datetime.h
@@ -1679,18 +1679,111 @@ const wxDateTime wxDefaultDateTime;
/**
@class wxDateTimeWorkDays
- @todo Write wxDateTimeWorkDays documentation.
+ Holiday authority that classifies all Saturdays and Sundays
+ as holidays.
@library{wxbase}
@category{data}
*/
-class wxDateTimeWorkDays
+class wxDateTimeWorkDays : public wxDateTimeHolidayAuthority
{
-public:
-
+protected:
+ /**
+ Override which returns @true if provided date is a Saturday and Sunday.
+ */
+ virtual bool DoIsHoliday(const wxDateTime& dt) const override;
+ /**
+ Override which returns all Saturdays and Sundays from a provided range.
+ */
+ virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart,
+ const wxDateTime& dtEnd,
+ wxDateTimeArray& holidays) const override;
};
+/**
+ @class wxDateTimeUSCatholicFeasts
+ Holiday authority that returns Catholic holy days of obligation,
+ as observed in the United States. This includes:
+
+ - Solemnity of Mary, Mother of God
+ - Easter (moveable feast)
+ - Ascension (moveable feast)
+ - Assumption of the Blessed Virgin Mary
+ - All Saints Day
+ - Immaculate Conception of the Blessed Virgin Mary
+ - Christmas
+
+ @library{wxbase}
+ @category{data}
+
+ @since 3.3.0
+*/
+class wxDateTimeUSCatholicFeasts : public wxDateTimeHolidayAuthority
+{
+public:
+ /**
+ Returns the date for Easter for a given year.
+ */
+ static wxDateTime GetEaster(int year);
+
+ /**
+ Returns the date for Ascension for a given year.
+ Celebrated on the 40th day of Easter/
+ sixth Thursday after Easter Sunday.
+ */
+ static wxDateTime GetThursdayAscension(int year);
+
+ /**
+ Returns the date for Ascension for a given year.
+ This is the same as GetThursdayAscension(),
+ but moved to the Sunday following the traditional Ascension
+ that falls on a Thursday.
+ */
+ static wxDateTime GetSundayAscension(int year);
+
+protected:
+ /**
+ Override which returns @true if provided date is a holy day of obligation.
+ */
+ bool DoIsHoliday(const wxDateTime& dt) const override;
+
+ /**
+ Override to determine the holy days of obligation within a date range.
+ */
+ size_t DoGetHolidaysInRange(const wxDateTime& dtStart,
+ const wxDateTime& dtEnd,
+ wxDateTimeArray& holidays) const override;
+};
+
+/**
+ @class wxDateTimeChristianHolidays
+
+ Holiday authority that returns holidays common to all Christian religions.
+ This includes:
+
+ - Easter (moveable feast)
+ - Christmas
+
+ @library{wxbase}
+ @category{data}
+
+ @since 3.3.0
+*/
+class WXDLLIMPEXP_BASE wxDateTimeChristianHolidays : public wxDateTimeUSCatholicFeasts
+{
+protected:
+ /**
+ Override which returns @true if provided date is Easter or Christmas.
+ */
+ bool DoIsHoliday(const wxDateTime& dt) const override;
+ /**
+ Override to determine the holidays within a date range.
+ */
+ size_t DoGetHolidaysInRange(const wxDateTime& dtStart,
+ const wxDateTime& dtEnd,
+ wxDateTimeArray& holidays) const override;
+};
/**
@class wxDateSpan
@@ -2231,7 +2324,12 @@ public:
/**
@class wxDateTimeHolidayAuthority
- @todo Write wxDateTimeHolidayAuthority documentation.
+ Class which decides whether a given
+ date is a holiday and is used by all functions working with "work days".
+
+ New classes can be derived from this to determine specific holidays.
+ These classes should override DoIsHoliday() and DoGetHolidaysInRange(),
+ and be passed to wxDateTimeHolidayAuthority::AddAuthority() to be used.
@library{wxbase}
@category{data}
@@ -2239,6 +2337,40 @@ public:
class wxDateTimeHolidayAuthority
{
public:
+ /// Returns @true if the given date is a holiday.
+ static bool IsHoliday(const wxDateTime& dt);
+ /**
+ Fills the provided array with all holidays in the given range, returns
+ the number of them.
+ */
+ static size_t GetHolidaysInRange(const wxDateTime& dtStart,
+ const wxDateTime& dtEnd,
+ wxDateTimeArray& holidays);
+
+ /// Clears the list of holiday authorities.
+ static void ClearAllAuthorities();
+
+ /**
+ Adds a new holiday authority.
+
+ The pointer will be deleted by wxDateTimeHolidayAuthority.
+ */
+ static void AddAuthority(wxDateTimeHolidayAuthority* auth);
+
+protected:
+ /**
+ This function should be overridden to determine whether
+ a given day is a holiday.
+ */
+ virtual bool DoIsHoliday(const wxDateTime& dt) const = 0;
+
+ /**
+ This function should be overridden to fill an array with
+ all holidays between the two given dates.
+ */
+ virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart,
+ const wxDateTime& dtEnd,
+ wxDateTimeArray& holidays) const = 0;
};
diff --git a/interface/wx/dcclient.h b/interface/wx/dcclient.h
index 05058d016a..41997f18ed 100644
--- a/interface/wx/dcclient.h
+++ b/interface/wx/dcclient.h
@@ -63,12 +63,13 @@ public:
window from outside an EVT_PAINT() handler in some ports, this does @em not
work on most of the platforms: neither wxOSX nor wxGTK with GTK 3 Wayland
backend support this at all, so drawing using wxClientDC simply doesn't
- have any effect there, while wxMSW doesn't support using it for composited
- windows, so wxWindow::MSWDisableComposited() must be called to allow it to
- work. The only supported way of drawing on a window is via wxPaintDC. To
- redraw a small part of the window, use wxWindow::RefreshRect() to
- invalidate just this part and check wxWindow::GetUpdateRegion() in the
- paint event handler to redraw this part only.
+ have any effect there. CanBeUsedForDrawing() can be used to determine
+ whether wxClientDC can be used for drawing in the current environment, but
+ it is recommended to only draw on the window using wxPaintDC, as this is
+ guaranteed to work everywhere. To redraw a small part of the window, use
+ wxWindow::RefreshRect() to invalidate just this part and check
+ wxWindow::GetUpdateRegion() in the paint event handler to redraw this part
+ only.
wxClientDC objects should normally be constructed as temporary stack
objects, i.e. don't store a wxClientDC object.
@@ -88,6 +89,23 @@ public:
Constructor. Pass a pointer to the window on which you wish to paint.
*/
wxClientDC(wxWindow* window);
+
+ /**
+ Return true if drawing on wxClientDC actually works.
+
+ In many environments (currently this includes wxGTK when using Wayland
+ backend, wxMSW when using double buffering and wxOSX in all cases),
+ wxClientDC can be only used for obtaining information about the device
+ context, but not for actually drawing on it. Portable code should avoid
+ using wxClientDC completely, as explained in the class documentation,
+ but it is also possible to optionally use it only when it does work,
+ i.e. when this function returns @true.
+
+ @param window The window that would be used with wxClientDC.
+
+ @since 3.3.0
+ */
+ static bool CanBeUsedForDrawing(const wxWindow* window);
};
diff --git a/interface/wx/editlbox.h b/interface/wx/editlbox.h
index 80462b24dc..445e60012c 100644
--- a/interface/wx/editlbox.h
+++ b/interface/wx/editlbox.h
@@ -19,7 +19,7 @@
@beginStyleTable
@style{wxEL_ALLOW_NEW}
- Allows the user to enter new strings.
+ Allows the user to enter new strings (implies wxEL_ALLOW_EDIT as well).
@style{wxEL_ALLOW_EDIT}
Allows the user to edit existing strings.
@style{wxEL_ALLOW_DELETE}
diff --git a/interface/wx/fileconf.h b/interface/wx/fileconf.h
index caef821174..95ae264a50 100644
--- a/interface/wx/fileconf.h
+++ b/interface/wx/fileconf.h
@@ -18,6 +18,25 @@
used explicitly if you want to use files and not the registry even under
Windows.
+ @section fileconf_paths Configuration Files Paths
+
+ The default path for local (or user) configuration file is `~/.appname`,
+ i.e. it is stored directly in the user home directory. This default
+ path is backwards-compatible but not recommended any more and it is advised
+ to call wxStandardPaths::SetFileLayout() with
+ wxStandardPaths::FileLayout_XDG parameter to change the default path to
+ `~/.config/appname.conf`. MigrateLocalFile() may be helpful for moving the
+ existing configuration file to the new location.
+
+ Alternatively, it is possible to specify ::wxCONFIG_USE_XDG flag in the
+ style parameter of the constructor to use this XDG-compliant path without
+ changing the global file layout.
+
+ And for the programs using multiple configuration files it is recommended
+ to use both ::wxCONFIG_USE_XDG and ::wxCONFIG_USE_SUBDIR which change the
+ default file path to `~/.config/appname/appname.conf` -- and allow the
+ program to store other files in the same `~/.config/appname` directory.
+
@library{wxbase}
@category{cfg}
@@ -71,8 +90,8 @@ public:
parameter in the constructor.
@a style has the same meaning as in @ref wxConfigBase::wxConfigBase "wxConfig constructor"
- and can contain any combination of styles but only wxCONFIG_USE_SUBDIR bit is
- examined by this function.
+ and can contain any combination of styles but only wxCONFIG_USE_SUBDIR,
+ wxCONFIG_USE_XDG and wxCONFIG_USE_HOME are really used by this function.
Notice that this function cannot be used if @a basename is already a full path name.
*/
@@ -81,6 +100,72 @@ public:
static wxString GetGlobalFileName(const wxString& szFile);
static wxString GetLocalFileName(const wxString& szFile, int style = 0);
+ /**
+ Contains return value of MigrateLocalFile().
+
+ @since 3.3.0
+ */
+ struct MigrationResult
+ {
+ /// If empty, it means the old file wasn't found and nothing was done.
+ wxString oldPath;
+
+ /// The name of the new file.
+ wxString newPath;
+
+ /// If empty, means the file was successfully migrated.
+ wxString error;
+ };
+
+ /**
+ Move the existing configuration file to a new location.
+
+ This function is useful for moving legacy configuration files in
+ `~/.appname` or `~/.appname/appname.conf` to the XDG-compliant location
+ under `~/.config`. To do this, simply specify ::wxCONFIG_USE_XDG as
+ part of @a newStyle.
+
+ The returned MigrationResult object describes what, if anything, was
+ done: if its `oldPath` member is empty, it means that the file
+ corresponding to @a oldStyle was not found and nothing was done.
+ Otherwise, if its `error` member is empty, the old file was found and
+ moved to `newPath`. And if `error` is not empty, it contains the
+ user-readable error message describing why moving the file failed.
+
+ Typical example of using this function is shown in the widgets sample:
+ @code
+ // Execute this early during the application startup, before the
+ // global wxConfig object is created.
+ const auto res = wxFileConfig::MigrateLocalFile("app", wxCONFIG_USE_XDG);
+ if ( !res.oldPath.empty() ) {
+ if ( res.error.empty() ) {
+ wxLogMessage("Config file was migrated from \"%s\" to \"%s\"",
+ res.oldPath, res.newPath);
+ } else {
+ wxLogWarning("Migrating old config failed: %s.", res.error);
+ }
+ }
+
+ // Prefer doing it only after successfully calling MigrateLocalFile(),
+ // otherwise, i.e. if it failed, the old config file wouldn't be used.
+ wxStandardPaths::Get().SetFileLayout(wxStandardPaths::FileLayout_XDG);
+ @endcode
+
+ @param name Name of the configuration file.
+ @param newStyle Style which is used by the current version of the
+ program, typically including ::wxCONFIG_USE_XDG and possibly also
+ including ::wxCONFIG_USE_SUBDIR.
+ @param oldStyle Style which was used by the previous versions of the
+ program, possibly including ::wxCONFIG_USE_SUBDIR and typically
+ including ::wxCONFIG_USE_HOME.
+
+ @since 3.3.0
+ */
+ static MigrationResult
+ MigrateLocalFile(const wxString& name,
+ int newStyle,
+ int oldStyle = wxCONFIG_USE_HOME);
+
/**
Saves all config data to the given stream, returns @true if data was saved
successfully or @false on error.
diff --git a/interface/wx/fs_data.h b/interface/wx/fs_data.h
new file mode 100644
index 0000000000..4d6a9f907b
--- /dev/null
+++ b/interface/wx/fs_data.h
@@ -0,0 +1,31 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/fs_data.h
+// Purpose: DATA scheme file system
+// Author: Vyacheslav Lisovski
+// Copyright: (c) 2023 Vyacheslav Lisovski
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ @class wxDataSchemeFSHandler
+
+ File system handler for "data" URI scheme (RFC 2397).
+ URI syntax: @c "data:[][;base64],".
+
+ The handler makes the data, included (encoded) into URI, available for
+ components that use the wxFileSystem infrastructure.
+
+ To make available for usage it should be registered somewhere within an
+ initialization procedure:
+ @code
+ wxFileSystem::AddHandler(new wxDataSchemeFSHandler);
+ @endcode
+
+ @since 3.3.0
+*/
+
+class wxDataSchemeFSHandler : public wxFileSystemHandler
+{
+public:
+ wxDataSchemeFSHandler();
+};
diff --git a/interface/wx/gdicmn.h b/interface/wx/gdicmn.h
index c512a99a3b..bef77ab9d4 100644
--- a/interface/wx/gdicmn.h
+++ b/interface/wx/gdicmn.h
@@ -200,38 +200,43 @@ public:
/**
@name Miscellaneous operators
- Note that these operators are documented as class members
- (to make them easier to find) but, as their prototype shows,
- they are implemented as global operators; note that this is
- transparent to the user but it helps to understand why the
- following functions are documented to take the wxPoint they
- operate on as an explicit argument.
+ Note that binary operators are defined as friend functions inside this
+ class, making them accessible via argument-dependent lookup, but hidden
+ otherwise.
*/
///@{
wxRealPoint& operator=(const wxRealPoint& pt);
- bool operator ==(const wxRealPoint& p1, const wxRealPoint& p2);
- bool operator !=(const wxRealPoint& p1, const wxRealPoint& p2);
+ friend bool operator ==(const wxRealPoint& p1, const wxRealPoint& p2);
+ friend bool operator !=(const wxRealPoint& p1, const wxRealPoint& p2);
- wxRealPoint operator +(const wxRealPoint& p1, const wxRealPoint& p2);
- wxRealPoint operator -(const wxRealPoint& p1, const wxRealPoint& p2);
+ friend wxRealPoint operator +(const wxRealPoint& p1, const wxRealPoint& p2);
+ friend wxRealPoint operator -(const wxRealPoint& p1, const wxRealPoint& p2);
wxRealPoint& operator +=(const wxRealPoint& pt);
wxRealPoint& operator -=(const wxRealPoint& pt);
- wxRealPoint operator +(const wxRealPoint& pt, const wxSize& sz);
- wxRealPoint operator -(const wxRealPoint& pt, const wxSize& sz);
- wxRealPoint operator +(const wxSize& sz, const wxRealPoint& pt);
- wxRealPoint operator -(const wxSize& sz, const wxRealPoint& pt);
+ friend wxRealPoint operator +(const wxRealPoint& pt, const wxSize& sz);
+ friend wxRealPoint operator -(const wxRealPoint& pt, const wxSize& sz);
+ friend wxRealPoint operator +(const wxSize& sz, const wxRealPoint& pt);
+ friend wxRealPoint operator -(const wxSize& sz, const wxRealPoint& pt);
wxRealPoint& operator +=(const wxSize& sz);
wxRealPoint& operator -=(const wxSize& sz);
- wxSize operator /(const wxRealPoint& sz, int factor);
- wxSize operator *(const wxRealPoint& sz, int factor);
- wxSize operator *(int factor, const wxSize& sz);
- wxSize& operator /=(int factor);
- wxSize& operator *=(int factor);
+ friend wxRealPoint operator -(const wxRealPoint& pt);
+
+ friend wxRealPoint operator /(const wxRealPoint& sz, int divisor);
+ friend wxRealPoint operator *(const wxRealPoint& sz, int factor);
+ friend wxRealPoint operator *(int factor, const wxRealPoint& pt);
+ wxRealPoint& operator /=(int divisor);
+ wxRealPoint& operator *=(int factor);
+
+ friend wxRealPoint operator /(const wxRealPoint& pt, double divisor);
+ friend wxRealPoint operator *(const wxRealPoint& pt, double factor);
+ friend wxRealPoint operator *(double factor, const wxRealPoint& pt);
+ wxRealPoint& operator /=(double divisor);
+ wxRealPoint& operator *=(double factor);
///@}
/**
@@ -600,13 +605,13 @@ public:
/**
Inequality operator.
*/
- bool operator !=(const wxRect& r1, const wxRect& r2);
+ friend bool operator !=(const wxRect& r1, const wxRect& r2);
///@{
/**
Like Union(), but doesn't treat empty rectangles specially.
*/
- wxRect operator +(const wxRect& r1, const wxRect& r2);
+ friend wxRect operator +(const wxRect& r1, const wxRect& r2);
wxRect& operator +=(const wxRect& r);
///@}
@@ -614,7 +619,7 @@ public:
/**
Returns the intersection of two rectangles (which may be empty).
*/
- wxRect operator *(const wxRect& r1, const wxRect& r2);
+ friend wxRect operator *(const wxRect& r1, const wxRect& r2);
wxRect& operator *=(const wxRect& r);
///@}
@@ -626,7 +631,7 @@ public:
/**
Equality operator.
*/
- bool operator ==(const wxRect& r1, const wxRect& r2);
+ friend bool operator ==(const wxRect& r1, const wxRect& r2);
/**
Height member.
@@ -704,38 +709,43 @@ public:
/**
@name Miscellaneous operators
- Note that these operators are documented as class members
- (to make them easier to find) but, as their prototype shows,
- they are implemented as global operators; note that this is
- transparent to the user but it helps to understand why the
- following functions are documented to take the wxPoint they
- operate on as an explicit argument.
+ Note that binary operators are defined as friend functions inside this
+ class, making them accessible via argument-dependent lookup, but hidden
+ otherwise.
*/
///@{
wxPoint& operator=(const wxPoint& pt);
- bool operator ==(const wxPoint& p1, const wxPoint& p2);
- bool operator !=(const wxPoint& p1, const wxPoint& p2);
+ friend bool operator ==(const wxPoint& p1, const wxPoint& p2);
+ friend bool operator !=(const wxPoint& p1, const wxPoint& p2);
- wxPoint operator +(const wxPoint& p1, const wxPoint& p2);
- wxPoint operator -(const wxPoint& p1, const wxPoint& p2);
+ friend wxPoint operator +(const wxPoint& p1, const wxPoint& p2);
+ friend wxPoint operator -(const wxPoint& p1, const wxPoint& p2);
wxPoint& operator +=(const wxPoint& pt);
wxPoint& operator -=(const wxPoint& pt);
- wxPoint operator +(const wxPoint& pt, const wxSize& sz);
- wxPoint operator -(const wxPoint& pt, const wxSize& sz);
- wxPoint operator +(const wxSize& sz, const wxPoint& pt);
- wxPoint operator -(const wxSize& sz, const wxPoint& pt);
+ friend wxPoint operator +(const wxPoint& pt, const wxSize& sz);
+ friend wxPoint operator -(const wxPoint& pt, const wxSize& sz);
+ friend wxPoint operator +(const wxSize& sz, const wxPoint& pt);
+ friend wxPoint operator -(const wxSize& sz, const wxPoint& pt);
wxPoint& operator +=(const wxSize& sz);
wxPoint& operator -=(const wxSize& sz);
- wxSize operator /(const wxPoint& sz, int factor);
- wxSize operator *(const wxPoint& sz, int factor);
- wxSize operator *(int factor, const wxSize& sz);
- wxSize& operator /=(int factor);
- wxSize& operator *=(int factor);
+ wxPoint operator -(const wxPoint& pt);
+
+ friend wxPoint operator /(const wxPoint& sz, int divisor);
+ friend wxPoint operator *(const wxPoint& sz, int factor);
+ friend wxPoint operator *(int factor, const wxPoint& sz);
+ wxPoint& operator /=(int divisor);
+ wxPoint& operator *=(int factor);
+
+ friend wxPoint operator /(const wxPoint& pt, double divisor);
+ friend wxPoint operator *(const wxPoint& pt, double factor);
+ friend wxPoint operator *(double factor, const wxPoint& pt);
+ wxPoint& operator /=(double divisor);
+ wxPoint& operator *=(double factor);
///@}
@@ -1101,12 +1111,9 @@ public:
Sizes can be added to or subtracted from each other or divided or
multiplied by a number.
- Note that these operators are documented as class members
- (to make them easier to find) but, as their prototype shows,
- they are implemented as global operators; note that this is
- transparent to the user but it helps to understand why the
- following functions are documented to take the wxSize they
- operate on as an explicit argument.
+ Note that binary operators are defined as friend functions inside this
+ class, making them accessible via argument-dependent lookup, but hidden
+ otherwise.
Also note that using @c double factor may result in rounding errors,
as wxSize always stores @c int coordinates and the result is always
@@ -1115,20 +1122,20 @@ public:
///@{
wxSize& operator=(const wxSize& sz);
- bool operator ==(const wxSize& s1, const wxSize& s2);
- bool operator !=(const wxSize& s1, const wxSize& s2);
+ friend bool operator ==(const wxSize& s1, const wxSize& s2);
+ friend bool operator !=(const wxSize& s1, const wxSize& s2);
- wxSize operator +(const wxSize& s1, const wxSize& s2);
- wxSize operator -(const wxSize& s1, const wxSize& s2);
+ friend wxSize operator +(const wxSize& s1, const wxSize& s2);
+ friend wxSize operator -(const wxSize& s1, const wxSize& s2);
wxSize& operator +=(const wxSize& sz);
wxSize& operator -=(const wxSize& sz);
- wxSize operator /(const wxSize& sz, int factor);
- wxSize operator /(const wxSize& sz, double factor);
- wxSize operator *(const wxSize& sz, int factor);
- wxSize operator *(const wxSize& sz, double factor);
- wxSize operator *(int factor, const wxSize& sz);
- wxSize operator *(double factor, const wxSize& sz);
+ friend wxSize operator /(const wxSize& sz, int factor);
+ friend wxSize operator /(const wxSize& sz, double factor);
+ friend wxSize operator *(const wxSize& sz, int factor);
+ friend wxSize operator *(const wxSize& sz, double factor);
+ friend wxSize operator *(int factor, const wxSize& sz);
+ friend wxSize operator *(double factor, const wxSize& sz);
wxSize& operator /=(int factor);
wxSize& operator /=(double factor);
wxSize& operator *=(int factor);
diff --git a/interface/wx/generic/aboutdlgg.h b/interface/wx/generic/aboutdlgg.h
index da993fabdb..b62b846d6a 100644
--- a/interface/wx/generic/aboutdlgg.h
+++ b/interface/wx/generic/aboutdlgg.h
@@ -34,7 +34,7 @@
aboutInfo.SetName("MyApp");
aboutInfo.SetVersion(MY_APP_VERSION_STRING);
aboutInfo.SetDescription(_("My wxWidgets-based application!"));
- aboutInfo.SetCopyright("(C) 1992-2023");
+ aboutInfo.SetCopyright("(C) 1992-2024");
aboutInfo.SetWebSite("http://myapp.org");
aboutInfo.AddDeveloper("My Self");
diff --git a/interface/wx/glcanvas.h b/interface/wx/glcanvas.h
index 20e55b3763..a86edb97bf 100644
--- a/interface/wx/glcanvas.h
+++ b/interface/wx/glcanvas.h
@@ -774,8 +774,8 @@ enum
libraries are found.
On Windows, OpenGL support is enabled by default (@c wxUSE_GLCANVAS set
to @c 1 in the @c setup.h file). If your program links with wxWidgets
- statically, you need to add @c opengl32.lib (and @c glu32.lib for old
- OpenGL versions) to the list of the libraries your program is linked with.
+ statically, you need to add @c opengl32.lib to the list of libraries
+ your program is linked with.
@library{wxgl}
@category{gl}
diff --git a/interface/wx/grid.h b/interface/wx/grid.h
index 2072dc9514..64550f9b4d 100644
--- a/interface/wx/grid.h
+++ b/interface/wx/grid.h
@@ -4997,6 +4997,21 @@ public:
*/
void ClearSelection();
+ /**
+ Copies all cells that are currently selected.
+
+ Note that the cells most be contiguously selected;
+ otherwise, nothing will be copied.
+
+ Returns @c true if content is successfully copied,
+ @c false otherwise. @c false will be returned if
+ nothing was selected, the selected cells weren't contiguous,
+ or a clipboard error occurred.
+
+ @since 3.3.0
+ */
+ bool CopySelection();
+
/**
Deselects a row of cells.
*/
diff --git a/interface/wx/headerctrl.h b/interface/wx/headerctrl.h
index 3980a9a01e..b5e0987e7f 100644
--- a/interface/wx/headerctrl.h
+++ b/interface/wx/headerctrl.h
@@ -447,13 +447,15 @@ protected:
/**
Method called when the columns order is changed in the customization
- dialog.
+ dialog @em or when the EVT_HEADER_END_REORDER event is not handled after
+ dragging a single column.
- This method is only called from ShowCustomizeDialog() when the user
- changes the order of columns. In particular it is @em not called if a
- single column changes place because the user dragged it to the new
- location, the EVT_HEADER_END_REORDER event handler should be used to
- react to this.
+ This method is always called from ShowCustomizeDialog() when the user
+ changes the order of columns. In case a single column changes place
+ because the user dragged it to a new location, the EVT_HEADER_END_REORDER
+ event handler can be used to react to this. If this event
+ handler is not defined though UpdateColumnsOrder() will be called
+ instead.
A typical implementation in a derived class will update the display
order of the columns in the associated control, if any. Notice that
diff --git a/interface/wx/listbox.h b/interface/wx/listbox.h
index 19bf3fe0aa..a21f0f2674 100644
--- a/interface/wx/listbox.h
+++ b/interface/wx/listbox.h
@@ -162,6 +162,11 @@ public:
const wxString& name = wxListBoxNameStr);
///@}
+ /**
+ return true if the listbox allows multiple selection
+ */
+ bool HasMultipleSelection() const;
+
/**
Deselects an item in the list box.
diff --git a/interface/wx/log.h b/interface/wx/log.h
index af5cb85d6e..a8fc5125f7 100644
--- a/interface/wx/log.h
+++ b/interface/wx/log.h
@@ -115,6 +115,9 @@ public:
[7872] d:\testApp\src\testApp.cpp(85) : *** Application started ***
@endverbatim
+ See wxLogFormatterNone for a trivial version of this class not doing any
+ formatting,
+
@library{wxbase}
@category{logging}
@@ -195,6 +198,31 @@ protected:
};
+/**
+ Specialized formatter not formatting the messages at all.
+
+ This class can be used to make wxLog log just the messages themselves,
+ without any time stamps or prefixes indicating their severity.
+
+ Example of using it:
+
+ @code
+ wxLog* logger = wxLog::GetActiveTarget();
+ delete logger->SetFormatter(new wxLogFormatterNone{});
+
+ // Log messages won't have time stamps or "Error:", "Warning:" etc
+ // prefixes any more.
+ @endcode
+
+ @since 3.3.0
+*/
+class wxLogFormatterNone : public wxLogFormatter
+{
+public:
+ /// Trivial default constructor.
+ wxLogFormatterNone();
+};
+
/**
@class wxLog
@@ -900,6 +928,18 @@ public:
*/
wxLogBuffer();
+ /**
+ Clear all the messages in the buffer.
+
+ This can be done to prevent them from being flushed by the next call to
+ Flush(), which happens implicitly if this logger ceases to be the
+ active logger after a call to wxLog::SetActiveTarget() with a different
+ log target.
+
+ @since 3.3.0
+ */
+ void Clear();
+
/**
Shows all the messages collected so far to the user (using a message box in the
GUI applications or by printing them out to the console in text mode) and
@@ -917,6 +957,65 @@ public:
};
+/**
+ @class wxLogCollector
+
+ Allows to collect all log messages into a string instead of showing them.
+
+ This class is supposed to be used as a local variable and collects all the
+ messages logged during its lifetime instead of showing them as usual, e.g.
+
+ @code
+ void Foo()
+ {
+ wxLogCollector collectLogs;
+
+ // Call some function that can log error messages, e.g. try to create a
+ // new directory. Without wxLogCollector a failure here would show
+ // errors to the user.
+ if ( !wxFileName::Mkdir("/some/path", wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL) )
+ {
+ // Instead, we can report them here as we see fit, e.g. write them
+ // to a log file or process them in some other way.
+ wxFprintf(logFile, "Creating directory failed: %s",
+ collectLogs.GetMessages());
+ }
+ }
+ @endcode
+
+ Note that because this class uses wxLog::SetActiveTarget() to temporarily
+ switch the active log target to wxLogBuffer, you need to ensure that the
+ log target doesn't change while it is alive (in the simplest case by just
+ avoiding to change it at all).
+
+ @since 3.3.0
+*/
+class wxLogCollector
+{
+public:
+ /**
+ Constructor overrides active log target to collect messages.
+ */
+ wxLogCollector();
+
+ /**
+ Get all the collected messages.
+
+ The returned string may be empty but if it isn't, it contains the
+ trailing new line (and may also contain more new lines inside it if
+ multiple messages were logged).
+
+ Note that the messages here contain just the messages, without any time
+ stamps or log level prefixes.
+ */
+ const wxString& GetMessages() const;
+
+ /**
+ Destructor restores the previously active log target.
+ */
+ ~wxLogCollector();
+};
+
/**
@class wxLogNull
@@ -965,6 +1064,8 @@ public:
This class is thread-safe and can be used from both the main and the
backgrounds threads.
+ @see wxLogCollector
+
@library{wxbase}
@category{logging}
*/
diff --git a/interface/wx/nonownedwnd.h b/interface/wx/nonownedwnd.h
index fde840b262..5232ce49f2 100644
--- a/interface/wx/nonownedwnd.h
+++ b/interface/wx/nonownedwnd.h
@@ -62,8 +62,8 @@ public:
resized using SetSize().
As the overload above, this method is not guaranteed to work on all
- platforms but currently does work in wxMSW, wxOSX/Cocoa and wxGTK (with
- the appropriate but almost always present X11 extensions) ports.
+ platforms but currently does work in wxMSW, wxOSX/Cocoa, wxGTK (with
+ the appropriate but almost always present X11 extensions) and wxQt ports.
@since 2.9.3
*/
diff --git a/interface/wx/persist/dataview.h b/interface/wx/persist/dataview.h
index b98896879b..865b1f64c3 100644
--- a/interface/wx/persist/dataview.h
+++ b/interface/wx/persist/dataview.h
@@ -39,4 +39,4 @@ public:
};
/// Overload allowing persistence adapter creation for wxDataViewCtrl objects.
-wxPersistentObject *wxCreatePersistentObject(wxDataViewCtrl *book);
+wxPersistentObject *wxCreatePersistentObject(wxDataViewCtrl *control);
diff --git a/interface/wx/persist/toplevel.h b/interface/wx/persist/toplevel.h
index 7094fc57a5..2581e5f115 100644
--- a/interface/wx/persist/toplevel.h
+++ b/interface/wx/persist/toplevel.h
@@ -21,10 +21,10 @@ public:
/**
Constructor.
- @param book
+ @param tlw
The associated window.
*/
- wxPersistentTLW(wxTopLevelWindow *book);
+ wxPersistentTLW(wxTopLevelWindow *tlw);
/**
Save the current window geometry.
@@ -39,4 +39,4 @@ public:
/// Overload allowing persistence adapter creation for wxTopLevelWindow-derived
/// objects.
-wxPersistentObject *wxCreatePersistentObject(wxTopLevelWindow *book);
+wxPersistentObject *wxCreatePersistentObject(wxTopLevelWindow *tlw);
diff --git a/interface/wx/propgrid/advprops.h b/interface/wx/propgrid/advprops.h
index 15f3791282..38f07dc746 100644
--- a/interface/wx/propgrid/advprops.h
+++ b/interface/wx/propgrid/advprops.h
@@ -77,7 +77,8 @@ public:
const wxFont& value = wxFont());
virtual ~wxFontProperty();
virtual void OnSetValue();
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual wxVariant ChildChanged( wxVariant& thisValue,
int childIndex,
wxVariant& childValue ) const;
@@ -107,26 +108,24 @@ public:
virtual ~wxSystemColourProperty();
virtual void OnSetValue();
- virtual bool IntToValue(wxVariant& variant,
- int number,
- int argFlags = 0) const;
+ virtual bool IntToValue(wxVariant& variant, int number,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
- /**
- Override in derived class to customize how colours are printed as
+ /** Override in derived class to customize how colours are printed as
strings.
*/
- virtual wxString ColourToString( const wxColour& col, int index,
- int argFlags = 0 ) const;
+ virtual wxString ColourToString(const wxColour& col, int index,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
/** Returns index of entry that triggers colour picker dialog
(default is last).
*/
virtual int GetCustomColourIndex() const;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool OnEvent( wxPropertyGrid* propgrid,
wxWindow* primary, wxEvent& event );
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
@@ -134,7 +133,8 @@ public:
virtual void OnCustomPaint( wxDC& dc,
const wxRect& rect, wxPGPaintData& paintdata );
- // Helper function to show the colour dialog
+ /** Helper function to show the colour dialog
+ */
bool QueryColourFromUser( wxVariant& variant ) const;
/** Default is to use wxSystemSettings::GetColour(index). Override to use
@@ -184,7 +184,8 @@ public:
const wxColour& value = *wxWHITE );
virtual ~wxColourProperty();
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual wxColour GetColour( int index ) const;
protected:
@@ -205,6 +206,8 @@ public:
int value = 0 );
virtual ~wxCursorProperty();
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual wxSize OnMeasureImage( int item ) const;
virtual void OnCustomPaint( wxDC& dc,
const wxRect& rect, wxPGPaintData& paintdata );
@@ -279,10 +282,10 @@ public:
virtual ~wxMultiChoiceProperty();
virtual void OnSetValue();
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
- virtual bool StringToValue(wxVariant& variant,
- const wxString& text,
- int argFlags = 0) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
wxArrayInt GetValueAsArrayInt() const;
@@ -322,10 +325,10 @@ public:
virtual ~wxDateProperty();
virtual void OnSetValue();
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
- virtual bool StringToValue(wxVariant& variant,
- const wxString& text,
- int argFlags = 0) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
diff --git a/interface/wx/propgrid/property.h b/interface/wx/propgrid/property.h
index debf028d9a..e86656fd88 100644
--- a/interface/wx/propgrid/property.h
+++ b/interface/wx/propgrid/property.h
@@ -235,157 +235,163 @@ struct wxPGPaintData
@{
*/
-enum wxPGPropertyFlags
+enum class wxPGPropertyFlags : int
{
+ /** No flags.
+ @hideinitializer
+ */
+ Null = 0,
-/** Indicates bold font.
- @hideinitializer
-*/
-wxPG_PROP_MODIFIED = 0x0001,
+ /** Indicates bold font.
+ @hideinitializer
+ */
+ Modified = 0x0001,
-/** Disables ('greyed' text and editor does not activate) property.
- @hideinitializer
-*/
-wxPG_PROP_DISABLED = 0x0002,
+ /** Disables ('greyed' text and editor does not activate) property.
+ @hideinitializer
+ */
+ Disabled = 0x0002,
-/** Hider button will hide this property.
- @hideinitializer
-*/
-wxPG_PROP_HIDDEN = 0x0004,
+ /** Hider button will hide this property.
+ @hideinitializer
+ */
+ Hidden = 0x0004,
-/** This property has custom paint image just in front of its value.
- If property only draws custom images into a popup list, then this
- flag should not be set.
- @hideinitializer
-*/
-wxPG_PROP_CUSTOMIMAGE = 0x0008,
+ /** This property has custom paint image just in front of its value.
+ If property only draws custom images into a popup list, then this
+ flag should not be set.
+ @hideinitializer
+ */
+ CustomImage = 0x0008,
-/** Do not create text based editor for this property (but button-triggered
- dialog and choice are ok).
- @hideinitializer
-*/
-wxPG_PROP_NOEDITOR = 0x0010,
+ /** Do not create text based editor for this property (but button-triggered
+ dialog and choice are ok).
+ @hideinitializer
+ */
+ NoEditor = 0x0010,
-/** Property is collapsed, ie. it's children are hidden.
- @hideinitializer
-*/
-wxPG_PROP_COLLAPSED = 0x0020,
+ /** Property is collapsed, ie. it's children are hidden.
+ @hideinitializer
+ */
+ Collapsed = 0x0020,
-/**
- If property is selected, then indicates that validation failed for pending
- value.
+ /** If property is selected, then indicates that validation failed for pending
+ value.
- If property is not selected, then indicates that the actual property
- value has failed validation (NB: this behaviour is not currently supported,
- but may be used in the future).
- @hideinitializer
-*/
-wxPG_PROP_INVALID_VALUE = 0x0040,
+ If property is not selected, then indicates that the actual property
+ value has failed validation (NB: this behaviour is not currently supported,
+ but may be used in the future).
+ @hideinitializer
+ */
+ InvalidValue = 0x0040,
-/** Switched via SetWasModified(). Temporary flag - only used when
- setting/changing property value.
- @hideinitializer
-*/
-wxPG_PROP_WAS_MODIFIED = 0x0200,
+ /** Switched via SetWasModified(). Temporary flag - only used when
+ setting/changing property value.
+ @hideinitializer
+ */
+ WasModified = 0x0200,
-/**
- If set, then child properties (if any) are private, and should be
- "invisible" to the application.
- @hideinitializer
-*/
-wxPG_PROP_AGGREGATE = 0x0400,
+ /** If set, then child properties (if any) are private, and should be
+ "invisible" to the application.
+ @hideinitializer
+ */
+ Aggregate = 0x0400,
-/** If set, then child properties (if any) are copies and should not
- be deleted in dtor.
- @hideinitializer
-*/
-wxPG_PROP_CHILDREN_ARE_COPIES = 0x0800,
+ /** If set, then child properties (if any) are copies and should not
+ be deleted in dtor.
+ @hideinitializer
+ */
+ ChildrenAreCopies = 0x0800,
-/**
- Classifies this item as a non-category.
+ /** Classifies this item as a non-category.
+ Used for faster item type identification.
+ @hideinitializer
+ */
+ Property = 0x1000,
- Used for faster item type identification.
- @hideinitializer
-*/
-wxPG_PROP_PROPERTY = 0x1000,
-/**
- Classifies this item as a category.
+ /** Classifies this item as a category.
+ Used for faster item type identification.
+ @hideinitializer
+ */
+ Category = 0x2000,
- Used for faster item type identification.
- @hideinitializer
-*/
-wxPG_PROP_CATEGORY = 0x2000,
+ /** Classifies this item as a property that has children, but is not aggregate
+ (i.e. children are not private).
+ @hideinitializer
+ */
+ MiscParent = 0x4000,
-/** Classifies this item as a property that has children, but is not aggregate
- (i.e. children are not private).
- @hideinitializer
-*/
-wxPG_PROP_MISC_PARENT = 0x4000,
-/** Property is read-only. Editor is still created for wxTextCtrl-based
- property editors. For others, editor is not usually created because
- they do implement wxTE_READONLY style or equivalent.
- @hideinitializer
-*/
-wxPG_PROP_READONLY = 0x8000,
+ /** Property is read-only. Editor is still created for wxTextCtrl-based
+ property editors. For others, editor is not usually created because
+ they do implement wxTE_READONLY style or equivalent.
+ @hideinitializer
+ */
+ ReadOnly = 0x8000,
-//
-// NB: FLAGS ABOVE 0x8000 CANNOT BE USED WITH PROPERTY ITERATORS
-//
+ //
+ // NB: FLAGS ABOVE 0x8000 CANNOT BE USED WITH PROPERTY ITERATORS
+ //
-/** Property's value is composed from values of child properties.
- @remarks
- This flag cannot be used with property iterators.
- @hideinitializer
-*/
-wxPG_PROP_COMPOSED_VALUE = 0x00010000,
+ /** Property's value is composed from values of child properties.
+ @remarks
+ This flag cannot be used with property iterators.
+ @hideinitializer
+ */
+ ComposedValue = 0x00010000,
-/** Common value of property is selectable in editor.
- @remarks
- This flag cannot be used with property iterators.
- @hideinitializer
-*/
-wxPG_PROP_USES_COMMON_VALUE = 0x00020000,
+ /** Common value of property is selectable in editor.
+ @remarks
+ This flag cannot be used with property iterators.
+ @hideinitializer
+ */
+ UsesCommonValue = 0x00020000,
-/** Property can be set to unspecified value via editor.
- Currently, this applies to following properties:
- - wxIntProperty, wxUIntProperty, wxFloatProperty, wxEditEnumProperty:
- Clear the text field
+ /** Property can be set to unspecified value via editor.
+ Currently, this applies to following properties:
+ - wxIntProperty, wxUIntProperty, wxFloatProperty, wxEditEnumProperty:
+ Clear the text field
- @remarks
- This flag cannot be used with property iterators.
+ @remarks
+ This flag cannot be used with property iterators.
- @see wxPGProperty::SetAutoUnspecified()
- @hideinitializer
-*/
-wxPG_PROP_AUTO_UNSPECIFIED = 0x00040000,
+ @see wxPGProperty::SetAutoUnspecified()
+ @hideinitializer
+ */
-/** Indicates that the property is being deleted and should be ignored.
- @hideinitializer
-*/
-wxPG_PROP_BEING_DELETED = 0x00200000
+ /** Indicates that the property is being deleted and should be ignored.
+ @remarks
+ This flag cannot be used with property iterators.
+ @hideinitializer
+ */
+ BeingDeleted = 0x00080000,
+
+ /** If set, full path is shown in wxFileProperty.
+ @remarks
+ This flag cannot be used with property iterators.
+ @hideinitializer
+ */
+ ShowFullFileName = 0x00100000,
+
+ /** Topmost flag.
+ @hideinitializer
+ */
+ Max = ShowFullFileName,
+
+ /** Property with children must have one of these set, otherwise iterators
+ will not work correctly.
+ Code should automatically take care of this, however.
+ @hideinitializer
+ */
+ ParentalFlags = Aggregate | Category | MiscParent,
+
+ /** Combination of flags that can be stored by GetFlagsAsString().
+ @hideinitializer
+ */
+ StringStoredFlags = Disabled | Hidden | NoEditor | Collapsed
};
-/** Topmost flag.
- @hideinitializer
-*/
-constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPG_PROP_AUTO_UNSPECIFIED;
-
-/** Property with children must have one of these set, otherwise iterators
- will not work correctly.
- Code should automatically take care of this, however.
-*/
-#define wxPG_PROP_PARENTAL_FLAGS \
- ((wxPGPropertyFlags)(wxPG_PROP_AGGREGATE | \
- wxPG_PROP_CATEGORY | \
- wxPG_PROP_MISC_PARENT))
-
-/** Combination of flags that can be stored by GetFlagsAsString().
-*/
-#define wxPG_STRING_STORED_FLAGS \
- (wxPG_PROP_DISABLED|wxPG_PROP_HIDDEN|wxPG_PROP_NOEDITOR|wxPG_PROP_COLLAPSED)
-
/** @}
*/
@@ -591,13 +597,6 @@ constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPG_PROP_AUTO_UNSPECIFIED;
}
@endcode
- Also, if you wish not to have line breaks and tabs translated to
- escape sequences, then do following in constructor of your subclass:
-
- @code
- m_flags |= wxPG_PROP_NO_ESCAPE;
- @endcode
-
Supported special attributes:
- ::wxPG_DIALOG_TITLE: Sets a specific title for the text editor dialog.
@@ -823,12 +822,12 @@ constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPG_PROP_AUTO_UNSPECIFIED;
}
virtual wxString ValueToString( wxVariant& value,
- int argFlags ) const
+ int flags ) const
{
// TODO: Convert given property value to a string
}
- virtual bool StringToValue( wxVariant& variant, const wxString& text, int argFlags )
+ virtual bool StringToValue( wxVariant& variant, const wxString& text, int flags )
{
// TODO: Adapt string to property value.
}
@@ -867,8 +866,6 @@ constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPG_PROP_AUTO_UNSPECIFIED;
class wxPGProperty : public wxObject
{
public:
- typedef wxUint32 FlagType;
-
/**
Virtual destructor. It is customary for derived properties to implement this.
*/
@@ -912,12 +909,12 @@ public:
@param text
Text to be translated into variant.
- @param argFlags
- If ::wxPG_FULL_VALUE is set, returns complete, storable value instead
- of displayable one (they may be different).
- If ::wxPG_COMPOSITE_FRAGMENT is set, text is interpreted as a part of
- composite property string value (as generated by ValueToString()
- called with this same flag).
+ @param flags
+ If wxPGPropValFormatFlags::FullValue is set, returns complete, storable value
+ instead of displayable one (they may be different).
+ If wxPGPropValFormatFlags::CompositeFragment is set, text is interpreted as
+ a part of composite property string value (as generated by
+ ValueToString() called with this same flag).
@return Returns @true if resulting wxVariant value was different.
@@ -928,7 +925,8 @@ public:
if property value is unspecified (which is usually only case if
you explicitly enabled that sort behaviour).
*/
- virtual bool StringToValue( wxVariant& variant, const wxString& text, int argFlags = 0 ) const;
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
/**
Converts integer (possibly a choice selection) into wxVariant value
@@ -939,9 +937,9 @@ public:
in normal cases). Translated value must be assigned back to it.
@param number
Integer to be translated into variant.
- @param argFlags
- If ::wxPG_FULL_VALUE is set, returns complete, storable value instead
- of displayable one.
+ @param flags
+ If wxPGPropValFormatFlags::FullValue is set, returns complete, storable value
+ instead of displayable one.
@return Returns @true if resulting wxVariant value was different.
@@ -956,24 +954,25 @@ public:
property value is unspecified (which is usually only case if you
explicitly enabled that sort behaviour).
*/
- virtual bool IntToValue( wxVariant& variant, int number, int argFlags = 0 ) const;
+ virtual bool IntToValue(wxVariant& variant, int number,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
/**
Converts property value into a text representation.
@param value
Value to be converted.
- @param argFlags
- If 0 (default value), then displayed string is returned.
- If ::wxPG_FULL_VALUE is set, returns complete, storable string value
- instead of displayable. If ::wxPG_EDITABLE_VALUE is set, returns
+ @param flags
+ If wxPGPropValFormatFlags::Null (default value), then displayed string is returned.
+ If wxPGPropValFormatFlags::FullValue is set, returns complete, storable string value
+ instead of displayable. If wxPGPropValFormatFlags::EditableValue is set, returns
string value that must be editable in textctrl.
- If ::wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to
+ If wxPGPropValFormatFlags::CompositeFragment is set, returns text that is appropriate to
display as a part of string property's composite text representation.
@remarks Default implementation calls GenerateComposedValue().
*/
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
+ virtual wxString ValueToString(wxVariant& value, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
/**
Converts string to a value, and if successful, calls SetValue() on it.
@@ -982,18 +981,19 @@ public:
@param text
String to get the value from.
@param flags
- If ::wxPG_FULL_VALUE is set, the function sets complete, storable
+ If wxPGPropValFormatFlags::FullValue is set, the function sets complete, storable
value instead of displayable one (they may be different).
- ::wxPG_PROGRAMMATIC_VALUE flag is used to indicate that value is
+ wxPGPropValFormatFlags::ProgrammaticValue flag is used to indicate that value is
being set programmatically (i.e. operation is not caused by user
input).
- If ::wxPG_REPORT_ERROR is set, a special action should be
+ If wxPGPropValFormatFlags::ReportError is set, a special action should be
performed if string couldn't have been successfully converted
to the valid value (e.g. a special value can be set in this case).
@return @true if value was changed.
*/
- bool SetValueFromString( const wxString& text, int flags = wxPG_PROGRAMMATIC_VALUE );
+ bool SetValueFromString(const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::ProgrammaticValue);
/**
Converts integer to a value, and if successful, calls SetValue() on it.
@@ -1002,11 +1002,11 @@ public:
@param value
Int to get the value from.
@param flags
- If has ::wxPG_FULL_VALUE, then the value given is an actual value and not an index.
+ If has wxPGPropValFormatFlags::FullValue, then the value given is an actual value and not an index.
@return @true if value was changed.
*/
- bool SetValueFromInt( long value, int flags = 0 );
+ bool SetValueFromInt(long value, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null);
/**
Returns size of the custom painted image in front of property. This method
@@ -1285,8 +1285,8 @@ public:
Adds a private child property. If you use this instead of
wxPropertyGridInterface::Insert() or
wxPropertyGridInterface::AppendIn(), then property's parental
- type will automatically be set up to ::wxPG_PROP_AGGREGATE. In other
- words, all properties of this property will become private.
+ type will automatically be set up to wxPGPropertyFlags::Aggregate.
+ In other words, all properties of this property will become private.
*/
void AddPrivateChild( wxPGProperty* prop );
@@ -1331,7 +1331,7 @@ public:
intended almost exclusively for internal use. So, for
example, if you want to disable a property, call
@code Enable(false) @endcode instead of setting
- ::wxPG_PROP_DISABLED flag.
+ wxPGPropertyFlags::Disabled flag.
@see HasFlag(), GetFlags()
*/
@@ -1549,12 +1549,12 @@ public:
const wxString& GetHelpString() const;
/** Gets flags as a'|' delimited string. Note that flag names are not
- prepended with 'wxPG_PROP_'.
+ prepended with 'wxPGPropertyFlags'.
@param flagsMask
String will only be made to include flags combined by this parameter.
*/
- wxString GetFlagsAsString( FlagType flagsMask ) const;
+ wxString GetFlagsAsString(wxPGPropertyFlags flagsMask) const;
/**
Returns position in parent's array.
@@ -1616,12 +1616,12 @@ public:
/** Returns text representation of property's value.
- @param argFlags
- If 0 (default value), then displayed string is returned.
- If ::wxPG_FULL_VALUE is set, returns complete, storable string value
- instead of displayable. If ::wxPG_EDITABLE_VALUE is set, returns
+ @param flags
+ If wxPGPropValFormatFlags::Null (default value), then displayed string is returned.
+ If wxPGPropValFormatFlags::FullValue is set, returns complete, storable string value
+ instead of displayable. If wxPGPropValFormatFlags::EditableValue is set, returns
string value that must be editable in textctrl. If
- ::wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to
+ wxPGPropValFormatFlags::CompositeFragment is set, returns text that is appropriate to
display as a part of string property's composite text
representation.
@@ -1630,15 +1630,7 @@ public:
now handled by ValueToString(), and overriding this function now
will result in run-time assertion failure.
*/
- virtual wxString GetValueAsString( int argFlags = 0 ) const;
-
- /** Synonymous to GetValueAsString().
-
- @deprecated Use GetValueAsString() instead.
-
- @see GetValueAsString()
- */
- wxString GetValueString( int argFlags = 0 ) const;
+ virtual wxString GetValueAsString(wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
/**
Returns value type used by this property.
@@ -1667,15 +1659,10 @@ public:
*/
bool HasFlag(wxPGPropertyFlags flag) const;
- /**
- Returns @true if property has given flag set.
- */
- bool HasFlag(FlagType flag) const;
-
/**
Returns @true if property has all given flags set.
*/
- bool HasFlagsExact(FlagType flags) const;
+ bool HasFlagsExact(wxPGPropertyFlags flags) const;
/**
Returns @true if property has even one visible child.
@@ -1912,7 +1899,7 @@ public:
void SetExpanded( bool expanded );
/** Sets flags from a '|' delimited string. Note that flag names are not
- prepended with 'wxPG_PROP_'.
+ prepended with 'wxPGPropertyFlags'.
*/
void SetFlagsFromString( const wxString& str );
@@ -1971,14 +1958,14 @@ public:
Changes what sort of parent this property is for its children.
@param flag
- Use one of the following values: ::wxPG_PROP_MISC_PARENT (for generic
- parents), ::wxPG_PROP_CATEGORY (for categories), or
- ::wxPG_PROP_AGGREGATE (for derived property classes with private
- children).
+ Use one of the following values: wxPGPropertyFlags::MiscParent (for
+ generic parents), wxPGPropertyFlags::Category (for categories), or
+ wxPGPropertyFlags::Aggregate (for derived property classes with
+ private children).
@remarks You generally do not need to call this function.
*/
- void SetParentalType( int flag );
+ void SetParentalType(wxPGPropertyFlags flag);
/**
Sets property's text colour.
@@ -2157,7 +2144,7 @@ protected:
const wxPGCell& preparedCell,
const wxPGCell& srcData,
wxPGCellData* unmodCellData,
- FlagType ignoreWithFlags,
+ wxPGPropertyFlags ignoreWithFlags,
bool recursively );
/**
@@ -2171,7 +2158,7 @@ protected:
@since 3.1.0
*/
- void ClearCells(FlagType ignoreWithFlags, bool recursively);
+ void ClearCells(wxPGPropertyFlags ignoreWithFlags, bool recursively);
/**
Makes sure m_cells has size of column+1 (or more).
@@ -2931,7 +2918,7 @@ public:
wxPGRootProperty( const wxString& name = wxS("") );
virtual ~wxPGRootProperty();
- virtual bool StringToValue( wxVariant&, const wxString&, int ) const;
+ virtual bool StringToValue( wxVariant&, const wxString&, wxPGPropValFormatFlags ) const;
};
// -----------------------------------------------------------------------
@@ -2950,10 +2937,10 @@ public:
wxPropertyCategory( const wxString& label,
const wxString& name = wxPG_LABEL );
- ~wxPropertyCategory();
+ virtual ~wxPropertyCategory();
int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const;
- virtual wxString ValueToString( wxVariant& value, int argFlags ) const;
- virtual wxString GetValueAsString( int argFlags = 0 ) const;
+ virtual wxString ValueToString(wxVariant& value, wxPGPropValFormatFlags flags) const;
+ virtual wxString GetValueAsString(wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
};
diff --git a/interface/wx/propgrid/propgrid.h b/interface/wx/propgrid/propgrid.h
index 886704a705..680a7e7374 100644
--- a/interface/wx/propgrid/propgrid.h
+++ b/interface/wx/propgrid/propgrid.h
@@ -166,8 +166,8 @@ wxPG_EX_NATIVE_DOUBLE_BUFFERING = 0x00080000,
/**
Set this style to let user have ability to set values of properties to
- unspecified state. Same as setting wxPG_PROP_AUTO_UNSPECIFIED for
- all properties.
+ unspecified state. Same as setting wxPGPropertyFlags::AutoUnspecified
+ for all properties.
@hideinitializer
*/
wxPG_EX_AUTO_UNSPECIFIED_VALUES = 0x00200000,
@@ -396,7 +396,7 @@ public:
@{
*/
-enum class wxPGKeyboardActions
+enum class wxPGKeyboardAction
{
Invalid,
@@ -517,7 +517,7 @@ public:
the next property.
@code
- propGrid->AddActionTrigger(wxPGKeyboardActions::NextProperty,
+ propGrid->AddActionTrigger(wxPGKeyboardAction::NextProperty,
WXK_RETURN);
propGrid->DedicateKey(WXK_RETURN);
@endcode
@@ -530,7 +530,7 @@ public:
Which key event modifiers, in addition to keycode, are needed to
trigger the action.
*/
- void AddActionTrigger(wxPGKeyboardActions action, int keycode, int modifiers = 0);
+ void AddActionTrigger(wxPGKeyboardAction action, int keycode, int modifiers = 0);
/**
Adds given property into selection. If ::wxPG_EX_MULTIPLE_SELECTION
@@ -602,7 +602,7 @@ public:
@param action
Which action to clear. @ref propgrid_keyboard_actions.
*/
- void ClearActionTriggers(wxPGKeyboardActions action);
+ void ClearActionTriggers(wxPGKeyboardAction action);
/**
Forces updating the value of property from the editor control.
@@ -851,9 +851,9 @@ public:
Returns (visual) text representation of the unspecified
property value.
- @param argFlags For internal use only.
+ @param flags For internal use only.
*/
- wxString GetUnspecifiedValueText( int argFlags = 0 ) const;
+ wxString GetUnspecifiedValueText(wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
/**
Returns current vertical spacing.
@@ -897,7 +897,8 @@ public:
Note that @a column must not be equal to 1, as the second column is
always editable and can be made read-only only on cell-by-cell basis
- using @code wxPGProperty::ChangeFlag(wxPG_PROP_READONLY, true) @endcode
+ using
+ @code wxPGProperty::ChangeFlag(wxPGPropertyFlags::ReadOnly, true) @endcode
@see BeginLabelEdit(), EndLabelEdit()
*/
@@ -1200,7 +1201,7 @@ public:
/** Override to customize resetting of property validation failure status.
@remarks
- Property is guaranteed to have flag ::wxPG_PROP_INVALID_VALUE set.
+ Property is guaranteed to have flag wxPGPropertyFlags::InvalidValue set.
*/
virtual void DoOnValidationFailureReset( wxPGProperty* property );
diff --git a/interface/wx/propgrid/propgriddefs.h b/interface/wx/propgrid/propgriddefs.h
index 23314b4411..259c5ff1d2 100644
--- a/interface/wx/propgrid/propgriddefs.h
+++ b/interface/wx/propgrid/propgriddefs.h
@@ -105,52 +105,57 @@ enum class wxPGPropertyValuesFlags : int
// -----------------------------------------------------------------------
-/** Misc argument flags.
+/** Miscellaneous property value format flags.
*/
-enum wxPG_MISC_ARG_FLAGS
+enum class wxPGPropValFormatFlags : int
{
+ /** No flags.
+ @hideinitializer
+ */
+ Null = 0,
+
/** Get/Store full value instead of displayed value.
@hideinitializer
*/
- wxPG_FULL_VALUE = 0x00000001,
+ FullValue = 0x00000001,
/** Perform special action in case of unsuccessful conversion.
@hideinitializer
*/
- wxPG_REPORT_ERROR = 0x00000002,
+ ReportError = 0x00000002,
/**
@hideinitializer
*/
- wxPG_PROPERTY_SPECIFIC = 0x00000004,
+ PropertySpecific = 0x00000004,
/** Get/Store editable value instead of displayed one (should only be
different in the case of common values).
@hideinitializer
*/
- wxPG_EDITABLE_VALUE = 0x00000008,
+ EditableValue = 0x00000008,
/** Used when dealing with fragments of composite string value
@hideinitializer
*/
- wxPG_COMPOSITE_FRAGMENT = 0x00000010,
+ CompositeFragment = 0x00000010,
/** Means property for which final string value is for cannot really be
edited.
@hideinitializer
*/
- wxPG_UNEDITABLE_COMPOSITE_FRAGMENT = 0x00000020,
+ UneditableCompositeFragment = 0x00000020,
/** wxPGProperty::ValueToString() called from wxPGProperty::GetValueAsString()
(guarantees that input wxVariant value is current own value)
@hideinitializer
*/
- wxPG_VALUE_IS_CURRENT = 0x00000040,
+ ValueIsCurrent = 0x00000040,
/** Value is being set programmatically (i.e. not by user)
@hideinitializer
*/
- wxPG_PROGRAMMATIC_VALUE = 0x00000080
+ ProgrammaticValue = 0x00000080
};
// -----------------------------------------------------------------------
diff --git a/interface/wx/propgrid/propgridiface.h b/interface/wx/propgrid/propgridiface.h
index 35b65c1362..73eada045a 100644
--- a/interface/wx/propgrid/propgridiface.h
+++ b/interface/wx/propgrid/propgridiface.h
@@ -368,7 +368,7 @@ public:
See @ref propgrid_iterator_flags.
*/
void GetPropertiesWithFlag( wxArrayPGProperty* targetArr,
- wxPGProperty::FlagType flags,
+ wxPGPropertyFlags flags,
bool inverse = false,
int iterFlags = (wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_HIDDEN|wxPG_ITERATE_CATEGORIES) ) const;
@@ -844,7 +844,7 @@ public:
Text identifier of attribute. See @ref propgrid_property_attributes.
@param value
Value of attribute.
- @param argFlags
+ @param flags
Optional.
Use wxPGPropertyValuesFlags::Recurse to set the attribute to child
properties recursively.
@@ -855,7 +855,7 @@ public:
- Property is refreshed with new settings.
*/
void SetPropertyAttribute(wxPGPropArg id, const wxString& attrName, wxVariant value,
- wxPGPropertyValuesFlags argFlags = wxPGPropertyValuesFlags::DontRecurse);
+ wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse);
/**
Sets property attribute for all applicable properties.
diff --git a/interface/wx/propgrid/propgridpagestate.h b/interface/wx/propgrid/propgridpagestate.h
index 08180fe7c9..8040ab6b36 100644
--- a/interface/wx/propgrid/propgridpagestate.h
+++ b/interface/wx/propgrid/propgridpagestate.h
@@ -120,26 +120,26 @@ enum wxPG_ITERATOR_FLAGS
aggregate or hidden items by default).
@hideinitializer
*/
-wxPG_ITERATE_PROPERTIES = wxPG_PROP_PROPERTY |
- wxPG_PROP_MISC_PARENT |
- wxPG_PROP_AGGREGATE |
- wxPG_PROP_COLLAPSED |
- wxPG_IT_CHILDREN(wxPG_PROP_MISC_PARENT) |
- wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY),
+wxPG_ITERATE_PROPERTIES = wxPGPropertyFlags::Property |
+ wxPGPropertyFlags::MiscParent |
+ wxPGPropertyFlags::Aggregate |
+ wxPGPropertyFlags::Collapsed |
+ wxPG_IT_CHILDREN(wxPGPropertyFlags::MiscParent) |
+ wxPG_IT_CHILDREN(wxPGPropertyFlags::Category),
/**
Iterate children of collapsed parents, and individual items that are hidden.
@hideinitializer
*/
-wxPG_ITERATE_HIDDEN = wxPG_PROP_HIDDEN |
- wxPG_IT_CHILDREN(wxPG_PROP_COLLAPSED),
+wxPG_ITERATE_HIDDEN = wxPGPropertyFlags::Hidden |
+ wxPG_IT_CHILDREN(wxPGPropertyFlags::Collapsed),
/**
Iterate children of parent that is an aggregate property (ie has fixed
children).
@hideinitializer
*/
-wxPG_ITERATE_FIXED_CHILDREN = wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE) |
+wxPG_ITERATE_FIXED_CHILDREN = wxPG_IT_CHILDREN(wxPGPropertyFlags::Aggregate) |
wxPG_ITERATE_PROPERTIES,
/** Iterate categories.
@@ -147,16 +147,16 @@ wxPG_ITERATE_FIXED_CHILDREN = wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE) |
through.
@hideinitializer
*/
-wxPG_ITERATE_CATEGORIES = wxPG_PROP_CATEGORY |
- wxPG_IT_CHILDREN(wxPG_PROP_CATEGORY) |
- wxPG_PROP_COLLAPSED,
+wxPG_ITERATE_CATEGORIES = wxPGPropertyFlags::Category |
+ wxPG_IT_CHILDREN(wxPGPropertyFlags::Category) |
+ wxPGPropertyFlags::Collapsed,
/**
@hideinitializer
*/
-wxPG_ITERATE_ALL_PARENTS = wxPG_PROP_MISC_PARENT |
- wxPG_PROP_AGGREGATE |
- wxPG_PROP_CATEGORY,
+wxPG_ITERATE_ALL_PARENTS = wxPGPropertyFlags::MiscParent |
+ wxPGPropertyFlags::Aggregate |
+ wxPGPropertyFlags::Category,
/**
@hideinitializer
@@ -168,19 +168,18 @@ wxPG_ITERATE_ALL_PARENTS_RECURSIVELY = wxPG_ITERATE_ALL_PARENTS |
/**
@hideinitializer
*/
-wxPG_ITERATOR_FLAGS_ALL = wxPG_PROP_PROPERTY |
- wxPG_PROP_MISC_PARENT |
- wxPG_PROP_AGGREGATE |
- wxPG_PROP_HIDDEN |
- wxPG_PROP_CATEGORY |
- wxPG_PROP_COLLAPSED,
+wxPG_ITERATOR_FLAGS_ALL = wxPGPropertyFlags::Property |
+ wxPGPropertyFlags::MiscParent |
+ wxPGPropertyFlags::Aggregate |
+ wxPGPropertyFlags::Hidden |
+ wxPGPropertyFlags::Category |
+ wxPGPropertyFlags::Collapsed,
/**
@hideinitializer
*/
wxPG_ITERATOR_MASK_OP_ITEM = wxPG_ITERATOR_FLAGS_ALL,
-// (wxPG_PROP_MISC_PARENT|wxPG_PROP_AGGREGATE|wxPG_PROP_CATEGORY)
/**
@hideinitializer
*/
@@ -192,8 +191,8 @@ wxPG_ITERATOR_MASK_OP_PARENT = wxPG_ITERATOR_FLAGS_ALL,
@hideinitializer
*/
wxPG_ITERATE_VISIBLE = wxPG_ITERATE_PROPERTIES |
- wxPG_PROP_CATEGORY |
- wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE),
+ wxPGPropertyFlags::Category |
+ wxPG_IT_CHILDREN(wxPGPropertyFlags::Aggregate),
/**
Iterate all items.
diff --git a/interface/wx/propgrid/props.h b/interface/wx/propgrid/props.h
index c5ac027f96..21fabaebb5 100644
--- a/interface/wx/propgrid/props.h
+++ b/interface/wx/propgrid/props.h
@@ -48,10 +48,10 @@ public:
const wxString& value = wxString() );
virtual ~wxStringProperty();
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
@@ -63,19 +63,19 @@ public:
/** Constants used with NumericValidation<>().
*/
-enum wxPGNumericValidationConstants
+enum class wxPGNumericValidationMode
{
/** Instead of modifying the value, show an error message.
*/
- wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE = 0,
+ ErrorMessage,
/** Modify value, but stick with the limitations.
*/
- wxPG_PROPERTY_VALIDATION_SATURATE = 1,
+ Saturate,
/** Modify value, wrap around on overflow.
*/
- wxPG_PROPERTY_VALIDATION_WRAP = 2
+ Wrap
};
@@ -86,9 +86,9 @@ enum wxPGNumericValidationConstants
class wxNumericPropertyValidator : public wxTextValidator
{
public:
- enum NumericType
+ enum class NumericType
{
- Signed = 0,
+ Signed,
Unsigned,
Float
};
@@ -215,15 +215,14 @@ public:
wxIntProperty( const wxString& label,
const wxString& name,
const wxLongLong& value );
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const;
- virtual bool IntToValue( wxVariant& variant,
- int number,
- int argFlags = 0 ) const;
+ virtual bool IntToValue(wxVariant& variant, int number,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
static wxValidator* GetClassValidator();
virtual wxValidator* DoGetValidator() const;
virtual wxVariant AddSpinStepValue(long stepScale) const;
@@ -260,17 +259,16 @@ public:
wxUIntProperty( const wxString& label,
const wxString& name,
const wxULongLong& value );
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const;
virtual wxValidator* DoGetValidator () const;
- virtual bool IntToValue( wxVariant& variant,
- int number,
- int argFlags = 0 ) const;
+ virtual bool IntToValue(wxVariant& variant, int number,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual wxVariant AddSpinStepValue(long stepScale) const;
protected:
@@ -299,10 +297,10 @@ public:
double value = 0.0 );
virtual ~wxFloatProperty();
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const;
@@ -335,12 +333,12 @@ public:
bool value = false );
virtual ~wxBoolProperty();
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const;
- virtual bool IntToValue( wxVariant& variant,
- int number, int argFlags = 0 ) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ virtual bool IntToValue(wxVariant& variant, int number,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
};
@@ -389,18 +387,18 @@ public:
size_t GetItemCount() const;
virtual void OnSetValue();
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const;
- // If wxPG_FULL_VALUE is not set in flags, then the value is interpreted
- // as index to choices list. Otherwise, it is actual value.
- virtual bool IntToValue( wxVariant& variant,
- int number,
- int argFlags = 0 ) const;
+ /** If wxPGPropValFormatFlags::FullValue is not set in flags, then the value is interpreted
+ as index to choices list. Otherwise, it is actual value.
+ */
+ virtual bool IntToValue(wxVariant& variant, int number,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
//
// Additional virtuals
@@ -418,13 +416,10 @@ protected:
int GetIndex() const;
void SetIndex( int index );
- bool ValueFromString_( wxVariant& value,
- const wxString& text,
- int argFlags ) const;
- bool ValueFromInt_( wxVariant& value, int intVal, int argFlags ) const;
-
- static void ResetNextIndex();
-
+ bool ValueFromString_(wxVariant& value, int* pIndex, const wxString& text,
+ wxPGPropValFormatFlags flags) const;
+ bool ValueFromInt_(wxVariant& value, int* pIndex, int intVal,
+ wxPGPropValFormatFlags flags) const;
};
@@ -468,6 +463,11 @@ public:
virtual ~wxEditEnumProperty();
+ void OnSetValue() override;
+ bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ bool ValidateValue(wxVariant& value,
+ wxPGValidationInfo& validationInfo) const;
};
@@ -506,10 +506,10 @@ public:
virtual ~wxFlagsProperty ();
virtual void OnSetValue();
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int flags ) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags) const;
virtual wxVariant ChildChanged( wxVariant& thisValue,
int childIndex,
wxVariant& childValue ) const;
@@ -602,10 +602,10 @@ public:
virtual ~wxFileProperty ();
virtual void OnSetValue();
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
static wxValidator* GetClassValidator();
@@ -643,10 +643,10 @@ public:
const wxString& value = wxString() );
virtual ~wxLongStringProperty();
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
protected:
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value);
@@ -669,9 +669,10 @@ public:
const wxString& value = wxString() );
virtual ~wxDirProperty();
- virtual wxString ValueToString(wxVariant& value, int argFlags = 0) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool StringToValue(wxVariant& variant, const wxString& text,
- int argFlags = 0) const;
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual wxValidator* DoGetValidator() const;
protected:
@@ -696,10 +697,10 @@ public:
virtual ~wxArrayStringProperty();
virtual void OnSetValue();
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
- virtual bool StringToValue( wxVariant& variant,
- const wxString& text,
- int argFlags = 0 ) const;
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
+ virtual bool StringToValue(wxVariant& variant, const wxString& text,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
/**
diff --git a/interface/wx/splitter.h b/interface/wx/splitter.h
index 4ff835b2ee..22d564a7ea 100644
--- a/interface/wx/splitter.h
+++ b/interface/wx/splitter.h
@@ -142,6 +142,20 @@ public:
*/
virtual ~wxSplitterWindow();
+ /**
+ Returns true if splitter always behaves as if wxSP_LIVE_UPDATE were
+ specified.
+
+ This function returns true if non-live update mode is not supported and
+ live update is always used, even if wxSP_LIVE_UPDATE was not explicitly
+ specified.
+
+ @see wxClientDC::CanBeUsedForDrawing()
+
+ @since 3.3.0
+ */
+ bool AlwaysUsesLiveUpdate() const;
+
/**
Creation function, for two-step construction.
See wxSplitterWindow() for details.
diff --git a/interface/wx/statusbr.h b/interface/wx/statusbr.h
index 2d25722607..0e93b92a3f 100644
--- a/interface/wx/statusbr.h
+++ b/interface/wx/statusbr.h
@@ -248,6 +248,22 @@ public:
*/
virtual void SetFieldsCount(int number = 1, const int* widths = nullptr);
+ /**
+ Add a control (child of the wxStatusBar) to be shown at the specified
+ field position in the status bar.
+
+ @param i
+ The field index where the control will be shown.
+ @param win
+ The control in question. Must be a child of the wxStatusBar itself.
+
+ @note You must delete the control to remove it from the status bar, as
+ simply passing @NULL will not do that.
+
+ @since 3.3.0
+ */
+ bool AddFieldControl(int i, wxWindow* win);
+
/**
Sets the minimal possible height for the status bar.
diff --git a/interface/wx/stdpaths.h b/interface/wx/stdpaths.h
index 36be031fb6..46e55a61d7 100644
--- a/interface/wx/stdpaths.h
+++ b/interface/wx/stdpaths.h
@@ -79,6 +79,18 @@ public:
*/
Dir_Cache,
+ /**
+ Directory containing configuration information.
+
+ Example return values:
+ - Unix: `~/.config`
+ - Windows: `C:\Users\username\AppData\Roaming`
+ - Mac: @c `~/Library/Preferences`
+
+ @since 3.3.0
+ */
+ Dir_Config,
+
/**
Directory containing user documents.
@@ -195,6 +207,20 @@ public:
ConfigFileConv_Ext
};
+ /**
+ Append application and/or vendor name to the given directory.
+
+ By default, appends the subdirectory with the application name, as
+ returned by wxApp::GetAppName(), to the given directory.
+
+ This behaviour is affected by UseAppInfo(), e.g. if this function is
+ called with `AppInfo_VendorName` then the vendor name would be appended
+ instead of the application name.
+
+ @since 3.3.0
+ */
+ wxString AppendAppInfo(const wxString& dir) const;
+
/**
MSW-specific function undoing the effect of IgnoreAppSubDir() calls.
@@ -370,17 +396,25 @@ public:
- Mac: @c ~/Library/Preferences
Only use this method if you have a single configuration file to put in this
- directory, otherwise GetUserDataDir() is more appropriate as the latter
- adds @c appinfo to the path, unlike this function.
+ directory, otherwise calling AppendAppInfo() with the value returned by
+ GetDir() with wxStandardPaths::Dir_Config is more appropriate.
*/
virtual wxString GetUserConfigDir() const;
/**
- Return the directory for the user-dependent application data files:
+ Return the directory for the user-dependent application data files.
+
+ The returned path is:
+
- Unix: @c ~/.appinfo
- Windows: @c "C:\Users\username\AppData\Roaming\appinfo" or
@c "C:\Documents and Settings\username\Application Data\appinfo"
- Mac: @c "~/Library/Application Support/appinfo"
+
+ Please note that under Unix this function return value doesn't depend
+ on the file layout, and so returns a possibly unexpected value when
+ wxStandardPaths::FileLayout_XDG is used. Consider using GetUserDir()
+ instead if you use XDG layout, as this function does respect it.
*/
virtual wxString GetUserDataDir() const;
@@ -505,6 +539,8 @@ public:
By default, only the application name is used.
+ @see AppendAppInfo()
+
@since 2.9.0
*/
void UseAppInfo(int info);
diff --git a/interface/wx/string.h b/interface/wx/string.h
index 7608c49658..451ba0b052 100644
--- a/interface/wx/string.h
+++ b/interface/wx/string.h
@@ -911,12 +911,12 @@ public:
/**
Concatenation: returns a new string equal to the concatenation of the operands.
*/
- wxString operator +(const wxString& x, const wxString& y);
+ friend wxString operator +(const wxString& x, const wxString& y);
/**
@overload
*/
- wxString operator +(const wxString& x, wxUniChar y);
+ friend wxString operator +(const wxString& x, wxUniChar y);
wxString& operator<<(const wxString& s);
wxString& operator<<(const char* psz);
@@ -1015,6 +1015,54 @@ public:
*/
bool IsSameAs(wxUniChar ch, bool caseSensitive = true) const;
+ ///@{
+ /**
+ Comparison operator for string types.
+ */
+ friend bool operator==(const wxString& s1, const wxString& s2);
+ friend bool operator!=(const wxString& s1, const wxString& s2);
+ friend bool operator< (const wxString& s1, const wxString& s2);
+ friend bool operator> (const wxString& s1, const wxString& s2);
+ friend bool operator<=(const wxString& s1, const wxString& s2);
+ friend bool operator>=(const wxString& s1, const wxString& s2);
+ friend bool operator==(const wxString& s1, const wxCStrData& s2);
+ friend bool operator==(const wxCStrData& s1, const wxString& s2);
+ friend bool operator!=(const wxString& s1, const wxCStrData& s2);
+ friend bool operator!=(const wxCStrData& s1, const wxString& s2);
+ friend bool operator==(const wxString& s1, const wxWCharBuffer& s2);
+ friend bool operator==(const wxWCharBuffer& s1, const wxString& s2);
+ friend bool operator!=(const wxString& s1, const wxWCharBuffer& s2);
+ friend bool operator!=(const wxWCharBuffer& s1, const wxString& s2);
+ friend bool operator==(const wxString& s1, const wxCharBuffer& s2);
+ friend bool operator==(const wxCharBuffer& s1, const wxString& s2);
+ friend bool operator!=(const wxString& s1, const wxCharBuffer& s2);
+ friend bool operator!=(const wxCharBuffer& s1, const wxString& s2);
+ ///@}
+
+ ///@{
+ /**
+ Comparison operators char types.
+ */
+ friend bool operator==(const wxUniChar& c, const wxString& s);
+ friend bool operator==(const wxUniCharRef& c, const wxString& s);
+ friend bool operator==(char c, const wxString& s);
+ friend bool operator==(wchar_t c, const wxString& s);
+ friend bool operator==(int c, const wxString& s);
+ friend bool operator==(const wxString& s, const wxUniChar& c);
+ friend bool operator==(const wxString& s, const wxUniCharRef& c);
+ friend bool operator==(const wxString& s, char c);
+ friend bool operator==(const wxString& s, wchar_t c);
+ friend bool operator!=(const wxUniChar& c, const wxString& s);
+ friend bool operator!=(const wxUniCharRef& c, const wxString& s);
+ friend bool operator!=(char c, const wxString& s);
+ friend bool operator!=(wchar_t c, const wxString& s);
+ friend bool operator!=(int c, const wxString& s);
+ friend bool operator!=(const wxString& s, const wxUniChar& c);
+ friend bool operator!=(const wxString& s, const wxUniCharRef& c);
+ friend bool operator!=(const wxString& s, char c);
+ friend bool operator!=(const wxString& s, wchar_t c);
+ ///@}
+
/**
Returns @true if the string contents matches a mask containing '*' and '?'.
*/
@@ -1999,54 +2047,6 @@ public:
-///@{
-/**
- Comparison operator for string types.
-*/
-inline bool operator==(const wxString& s1, const wxString& s2);
-inline bool operator!=(const wxString& s1, const wxString& s2);
-inline bool operator< (const wxString& s1, const wxString& s2);
-inline bool operator> (const wxString& s1, const wxString& s2);
-inline bool operator<=(const wxString& s1, const wxString& s2);
-inline bool operator>=(const wxString& s1, const wxString& s2);
-inline bool operator==(const wxString& s1, const wxCStrData& s2);
-inline bool operator==(const wxCStrData& s1, const wxString& s2);
-inline bool operator!=(const wxString& s1, const wxCStrData& s2);
-inline bool operator!=(const wxCStrData& s1, const wxString& s2);
-inline bool operator==(const wxString& s1, const wxWCharBuffer& s2);
-inline bool operator==(const wxWCharBuffer& s1, const wxString& s2);
-inline bool operator!=(const wxString& s1, const wxWCharBuffer& s2);
-inline bool operator!=(const wxWCharBuffer& s1, const wxString& s2);
-inline bool operator==(const wxString& s1, const wxCharBuffer& s2);
-inline bool operator==(const wxCharBuffer& s1, const wxString& s2);
-inline bool operator!=(const wxString& s1, const wxCharBuffer& s2);
-inline bool operator!=(const wxCharBuffer& s1, const wxString& s2);
-///@}
-
-///@{
-/**
- Comparison operators char types.
-*/
-inline bool operator==(const wxUniChar& c, const wxString& s);
-inline bool operator==(const wxUniCharRef& c, const wxString& s);
-inline bool operator==(char c, const wxString& s);
-inline bool operator==(wchar_t c, const wxString& s);
-inline bool operator==(int c, const wxString& s);
-inline bool operator==(const wxString& s, const wxUniChar& c);
-inline bool operator==(const wxString& s, const wxUniCharRef& c);
-inline bool operator==(const wxString& s, char c);
-inline bool operator==(const wxString& s, wchar_t c);
-inline bool operator!=(const wxUniChar& c, const wxString& s);
-inline bool operator!=(const wxUniCharRef& c, const wxString& s);
-inline bool operator!=(char c, const wxString& s);
-inline bool operator!=(wchar_t c, const wxString& s);
-inline bool operator!=(int c, const wxString& s);
-inline bool operator!=(const wxString& s, const wxUniChar& c);
-inline bool operator!=(const wxString& s, const wxUniCharRef& c);
-inline bool operator!=(const wxString& s, char c);
-inline bool operator!=(const wxString& s, wchar_t c);
-///@}
-
/**
The global wxString instance of an empty string.
Used extensively in the entire wxWidgets API.
diff --git a/interface/wx/valgen.h b/interface/wx/valgen.h
index 40eca58d08..3dc150713b 100644
--- a/interface/wx/valgen.h
+++ b/interface/wx/valgen.h
@@ -15,12 +15,16 @@
- wxButton, wxRadioButton, wxToggleButton, wxBitmapToggleButton, wxSpinButton
- wxCheckBox, wxRadioBox, wxComboBox, wxListBox, wxCheckListBox
- wxGauge, wxSlider, wxScrollBar, wxChoice, wxStaticText
- - wxSpinCtrl, wxTextCtrl
+ - wxSpinCtrl, wxTextCtrl, wxColourPickerCtrl (since wxWidgets 3.3.0 or later).
It checks the type of the window and uses an appropriate type for it.
For example, wxButton and wxTextCtrl transfer data to and from a
wxString variable; wxListBox uses a wxArrayInt; wxCheckBox uses a boolean.
+ @since 3.2.5
+ A wxLB_SINGLE wxListBox can also use an int. wxColourPickerCtrl support.
+ A 3-state wxCheckBox can use wxCheckBoxState.
+
For more information, please see @ref overview_validator.
@library{wxcore}
diff --git a/interface/wx/variant.h b/interface/wx/variant.h
index 7c2701da79..60b7158c90 100644
--- a/interface/wx/variant.h
+++ b/interface/wx/variant.h
@@ -42,21 +42,24 @@
required.
Note that as of wxWidgets 2.7.1, wxVariant is
- @ref overview_refcount "reference counted". Additionally, the convenience
- macros DECLARE_VARIANT_OBJECT() and IMPLEMENT_VARIANT_OBJECT() were added
- so that adding (limited) support for conversion to and from wxVariant can
- be very easily implemented without modifying either wxVariant or the class
- to be stored by wxVariant. Since assignment operators cannot be declared
- outside the class, the shift left operators are used like this:
+ @ref overview_refcount "reference counted".
+
+ Convenience macros wxDECLARE_VARIANT_OBJECT() and wxIMPLEMENT_VARIANT_OBJECT()
+ allow easily adding support for conversion to and from wxVariant to custom
+ classes. The first of these macros must be used inside the class declaration
+ and the second one outside of it in the implementation file, e.g.
@code
// in the header file
- DECLARE_VARIANT_OBJECT(MyClass)
+ class MyClass : public wxObject {
+ ...
+ wxDECLARE_VARIANT_OBJECT(MyClass);
+ };
// in the implementation file
- IMPLEMENT_VARIANT_OBJECT(MyClass)
+ wxIMPLEMENT_VARIANT_OBJECT(MyClass);
- // in the user code
+ // and then objects of MyClass can be used with wxVariant like this:
wxVariant variant;
MyClass value;
variant << value;
@@ -73,12 +76,16 @@
wxObject itself. By default, wxWidgets already implements the shift
operator conversion for a few of its drawing related classes:
- @code
- IMPLEMENT_VARIANT_OBJECT(wxColour)
- IMPLEMENT_VARIANT_OBJECT(wxImage)
- IMPLEMENT_VARIANT_OBJECT(wxIcon)
- IMPLEMENT_VARIANT_OBJECT(wxBitmap)
- @endcode
+ - wxColour
+ - wxImage
+ - wxIcon
+ - wxBitmap
+ - wxBitmapBundle
+
+ @note There also are legacy versions of the above macros without `wx`
+ prefix, working in a slightly different way. Please use the new
+ versions in the new code and consider replacing any existing use of
+ the legacy macros with the new ones.
Note that as of wxWidgets 2.9.0, wxVariantData no longer inherits from
wxObject and wxVariant no longer uses the type-unsafe wxList class for list
diff --git a/interface/wx/window.h b/interface/wx/window.h
index 392f1aa3a6..e83cb6ffeb 100644
--- a/interface/wx/window.h
+++ b/interface/wx/window.h
@@ -3462,6 +3462,17 @@ public:
*/
void SetAccessible(wxAccessible* accessible);
+ /**
+ Override to create a specific accessible object.
+ */
+ virtual wxAccessible* CreateAccessible();
+
+ /**
+ Returns the accessible object, calling CreateAccessible if necessary.
+ May return @NULL, in which case system-provide accessible is used.
+ */
+ wxAccessible* GetOrCreateAccessible();
+
///@}
diff --git a/interface/wx/xml/xml.h b/interface/wx/xml/xml.h
index ebfda1be2b..88c66712a4 100644
--- a/interface/wx/xml/xml.h
+++ b/interface/wx/xml/xml.h
@@ -637,7 +637,7 @@ enum wxXmlDocumentLoadFlag
@code
wxXmlDocument doc;
- doc.Load("myfile.xml", "UTF-8", wxXMLDOC_KEEP_WHITESPACE_NODES);
+ doc.Load("myfile.xml", wxXMLDOC_KEEP_WHITESPACE_NODES);
// myfile2.xml will be identical to myfile.xml saving it this way:
doc.Save("myfile2.xml", wxXML_NO_INDENTATION);
@@ -709,16 +709,14 @@ public:
wxXmlDocument(const wxXmlDocument& doc);
/**
- Loads the given filename using the given encoding. See Load().
+ Loads the given filename. See Load().
*/
- wxXmlDocument(const wxString& filename,
- const wxString& encoding = "UTF-8");
+ wxXmlDocument(const wxString& filename);
/**
- Loads the XML document from given stream using the given encoding. See Load().
+ Loads the XML document from given stream. See Load().
*/
- wxXmlDocument(wxInputStream& stream,
- const wxString& encoding = "UTF-8");
+ wxXmlDocument(wxInputStream& stream);
/**
Virtual destructor. Frees the document root node.
@@ -760,14 +758,6 @@ public:
*/
wxXmlNode* DetachRoot();
- /**
- Returns encoding of in-memory representation of the document
- (same as passed to Load() or constructor, defaults to UTF-8).
-
- @note this is meaningless in Unicode build where data are stored as @c wchar_t*.
- */
- wxString GetEncoding() const;
-
/**
Returns encoding of document (may be empty).
@@ -839,15 +829,13 @@ public:
Returns true on success, false otherwise.
*/
- virtual bool Load(const wxString& filename,
- const wxString& encoding = "UTF-8", int flags = wxXMLDOC_NONE);
+ bool Load(const wxString& filename, int flags = wxXMLDOC_NONE);
/**
- Like Load(const wxString&, const wxString&, int) but takes the data from
- given input stream.
+ Like Load(const wxString&, int) but takes the data from given input
+ stream.
*/
- virtual bool Load(wxInputStream& stream,
- const wxString& encoding = "UTF-8", int flags = wxXMLDOC_NONE);
+ bool Load(wxInputStream& stream, int flags = wxXMLDOC_NONE);
/**
Saves XML tree creating a file named with given string.
diff --git a/samples/aui/auidemo.cpp b/samples/aui/auidemo.cpp
index 6eeee9a118..56f5384bb6 100644
--- a/samples/aui/auidemo.cpp
+++ b/samples/aui/auidemo.cpp
@@ -18,17 +18,20 @@
#include "wx/artprov.h"
#include "wx/clipbrd.h"
#include "wx/image.h"
+#include "wx/choice.h"
#include "wx/colordlg.h"
#include "wx/wxhtml.h"
#include "wx/imaglist.h"
#include "wx/dataobj.h"
#include "wx/dcclient.h"
#include "wx/bmpbuttn.h"
+#include "wx/log.h"
#include "wx/menu.h"
#include "wx/toolbar.h"
#include "wx/statusbr.h"
#include "wx/msgdlg.h"
#include "wx/textdlg.h"
+#include "wx/stattext.h"
#include "wx/aui/aui.h"
#include "../sample.xpm"
@@ -98,6 +101,8 @@ class MyFrame : public wxFrame
ID_NotebookArtSimple,
ID_NotebookAlignTop,
ID_NotebookAlignBottom,
+ ID_NotebookNewTab,
+ ID_NotebookDeleteTab,
ID_SampleItem,
@@ -158,6 +163,9 @@ private:
void OnNotebookFlag(wxCommandEvent& evt);
void OnUpdateUI(wxUpdateUIEvent& evt);
+ void OnNotebookNewTab(wxCommandEvent& evt);
+ void OnNotebookDeleteTab(wxCommandEvent& evt);
+
void OnPaneClose(wxAuiManagerEvent& evt);
private:
@@ -605,6 +613,8 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_NotebookArtSimple, MyFrame::OnNotebookFlag)
EVT_MENU(ID_NotebookAlignTop, MyFrame::OnTabAlignment)
EVT_MENU(ID_NotebookAlignBottom, MyFrame::OnTabAlignment)
+ EVT_MENU(ID_NotebookNewTab, MyFrame::OnNotebookNewTab)
+ EVT_MENU(ID_NotebookDeleteTab, MyFrame::OnNotebookDeleteTab)
EVT_MENU(ID_NoGradient, MyFrame::OnGradient)
EVT_MENU(ID_VerticalGradient, MyFrame::OnGradient)
EVT_MENU(ID_HorizontalGradient, MyFrame::OnGradient)
@@ -733,6 +743,9 @@ MyFrame::MyFrame(wxWindow* parent,
notebook_menu->AppendCheckItem(ID_NotebookScrollButtons, _("Scroll Buttons Visible"));
notebook_menu->AppendCheckItem(ID_NotebookWindowList, _("Window List Button Visible"));
notebook_menu->AppendCheckItem(ID_NotebookTabFixedWidth, _("Fixed-width Tabs"));
+ notebook_menu->AppendSeparator();
+ notebook_menu->Append(ID_NotebookNewTab, _("Add a &New Tab"));
+ notebook_menu->Append(ID_NotebookDeleteTab, _("&Delete Last Tab"));
m_perspectives_menu = new wxMenu;
m_perspectives_menu->Append(ID_CreatePerspective, _("Create Perspective"));
@@ -1261,7 +1274,7 @@ void MyFrame::OnUpdateUI(wxUpdateUIEvent& event)
break;
case ID_NotebookNoCloseButton:
- event.Check((m_notebook_style & (wxAUI_NB_CLOSE_BUTTON|wxAUI_NB_CLOSE_ON_ALL_TABS|wxAUI_NB_CLOSE_ON_ACTIVE_TAB)) != 0);
+ event.Check((m_notebook_style & (wxAUI_NB_CLOSE_BUTTON|wxAUI_NB_CLOSE_ON_ALL_TABS|wxAUI_NB_CLOSE_ON_ACTIVE_TAB)) == 0);
break;
case ID_NotebookCloseButton:
event.Check((m_notebook_style & wxAUI_NB_CLOSE_BUTTON) != 0);
@@ -1300,6 +1313,36 @@ void MyFrame::OnUpdateUI(wxUpdateUIEvent& event)
}
}
+
+void MyFrame::OnNotebookNewTab(wxCommandEvent& WXUNUSED(evt))
+{
+ auto* const book =
+ wxCheckCast(m_mgr.GetPane("notebook_content").window);
+
+ book->AddPage(new wxTextCtrl(book, wxID_ANY, "New Tab",
+ wxDefaultPosition, wxDefaultSize,
+ wxTE_MULTILINE | wxNO_BORDER),
+ wxString::Format("Tab %zu", book->GetPageCount() + 1),
+ true /* select */);
+}
+
+
+void MyFrame::OnNotebookDeleteTab(wxCommandEvent& WXUNUSED(evt))
+{
+ auto* const book =
+ wxCheckCast(m_mgr.GetPane("notebook_content").window);
+
+ auto numPages = book->GetPageCount();
+ if ( !numPages )
+ {
+ wxLogWarning("No pages to delete.");
+ return;
+ }
+
+ book->DeletePage(numPages - 1);
+}
+
+
void MyFrame::OnPaneClose(wxAuiManagerEvent& evt)
{
if (evt.pane->name == "test10")
diff --git a/samples/caret/caret.cpp b/samples/caret/caret.cpp
index 44e9f6177a..7e4d268506 100644
--- a/samples/caret/caret.cpp
+++ b/samples/caret/caret.cpp
@@ -419,7 +419,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
wxChar ch = CharAt(x, y);
if ( !ch )
ch = ' ';
-#ifdef __WXOSX__
+#if defined(__WXOSX__) || defined(__WXQT__)
dc.DrawText(ch, m_xMargin + x * m_widthChar,
m_yMargin + y * m_heightChar );
#else
@@ -427,9 +427,8 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
#endif
}
-#ifndef __WXOSX__
- dc.DrawText( line, m_xMargin, m_yMargin + y * m_heightChar );
-#endif
+ if ( !line.empty() )
+ dc.DrawText( line, m_xMargin, m_yMargin + y * m_heightChar );
}
}
diff --git a/samples/collpane/collpane.cpp b/samples/collpane/collpane.cpp
index 69f7ec8d0e..7c6e0d5a1a 100644
--- a/samples/collpane/collpane.cpp
+++ b/samples/collpane/collpane.cpp
@@ -71,16 +71,19 @@ class MyApp: public wxApp
{
public:
MyApp() { }
+ MyApp(const MyApp&) = delete;
+ MyApp& operator=(const MyApp&) = delete;
virtual bool OnInit() override;
-
- wxDECLARE_NO_COPY_CLASS(MyApp);
};
class MyFrame: public wxFrame
{
public:
MyFrame();
+ MyFrame(const MyFrame&) = delete;
+ MyFrame& operator=(const MyFrame&) = delete;
+
virtual ~MyFrame();
// Menu commands
@@ -103,13 +106,15 @@ private:
wxBoxSizer *m_paneSizer;
wxDECLARE_EVENT_TABLE();
- wxDECLARE_NO_COPY_CLASS(MyFrame);
};
class MyDialog : public wxDialog
{
public:
MyDialog(wxFrame *parent);
+ MyDialog(const MyDialog&) = delete;
+ MyDialog& operator=(const MyDialog&) = delete;
+
void OnToggleStatus(wxCommandEvent& WXUNUSED(ev));
void OnAlignButton(wxCommandEvent& WXUNUSED(ev));
void OnPaneChanged(wxCollapsiblePaneEvent& event);
@@ -119,7 +124,6 @@ private:
wxGridSizer *m_paneSizer;
wxDECLARE_EVENT_TABLE();
- wxDECLARE_NO_COPY_CLASS(MyDialog);
};
diff --git a/samples/dataview/mymodels.h b/samples/dataview/mymodels.h
index 40f86e6666..f4467de67d 100644
--- a/samples/dataview/mymodels.h
+++ b/samples/dataview/mymodels.h
@@ -245,6 +245,8 @@ class MyIndexListModel : public wxDataViewIndexListModel
{
public:
MyIndexListModel() { }
+ MyIndexListModel(const MyIndexListModel&) = delete;
+ MyIndexListModel& operator=(const MyIndexListModel&) = delete;
void Fill(const wxArrayString& strings)
{
@@ -266,8 +268,6 @@ public:
private:
wxArrayString m_strings;
-
- wxDECLARE_NO_COPY_CLASS(MyIndexListModel);
};
enum ModelFlags
diff --git a/samples/debugrpt/debugrpt.cpp b/samples/debugrpt/debugrpt.cpp
index 89f7bb2eef..9dcced128f 100644
--- a/samples/debugrpt/debugrpt.cpp
+++ b/samples/debugrpt/debugrpt.cpp
@@ -157,6 +157,8 @@ class MyFrame : public wxFrame
{
public:
MyFrame();
+ MyFrame(const MyFrame&) = delete;
+ MyFrame& operator=(const MyFrame&) = delete;
private:
void OnListLoadedDLLs(wxCommandEvent& event);
@@ -185,7 +187,6 @@ private:
// number of lines drawn in OnPaint()
int m_numLines;
- wxDECLARE_NO_COPY_CLASS(MyFrame);
wxDECLARE_EVENT_TABLE();
};
@@ -202,6 +203,8 @@ class MyApp : public wxApp
public:
// call wxHandleFatalExceptions here
MyApp();
+ MyApp(const MyApp&) = delete;
+ MyApp& operator=(const MyApp&) = delete;
// create our main window here
virtual bool OnInit() override;
@@ -219,8 +222,6 @@ public:
private:
bool m_uploadReport;
-
- wxDECLARE_NO_COPY_CLASS(MyApp);
};
wxIMPLEMENT_APP(MyApp);
diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp
index a49ce3da85..e493326d93 100644
--- a/samples/dialogs/dialogs.cpp
+++ b/samples/dialogs/dialogs.cpp
@@ -1318,6 +1318,8 @@ public:
sizerBtns->Add(new wxButton(this, wxID_RESET, "&Reset all"),
wxSizerFlags().Border(wxLEFT));
}
+ MyRearrangeDialog(const MyRearrangeDialog&) = delete;
+ MyRearrangeDialog& operator=(const MyRearrangeDialog&) = delete;
// call this instead of ShowModal() to update order and labels array in
// case the dialog was not cancelled
@@ -1409,7 +1411,6 @@ private:
wxTextCtrl *m_text;
wxDECLARE_EVENT_TABLE();
- wxDECLARE_NO_COPY_CLASS(MyRearrangeDialog);
};
wxBEGIN_EVENT_TABLE(MyRearrangeDialog, wxRearrangeDialog)
@@ -1731,6 +1732,8 @@ public:
: m_dialog(&dialog)
{
}
+ MyCustomizeHook(const MyCustomizeHook&) = delete;
+ MyCustomizeHook& operator=(const MyCustomizeHook&) = delete;
// Override pure virtual base class method to add our custom controls.
virtual void AddCustomControls(wxFileDialogCustomize& customizer) override
@@ -1804,8 +1807,6 @@ private:
wxFileDialogStaticText* m_label;
wxString m_info;
-
- wxDECLARE_NO_COPY_CLASS(MyCustomizeHook);
};
void MyFrame::FileOpen(wxCommandEvent& WXUNUSED(event) )
diff --git a/samples/dialogs/dialogs.h b/samples/dialogs/dialogs.h
index eab880b7d8..a1471d22a5 100644
--- a/samples/dialogs/dialogs.h
+++ b/samples/dialogs/dialogs.h
@@ -190,6 +190,8 @@ class TestMessageBoxDialog : public wxDialog
{
public:
TestMessageBoxDialog(wxWindow *parent);
+ TestMessageBoxDialog(const TestMessageBoxDialog&) = delete;
+ TestMessageBoxDialog& operator=(const TestMessageBoxDialog&) = delete;
bool Create();
@@ -256,7 +258,6 @@ private:
wxStaticText *m_labelResult;
wxDECLARE_EVENT_TABLE();
- wxDECLARE_NO_COPY_CLASS(TestMessageBoxDialog);
};
#if wxUSE_RICHMSGDLG
diff --git a/samples/docview/doc.h b/samples/docview/doc.h
index f5fc6938ad..4b1753300e 100644
--- a/samples/docview/doc.h
+++ b/samples/docview/doc.h
@@ -164,6 +164,8 @@ class wxTextDocument : public wxDocument
{
public:
wxTextDocument() : wxDocument() { }
+ wxTextDocument(const wxTextDocument&) = delete;
+ wxTextDocument &operator=(const wxTextDocument&) = delete;
virtual bool OnCreate(const wxString& path, long flags) override;
@@ -178,7 +180,6 @@ protected:
void OnTextChange(wxCommandEvent& event);
- wxDECLARE_NO_COPY_CLASS(wxTextDocument);
wxDECLARE_ABSTRACT_CLASS(wxTextDocument);
};
@@ -190,9 +191,11 @@ class TextEditDocument : public wxTextDocument
{
public:
TextEditDocument() : wxTextDocument() { }
+ TextEditDocument(const TextEditDocument&) = delete;
+ TextEditDocument &operator=(const TextEditDocument&) = delete;
+
virtual wxTextCtrl* GetTextCtrl() const override;
- wxDECLARE_NO_COPY_CLASS(TextEditDocument);
wxDECLARE_DYNAMIC_CLASS(TextEditDocument);
};
@@ -207,6 +210,8 @@ class ImageDocument : public wxDocument
{
public:
ImageDocument() : wxDocument() { }
+ ImageDocument(const ImageDocument&) = delete;
+ ImageDocument &operator=(const ImageDocument&) = delete;
virtual bool OnOpenDocument(const wxString& file) override;
@@ -218,7 +223,6 @@ protected:
private:
wxImage m_image;
- wxDECLARE_NO_COPY_CLASS(ImageDocument);
wxDECLARE_DYNAMIC_CLASS(ImageDocument);
};
@@ -229,6 +233,8 @@ class ImageDetailsDocument : public wxDocument
{
public:
ImageDetailsDocument(ImageDocument *parent);
+ ImageDetailsDocument(const ImageDetailsDocument&) = delete;
+ ImageDetailsDocument &operator=(const ImageDetailsDocument&) = delete;
// accessors for ImageDetailsView
wxSize GetSize() const { return m_size; }
@@ -242,8 +248,6 @@ private:
unsigned long m_numColours;
wxBitmapType m_type;
bool m_hasAlpha;
-
- wxDECLARE_NO_COPY_CLASS(ImageDetailsDocument);
};
#endif // _WX_SAMPLES_DOCVIEW_DOC_H_
diff --git a/samples/docview/docview.h b/samples/docview/docview.h
index 49a531896f..fe5e2cabe2 100644
--- a/samples/docview/docview.h
+++ b/samples/docview/docview.h
@@ -35,6 +35,8 @@ public:
};
MyApp();
+ MyApp(const MyApp&) = delete;
+ MyApp& operator=(const MyApp&) = delete;
// override some wxApp virtual methods
virtual bool OnInit() override;
@@ -90,7 +92,6 @@ private:
wxMenu *m_menuEdit;
wxDECLARE_EVENT_TABLE();
- wxDECLARE_NO_COPY_CLASS(MyApp);
};
wxDECLARE_APP(MyApp);
diff --git a/samples/docview/view.h b/samples/docview/view.h
index af587492d2..baefee6baa 100644
--- a/samples/docview/view.h
+++ b/samples/docview/view.h
@@ -155,14 +155,14 @@ class ImageDetailsView : public wxView
{
public:
ImageDetailsView(ImageDetailsDocument *doc);
+ ImageDetailsView(const ImageDetailsView&) = delete;
+ ImageDetailsView& operator=(const ImageDetailsView&) = delete;
virtual void OnDraw(wxDC *dc) override;
virtual bool OnClose(bool deleteWindow) override;
private:
wxFrame *m_frame;
-
- wxDECLARE_NO_COPY_CLASS(ImageDetailsView);
};
#endif // _WX_SAMPLES_DOCVIEW_VIEW_H_
diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp
index e0a21882bc..b4cea19e54 100644
--- a/samples/grid/griddemo.cpp
+++ b/samples/grid/griddemo.cpp
@@ -49,6 +49,8 @@ public:
m_colBg(colBg)
{
}
+ CustomColumnHeaderRenderer(const CustomColumnHeaderRenderer&) = delete;
+ CustomColumnHeaderRenderer& operator=(const CustomColumnHeaderRenderer&) = delete;
virtual void DrawLabel(const wxGrid& WXUNUSED(grid),
wxDC& dc,
@@ -74,8 +76,6 @@ public:
private:
const wxColour m_colFg, m_colBg;
-
- wxDECLARE_NO_COPY_CLASS(CustomColumnHeaderRenderer);
};
// And a custom attributes provider which uses custom column header renderer
@@ -91,6 +91,8 @@ public:
m_useCustom(false)
{
}
+ CustomColumnHeadersProvider(const CustomColumnHeadersProvider&) = delete;
+ CustomColumnHeadersProvider& operator=(const CustomColumnHeadersProvider&) = delete;
// enable or disable the use of custom renderer for column headers
void UseCustomColHeaders(bool use = true) { m_useCustom = use; }
@@ -114,8 +116,6 @@ private:
m_customEvenRenderer;
bool m_useCustom;
-
- wxDECLARE_NO_COPY_CLASS(CustomColumnHeadersProvider);
};
// ----------------------------------------------------------------------------
@@ -2437,6 +2437,8 @@ class TabularGridFrame : public wxFrame
{
public:
TabularGridFrame();
+ TabularGridFrame(const TabularGridFrame&) = delete;
+ TabularGridFrame& operator=(const TabularGridFrame&) = delete;
private:
enum // control ids
@@ -2626,7 +2628,6 @@ private:
bool m_shouldUpdateRowOrder,
m_shouldUpdateColOrder;
- wxDECLARE_NO_COPY_CLASS(TabularGridFrame);
wxDECLARE_EVENT_TABLE();
};
diff --git a/samples/htlbox/htlbox.cpp b/samples/htlbox/htlbox.cpp
index 571cab0c68..a760ea245d 100644
--- a/samples/htlbox/htlbox.cpp
+++ b/samples/htlbox/htlbox.cpp
@@ -60,6 +60,8 @@ class MyHtmlListBox : public wxHtmlListBox
public:
MyHtmlListBox() { }
MyHtmlListBox(wxWindow *parent, bool multi = false);
+ MyHtmlListBox(const MyHtmlListBox&) = delete;
+ MyHtmlListBox& operator=(const MyHtmlListBox&) = delete;
void SetChangeSelFg(bool change) { m_change = change; }
void UpdateFirstItem();
@@ -90,7 +92,6 @@ public:
wxTextFile m_file;
#endif
- wxDECLARE_NO_COPY_CLASS(MyHtmlListBox);
wxDECLARE_DYNAMIC_CLASS(MyHtmlListBox);
};
diff --git a/samples/html/test/test.cpp b/samples/html/test/test.cpp
index c5402495e9..509887c54e 100644
--- a/samples/html/test/test.cpp
+++ b/samples/html/test/test.cpp
@@ -50,6 +50,8 @@ public:
// no custom background initially to avoid confusing people
m_drawCustomBg = false;
}
+ MyHtmlWindow(const MyHtmlWindow&) = delete;
+ MyHtmlWindow& operator=(const MyHtmlWindow&) = delete;
virtual wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType WXUNUSED(type),
const wxString& WXUNUSED(url),
@@ -71,7 +73,6 @@ private:
bool m_drawCustomBg;
wxDECLARE_EVENT_TABLE();
- wxDECLARE_NO_COPY_CLASS(MyHtmlWindow);
};
// Define a new frame type: this is going to be our main frame
diff --git a/samples/image/image.cpp b/samples/image/image.cpp
index 27ee4975c8..9714b04de9 100644
--- a/samples/image/image.cpp
+++ b/samples/image/image.cpp
@@ -1261,6 +1261,8 @@ public:
Show();
}
+ MySVGFrame(const MySVGFrame&) = delete;
+ MySVGFrame& operator=(const MySVGFrame&) = delete;
private:
void OnPaint(wxPaintEvent&)
@@ -1290,8 +1292,6 @@ private:
const wxBitmapBundle m_bundle;
wxBitmap m_bitmap;
-
- wxDECLARE_NO_COPY_CLASS(MySVGFrame);
};
void MyFrame::OnNewSVGFrame(wxCommandEvent&)
@@ -1413,6 +1413,8 @@ public:
Show();
}
+ MyGraphicsFrame(const MyGraphicsFrame&) = delete;
+ MyGraphicsFrame& operator=(const MyGraphicsFrame&) = delete;
private:
void OnPaint(wxPaintEvent& WXUNUSED(event))
@@ -1433,8 +1435,6 @@ private:
wxImage m_image;
wxBitmap m_bitmap;
-
- wxDECLARE_NO_COPY_CLASS(MyGraphicsFrame);
};
void MyFrame::OnTestGraphics(wxCommandEvent& WXUNUSED(event))
diff --git a/samples/ipc/baseserver.cpp b/samples/ipc/baseserver.cpp
index 1576ccf735..9898bc284f 100644
--- a/samples/ipc/baseserver.cpp
+++ b/samples/ipc/baseserver.cpp
@@ -78,6 +78,8 @@ class BenchConnection : public wxConnection
{
public:
BenchConnection() { m_advise = false; }
+ BenchConnection(const BenchConnection&) = delete;
+ BenchConnection& operator=(const BenchConnection&) = delete;
virtual bool OnPoke(const wxString& topic,
const wxString& item,
@@ -99,8 +101,6 @@ private:
// should we notify the client about changes to m_item?
bool m_advise;
-
- wxDECLARE_NO_COPY_CLASS(BenchConnection);
};
// a simple server accepting connections to IPC_TOPIC and IPC_BENCHMARK_TOPIC
diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp
index 9f1af0b595..e08687d867 100644
--- a/samples/listctrl/listtest.cpp
+++ b/samples/listctrl/listtest.cpp
@@ -170,7 +170,7 @@ wxEND_EVENT_TABLE()
// My frame constructor
MyFrame::MyFrame(const wxString& title)
- : wxFrame(nullptr, wxID_ANY, title, wxDefaultPosition, wxSize(600, 500))
+ : wxFrame(nullptr, wxID_ANY, title)
{
m_listCtrl = nullptr;
m_logWindow = nullptr;
@@ -293,6 +293,9 @@ MyFrame::MyFrame(const wxString& title)
RecreateList(wxLC_REPORT | wxLC_SINGLE_SEL);
+ // Make the list control big enough to show its initial contents.
+ m_listCtrl->SetInitialSize(FromDIP(wxSize(600, 300)));
+
#ifdef __WXMSW__
// this is useful to know specially when debugging :)
wxLogMessage("Your version of comctl32.dll is: %d",
diff --git a/samples/listctrl/listtest.h b/samples/listctrl/listtest.h
index 1538799ebb..4920cba6f5 100644
--- a/samples/listctrl/listtest.h
+++ b/samples/listctrl/listtest.h
@@ -20,11 +20,10 @@ class MyApp: public wxApp
{
public:
MyApp() { }
+ MyApp(const MyApp&) = delete;
+ MyApp& operator=(const MyApp&) = delete;
virtual bool OnInit() override;
-
-private:
- wxDECLARE_NO_COPY_CLASS(MyApp);
};
class MyListCtrl: public wxListCtrl
@@ -40,6 +39,8 @@ public:
m_updated = -1;
}
+ MyListCtrl(const MyListCtrl&) = delete;
+ MyListCtrl &operator=(const MyListCtrl&) = delete;
// add one item to the listctrl in report mode
void InsertItemInReportView(int i);
@@ -90,7 +91,6 @@ private:
// checked boxes in virtual list
wxSelectionStore m_checked;
- wxDECLARE_NO_COPY_CLASS(MyListCtrl);
wxDECLARE_EVENT_TABLE();
};
@@ -99,6 +99,9 @@ class MyFrame: public wxFrame
{
public:
MyFrame(const wxString& title);
+ MyFrame(const MyFrame&) = delete;
+ MyFrame &operator=(const MyFrame&) = delete;
+
virtual ~MyFrame();
protected:
@@ -185,8 +188,6 @@ private:
// number of items to initialize list/report view with
int m_numListItems;
-
- wxDECLARE_NO_COPY_CLASS(MyFrame);
wxDECLARE_EVENT_TABLE();
};
diff --git a/samples/mdi/mdi.h b/samples/mdi/mdi.h
index 1dee3e51b4..c8e1804e31 100644
--- a/samples/mdi/mdi.h
+++ b/samples/mdi/mdi.h
@@ -25,6 +25,8 @@ public:
m_frame(frame)
{
}
+ MenuEventLogger(const MenuEventLogger&) = delete;
+ MenuEventLogger& operator=(const MenuEventLogger&) = delete;
protected:
void LogMenuOpenClose(wxMenuEvent& event, const char *action)
@@ -52,8 +54,6 @@ protected:
const wxString m_label;
wxFrame* const m_frame;
-
- wxDECLARE_NO_COPY_CLASS(MenuEventLogger);
};
class MyCanvas : public wxScrolledWindow,
@@ -155,6 +155,8 @@ private:
{
public:
EventHandler(unsigned numChild) : m_numChild(numChild) { }
+ EventHandler(const EventHandler&) = delete;
+ EventHandler &operator=(const EventHandler&) = delete;
private:
void OnRefresh(wxCommandEvent& event)
@@ -166,8 +168,6 @@ private:
const unsigned m_numChild;
wxDECLARE_EVENT_TABLE();
-
- wxDECLARE_NO_COPY_CLASS(EventHandler);
};
wxDECLARE_EVENT_TABLE();
diff --git a/samples/minimal/Info_cocoa.plist b/samples/minimal/Info_cocoa.plist
index 4dd85300c6..db96a4a67b 100644
--- a/samples/minimal/Info_cocoa.plist
+++ b/samples/minimal/Info_cocoa.plist
@@ -7,7 +7,7 @@
CFBundleExecutable
$(PRODUCT_NAME)
CFBundleGetInfoString
- $(PRODUCT_NAME) version 3.3.0, (c) 2005-2023 wxWidgets
+ $(PRODUCT_NAME) version 3.3.0, (c) 2005-2024 wxWidgets
CFBundleIconFile
wxmac.icns
CFBundleIdentifier
@@ -15,7 +15,7 @@
CFBundleInfoDictionaryVersion
6.0
CFBundleLongVersionString
- 3.3.0, (c) 2005-2023 wxWidgets
+ 3.3.0, (c) 2005-2024 wxWidgets
CFBundleName
$(PRODUCT_NAME)
CFBundlePackageType
@@ -25,7 +25,7 @@
CFBundleVersion
3.3.0
NSHumanReadableCopyright
- Copyright 2005-2023 wxWidgets
+ Copyright 2005-2024 wxWidgets
NSPrincipalClass
wxNSApplication
LSMinimumSystemVersion
diff --git a/samples/opengl/cube/makefile.gcc b/samples/opengl/cube/makefile.gcc
index fa4d106a46..bd35bec151 100644
--- a/samples/opengl/cube/makefile.gcc
+++ b/samples/opengl/cube/makefile.gcc
@@ -211,7 +211,7 @@ ifeq ($(USE_OPENGL),1)
$(OBJS)\cube.exe: $(CUBE_OBJECTS) $(OBJS)\cube_sample_rc.o
$(foreach f,$(subst \,/,$(CUBE_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp))
@move /y $@.rsp.tmp $@.rsp >nul
- $(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl -lopengl32 -lglu32 $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme
+ $(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl -lopengl32 $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme
@-del $@.rsp
endif
diff --git a/samples/opengl/cube/makefile.vc b/samples/opengl/cube/makefile.vc
index 98cb4a2ad5..298a88c09a 100644
--- a/samples/opengl/cube/makefile.vc
+++ b/samples/opengl/cube/makefile.vc
@@ -419,7 +419,7 @@ clean:
!if "$(USE_OPENGL)" == "1"
$(OBJS)\cube.exe: $(CUBE_OBJECTS) $(OBJS)\cube_sample.res
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\cube.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
- $(CUBE_OBJECTS) $(CUBE_RESOURCES) wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib opengl32.lib glu32.lib $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib
+ $(CUBE_OBJECTS) $(CUBE_RESOURCES) wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib opengl32.lib $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib
<<
!endif
diff --git a/samples/opengl/isosurf/isosurf.h b/samples/opengl/isosurf/isosurf.h
index 4a7305d0c6..043741fad5 100644
--- a/samples/opengl/isosurf/isosurf.h
+++ b/samples/opengl/isosurf/isosurf.h
@@ -15,14 +15,11 @@
#if defined(__WXMAC__)
# ifdef __DARWIN__
# include
-# include
# else
# include
-# include
# endif
#else
# include
-# include
#endif
// the maximum number of vertex in the loaded .dat file
@@ -47,6 +44,8 @@ public:
TestGLCanvas(wxWindow *parent,
wxWindowID id = wxID_ANY,
int *gl_attrib = nullptr);
+ TestGLCanvas(const TestGLCanvas&) = delete;
+ TestGLCanvas& operator=(const TestGLCanvas&) = delete;
virtual ~TestGLCanvas();
@@ -69,7 +68,6 @@ private:
GLfloat m_xrot;
GLfloat m_yrot;
- wxDECLARE_NO_COPY_CLASS(TestGLCanvas);
wxDECLARE_EVENT_TABLE();
};
diff --git a/samples/opengl/isosurf/makefile.gcc b/samples/opengl/isosurf/makefile.gcc
index 37d7b1d431..d076e18f64 100644
--- a/samples/opengl/isosurf/makefile.gcc
+++ b/samples/opengl/isosurf/makefile.gcc
@@ -211,7 +211,7 @@ ifeq ($(USE_OPENGL),1)
$(OBJS)\isosurf.exe: $(ISOSURF_OBJECTS) $(OBJS)\isosurf_sample_rc.o
$(foreach f,$(subst \,/,$(ISOSURF_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp))
@move /y $@.rsp.tmp $@.rsp >nul
- $(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl -lopengl32 -lglu32 $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme
+ $(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl -lopengl32 $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme
@-del $@.rsp
endif
diff --git a/samples/opengl/isosurf/makefile.vc b/samples/opengl/isosurf/makefile.vc
index 97a19a2d96..1f5b1b6a2e 100644
--- a/samples/opengl/isosurf/makefile.vc
+++ b/samples/opengl/isosurf/makefile.vc
@@ -419,7 +419,7 @@ clean:
!if "$(USE_OPENGL)" == "1"
$(OBJS)\isosurf.exe: $(ISOSURF_OBJECTS) $(OBJS)\isosurf_sample.res
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\isosurf.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
- $(ISOSURF_OBJECTS) $(ISOSURF_RESOURCES) wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib opengl32.lib glu32.lib $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib
+ $(ISOSURF_OBJECTS) $(ISOSURF_RESOURCES) wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib opengl32.lib $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib
<<
!endif
diff --git a/samples/opengl/penguin/Makefile.in b/samples/opengl/penguin/Makefile.in
index 60c3c1c1ad..a4237ee540 100644
--- a/samples/opengl/penguin/Makefile.in
+++ b/samples/opengl/penguin/Makefile.in
@@ -169,7 +169,7 @@ distclean: clean
rm -f config.cache config.log config.status bk-deps bk-make-pch Makefile
@COND_USE_OPENGL_1@penguin$(EXEEXT): $(PENGUIN_OBJECTS) $(__penguin___win32rc)
-@COND_USE_OPENGL_1@ $(CXX) -o $@ $(PENGUIN_OBJECTS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(WX_LDFLAGS) -lwx_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl-$(WX_RELEASE)$(HOST_SUFFIX) $(EXTRALIBS_OPENGL) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
+@COND_USE_OPENGL_1@ $(CXX) -o $@ $(PENGUIN_OBJECTS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(WX_LDFLAGS) -lwx_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl-$(WX_RELEASE)$(HOST_SUFFIX) $(EXTRALIBS_OPENGL) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
@COND_USE_OPENGL_1@ $(__penguin___os2_emxbindcmd)
@COND_PLATFORM_MACOSX_1_USE_OPENGL_1@penguin.app/Contents/PkgInfo: $(__penguin___depname) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
diff --git a/samples/opengl/penguin/dxfrenderer.cpp b/samples/opengl/penguin/dxfrenderer.cpp
index 8b29f6f0ff..a81f7f4d5b 100644
--- a/samples/opengl/penguin/dxfrenderer.cpp
+++ b/samples/opengl/penguin/dxfrenderer.cpp
@@ -17,17 +17,12 @@
#include "wx/wfstream.h"
#include "wx/txtstrm.h"
+#include "wx/glcanvas.h"
#if !wxUSE_GLCANVAS
#error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
#endif
-#ifdef __DARWIN__
- #include
-#else
- #include
-#endif
-
#include
#include "dxfrenderer.h"
diff --git a/samples/opengl/penguin/makefile.gcc b/samples/opengl/penguin/makefile.gcc
index c482329c10..9911c206fa 100644
--- a/samples/opengl/penguin/makefile.gcc
+++ b/samples/opengl/penguin/makefile.gcc
@@ -218,7 +218,7 @@ ifeq ($(USE_OPENGL),1)
$(OBJS)\penguin.exe: $(PENGUIN_OBJECTS) $(OBJS)\penguin_sample_rc.o
$(foreach f,$(subst \,/,$(PENGUIN_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp))
@move /y $@.rsp.tmp $@.rsp >nul
- $(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl -lopengl32 -lglu32 $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme
+ $(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl -lopengl32 $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme
@-del $@.rsp
endif
diff --git a/samples/opengl/penguin/makefile.unx b/samples/opengl/penguin/makefile.unx
index 5244e9960a..7f36d867f4 100644
--- a/samples/opengl/penguin/makefile.unx
+++ b/samples/opengl/penguin/makefile.unx
@@ -98,7 +98,7 @@ test_for_selected_wxbuild:
@$(WX_CONFIG) $(WX_CONFIG_FLAGS)
penguin: $(PENGUIN_OBJECTS)
- $(CXX) -o $@ $(PENGUIN_OBJECTS) $(LDFLAGS) `$(WX_CONFIG) $(WX_CONFIG_FLAGS) --libs gl,core,base` -lGL -lGLU
+ $(CXX) -o $@ $(PENGUIN_OBJECTS) $(LDFLAGS) `$(WX_CONFIG) $(WX_CONFIG_FLAGS) --libs gl,core,base` -lGL
penguin_penguin.o: ./penguin.cpp
$(CXX) -c -o $@ $(PENGUIN_CXXFLAGS) $(CPPDEPS) $<
diff --git a/samples/opengl/penguin/makefile.vc b/samples/opengl/penguin/makefile.vc
index 215c70b202..e003c3c841 100644
--- a/samples/opengl/penguin/makefile.vc
+++ b/samples/opengl/penguin/makefile.vc
@@ -431,7 +431,7 @@ clean:
!if "$(USE_OPENGL)" == "1"
$(OBJS)\penguin.exe: $(PENGUIN_OBJECTS) $(OBJS)\penguin_sample.res
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\penguin.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
- $(PENGUIN_OBJECTS) $(PENGUIN_RESOURCES) wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib opengl32.lib glu32.lib $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib
+ $(PENGUIN_OBJECTS) $(PENGUIN_RESOURCES) wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib opengl32.lib $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib
<<
!endif
diff --git a/samples/opengl/penguin/penguin.bkl b/samples/opengl/penguin/penguin.bkl
index a7283caa6a..e11dc2e545 100644
--- a/samples/opengl/penguin/penguin.bkl
+++ b/samples/opengl/penguin/penguin.bkl
@@ -8,13 +8,10 @@
1
-
+
GL
-
- GLU
-
@@ -31,7 +28,6 @@
core
base
$(SYS_GL_LIB)
- $(SYS_GLU_LIB)
diff --git a/samples/opengl/penguin/penguin.cpp b/samples/opengl/penguin/penguin.cpp
index a2b5da28e4..898e377c4e 100644
--- a/samples/opengl/penguin/penguin.cpp
+++ b/samples/opengl/penguin/penguin.cpp
@@ -21,11 +21,6 @@
#endif
#include "penguin.h"
-#ifdef __DARWIN__
- #include
-#else
- #include
-#endif
#include "../../sample.xpm"
@@ -312,7 +307,9 @@ void TestGLCanvas::ResetProjectionMode()
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- gluPerspective(45, double(ClientSize.x) / ClientSize.y, 1, 100);
+ double fH = tan(M_PI / 8);
+ double fW = fH * ClientSize.x / ClientSize.y;
+ glFrustum(-fW, fW, -fH, fH, 1.0, 100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
diff --git a/samples/opengl/penguin/penguin.h b/samples/opengl/penguin/penguin.h
index d1bfdc83fb..ca37b2f119 100644
--- a/samples/opengl/penguin/penguin.h
+++ b/samples/opengl/penguin/penguin.h
@@ -79,6 +79,8 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxString& name = "TestGLCanvas");
+ TestGLCanvas(const TestGLCanvas&) = delete;
+ TestGLCanvas& operator=(const TestGLCanvas&) = delete;
virtual ~TestGLCanvas();
@@ -98,7 +100,6 @@ private:
GLData m_gldata;
DXFRenderer m_renderer;
- wxDECLARE_NO_COPY_CLASS(TestGLCanvas);
wxDECLARE_EVENT_TABLE();
};
diff --git a/samples/opengl/pyramid/makefile.gcc b/samples/opengl/pyramid/makefile.gcc
index fb68628929..9348bf3847 100644
--- a/samples/opengl/pyramid/makefile.gcc
+++ b/samples/opengl/pyramid/makefile.gcc
@@ -214,7 +214,7 @@ ifeq ($(USE_OPENGL),1)
$(OBJS)\pyramid.exe: $(PYRAMID_OBJECTS) $(OBJS)\pyramid_sample_rc.o
$(foreach f,$(subst \,/,$(PYRAMID_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp))
@move /y $@.rsp.tmp $@.rsp >nul
- $(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl -lopengl32 -lglu32 $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme
+ $(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl -lopengl32 $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme
@-del $@.rsp
endif
diff --git a/samples/opengl/pyramid/makefile.vc b/samples/opengl/pyramid/makefile.vc
index fed9a54f8b..58613988f6 100644
--- a/samples/opengl/pyramid/makefile.vc
+++ b/samples/opengl/pyramid/makefile.vc
@@ -422,7 +422,7 @@ clean:
!if "$(USE_OPENGL)" == "1"
$(OBJS)\pyramid.exe: $(PYRAMID_OBJECTS) $(OBJS)\pyramid_sample.res
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\pyramid.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
- $(PYRAMID_OBJECTS) $(PYRAMID_RESOURCES) wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib opengl32.lib glu32.lib $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib
+ $(PYRAMID_OBJECTS) $(PYRAMID_RESOURCES) wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.lib opengl32.lib $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib
<<
!endif
diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp
index a47e2801b2..79dfd835ca 100644
--- a/samples/propgrid/propgrid.cpp
+++ b/samples/propgrid/propgrid.cpp
@@ -339,7 +339,7 @@ public:
SingleChoiceProperty( const wxString& label,
const wxString& name = wxPG_LABEL,
- const wxString& value = wxEmptyString )
+ const wxString& value = wxString() )
: wxStringProperty(label, name, value)
{
// Prepare choices
@@ -812,7 +812,7 @@ void FormMain::OnPropertyGridItemRightClick( wxPropertyGridEvent& event )
}
else
{
- sb->SetStatusText( wxEmptyString );
+ sb->SetStatusText( wxString() );
}
#endif
}
@@ -834,7 +834,7 @@ void FormMain::OnPropertyGridItemDoubleClick( wxPropertyGridEvent& event )
}
else
{
- sb->SetStatusText ( wxEmptyString );
+ sb->SetStatusText ( wxString() );
}
#endif
}
@@ -1280,7 +1280,7 @@ void FormMain::PopulateWithExamples ()
soc.Add( "Look, it continues", 200 );
soc.Add( "Even More", 240 );
soc.Add( "And More", 280 );
- soc.Add( wxEmptyString, 300 );
+ soc.Add( "", 300);
soc.Add( "True End of the List", 320 );
// Test custom colours ([] operator of wxPGChoices returns
@@ -1331,8 +1331,7 @@ void FormMain::PopulateWithExamples ()
pg->SetPropertyHelpString( "Password",
"Has attribute wxPG_STRING_PASSWORD set to true" );
- // String editor with dir selector button. Uses wxEmptyString as name, which
- // is allowed (naturally, in this case property cannot be accessed by name).
+ // String editor with dir selector button.
pg->Append( new wxDirProperty( "DirProperty", wxPG_LABEL, ::wxGetUserHome()) );
pg->SetPropertyAttribute( "DirProperty",
wxPG_DIALOG_TITLE,
@@ -1978,7 +1977,7 @@ FormMain::FormMain(const wxString& title)
//
// Create menu bar
- wxMenu *menuFile = new wxMenu(wxEmptyString, wxMENU_TEAROFF);
+ wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF);
wxMenu *menuTry = new wxMenu;
wxMenu *menuTools1 = new wxMenu;
wxMenu *menuTools2 = new wxMenu;
@@ -2102,7 +2101,7 @@ FormMain::FormMain(const wxString& title)
#if wxUSE_STATUSBAR
// create a status bar
CreateStatusBar(1);
- SetStatusText(wxEmptyString);
+ SetStatusText(wxString());
#endif // wxUSE_STATUSBAR
// Register all editors (SpinCtrl etc.)
@@ -2440,7 +2439,7 @@ void FormMain::OnExtendedKeyNav( wxCommandEvent& WXUNUSED(event) )
// Up, and Down keys for navigating between properties.
wxPropertyGrid* propGrid = m_pPropGridManager->GetGrid();
- propGrid->AddActionTrigger(wxPGKeyboardActions::NextProperty,
+ propGrid->AddActionTrigger(wxPGKeyboardAction::NextProperty,
WXK_RETURN);
propGrid->DedicateKey(WXK_RETURN);
diff --git a/samples/propgrid/sampleprops.cpp b/samples/propgrid/sampleprops.cpp
index a128ac87e3..b305cd82f5 100644
--- a/samples/propgrid/sampleprops.cpp
+++ b/samples/propgrid/sampleprops.cpp
@@ -490,7 +490,7 @@ wxArrayDoubleProperty::wxArrayDoubleProperty (const wxString& label,
// (i.e. can't use comma when comma acts as decimal point in float).
wxChar use_delimiter = ',';
- if (wxString::Format("%.2f",12.34).Find(use_delimiter) >= 0)
+ if ( wxNumberFormatter::GetDecimalSeparator() == use_delimiter )
use_delimiter = ';';
m_delimiter = use_delimiter;
@@ -505,11 +505,11 @@ void wxArrayDoubleProperty::OnSetValue()
}
wxString wxArrayDoubleProperty::ValueToString( wxVariant& value,
- int argFlags ) const
+ wxPGPropValFormatFlags flags ) const
{
wxString s;
- if ( argFlags & wxPG_FULL_VALUE )
+ if ( !!(flags & wxPGPropValFormatFlags::FullValue) )
{
GenerateValueAsString(s,-1,false);
}
@@ -557,7 +557,7 @@ bool wxArrayDoubleProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& v
// Create editor dialog.
wxArrayDoubleEditorDialog dlg;
dlg.SetPrecision(m_precision);
- dlg.Create(pg->GetPanel(), wxEmptyString,
+ dlg.Create(pg->GetPanel(), "",
m_dlgTitle.empty() ? GetLabel() : m_dlgTitle, curValue, m_dlgStyle);
dlg.Move( pg->GetGoodEditorDialogPosition(this,dlg.GetSize()) );
@@ -571,7 +571,7 @@ bool wxArrayDoubleProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& v
return false;
}
-bool wxArrayDoubleProperty::StringToValue( wxVariant& variant, const wxString& text, int ) const
+bool wxArrayDoubleProperty::StringToValue( wxVariant& variant, const wxString& text, wxPGPropValFormatFlags ) const
{
// Add values to a temporary array so that in case
// of error we can opt not to use them.
@@ -632,7 +632,7 @@ wxValidator* wxArrayDoubleProperty::DoGetValidator() const
WX_PG_DOGETVALIDATOR_ENTRY()
wxTextValidator* validator =
- new wxNumericPropertyValidator(wxNumericPropertyValidator::Float);
+ new wxNumericPropertyValidator(wxNumericPropertyValidator::NumericType::Float);
// Accept also a delimiter and space character
validator->AddCharIncludes(m_delimiter);
@@ -707,12 +707,12 @@ wxColour MyColourProperty::GetColour(int index) const
return wxColour();
}
-wxString MyColourProperty::ColourToString(const wxColour& col, int index, int argFlags) const
+wxString MyColourProperty::ColourToString(const wxColour& col, int index, wxPGPropValFormatFlags flags) const
{
if ( index == (int)(m_choices.GetCount() - 1) )
- return wxEmptyString;
+ return wxString();
- return wxColourProperty::ColourToString(col, index, argFlags);
+ return wxColourProperty::ColourToString(col, index, flags);
}
int MyColourProperty::GetCustomColourIndex() const
diff --git a/samples/propgrid/sampleprops.h b/samples/propgrid/sampleprops.h
index 3fa44c1d6e..32927038d2 100644
--- a/samples/propgrid/sampleprops.h
+++ b/samples/propgrid/sampleprops.h
@@ -116,10 +116,16 @@ public:
virtual ~wxArrayDoubleProperty() = default;
virtual void OnSetValue() override;
- virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ // To prevent warnings that obsolete methods are hidden by overloads with new signature.
+ using wxEditorDialogProperty::ValueToString;
+ using wxEditorDialogProperty::StringToValue;
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ValueToString(wxVariant& value,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool StringToValue( wxVariant& variant,
const wxString& text,
- int argFlags = 0 ) const override;
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null ) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
// Generates cache for displayed text
@@ -150,8 +156,12 @@ public:
virtual wxColour GetColour(int index) const override;
- virtual wxString ColourToString(const wxColour& col,
- int index, int argFlags = 0) const override;
+#if WXWIN_COMPATIBILITY_3_2
+ // To prevent warning that obsolete method is hidden by overload with new signature.
+ using wxColourProperty::ColourToString;
+#endif // WXWIN_COMPATIBILITY_3_2
+ virtual wxString ColourToString(const wxColour& col, int index,
+ wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual int GetCustomColourIndex() const override;
};
diff --git a/samples/splitter/splitter.cpp b/samples/splitter/splitter.cpp
index 441ae97214..cee9eafc03 100644
--- a/samples/splitter/splitter.cpp
+++ b/samples/splitter/splitter.cpp
@@ -71,16 +71,19 @@ class MyApp: public wxApp
{
public:
MyApp() { }
+ MyApp(const MyApp&) = delete;
+ MyApp& operator=(const MyApp&) = delete;
virtual bool OnInit() override;
-
- wxDECLARE_NO_COPY_CLASS(MyApp);
};
class MyFrame: public wxFrame
{
public:
MyFrame();
+ MyFrame(const MyFrame&) = delete;
+ MyFrame& operator=(const MyFrame&) = delete;
+
virtual ~MyFrame();
void ToggleFlag(int flag, bool enable);
@@ -126,22 +129,24 @@ public:
int GetSashPos() const { return m_sashPos; }
private:
- wxWindow *m_left, *m_right;
+ wxWindow *m_left = nullptr,
+ *m_right = nullptr;
- wxSplitterWindow* m_splitter;
- wxWindow *m_replacewindow;
- int m_sashPos;
- bool m_lockSash;
- bool m_allowDClick;
+ wxSplitterWindow* m_splitter = nullptr;
+ wxWindow *m_replacewindow = nullptr;
+ int m_sashPos = 0;
+ bool m_lockSash = false;
+ bool m_allowDClick = true;
wxDECLARE_EVENT_TABLE();
- wxDECLARE_NO_COPY_CLASS(MyFrame);
};
class MySplitterWindow : public wxSplitterWindow
{
public:
MySplitterWindow(MyFrame *parent);
+ MySplitterWindow(const MySplitterWindow&) = delete;
+ MySplitterWindow &operator=(const MySplitterWindow &) = delete;
// event handlers
void OnPositionChanged(wxSplitterEvent& event);
@@ -154,21 +159,21 @@ private:
MyFrame *m_frame;
wxDECLARE_EVENT_TABLE();
- wxDECLARE_NO_COPY_CLASS(MySplitterWindow);
};
class MyCanvas: public wxScrolledWindow
{
public:
MyCanvas(wxWindow* parent, bool mirror);
+ MyCanvas(const MyCanvas&) = delete;
+ MyCanvas &operator=(const MyCanvas &) = delete;
+
virtual ~MyCanvas(){}
virtual void OnDraw(wxDC& dc) override;
private:
bool m_mirror;
-
- wxDECLARE_NO_COPY_CLASS(MyCanvas);
};
// ============================================================================
@@ -225,13 +230,8 @@ wxEND_EVENT_TABLE()
// My frame constructor
MyFrame::MyFrame()
- : wxFrame(nullptr, wxID_ANY, "wxSplitterWindow sample",
- wxDefaultPosition, wxSize(420, 300))
+ : wxFrame(nullptr, wxID_ANY, "wxSplitterWindow sample")
{
- m_lockSash = false;
- m_sashPos = 0;
- m_allowDClick = true;
-
SetIcon(wxICON(sample));
#if wxUSE_STATUSBAR
@@ -254,7 +254,7 @@ MyFrame::MyFrame()
"Toggle sash invisibility");
splitMenu->AppendSeparator();
- splitMenu->AppendCheckItem(SPLIT_LIVE,
+ auto itemLive = splitMenu->AppendCheckItem(SPLIT_LIVE,
"&Live update\tCtrl-L",
"Toggle live update mode");
splitMenu->AppendCheckItem(SPLIT_BORDER,
@@ -306,6 +306,12 @@ MyFrame::MyFrame()
menuBar->Check(SPLIT_LIVE, true);
m_splitter = new MySplitterWindow(this);
+ if ( m_splitter->AlwaysUsesLiveUpdate() )
+ {
+ // Only live update mode is supported, so this menu item can't be used.
+ itemLive->Enable(false);
+ }
+
// If you use non-zero gravity you must initialize the splitter with its
// correct initial size, otherwise it will change the sash position by a
// huge amount when it's resized from its initial default size to its real
@@ -334,14 +340,14 @@ MyFrame::MyFrame()
m_splitter->Initialize(m_left);
#else
// you can also try -100
- m_splitter->SplitVertically(m_left, m_right, 100);
+ m_splitter->SplitVertically(m_left, m_right, FromDIP(100));
#endif
#if wxUSE_STATUSBAR
SetStatusText("Min pane size = 0", 1);
#endif // wxUSE_STATUSBAR
- m_replacewindow = nullptr;
+ SetInitialSize(FromDIP(wxSize(420, 300)));
}
MyFrame::~MyFrame()
@@ -625,13 +631,13 @@ void MyCanvas::OnDraw(wxDC& dcOrig)
wxMirrorDC dc(dcOrig, m_mirror);
dc.SetPen(*wxBLACK_PEN);
- dc.DrawLine(0, 0, 100, 200);
+ dc.DrawLine(wxPoint(0, 0), dc.FromDIP(wxPoint(100, 200)));
dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
- dc.DrawText("Testing", 50, 50);
+ dc.DrawText("Testing", dc.FromDIP(wxPoint(50, 50)));
dc.SetPen(*wxRED_PEN);
dc.SetBrush(*wxGREEN_BRUSH);
- dc.DrawRectangle(120, 120, 100, 80);
+ dc.DrawRectangle(dc.FromDIP(wxPoint(120, 120)), dc.FromDIP(wxSize(100, 80)));
}
diff --git a/samples/statbar/statbar.cpp b/samples/statbar/statbar.cpp
index 0887f1b027..26d06db1b8 100644
--- a/samples/statbar/statbar.cpp
+++ b/samples/statbar/statbar.cpp
@@ -94,7 +94,6 @@ public:
#if wxUSE_TIMER
void OnTimer(wxTimerEvent& WXUNUSED(event)) { UpdateClock(); }
#endif
- void OnSize(wxSizeEvent& event);
void OnToggleClock(wxCommandEvent& event);
void OnIdle(wxIdleEvent& event);
@@ -223,7 +222,6 @@ enum
StatusBar_SetStyleShowTips
};
-static const int BITMAP_SIZE_X = 32;
// ----------------------------------------------------------------------------
// event tables and other macros for wxWidgets
@@ -271,7 +269,6 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
wxEND_EVENT_TABLE()
wxBEGIN_EVENT_TABLE(MyStatusBar, wxStatusBar)
- EVT_SIZE(MyStatusBar::OnSize)
#if wxUSE_CHECKBOX
EVT_CHECKBOX(StatusBar_Checkbox, MyStatusBar::OnToggleClock)
#endif
@@ -925,7 +922,7 @@ MyStatusBar::MyStatusBar(wxWindow *parent, long style)
int widths[Field_Max];
widths[Field_Text] = -1; // growable
widths[Field_Checkbox] = 150;
- widths[Field_Bitmap] = BITMAP_SIZE_X;
+ widths[Field_Bitmap] = -1; // growable
widths[Field_NumLockIndicator] = sizeNumLock.x;
widths[Field_Clock] = 100;
widths[Field_CapsLockIndicator] = dc.GetTextExtent(capslockIndicators[1]).x;
@@ -936,9 +933,11 @@ MyStatusBar::MyStatusBar(wxWindow *parent, long style)
#if wxUSE_CHECKBOX
m_checkbox = new wxCheckBox(this, StatusBar_Checkbox, "&Toggle clock");
m_checkbox->SetValue(true);
+ AddFieldControl(Field_Checkbox, m_checkbox);
#endif
m_statbmp = new wxStaticBitmap(this, wxID_ANY, wxIcon(green_xpm));
+ AddFieldControl(Field_Bitmap, m_statbmp);
#if wxUSE_TIMER
m_timer.Start(1000);
@@ -964,35 +963,6 @@ MyStatusBar::~MyStatusBar()
#endif
}
-void MyStatusBar::OnSize(wxSizeEvent& event)
-{
-#if wxUSE_CHECKBOX
- if ( !m_checkbox )
- return;
-#endif
-
- wxRect rect;
- if (!GetFieldRect(Field_Checkbox, rect))
- {
- event.Skip();
- return;
- }
-
-#if wxUSE_CHECKBOX
- wxRect rectCheck = rect;
- rectCheck.Deflate(2);
- m_checkbox->SetSize(rectCheck);
-#endif
-
- GetFieldRect(Field_Bitmap, rect);
- wxSize size = m_statbmp->GetSize();
-
- m_statbmp->Move(rect.x + (rect.width - size.x) / 2,
- rect.y + (rect.height - size.y) / 2);
-
- event.Skip();
-}
-
void MyStatusBar::OnToggleClock(wxCommandEvent& WXUNUSED(event))
{
DoToggle();
diff --git a/samples/widgets/button.cpp b/samples/widgets/button.cpp
index d9b7b750ee..da02a26668 100644
--- a/samples/widgets/button.cpp
+++ b/samples/widgets/button.cpp
@@ -374,7 +374,7 @@ void ButtonWidgetsPage::CreateContent()
#endif
// right pane
- m_sizerButton = new wxBoxSizer(wxHORIZONTAL);
+ m_sizerButton = new wxBoxSizer(wxVERTICAL);
m_sizerButton->SetMinSize(FromDIP(150), 0);
// the 3 panes panes compose the window
@@ -612,7 +612,7 @@ void ButtonWidgetsPage::CreateButton()
m_sizerButton->AddStretchSpacer();
m_sizerButton->Add(m_button, wxSizerFlags().Centre().Border());
- m_sizerButton->AddStretchSpacer();
+ m_sizerButton->AddStretchSpacer(2);
m_sizerButton->Layout();
}
diff --git a/samples/widgets/combobox.cpp b/samples/widgets/combobox.cpp
index 7f57b10556..af2d78050f 100644
--- a/samples/widgets/combobox.cpp
+++ b/samples/widgets/combobox.cpp
@@ -259,6 +259,15 @@ void ComboboxWidgetsPage::CreateContent()
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// upper left pane
+ wxStaticBoxSizer *sizerLeftTop = new wxStaticBoxSizer(wxVERTICAL, this, "&Popup");
+ wxStaticBox* const sizerLeftTopBox = sizerLeftTop->GetStaticBox();
+
+ sizerLeftTop->Add(new wxButton(sizerLeftTopBox, ComboPage_Popup, "&Show"),
+ wxSizerFlags().Border().Centre());
+ sizerLeftTop->Add(new wxButton(sizerLeftTopBox, ComboPage_Dismiss, "&Hide"),
+ wxSizerFlags().Border().Centre());
+
+ // lower left pane
// should be in sync with ComboKind_XXX values
static const wxString kinds[] =
@@ -268,32 +277,23 @@ void ComboboxWidgetsPage::CreateContent()
"drop down",
};
- wxStaticBoxSizer *sizerLeftTop = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
- wxStaticBox* const sizerLeftTopBox = sizerLeftTop->GetStaticBox();
+ wxStaticBoxSizer *sizerLeftBottom = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style");
+ wxStaticBox* const sizerLeftBottomBox = sizerLeftBottom->GetStaticBox();
- m_radioKind = new wxRadioBox(sizerLeftTopBox, wxID_ANY, "Combobox &kind:",
+ m_radioKind = new wxRadioBox(sizerLeftBottomBox, wxID_ANY, "Combobox &kind:",
wxDefaultPosition, wxDefaultSize,
WXSIZEOF(kinds), kinds,
1, wxRA_SPECIFY_COLS);
- m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeftTop, "&Sort items", wxID_ANY, sizerLeftTopBox);
- m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerLeftTop, "&Read only", wxID_ANY, sizerLeftTopBox);
- m_chkProcessEnter = CreateCheckBoxAndAddToSizer(sizerLeftTop, "Process &Enter", wxID_ANY, sizerLeftTopBox);
+ m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeftBottom, "&Sort items", wxID_ANY, sizerLeftBottomBox);
+ m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerLeftBottom, "&Read only", wxID_ANY, sizerLeftBottomBox);
+ m_chkProcessEnter = CreateCheckBoxAndAddToSizer(sizerLeftBottom, "Process &Enter", wxID_ANY, sizerLeftBottomBox);
- sizerLeftTop->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
- sizerLeftTop->Add(m_radioKind, 0, wxGROW | wxALL, 5);
+ sizerLeftBottom->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
+ sizerLeftBottom->Add(m_radioKind, 0, wxGROW | wxALL, 5);
- wxButton *btn = new wxButton(sizerLeftTopBox, ComboPage_Reset, "&Reset");
- sizerLeftTop->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
-
- // lower left pane
- wxStaticBoxSizer *sizerLeftBottom = new wxStaticBoxSizer(wxVERTICAL, this, "&Popup");
- wxStaticBox* const sizerLeftBottomBox = sizerLeftBottom->GetStaticBox();
-
- sizerLeftBottom->Add(new wxButton(sizerLeftBottomBox, ComboPage_Popup, "&Show"),
- wxSizerFlags().Border().Centre());
- sizerLeftBottom->Add(new wxButton(sizerLeftBottomBox, ComboPage_Dismiss, "&Hide"),
- wxSizerFlags().Border().Centre());
+ wxButton *btn = new wxButton(sizerLeftBottomBox, ComboPage_Reset, "&Reset");
+ sizerLeftBottom->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
wxSizer *sizerLeft = new wxBoxSizer(wxVERTICAL);
diff --git a/samples/widgets/itemcontainer.cpp b/samples/widgets/itemcontainer.cpp
index 30b02d1c82..47cda198c7 100644
--- a/samples/widgets/itemcontainer.cpp
+++ b/samples/widgets/itemcontainer.cpp
@@ -40,6 +40,8 @@ public:
{
m_tracker->StartTrackingData();
}
+ TrackedClientData(const TrackedClientData&) = delete;
+ TrackedClientData& operator=(const TrackedClientData&) = delete;
virtual ~TrackedClientData()
{
@@ -54,8 +56,6 @@ public:
private:
ItemContainerWidgetsPage *m_tracker;
int m_value;
-
- wxDECLARE_NO_COPY_CLASS(TrackedClientData);
};
// ============================================================================
diff --git a/samples/widgets/widgets.cpp b/samples/widgets/widgets.cpp
index c9d0b41593..9add0d857d 100644
--- a/samples/widgets/widgets.cpp
+++ b/samples/widgets/widgets.cpp
@@ -37,6 +37,9 @@
#include "wx/msgdlg.h"
#endif
+#include "wx/config.h"
+#include "wx/stdpaths.h"
+
#include "wx/sysopt.h"
#include "wx/bookctrl.h"
#include "wx/treebook.h"
@@ -141,7 +144,33 @@ public:
#if USE_LOG
m_logTarget = nullptr;
#endif // USE_LOG
+
+#ifdef wxHAS_CONFIG_AS_FILECONFIG
+ // We want to put our config file (implicitly created for persistent
+ // controls settings) in XDG-compliant location, so we want to change
+ // the default file layout, but before doing this migrate any existing
+ // config files to the new location as the previous versions of this
+ // sample didn't use XDG layout.
+ const auto
+ res = wxFileConfig::MigrateLocalFile("widgets", wxCONFIG_USE_XDG);
+ if ( !res.oldPath.empty() )
+ {
+ if ( res.error.empty() )
+ {
+ wxLogMessage("Config file was migrated from \"%s\" to \"%s\"",
+ res.oldPath, res.newPath);
+ }
+ else
+ {
+ wxLogWarning("Migrating old config failed: %s.", res.error);
+ }
+ }
+
+ wxStandardPaths::Get().SetFileLayout(wxStandardPaths::FileLayout_XDG);
+#endif // wxHAS_CONFIG_AS_FILECONFIG
}
+ WidgetsApp(const WidgetsApp&) = delete;
+ WidgetsApp& operator=(const WidgetsApp&) = delete;
// override base class virtuals
// ----------------------------
@@ -158,8 +187,6 @@ private:
#if USE_LOG
wxLog* m_logTarget;
#endif // USE_LOG
-
- wxDECLARE_NO_COPY_CLASS(WidgetsApp);
};
wxDECLARE_APP(WidgetsApp); // This provides a convenient wxGetApp() accessor.
@@ -506,8 +533,9 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
// Uncomment to suppress page theme (draw in solid colour)
//style |= wxNB_NOPAGETHEME;
+ // Give it some reasonably big minimal size by default.
m_book = new WidgetsBookCtrl(m_panel, Widgets_BookCtrl,
- wxDefaultPosition, wxDefaultSize,
+ wxDefaultPosition, FromDIP(wxSize(900, 500)),
style, "Widgets");
InitBook();
@@ -771,7 +799,8 @@ void WidgetsFrame::OnPageChanged(WidgetsBookCtrlEvent& event)
{
wxWindowUpdateLocker noUpdates(curPage);
curPage->CreateContent();
- curPage->Layout();
+ curPage->SetScrollRate(10, 10);
+ curPage->FitInside();
ConnectToWidgetEvents();
}
@@ -1321,10 +1350,9 @@ WidgetsPageInfo *WidgetsPage::ms_widgetPages = nullptr;
WidgetsPage::WidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist,
const char *const icon[])
- : wxPanel(book, wxID_ANY,
+ : wxScrolledWindow(book, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
- wxCLIP_CHILDREN |
- wxTAB_TRAVERSAL)
+ wxCLIP_CHILDREN | wxTAB_TRAVERSAL)
{
imaglist->Add(wxBitmap(wxImage(icon).Scale(ICON_SIZE, ICON_SIZE)));
}
diff --git a/samples/widgets/widgets.h b/samples/widgets/widgets.h
index 3f934cb4d6..c89acaec5c 100644
--- a/samples/widgets/widgets.h
+++ b/samples/widgets/widgets.h
@@ -46,7 +46,7 @@ class WXDLLIMPEXP_FWD_CORE WidgetsBookCtrl;
class WidgetsPageInfo;
-#include "wx/panel.h"
+#include "wx/scrolwin.h"
#include "wx/vector.h"
// INTRODUCING NEW PAGES DON'T FORGET TO ADD ENTRIES TO 'WidgetsCategories'
@@ -119,7 +119,7 @@ struct WidgetAttributes
long m_defaultFlags;
};
-class WidgetsPage : public wxPanel
+class WidgetsPage : public wxScrolledWindow
{
public:
WidgetsPage(WidgetsBookCtrl *book,
diff --git a/src/aui/auibar.cpp b/src/aui/auibar.cpp
index 0a70bbcc1a..91fe377cb7 100644
--- a/src/aui/auibar.cpp
+++ b/src/aui/auibar.cpp
@@ -1412,6 +1412,8 @@ void wxAuiToolBar::SetOrientation(int orientation)
{
m_orientation = wxOrientation(orientation);
SetArtFlags();
+
+ Realize();
}
}
@@ -1873,39 +1875,51 @@ bool wxAuiToolBar::Realize()
if (!dc.IsOk())
return false;
- // calculate hint sizes for both horizontal and vertical
- // in the order that leaves toolbar in correct final state
- bool retval = false;
+ // calculate hint sizes for both horizontal and vertical orientations if we
+ // can use them, i.e. if the toolbar isn't locked into just one of them, and
+ // store the size appropriate for the current orientation in this variable.
+ wxSize size;
if (m_orientation == wxHORIZONTAL)
{
- if (RealizeHelper(dc, false))
- {
- m_vertHintSize = GetSize();
- if (RealizeHelper(dc, true))
- {
- m_horzHintSize = GetSize();
- retval = true;
- }
- }
+ if (!HasFlag(wxAUI_TB_HORIZONTAL))
+ m_vertHintSize = RealizeHelper(dc, wxVERTICAL);
+
+ m_horzHintSize = RealizeHelper(dc, wxHORIZONTAL);
+
+ size = m_horzHintSize;
}
else
{
- if (RealizeHelper(dc, true))
- {
- m_horzHintSize = GetSize();
- if (RealizeHelper(dc, false))
- {
- m_vertHintSize = GetSize();
- retval = true;
- }
- }
+ if (!HasFlag(wxAUI_TB_VERTICAL))
+ m_horzHintSize = RealizeHelper(dc, wxHORIZONTAL);
+
+ m_vertHintSize = RealizeHelper(dc, wxVERTICAL);
+
+ size = m_vertHintSize;
+ }
+
+ // Remember our minimum size.
+ m_minWidth = size.x;
+ m_minHeight = size.y;
+
+ // And set control size if we are not forbidden from doing it by the use of
+ // a special flag and if it did actually change.
+ wxSize curSize = GetClientSize();
+
+ if ((m_windowStyle & wxAUI_TB_NO_AUTORESIZE) == 0 && (size != curSize))
+ {
+ SetClientSize(size);
+ }
+ else // Don't change the size but let the sizer know about available size.
+ {
+ m_sizer->SetDimension(0, 0, curSize.x, curSize.y);
}
Refresh(false);
- return retval;
+ return true;
}
-bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal)
+wxSize wxAuiToolBar::RealizeHelper(wxClientDC& dc, wxOrientation orientation)
{
// Remove old sizer before adding any controls in this tool bar, which are
// elements of this sizer, to the new sizer below.
@@ -1913,17 +1927,15 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal)
m_sizer = nullptr;
// create the new sizer to add toolbar elements to
- wxBoxSizer* sizer = new wxBoxSizer(horizontal ? wxHORIZONTAL : wxVERTICAL);
+ wxBoxSizer* sizer = new wxBoxSizer(orientation);
// add gripper area
int separatorSize = m_art->GetElementSize(wxAUI_TBART_SEPARATOR_SIZE);
int gripperSize = m_art->GetElementSize(wxAUI_TBART_GRIPPER_SIZE);
if (gripperSize > 0 && m_gripperVisible)
{
- if (horizontal)
- m_gripperSizerItem = sizer->Add(gripperSize, 1, 0, wxEXPAND);
- else
- m_gripperSizerItem = sizer->Add(1, gripperSize, 0, wxEXPAND);
+ m_gripperSizerItem = sizer->AddSpacer(gripperSize);
+ m_gripperSizerItem->SetFlag(wxEXPAND);
}
else
{
@@ -1933,10 +1945,7 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal)
// add "left" padding
if (m_leftPadding > 0)
{
- if (horizontal)
- sizer->Add(m_leftPadding, 1);
- else
- sizer->Add(1, m_leftPadding);
+ sizer->AddSpacer(m_leftPadding);
}
size_t i, count;
@@ -1982,10 +1991,8 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal)
case wxITEM_SEPARATOR:
{
- if (horizontal)
- sizerItem = sizer->Add(separatorSize, 1, 0, wxEXPAND);
- else
- sizerItem = sizer->Add(1, separatorSize, 0, wxEXPAND);
+ sizerItem = sizer->AddSpacer(separatorSize);
+ sizerItem->SetFlag(wxEXPAND);
// add tool packing
if (i+1 < count)
@@ -2052,10 +2059,7 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal)
// add "right" padding
if (m_rightPadding > 0)
{
- if (horizontal)
- sizer->Add(m_rightPadding, 1);
- else
- sizer->Add(1, m_rightPadding);
+ sizer->AddSpacer(m_rightPadding);
}
// add drop down area
@@ -2066,10 +2070,8 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal)
int overflow_size = m_art->GetElementSize(wxAUI_TBART_OVERFLOW_SIZE);
if (overflow_size > 0 && m_overflowVisible)
{
- if (horizontal)
- m_overflowSizerItem = sizer->Add(overflow_size, 1, 0, wxEXPAND);
- else
- m_overflowSizerItem = sizer->Add(1, overflow_size, 0, wxEXPAND);
+ m_overflowSizerItem = sizer->AddSpacer(overflow_size);
+ m_overflowSizerItem->SetFlag(wxEXPAND);
m_overflowSizerItem->SetMinSize(m_overflowSizerItem->GetSize());
}
else
@@ -2080,15 +2082,12 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal)
// the outside sizer helps us apply the "top" and "bottom" padding
- wxBoxSizer* outside_sizer = new wxBoxSizer(horizontal ? wxVERTICAL : wxHORIZONTAL);
+ wxBoxSizer* outside_sizer = new wxBoxSizer(orientation ^ wxBOTH);
// add "top" padding
if (m_topPadding > 0)
{
- if (horizontal)
- outside_sizer->Add(1, m_topPadding);
- else
- outside_sizer->Add(m_topPadding, 1);
+ outside_sizer->AddSpacer(m_topPadding);
}
// add the sizer that contains all of the toolbar elements
@@ -2097,10 +2096,7 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal)
// add "bottom" padding
if (m_bottomPadding > 0)
{
- if (horizontal)
- outside_sizer->Add(1, m_bottomPadding);
- else
- outside_sizer->Add(m_bottomPadding, 1);
+ outside_sizer->AddSpacer(m_bottomPadding);
}
m_sizer = outside_sizer;
@@ -2123,31 +2119,7 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal)
item.m_sizerItem->SetMinSize(item.m_minSize);
}
- // set control size
- wxSize size = m_sizer->GetMinSize();
- m_minWidth = size.x;
- m_minHeight = size.y;
-
- if ((m_windowStyle & wxAUI_TB_NO_AUTORESIZE) == 0)
- {
- wxSize curSize = GetClientSize();
- wxSize new_size = GetMinSize();
- if (new_size != curSize)
- {
- SetClientSize(new_size);
- }
- else
- {
- m_sizer->SetDimension(0, 0, curSize.x, curSize.y);
- }
- }
- else
- {
- wxSize curSize = GetClientSize();
- m_sizer->SetDimension(0, 0, curSize.x, curSize.y);
- }
-
- return true;
+ return m_sizer->GetMinSize();
}
int wxAuiToolBar::GetOverflowState() const
@@ -2374,7 +2346,7 @@ void wxAuiToolBar::OnIdle(wxIdleEvent& evt)
if (newOrientation != m_orientation)
{
SetOrientation(newOrientation);
- Realize();
+
if (newOrientation == wxHORIZONTAL)
{
pane.best_size = GetHintSize(wxAUI_DOCK_TOP);
diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp
index 035e763edb..0ccb258efb 100644
--- a/src/aui/auibook.cpp
+++ b/src/aui/auibook.cpp
@@ -400,6 +400,15 @@ void wxAuiTabContainer::SetTabOffset(size_t offset)
+int wxAuiTabContainer::GetCloseButtonState(const wxAuiNotebookPage& page) const
+{
+ // determine if a close button is on this tab
+ return ((m_flags & wxAUI_NB_CLOSE_ON_ALL_TABS) != 0 ||
+ ((m_flags & wxAUI_NB_CLOSE_ON_ACTIVE_TAB) != 0 && page.active))
+ ? wxAUI_BUTTON_STATE_NORMAL
+ : wxAUI_BUTTON_STATE_HIDDEN;
+}
+
// Render() renders the tab catalog to the specified DC
// It is a virtual function and can be overridden to
@@ -446,24 +455,13 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
{
wxAuiNotebookPage& page = m_pages.Item(i);
- // determine if a close button is on this tab
- bool close_button = false;
- if ((m_flags & wxAUI_NB_CLOSE_ON_ALL_TABS) != 0 ||
- ((m_flags & wxAUI_NB_CLOSE_ON_ACTIVE_TAB) != 0 && page.active))
- {
- close_button = true;
- }
-
-
int x_extent = 0;
wxSize size = m_art->GetTabSize(dc,
wnd,
page.caption,
page.bitmap,
page.active,
- close_button ?
- wxAUI_BUTTON_STATE_NORMAL :
- wxAUI_BUTTON_STATE_HIDDEN,
+ GetCloseButtonState(page),
&x_extent);
if (i+1 < page_count)
@@ -798,7 +796,6 @@ bool wxAuiTabContainer::IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWin
for (i = tabOffset; i < page_count; ++i)
{
wxAuiNotebookPage& page = m_pages.Item(i);
- wxAuiTabContainerButton& tab_button = m_tabCloseButtons.Item(i);
rect.width = m_rect.width - right_buttons_width - offset - wnd->FromDIP(2);
@@ -811,7 +808,7 @@ bool wxAuiTabContainer::IsTabVisible(int tabPage, int tabOffset, wxDC* dc, wxWin
page.caption,
page.bitmap,
page.active,
- tab_button.curState,
+ GetCloseButtonState(page),
&x_extent);
offset += x_extent;
@@ -1019,6 +1016,12 @@ wxAuiTabCtrl::~wxAuiTabCtrl()
{
}
+void wxAuiTabCtrl::DoShowTab(int idx)
+{
+ DoShowHide();
+ MakeTabVisible(idx, this);
+}
+
void wxAuiTabCtrl::DoEndDragging()
{
m_clickPt = wxDefaultPosition;
@@ -1081,7 +1084,7 @@ void wxAuiTabCtrl::OnLeftDown(wxMouseEvent& evt)
e.SetSelection(new_selection);
e.SetOldSelection(GetActivePage());
e.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
}
m_clickPt.x = evt.m_x;
@@ -1110,7 +1113,7 @@ void wxAuiTabCtrl::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event))
evt.SetSelection(GetIdxFromWindow(clickTab));
evt.SetOldSelection(evt.GetSelection());
evt.SetEventObject(this);
- GetEventHandler()->ProcessEvent(evt);
+ ProcessWindowEvent(evt);
}
}
@@ -1129,7 +1132,7 @@ void wxAuiTabCtrl::OnLeftUp(wxMouseEvent& evt)
e.SetSelection(GetIdxFromWindow(clickTab));
e.SetOldSelection(e.GetSelection());
e.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
return;
}
@@ -1157,7 +1160,7 @@ void wxAuiTabCtrl::OnLeftUp(wxMouseEvent& evt)
e.SetSelection(GetIdxFromWindow(m_clickTab));
e.SetInt(m_pressedButton->id);
e.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
}
m_pressedButton = nullptr;
@@ -1175,7 +1178,7 @@ void wxAuiTabCtrl::OnMiddleUp(wxMouseEvent& evt)
wxAuiNotebookEvent e(wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP, m_windowId);
e.SetEventObject(this);
e.SetSelection(GetIdxFromWindow(wnd));
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
}
void wxAuiTabCtrl::OnMiddleDown(wxMouseEvent& evt)
@@ -1187,7 +1190,7 @@ void wxAuiTabCtrl::OnMiddleDown(wxMouseEvent& evt)
wxAuiNotebookEvent e(wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, m_windowId);
e.SetEventObject(this);
e.SetSelection(GetIdxFromWindow(wnd));
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
}
void wxAuiTabCtrl::OnRightUp(wxMouseEvent& evt)
@@ -1199,7 +1202,7 @@ void wxAuiTabCtrl::OnRightUp(wxMouseEvent& evt)
wxAuiNotebookEvent e(wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, m_windowId);
e.SetEventObject(this);
e.SetSelection(GetIdxFromWindow(wnd));
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
}
void wxAuiTabCtrl::OnRightDown(wxMouseEvent& evt)
@@ -1211,7 +1214,7 @@ void wxAuiTabCtrl::OnRightDown(wxMouseEvent& evt)
wxAuiNotebookEvent e(wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, m_windowId);
e.SetEventObject(this);
e.SetSelection(GetIdxFromWindow(wnd));
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
}
void wxAuiTabCtrl::OnLeftDClick(wxMouseEvent& evt)
@@ -1222,7 +1225,7 @@ void wxAuiTabCtrl::OnLeftDClick(wxMouseEvent& evt)
{
wxAuiNotebookEvent e(wxEVT_AUINOTEBOOK_BG_DCLICK, m_windowId);
e.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
}
}
@@ -1295,7 +1298,7 @@ void wxAuiTabCtrl::OnMotion(wxMouseEvent& evt)
e.SetSelection(GetIdxFromWindow(m_clickTab));
e.SetOldSelection(e.GetSelection());
e.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
return;
}
@@ -1310,7 +1313,7 @@ void wxAuiTabCtrl::OnMotion(wxMouseEvent& evt)
e.SetSelection(GetIdxFromWindow(m_clickTab));
e.SetOldSelection(e.GetSelection());
e.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
m_isDragging = true;
}
@@ -1361,7 +1364,7 @@ void wxAuiTabCtrl::OnButton(wxAuiNotebookEvent& event)
e.SetSelection(idx);
e.SetOldSelection(GetActivePage());
e.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
}
}
else
@@ -1437,7 +1440,7 @@ void wxAuiTabCtrl::OnChar(wxKeyEvent& event)
keyEvent.SetFromTab(bFromTab);
keyEvent.SetEventObject(nb);
- if (!nb->GetEventHandler()->ProcessEvent(keyEvent))
+ if (!nb->ProcessWindowEvent(keyEvent))
{
// Not processed? Do an explicit tab into the page.
wxWindow* win = GetWindowFromIdx(GetActivePage());
@@ -1504,7 +1507,7 @@ void wxAuiTabCtrl::OnChar(wxKeyEvent& event)
e.SetSelection(newPage);
e.SetOldSelection(newPage);
e.SetEventObject(this);
- this->GetEventHandler()->ProcessEvent(e);
+ this->ProcessWindowEvent(e);
}
else
event.Skip();
@@ -2119,12 +2122,12 @@ bool wxAuiNotebook::RemovePage(size_t page_idx)
if (is_active_in_split)
{
- int ctrl_new_page_count = (int)ctrl->GetPageCount();
+ const int ctrl_new_page_count = (int)ctrl->GetPageCount();
if (ctrl_idx >= ctrl_new_page_count)
ctrl_idx = ctrl_new_page_count-1;
- if (ctrl_idx >= 0 && ctrl_idx < (int)ctrl->GetPageCount())
+ if (ctrl_idx >= 0 && ctrl_idx < ctrl_new_page_count)
{
// set new page as active in the tab split
ctrl->SetActivePage(ctrl_idx);
@@ -2136,6 +2139,15 @@ bool wxAuiNotebook::RemovePage(size_t page_idx)
{
new_active = ctrl->GetWindowFromIdx(ctrl_idx);
}
+ else // not deleting the globally active page
+ {
+ // so don't change the current one
+ new_active = active_wnd;
+
+ // but we still need to show the new active page in this
+ // control, otherwise it wouldn't be updated
+ ctrl->DoShowTab(ctrl_idx);
+ }
}
}
else
@@ -2311,7 +2323,7 @@ void wxAuiNotebook::SetSelectionToWindow(wxWindow *win)
if (parent)
{
wxChildFocusEvent eventFocus(this);
- parent->GetEventHandler()->ProcessEvent(eventFocus);
+ parent->ProcessWindowEvent(eventFocus);
}
@@ -2570,7 +2582,7 @@ void wxAuiNotebook::OnTabBgDClick(wxAuiNotebookEvent& evt)
// notify owner that the tabbar background has been double-clicked
wxAuiNotebookEvent e(wxEVT_AUINOTEBOOK_BG_DCLICK, m_windowId);
e.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
}
void wxAuiNotebook::OnTabBeginDrag(wxAuiNotebookEvent&)
@@ -2726,10 +2738,7 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt)
wxPoint mouse_screen_pt = ::wxGetMousePosition();
wxPoint mouse_client_pt = ScreenToClient(mouse_screen_pt);
- // Update our selection (it may be updated again below but the code below
- // can also return without doing anything else and this ensures that the
- // selection is updated even then).
- m_curPage = src_tabs->GetActivePage();
+
// check for an external move
if (m_flags & wxAUI_NB_TAB_EXTERNAL_MOVE)
@@ -2758,7 +2767,7 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt)
e.SetDragSource(this);
e.Veto(); // dropping must be explicitly approved by control owner
- nb->GetEventHandler()->ProcessEvent(e);
+ nb->ProcessWindowEvent(e);
if (!e.IsAllowed())
{
@@ -2829,7 +2838,7 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt)
e2.SetSelection(evt.GetSelection());
e2.SetOldSelection(evt.GetSelection());
e2.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e2);
+ ProcessWindowEvent(e2);
return;
}
@@ -2940,7 +2949,7 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt)
e.SetSelection(evt.GetSelection());
e.SetOldSelection(evt.GetSelection());
e.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
}
@@ -3139,7 +3148,7 @@ void wxAuiNotebook::OnNavigationKeyNotebook(wxNavigationKeyEvent& event)
event.SetEventObject(this);
wxWindow *page = GetPage(GetSelection());
- if ( !page->GetEventHandler()->ProcessEvent(event) )
+ if ( !page->ProcessWindowEvent(event) )
{
page->SetFocus();
}
@@ -3163,7 +3172,7 @@ void wxAuiNotebook::OnNavigationKeyNotebook(wxNavigationKeyEvent& event)
else if ( parent )
{
event.SetCurrentFocus(this);
- parent->GetEventHandler()->ProcessEvent(event);
+ parent->ProcessWindowEvent(event);
}
}
}
@@ -3197,7 +3206,7 @@ void wxAuiNotebook::OnTabButton(wxAuiNotebookEvent& evt)
e.SetSelection(idx);
e.SetOldSelection(evt.GetSelection());
e.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
if (!e.IsAllowed())
return;
@@ -3220,7 +3229,7 @@ void wxAuiNotebook::OnTabButton(wxAuiNotebookEvent& evt)
wxAuiNotebookEvent e2(wxEVT_AUINOTEBOOK_PAGE_CLOSED, m_windowId);
e2.SetSelection(idx);
e2.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e2);
+ ProcessWindowEvent(e2);
}
}
}
@@ -3235,7 +3244,7 @@ void wxAuiNotebook::OnTabMiddleDown(wxAuiNotebookEvent& evt)
wxAuiNotebookEvent e(wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, m_windowId);
e.SetSelection(m_tabs.GetIdxFromWindow(wnd));
e.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
}
void wxAuiNotebook::OnTabMiddleUp(wxAuiNotebookEvent& evt)
@@ -3251,7 +3260,7 @@ void wxAuiNotebook::OnTabMiddleUp(wxAuiNotebookEvent& evt)
wxAuiNotebookEvent e(wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP, m_windowId);
e.SetSelection(m_tabs.GetIdxFromWindow(wnd));
e.SetEventObject(this);
- if (GetEventHandler()->ProcessEvent(e))
+ if (ProcessWindowEvent(e))
return;
if (!e.IsAllowed())
return;
@@ -3274,7 +3283,7 @@ void wxAuiNotebook::OnTabRightDown(wxAuiNotebookEvent& evt)
wxAuiNotebookEvent e(wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, m_windowId);
e.SetSelection(m_tabs.GetIdxFromWindow(wnd));
e.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
}
void wxAuiNotebook::OnTabRightUp(wxAuiNotebookEvent& evt)
@@ -3286,7 +3295,7 @@ void wxAuiNotebook::OnTabRightUp(wxAuiNotebookEvent& evt)
wxAuiNotebookEvent e(wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, m_windowId);
e.SetSelection(m_tabs.GetIdxFromWindow(wnd));
e.SetEventObject(this);
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
}
// Sets the normal font
@@ -3354,7 +3363,7 @@ bool wxAuiNotebook::ShowWindowMenu()
e.SetSelection(idx);
e.SetOldSelection(tabCtrl->GetActivePage());
e.SetEventObject(tabCtrl);
- GetEventHandler()->ProcessEvent(e);
+ ProcessWindowEvent(e);
return true;
}
@@ -3632,7 +3641,7 @@ int wxAuiNotebook::DoModifySelection(size_t n, bool events)
evt.SetSelection(n);
evt.SetOldSelection(m_curPage);
evt.SetEventObject(this);
- GetEventHandler()->ProcessEvent(evt);
+ ProcessWindowEvent(evt);
vetoed = !evt.IsAllowed();
}
@@ -3649,9 +3658,7 @@ int wxAuiNotebook::DoModifySelection(size_t n, bool events)
ctrl->SetActivePage(ctrl_idx);
DoSizing();
- ctrl->DoShowHide();
-
- ctrl->MakeTabVisible(ctrl_idx, ctrl);
+ ctrl->DoShowTab(ctrl_idx);
// set fonts
wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
@@ -3678,7 +3685,7 @@ int wxAuiNotebook::DoModifySelection(size_t n, bool events)
if(events)
{
evt.SetEventType(wxEVT_AUINOTEBOOK_PAGE_CHANGED);
- (void)GetEventHandler()->ProcessEvent(evt);
+ (void)ProcessWindowEvent(evt);
}
return old_curpage;
diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp
index aa2e448e9f..c62b1d848d 100644
--- a/src/aui/framemanager.cpp
+++ b/src/aui/framemanager.cpp
@@ -64,6 +64,8 @@ wxDEFINE_EVENT( wxEVT_AUI_FIND_MANAGER, wxAuiManagerEvent );
#include "wx/msw/dc.h"
#endif
+#include
+
wxIMPLEMENT_DYNAMIC_CLASS(wxAuiManagerEvent, wxEvent);
wxIMPLEMENT_CLASS(wxAuiManager, wxEvtHandler);
@@ -277,16 +279,21 @@ static wxBitmap wxPaneCreateStippleBitmap()
static void DrawResizeHint(wxDC& dc, const wxRect& rect)
{
+#ifdef __WXMSW__
wxBitmap stipple = wxPaneCreateStippleBitmap();
wxBrush brush(stipple);
dc.SetBrush(brush);
-#ifdef __WXMSW__
wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
PatBlt(GetHdcOf(*impl), rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight(), PATINVERT);
#else
- dc.SetPen(*wxTRANSPARENT_PEN);
+ // Note that we have to use white colour for wxINVERT to work with
+ // wxGraphicsContext-based wxDC implementations, such as used by wxGTK3
+ // (and wxOSX, but this code is never used for the latter because it always
+ // uses live resize).
+ dc.SetPen(*wxWHITE_PEN);
+ dc.SetBrush(*wxWHITE_BRUSH);
- dc.SetLogicalFunction(wxXOR);
+ dc.SetLogicalFunction(wxINVERT);
dc.DrawRectangle(rect);
#endif
}
@@ -760,26 +767,17 @@ unsigned int wxAuiManager::GetFlags() const
return m_flags;
}
-// With Core Graphics on Mac or GTK 3, it's not possible to show sash feedback,
-// so we'll always use live update instead.
-#if defined(__WXMAC__) || defined(__WXGTK3__)
- #define wxUSE_AUI_LIVE_RESIZE_ALWAYS 1
-#else
- #define wxUSE_AUI_LIVE_RESIZE_ALWAYS 0
-#endif
-
-/* static */ bool wxAuiManager::AlwaysUsesLiveResize()
+/* static */ bool wxAuiManager::AlwaysUsesLiveResize(const wxWindow* window)
{
- return wxUSE_AUI_LIVE_RESIZE_ALWAYS;
+ // Not using live resize relies on wxClientDC being usable for drawing, so
+ // we have to use live resize if it can't be used on the current platform.
+ return !wxClientDC::CanBeUsedForDrawing(window);
}
bool wxAuiManager::HasLiveResize() const
{
-#if wxUSE_AUI_LIVE_RESIZE_ALWAYS
- return true;
-#else
- return (GetFlags() & wxAUI_MGR_LIVE_RESIZE) == wxAUI_MGR_LIVE_RESIZE;
-#endif
+ return AlwaysUsesLiveResize(m_frame) ||
+ (GetFlags() & wxAUI_MGR_LIVE_RESIZE) == wxAUI_MGR_LIVE_RESIZE;
}
// don't use these anymore as they are deprecated
@@ -844,34 +842,24 @@ void wxAuiManager::UpdateHintWindowConfig()
if ((m_flags & wxAUI_MGR_TRANSPARENT_HINT) && can_do_transparent)
{
// Make a window to use for a transparent hint
- #if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXQT__)
- m_hintWnd = new wxFrame(m_frame, wxID_ANY, wxEmptyString,
- wxDefaultPosition, wxSize(1,1),
- wxFRAME_TOOL_WINDOW |
- wxFRAME_FLOAT_ON_PARENT |
- wxFRAME_NO_TASKBAR |
- wxNO_BORDER);
+ m_hintWnd = new wxFrame(m_frame, wxID_ANY, wxEmptyString,
+ wxDefaultPosition, wxSize(1,1),
+ wxFRAME_TOOL_WINDOW |
+ wxFRAME_FLOAT_ON_PARENT |
+ wxFRAME_NO_TASKBAR |
+ wxNO_BORDER);
+ #ifdef __WXMAC__
+ // Do nothing so this event isn't handled in the base handlers.
- m_hintWnd->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION));
- #elif defined(__WXMAC__)
- // Using a miniframe with float and tool styles keeps the parent
- // frame activated and highlighted as such...
- m_hintWnd = new wxMiniFrame(m_frame, wxID_ANY, wxEmptyString,
- wxDefaultPosition, wxSize(1,1),
- wxFRAME_FLOAT_ON_PARENT
- | wxFRAME_TOOL_WINDOW );
- m_hintWnd->Bind(wxEVT_ACTIVATE, &wxAuiManager::OnHintActivate, this);
-
- // Can't set the bg colour of a Frame in wxMac
- wxPanel* p = new wxPanel(m_hintWnd);
-
- // The default wxSYS_COLOUR_ACTIVECAPTION colour is a light silver
- // color that is really hard to see, especially transparent.
- // Until a better system color is decided upon we'll just use
- // blue.
- p->SetBackgroundColour(*wxBLUE);
+ // Letting the hint window activate without this handler can lead to
+ // weird behaviour on Mac where the menu is switched out to the top
+ // window's menu in MDI applications when it shouldn't be. So since
+ // we don't want user interaction with the hint window anyway, we just
+ // prevent it from activating here.
+ m_hintWnd->Bind(wxEVT_ACTIVATE, [](wxActivateEvent&) {});
#endif
+ m_hintWnd->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT));
}
else
{
@@ -3302,7 +3290,7 @@ void wxAuiManager::OnHintFadeTimer(wxTimerEvent& WXUNUSED(event))
return;
}
- m_hintFadeAmt += 4;
+ m_hintFadeAmt++;
m_hintWnd->SetTransparent(m_hintFadeAmt);
}
@@ -3315,13 +3303,15 @@ void wxAuiManager::ShowHint(const wxRect& rect)
return;
m_lastHint = rect;
- m_hintFadeAmt = m_hintFadeMax;
-
+ // Decide if we want to fade in the hint and set it to the end value if
+ // we don't.
if ((m_flags & wxAUI_MGR_HINT_FADE)
- && !((wxDynamicCast(m_hintWnd, wxPseudoTransparentFrame)) &&
+ && !((m_flags & wxAUI_MGR_VENETIAN_BLINDS_HINT) &&
(m_flags & wxAUI_MGR_NO_VENETIAN_BLINDS_FADE))
)
m_hintFadeAmt = 0;
+ else
+ m_hintFadeAmt = m_hintFadeMax;
m_hintWnd->SetSize(rect);
m_hintWnd->SetTransparent(m_hintFadeAmt);
@@ -3341,7 +3331,7 @@ void wxAuiManager::ShowHint(const wxRect& rect)
{
// start fade in timer
m_hintFadeTimer.SetOwner(this);
- m_hintFadeTimer.Start(5);
+ m_hintFadeTimer.Start(15);
Bind(wxEVT_TIMER, &wxAuiManager::OnHintFadeTimer, this,
m_hintFadeTimer.GetId());
}
@@ -3429,18 +3419,6 @@ void wxAuiManager::HideHint()
}
}
-void wxAuiManager::OnHintActivate(wxActivateEvent& WXUNUSED(event))
-{
- // Do nothing so this event isn't handled in the base handlers.
-
- // Letting the hint window activate without this handler can lead to
- // weird behaviour on Mac where the menu is switched out to the top
- // window's menu in MDI applications when it shouldn't be. So since
- // we don't want user interaction with the hint window anyway, we just
- // prevent it from activating here.
-}
-
-
void wxAuiManager::StartPaneDrag(wxWindow* pane_window,
const wxPoint& offset)
@@ -3911,28 +3889,28 @@ void wxAuiManager::Render(wxDC* dc)
void wxAuiManager::Repaint(wxDC* dc)
{
-#if defined(__WXMAC__) || defined(__WXGTK3__)
- // We can't use wxClientDC in these ports.
- if ( dc == nullptr )
- {
- m_frame->Refresh() ;
- m_frame->Update() ;
- return ;
- }
-#endif
- int w, h;
- m_frame->GetClientSize(&w, &h);
+ std::unique_ptr client_dc;
// figure out which dc to use; if one
// has been specified, use it, otherwise
// make a client dc
- wxClientDC* client_dc = nullptr;
if (!dc)
{
- client_dc = new wxClientDC(m_frame);
- dc = client_dc;
+ if ( AlwaysUsesLiveResize(m_frame) )
+ {
+ // We can't use wxClientDC in these ports.
+ m_frame->Refresh() ;
+ m_frame->Update() ;
+ return ;
+ }
+
+ client_dc.reset(new wxClientDC(m_frame));
+ dc = client_dc.get();
}
+ int w, h;
+ m_frame->GetClientSize(&w, &h);
+
// if the frame has a toolbar, the client area
// origin will not be (0,0).
wxPoint pt = m_frame->GetClientAreaOrigin();
@@ -3941,10 +3919,6 @@ void wxAuiManager::Repaint(wxDC* dc)
// render all the items
Render(dc);
-
- // if we created a client_dc, delete it
- if (client_dc)
- delete client_dc;
}
void wxAuiManager::OnDestroy(wxWindowDestroyEvent& event)
@@ -4090,7 +4064,14 @@ void wxAuiManager::UpdateButtonOnScreen(wxAuiDockUIPart* button_ui_part,
state = wxAUI_BUTTON_STATE_HOVER;
}
- // now repaint the button with hover state
+ // now repaint the button with hover state -- or everything if we can't
+ // repaint just it
+ if ( !wxClientDC::CanBeUsedForDrawing(m_frame) )
+ {
+ m_frame->Refresh();
+ m_frame->Update();
+ }
+
wxClientDC cdc(m_frame);
// if the frame has a toolbar, the client area
@@ -4472,7 +4453,7 @@ void wxAuiManager::OnLeftUp(wxMouseEvent& event)
if (!HasLiveResize())
{
// get rid of the hint rectangle
- wxScreenDC dc;
+ wxClientDC dc{m_frame};
DrawResizeHint(dc, m_actionHintRect);
}
if (m_currentDragItem != -1 && HasLiveResize())
@@ -4587,9 +4568,8 @@ void wxAuiManager::OnMotion(wxMouseEvent& event)
}
else
{
- wxRect rect(m_frame->ClientToScreen(pos),
- m_actionPart->rect.GetSize());
- wxScreenDC dc;
+ wxRect rect(pos, m_actionPart->rect.GetSize());
+ wxClientDC dc{m_frame};
if (!m_actionHintRect.IsEmpty())
{
@@ -4598,13 +4578,9 @@ void wxAuiManager::OnMotion(wxMouseEvent& event)
m_actionHintRect = wxRect();
}
- // draw new resize hint, if it's inside the managed frame
- wxRect frameScreenRect = m_frame->GetScreenRect();
- if (frameScreenRect.Contains(rect))
- {
- DrawResizeHint(dc, rect);
- m_actionHintRect = rect;
- }
+ // draw new resize hint
+ DrawResizeHint(dc, rect);
+ m_actionHintRect = rect;
}
}
}
diff --git a/src/common/animatecmn.cpp b/src/common/animatecmn.cpp
index 9a80ce3add..282fc2e9da 100644
--- a/src/common/animatecmn.cpp
+++ b/src/common/animatecmn.cpp
@@ -173,7 +173,7 @@ void wxAnimationCtrlBase::UpdateStaticImage()
m_bmpStaticReal.GetLogicalHeight() != sz.GetHeight())
{
// need to (re)create m_bmpStaticReal
- if (!m_bmpStaticReal.CreateWithDIPSize(sz,
+ if (!m_bmpStaticReal.CreateWithLogicalSize(sz,
bmpCurrent.GetScaleFactor(),
bmpCurrent.GetDepth()))
{
diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp
index 1de2d9c468..b8d912b8bd 100644
--- a/src/common/appbase.cpp
+++ b/src/common/appbase.cpp
@@ -1023,19 +1023,18 @@ wxString wxAppTraitsBase::GetAssertStackTrace()
if ( !name.empty() )
{
- m_stackTrace << wxString::Format(wxT("%-40s"), name.c_str());
+ m_stackTrace << wxString::Format("%-80s", name);
}
else
{
- m_stackTrace << wxString::Format(wxT("%p"), frame.GetAddress());
+ m_stackTrace << wxString::Format("%-80p", frame.GetAddress());
}
if ( frame.HasSourceLocation() )
{
- m_stackTrace << wxT('\t')
- << frame.GetFileName()
- << wxT(':')
- << frame.GetLine();
+ m_stackTrace << wxString::Format("%s:%zu",
+ frame.GetFileName(),
+ frame.GetLine());
}
m_stackTrace << wxT('\n');
diff --git a/src/common/config.cpp b/src/common/config.cpp
index fb29b8538d..7a2765636f 100644
--- a/src/common/config.cpp
+++ b/src/common/config.cpp
@@ -56,12 +56,13 @@ bool wxConfigBase::ms_bAutoCreate = true;
wxConfigBase *wxAppTraitsBase::CreateConfig()
{
- return new
- #if defined(__WINDOWS__) && wxUSE_CONFIG_NATIVE
- wxRegConfig(wxTheApp->GetAppName(), wxTheApp->GetVendorName());
- #else // either we're under Unix or wish to use files even under Windows
- wxFileConfig(wxTheApp->GetAppName());
- #endif
+#if defined(wxHAS_CONFIG_AS_REGCONFIG)
+ return new wxRegConfig(wxTheApp->GetAppName(), wxTheApp->GetVendorName());
+#elif defined(wxHAS_CONFIG_AS_FILECONFIG)
+ return new wxFileConfig(wxTheApp->GetAppName());
+#else
+ #error No wxConfig implementation defined.
+#endif
}
// ----------------------------------------------------------------------------
diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp
index 01ee68969d..62dcf9d308 100644
--- a/src/common/datetime.cpp
+++ b/src/common/datetime.cpp
@@ -74,6 +74,7 @@
#include "wx/tokenzr.h"
#include
+#include
#ifdef __WINDOWS__
#include
@@ -2271,6 +2272,133 @@ size_t wxDateTimeWorkDays::DoGetHolidaysInRange(const wxDateTime& dtStart,
return holidays.GetCount();
}
+// ----------------------------------------------------------------------------
+// wxDateTimeUSCatholicFeasts
+// ----------------------------------------------------------------------------
+
+std::vector wxDateTimeUSCatholicFeasts::m_holyDaysOfObligation =
+{
+ // Feasts with fixed dates
+ { wxDateTime(1, wxDateTime::Month::Jan, 0) }, // Solemnity of Mary, Mother of God
+ { wxDateTime(15, wxDateTime::Month::Aug, 0) }, // Assumption of the Blessed Virgin Mary
+ { wxDateTime(1, wxDateTime::Month::Nov, 0) }, // All Saints Day
+ { wxDateTime(8, wxDateTime::Month::Dec, 0) }, // Immaculate Conception of the Blessed Virgin Mary
+ { wxDateTime(25, wxDateTime::Month::Dec, 0) } // Christmas
+};
+
+wxDateTime wxDateTimeUSCatholicFeasts::GetEaster(int year)
+{
+ // Adjust for miscalculation in Gauss formula
+ if (year == 1734 || year == 1886)
+ {
+ return wxDateTime(25, wxDateTime::Apr, year);
+ }
+
+ // All calculations done
+ // on the basis of
+ // Gauss Easter Algorithm
+ const float A = year % 19;
+ const float B = year % 4;
+ const float C = year % 7;
+ const float P = std::floor((float)year / 100.0);
+
+ const float Q = std::floor((float)(13 + 8 * P) / 25.0);
+
+ const float M = (int)(15 - Q + P - std::floor((float)P / 4)) % 30;
+
+ const float N = (int)(4 + P - std::floor((float)P / 4)) % 7;
+
+ const float D = (int)(19 * A + M) % 30;
+
+ const float E = (int)(2 * B + 4 * C + 6 * D + N) % 7;
+
+ const int days = (int)(22 + D + E);
+
+ // A corner case,
+ // when D is 29
+ if ((D == 29) && (E == 6))
+ {
+ wxASSERT_MSG(
+ wxDateTime(19, wxDateTime::Apr, year).GetWeekDay() ==
+ wxDateTime::WeekDay::Sun,
+ "Error in Easter calculation!");
+ return wxDateTime(19, wxDateTime::Apr, year);
+ }
+ // Another corner case,
+ // when D is 28
+ else if ((D == 28) && (E == 6))
+ {
+ wxASSERT_MSG(
+ wxDateTime(18, wxDateTime::Apr, year).GetWeekDay() ==
+ wxDateTime::WeekDay::Sun,
+ "Error in Easter calculation!");
+ return wxDateTime(18, wxDateTime::Apr, year);
+ }
+ else
+ {
+ // If days > 31, move to April
+ // April = 4th Month
+ if (days > 31)
+ {
+ wxASSERT_MSG(
+ wxDateTime((days - 31), wxDateTime::Apr, year).GetWeekDay() ==
+ wxDateTime::WeekDay::Sun,
+ "Error in Easter calculation!");
+ return wxDateTime((days - 31), wxDateTime::Apr, year);
+ }
+ else
+ {
+ // Otherwise, stay on March
+ // March = 3rd Month
+ wxASSERT_MSG(
+ wxDateTime(days, wxDateTime::Mar, year).GetWeekDay() ==
+ wxDateTime::WeekDay::Sun,
+ "Error in Easter calculation!");
+ return wxDateTime(days, wxDateTime::Mar, year);
+ }
+ }
+}
+
+size_t wxDateTimeUSCatholicFeasts::DoGetHolidaysInRange(const wxDateTime& dtStart,
+ const wxDateTime& dtEnd,
+ wxDateTimeArray& holidays) const
+{
+ holidays.Clear();
+
+ for (wxDateTime dt = dtStart; dt <= dtEnd; dt += wxDateSpan::Day())
+ {
+ if (DoIsHoliday(dt) )
+ {
+ holidays.Add(dt);
+ continue;
+ }
+ }
+
+ return holidays.size();
+}
+
+// ----------------------------------------------------------------------------
+// wxDateTimeChristianHolidays
+// ----------------------------------------------------------------------------
+
+size_t wxDateTimeChristianHolidays::DoGetHolidaysInRange(const wxDateTime& dtStart,
+ const wxDateTime& dtEnd,
+ wxDateTimeArray& holidays) const
+{
+ holidays.Clear();
+
+ for (wxDateTime dt = dtStart; dt <= dtEnd; dt += wxDateSpan::Day())
+ {
+ if (DoIsHoliday(dt) )
+ {
+ holidays.Add(dt);
+ continue;
+ }
+ }
+
+ return holidays.size();
+}
+
// ============================================================================
// other helper functions
// ============================================================================
diff --git a/src/common/datetimefmt.cpp b/src/common/datetimefmt.cpp
index ff72517769..dd2b47c60c 100644
--- a/src/common/datetimefmt.cpp
+++ b/src/common/datetimefmt.cpp
@@ -337,8 +337,8 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const
bool isPercent = false;
// We also can't use strftime() if we use non standard specifier: either
- // our own extension "%l" or one of "%g", "%G", "%V", "%z" which are POSIX
- // but not supported under Windows.
+ // our own extension "%l" or one of C99/POSIX specifiers not supported when
+ // using MinGW, see https://sourceforge.net/p/mingw-w64/bugs/793/
for ( wxString::const_iterator p = format.begin();
canUseStrftime && p != format.end();
++p )
@@ -354,12 +354,13 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const
switch ( (*p).GetValue() )
{
case 'l':
-#ifdef __WINDOWS__
+#ifdef __MINGW32__
+ case 'F':
case 'g':
case 'G':
case 'V':
case 'z':
-#endif // __WINDOWS__
+#endif // __MINGW32__
canUseStrftime = false;
break;
}
@@ -580,6 +581,10 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const
res += wxString::Format(fmt, tm.mday);
break;
+ case wxT('F'): // ISO 8601 date
+ res += wxString::Format(wxT("%04d-%02d-%02d"), tm.year, tm.mon + 1, tm.mday);
+ break;
+
case wxT('g'): // 2-digit week-based year
res += wxString::Format(fmt, GetWeekBasedYear() % 100);
break;
@@ -1229,6 +1234,22 @@ wxDateTime::ParseFormat(const wxString& date,
mday = (wxDateTime_t)num;
break;
+ case wxT('F'): // ISO 8601 date
+ {
+ wxDateTime dt = ParseFormatAt(input, end, wxS("%Y-%m-%d"));
+ if ( !dt.IsValid() )
+ return false;
+
+ const Tm tm = dt.GetTm();
+
+ year = tm.year;
+ mon = tm.mon;
+ mday = tm.mday;
+
+ haveDay = haveMon = haveYear = true;
+ }
+ break;
+
case wxT('H'): // hour in 24h format (00-23)
if ( !GetNumericToken(width, input, end, &num) || (num > 23) )
{
diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp
index e1060ae402..efced61b9a 100644
--- a/src/common/dcbase.cpp
+++ b/src/common/dcbase.cpp
@@ -174,6 +174,11 @@ wxDCImpl *wxNativeDCFactory::CreatePrinterDC( wxPrinterDC *owner, const wxPrintD
}
#endif
+bool wxNativeDCFactory::CanDrawUsingClientDC(const wxWindow* window) const
+{
+ return wxClientDCImpl::CanBeUsedForDrawing(window);
+}
+
//-----------------------------------------------------------------------------
// wxWindowDC
//-----------------------------------------------------------------------------
@@ -196,6 +201,12 @@ wxClientDC::wxClientDC(wxWindow *win)
{
}
+/* static */
+bool wxClientDC::CanBeUsedForDrawing(const wxWindow* window)
+{
+ return wxDCFactory::Get()->CanDrawUsingClientDC(window);
+}
+
//-----------------------------------------------------------------------------
// wxMemoryDC
//-----------------------------------------------------------------------------
@@ -1397,13 +1408,17 @@ float wxDCImpl::GetFontPointSizeAdjustment(float dpi)
return float(wxDisplay::GetStdPPIValue()) / dpi;
}
+static void mmToPx(wxWindow* win, double& x, double& y)
+{
+ const wxSize ppi(win ? wxDisplay(win).GetPPI() : wxGetDisplayPPI());
+ x = ppi.x * mm2inches;
+ y = ppi.y * mm2inches;
+}
+
double wxDCImpl::GetMMToPXx() const
{
if ( wxIsNullDouble(m_mm_to_pix_x) )
- {
- m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() /
- (double)wxGetDisplaySizeMM().GetWidth();
- }
+ mmToPx(m_window, m_mm_to_pix_x, m_mm_to_pix_y);
return m_mm_to_pix_x;
}
@@ -1411,10 +1426,7 @@ double wxDCImpl::GetMMToPXx() const
double wxDCImpl::GetMMToPXy() const
{
if ( wxIsNullDouble(m_mm_to_pix_y) )
- {
- m_mm_to_pix_y = (double)wxGetDisplaySize().GetHeight() /
- (double)wxGetDisplaySizeMM().GetHeight();
- }
+ mmToPx(m_window, m_mm_to_pix_x, m_mm_to_pix_y);
return m_mm_to_pix_y;
}
diff --git a/src/common/dcbufcmn.cpp b/src/common/dcbufcmn.cpp
index db0e001fba..ba31002c1d 100644
--- a/src/common/dcbufcmn.cpp
+++ b/src/common/dcbufcmn.cpp
@@ -84,7 +84,7 @@ private:
// we must always return a valid bitmap but creating a bitmap of
// size 0 would fail, so create a 1*1 bitmap in this case
- buffer->CreateWithDIPSize(wxMax(w, 1), wxMax(h, 1), scale);
+ buffer->CreateWithLogicalSize(wxMax(w, 1), wxMax(h, 1), scale);
return buffer;
}
diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp
index 0313014874..caed52e0bd 100644
--- a/src/common/dcgraph.cpp
+++ b/src/common/dcgraph.cpp
@@ -212,9 +212,6 @@ wxGCDCImpl::wxGCDCImpl(wxDC* owner, int)
void wxGCDCImpl::CommonInit()
{
- m_mm_to_pix_x = mm2pt;
- m_mm_to_pix_y = mm2pt;
-
m_isClipBoxValid = false;
m_logicalFunctionSupported = true;
@@ -1051,7 +1048,7 @@ bool wxGCDCImpl::DoStretchBlit(
wxCompositionMode mode = TranslateRasterOp(logical_func);
if ( mode == wxCOMPOSITION_INVALID )
{
- // Do *not* assert here, this function is often call from wxEVT_PAINT
+ // Do *not* assert here, this function is often called from wxEVT_PAINT
// handler and asserting will just result in a reentrant call to the
// same handler and a crash.
return false;
diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp
index 04b46ba448..646c45b16e 100644
--- a/src/common/fileconf.cpp
+++ b/src/common/fileconf.cpp
@@ -247,42 +247,196 @@ wxString wxFileConfig::GetGlobalDir()
wxString wxFileConfig::GetLocalDir(int style)
{
- wxUnusedVar(style);
+ const wxStandardPathsBase& stdp = wxStandardPaths::Get();
- wxStandardPathsBase& stdp = wxStandardPaths::Get();
+ if ( style & wxCONFIG_USE_XDG )
+ {
+ // When XDG-compliant layout is requested, we need to use this function
+ // as GetUserDataDir() doesn't support it.
+ wxString dir = stdp.GetUserDir(wxStandardPaths::Dir_Config);
- // it so happens that user data directory is a subdirectory of user config
- // directory on all supported platforms, which explains why we use it here
+ if ( style & wxCONFIG_USE_SUBDIR )
+ dir = stdp.AppendAppInfo(dir);
+
+ return dir;
+ }
+
+ if ( style & wxCONFIG_USE_HOME )
+ {
+ // When traditional layout is requested, don't use wxStandardPaths as
+ // it could be using XDG layout.
+ wxString dir = wxGetHomeDir();
+
+ if ( style & wxCONFIG_USE_HOME )
+ dir = stdp.AppendAppInfo(dir);
+
+ return dir;
+ }
+
+ // Normally we'd like to use GetUserConfigDir() and just append app info
+ // subdirectories to it, but we can't do it for compatibility reasons:
+ // there are existing configuration files in the locations returned by
+ // these functions already, so return the same values as we always did.
return style & wxCONFIG_USE_SUBDIR ? stdp.GetUserDataDir()
: stdp.GetUserConfigDir();
}
wxFileName wxFileConfig::GetGlobalFile(const wxString& szFile)
{
- wxStandardPathsBase& stdp = wxStandardPaths::Get();
+ const wxStandardPathsBase& stdp = wxStandardPaths::Get();
return wxFileName(GetGlobalDir(), stdp.MakeConfigFileName(szFile));
}
wxFileName wxFileConfig::GetLocalFile(const wxString& szFile, int style)
{
- wxStandardPathsBase& stdp = wxStandardPaths::Get();
+ const wxStandardPathsBase& stdp = wxStandardPaths::Get();
// If the config file is located in a subdirectory, we always use an
// extension for it, but we use just the leading dot if it is located
// directly in the home directory. Note that if wxStandardPaths is
// configured to follow XDG specification, all config files go to a
// subdirectory of XDG_CONFIG_HOME anyhow, so in this case we'll still end
- // up using the extension even if wxCONFIG_USE_SUBDIR is not set, but this
- // is the correct and expected (if a little confusing) behaviour.
+ // up using the extension even if neither wxCONFIG_USE_SUBDIR nor
+ // wxCONFIG_USE_XDG is set, but this is the correct and expected (if a
+ // little confusing) behaviour.
const wxStandardPaths::ConfigFileConv
- conv = style & wxCONFIG_USE_SUBDIR
+ conv = style & (wxCONFIG_USE_SUBDIR | wxCONFIG_USE_XDG)
? wxStandardPaths::ConfigFileConv_Ext
: wxStandardPaths::ConfigFileConv_Dot;
return wxFileName(GetLocalDir(style), stdp.MakeConfigFileName(szFile, conv));
}
+wxFileConfig::MigrationResult
+wxFileConfig::MigrateLocalFile(const wxString& name, int newStyle, int oldStyle)
+{
+ MigrationResult res;
+
+ const auto oldPath = GetLocalFile(name, oldStyle);
+ if ( !oldPath.FileExists() )
+ return res;
+
+ const auto newPath = GetLocalFile(name, newStyle);
+ if ( newPath == oldPath )
+ return res;
+
+ res.oldPath = oldPath.GetFullPath();
+ res.newPath = newPath.GetFullPath();
+
+ // This class ensures that we (at least try to) rename the existing config
+ // file back to its original name if we fail with an error.
+ class RenameBackOnError
+ {
+ public:
+ explicit RenameBackOnError(wxFileConfig::MigrationResult& res)
+ : m_res(res)
+ {
+ }
+
+ void Init(const wxString& tempPath)
+ {
+ m_tempPath = tempPath;
+ }
+
+ void Dismiss()
+ {
+ m_tempPath.clear();
+ }
+
+ ~RenameBackOnError()
+ {
+ if ( !m_tempPath.empty() )
+ {
+ if ( !wxRenameFile(m_tempPath, m_res.oldPath) )
+ {
+ // This should never happen, but if it does, do at least
+ // let the user know that we moved their file to a wrong
+ // place and couldn't put it back.
+ m_res.error += wxString::Format(
+ _(" and additionally, the existing configuration file"
+ " was renamed to \"%s\" and couldn't be renamed back,"
+ " please rename it to its original path \"%s\""),
+ m_tempPath,
+ m_res.oldPath
+ );
+ }
+ }
+ }
+
+ private:
+ MigrationResult& m_res;
+
+ wxString m_tempPath;
+ } renameBackOnError{res};
+
+ wxString currentPath = res.oldPath;
+
+ class AppendLogToError
+ {
+ public:
+ explicit AppendLogToError(MigrationResult& res)
+ : m_res(res)
+ {
+ }
+
+ ~AppendLogToError()
+ {
+ if ( !m_res.error.empty() )
+ {
+ wxString msg = m_logCollect.GetMessages();
+ if ( !msg.empty() )
+ {
+ // Normally the messages are separated with new lines, but
+ // we don't need the trailing one after the last one.
+ if ( msg.Last() == '\n' )
+ msg.RemoveLast();
+ m_res.error << _(" due to the following error:\n") << msg;
+ }
+ }
+ }
+
+ private:
+ MigrationResult& m_res;
+
+ wxLogCollector m_logCollect;
+ } appendLogToError{res};
+
+ const auto newDir = newPath.GetPath();
+ if ( !wxFileName::DirExists(newDir) )
+ {
+ // There is an annoying failure mode here when the new directory can't
+ // be created because its name is the same as the name of the existing
+ // file, e.g. when oldStyle==0 and newStyle==wxCONFIG_USE_SUBDIR and
+ // XDG layout is not used, so check for this specially.
+ if ( newDir == res.oldPath )
+ {
+ currentPath = wxFileName::CreateTempFileName(currentPath);
+ if ( !wxRenameFile(res.oldPath, currentPath) )
+ {
+ res.error = _("failed to rename the existing file");
+ return res;
+ }
+
+ renameBackOnError.Init(currentPath);
+ }
+
+ if ( !wxFileName::Mkdir(newDir, wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL) )
+ {
+ res.error = _("failed to create the new file directory");
+ return res;
+ }
+ }
+
+ if ( !wxRenameFile(currentPath, res.newPath) )
+ {
+ res.error = _("failed to move the file to the new location");
+ return res;
+ }
+
+ return res;
+}
+
// ----------------------------------------------------------------------------
// ctor
// ----------------------------------------------------------------------------
@@ -357,8 +511,22 @@ wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName,
{
// Make up names for files if empty
if ( !m_fnLocalFile.IsOk() && (style & wxCONFIG_USE_LOCAL_FILE) )
+ {
m_fnLocalFile = GetLocalFile(GetAppName(), style);
+ // If none of the styles explicitly selecting the location to use is
+ // specified, default to XDG unless the file already exists in the
+ // traditional location in the home directory:
+ if ( !(style & (wxCONFIG_USE_XDG | wxCONFIG_USE_HOME)) )
+ {
+ if ( !m_fnLocalFile.FileExists() )
+ {
+ style |= wxCONFIG_USE_XDG;
+ m_fnLocalFile = GetLocalFile(GetAppName(), style);
+ }
+ }
+ }
+
if ( !m_fnGlobalFile.IsOk() && (style & wxCONFIG_USE_GLOBAL_FILE) )
m_fnGlobalFile = GetGlobalFile(GetAppName());
@@ -970,6 +1138,21 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
if ( !IsDirty() || !m_fnLocalFile.GetFullPath() )
return true;
+ // Create the directory containing the file if it doesn't exist. Although we
+ // don't always use XDG, it seems sensible to follow the XDG specification
+ // and create it with permissions 700 if it doesn't exist.
+ const wxString& outPath = m_fnLocalFile.GetPath();
+ if ( !wxFileName::DirExists(outPath) )
+ {
+ if ( !wxFileName::Mkdir(outPath,
+ wxS_IRUSR | wxS_IWUSR | wxS_IXUSR,
+ wxPATH_MKDIR_FULL) )
+ {
+ wxLogWarning(_("Failed to create configuration file directory."));
+ return false;
+ }
+ }
+
// set the umask if needed
wxCHANGE_UMASK(m_umask);
diff --git a/src/common/fs_data.cpp b/src/common/fs_data.cpp
new file mode 100644
index 0000000000..4eb8b35602
--- /dev/null
+++ b/src/common/fs_data.cpp
@@ -0,0 +1,126 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name: src/common/fs_data.cpp
+// Purpose: DATA scheme file system
+// Author: Vyacheslav Lisovski
+// Copyright: (c) 2023 Vyacheslav Lisovski
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/wxprec.h"
+
+#if wxUSE_FILESYSTEM
+
+#include "wx/fs_data.h"
+
+#include "wx/base64.h"
+#include "wx/filesys.h"
+#include "wx/mstream.h"
+#include "wx/sstream.h"
+#include "wx/uri.h"
+
+namespace
+{
+
+// This stream holds the buffer and deletes when destroyed
+class wxBufferedMemoryInputStream : public wxMemoryInputStream
+{
+public:
+ wxBufferedMemoryInputStream(const wxMemoryBuffer& buffer) :
+ wxMemoryInputStream(buffer.GetData(), buffer.GetDataLen()),
+ m_buffer{buffer}
+ {
+ }
+
+private:
+ wxMemoryBuffer m_buffer;
+};
+
+// URL syntax: data:[][;base64],
+int GetMetadata(const wxString& location, wxString& mediatype, bool& isBase64)
+{
+ int dataPos = location.Find(',');
+ if (dataPos > 0)
+ {
+ const int hdrPos = location.Find(':');
+ if (hdrPos > 0)
+ {
+ wxString metadata(location, hdrPos + 1, dataPos - hdrPos - 1);
+
+ int encPos = metadata.Find(';', true);
+
+ if (encPos > 0)
+ {
+ auto encoding = metadata.Right(metadata.Len() - encPos - 1);
+ if (encoding.IsSameAs("base64", false))
+ {
+ isBase64 = true;
+ }
+ else
+ {
+ encPos = metadata.Len();
+ }
+ }
+ else
+ encPos = metadata.Len();
+
+ mediatype = metadata.Left(encPos);
+ }
+ ++dataPos;
+ }
+ return dataPos;
+}
+
+} // anonymous namespace
+
+// ----------------------------------------------------------------------------
+// wxDataSchemeFSHandler
+// ----------------------------------------------------------------------------
+
+bool wxDataSchemeFSHandler::CanOpen(const wxString& location)
+{
+ return GetProtocol(location).IsSameAs("data", false);
+}
+
+wxFSFile* wxDataSchemeFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs),
+ const wxString& location)
+{
+ wxString mediatype;
+ bool isBase64 = false;
+ int dataPos = GetMetadata(location, mediatype, isBase64);
+
+ if (dataPos < 0)
+ return nullptr;
+
+ if (mediatype.IsEmpty())
+ mediatype = "text/plain";
+
+ wxInputStream* stream = nullptr;
+ if (isBase64)
+ {
+#if wxUSE_BASE64
+ stream = new wxBufferedMemoryInputStream(
+ wxBase64Decode(location.Right(location.Len() - dataPos)));
+#endif // wxUSE_BASE64
+ }
+ else
+ {
+ stream = new wxStringInputStream(
+ wxURI::Unescape(location.Right(location.Len() - dataPos)));
+ }
+
+ if (stream)
+ {
+ return new wxFSFile(stream,
+ "",
+ mediatype,
+ ""
+#if wxUSE_DATETIME
+ , wxDateTime::Now()
+#endif // wxUSE_DATETIME
+ );
+ }
+
+ return nullptr;
+}
+
+#endif // wxUSE_FILESYSTEM
diff --git a/src/common/headerctrlcmn.cpp b/src/common/headerctrlcmn.cpp
index a7787c46ab..ee284267cf 100644
--- a/src/common/headerctrlcmn.cpp
+++ b/src/common/headerctrlcmn.cpp
@@ -317,6 +317,7 @@ bool wxHeaderCtrlBase::ShowColumnsMenu(const wxPoint& pt, const wxString& title)
{
const int columnIndex = rc - wxID_COLUMNS_BASE;
UpdateColumnVisibility(columnIndex, !GetColumn(columnIndex).IsShown());
+ UpdateColumn(columnIndex);
}
return true;
@@ -469,6 +470,19 @@ wxHeaderCtrlSimple::UpdateColumnWidthToFit(unsigned int idx, int widthTitle)
return true;
}
+void
+wxHeaderCtrlSimple::UpdateColumnVisibility(unsigned int idx, bool show)
+{
+ ShowColumn(idx, show);
+}
+
+void
+wxHeaderCtrlSimple::UpdateColumnsOrder(const wxArrayInt& WXUNUSED(order))
+{
+ // Nothing to do here, we only override this function to prevent the base
+ // class version from asserting that it should be implemented.
+}
+
void wxHeaderCtrlSimple::OnHeaderResizing(wxHeaderCtrlEvent& evt)
{
m_cols[evt.GetColumn()].SetWidth(evt.GetWidth());
diff --git a/src/common/init.cpp b/src/common/init.cpp
index cb244311b4..3a6a645cb2 100644
--- a/src/common/init.cpp
+++ b/src/common/init.cpp
@@ -210,9 +210,9 @@ void wxInitData::InitIfNecessary(int argcIn, wchar_t** argvIn)
// elsewhere, but it is also possible to call a wide-char initialization
// function (wxInitialize(), wxEntryStart() or wxEntry() itself) directly,
// so we need to support this case too.
- if ( argc )
+ if ( argc || !argcIn )
{
- // Already initialized, nothing to do.
+ // Already initialized or nothing to do.
return;
}
@@ -488,14 +488,18 @@ static void DoCommonPostCleanup()
void wxEntryCleanup()
{
- DoCommonPreCleanup();
-
-
// delete the application object
if ( wxTheApp )
{
wxTheApp->CleanUp();
+ }
+ // It's important to call this after wxApp::CleanUp() as it can log some
+ // messages that will be flushed inside DoCommonPreCleanup().
+ DoCommonPreCleanup();
+
+ if ( wxTheApp )
+ {
// reset the global pointer to it to nullptr before destroying it as in
// some circumstances this can result in executing the code using
// wxTheApp and using half-destroyed object is no good
diff --git a/src/common/intl.cpp b/src/common/intl.cpp
index 2e746cf8c6..9bc8513c47 100644
--- a/src/common/intl.cpp
+++ b/src/common/intl.cpp
@@ -1248,7 +1248,7 @@ wxString wxLocale::GetOSInfo(wxLocaleInfo index, wxLocaleCategory cat)
extern wxString
wxGetInfoFromCFLocale(CFLocaleRef cfloc, wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
{
- CFStringRef cfstr = 0;
+ CFStringRef cfstr = nullptr;
switch ( index )
{
case wxLOCALE_THOUSANDS_SEP:
diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp
index bf11efccbc..a0b9e8b721 100644
--- a/src/common/popupcmn.cpp
+++ b/src/common/popupcmn.cpp
@@ -431,8 +431,8 @@ bool wxPopupTransientWindow::Show( bool show )
void wxPopupTransientWindow::Dismiss()
{
- Hide();
PopHandlers();
+ Hide();
}
#if defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON
diff --git a/src/common/sckaddr.cpp b/src/common/sckaddr.cpp
index fe09238ca4..0262365ca4 100644
--- a/src/common/sckaddr.cpp
+++ b/src/common/sckaddr.cpp
@@ -203,11 +203,11 @@ hostent *deepCopyHostent(hostent *h,
/* leave space for pointer list */
char **p = h->h_addr_list, **q;
char **h_addr_list = (char **)(buffer + pos);
- while(*(p++) != 0)
+ while(*(p++) != nullptr)
pos += sizeof(char *);
/* copy addresses and fill new pointer list */
- for (p = h->h_addr_list, q = h_addr_list; *p != 0; p++, q++)
+ for (p = h->h_addr_list, q = h_addr_list; *p != nullptr; p++, q++)
{
if (size < pos + len)
{
@@ -218,7 +218,7 @@ hostent *deepCopyHostent(hostent *h,
*q = buffer + pos; /* set copied pointer to copied content */
pos += len;
}
- *++q = 0; /* null terminate the pointer list */
+ *++q = nullptr; /* null terminate the pointer list */
h->h_addr_list = h_addr_list; /* copy pointer to pointers */
/* ensure word alignment of pointers */
@@ -229,11 +229,11 @@ hostent *deepCopyHostent(hostent *h,
/* leave space for pointer list */
p = h->h_aliases;
char **h_aliases = (char **)(buffer + pos);
- while(*(p++) != 0)
+ while(*(p++) != nullptr)
pos += sizeof(char *);
/* copy aliases and fill new pointer list */
- for (p = h->h_aliases, q = h_aliases; *p != 0; p++, q++)
+ for (p = h->h_aliases, q = h_aliases; *p != nullptr; p++, q++)
{
len = strlen(*p);
if (size <= pos + len)
@@ -246,7 +246,7 @@ hostent *deepCopyHostent(hostent *h,
*q = buffer + pos; /* set copied pointer to copied content */
pos += len + 1;
}
- *++q = 0; /* null terminate the pointer list */
+ *++q = nullptr; /* null terminate the pointer list */
h->h_aliases = h_aliases; /* copy pointer to pointers */
return h;
@@ -358,11 +358,11 @@ servent *deepCopyServent(servent *s,
/* leave space for pointer list */
char **p = s->s_aliases, **q;
char **s_aliases = (char **)(buffer + pos);
- while(*(p++) != 0)
+ while(*(p++) != nullptr)
pos += sizeof(char *);
/* copy addresses and fill new pointer list */
- for (p = s->s_aliases, q = s_aliases; *p != 0; p++, q++){
+ for (p = s->s_aliases, q = s_aliases; *p != nullptr; p++, q++){
len = strlen(*p);
if (size <= pos + len)
{
@@ -373,7 +373,7 @@ servent *deepCopyServent(servent *s,
*q = buffer + pos; /* set copied pointer to copied content */
pos += len + 1;
}
- *++q = 0; /* null terminate the pointer list */
+ *++q = nullptr; /* null terminate the pointer list */
s->s_aliases = s_aliases; /* copy pointer to pointers */
return s;
}
diff --git a/src/common/statbar.cpp b/src/common/statbar.cpp
index 358e9fe133..04ade7fb08 100644
--- a/src/common/statbar.cpp
+++ b/src/common/statbar.cpp
@@ -112,6 +112,8 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow);
wxStatusBarBase::wxStatusBarBase()
{
m_bSameWidthForAllPanes = true;
+
+ Bind(wxEVT_SIZE, &wxStatusBarBase::OnSize, this);
}
wxStatusBarBase::~wxStatusBarBase()
@@ -297,4 +299,40 @@ void wxStatusBarBase::PopStatusText(int number)
DoUpdateStatusText(number);
}
+// ----------------------------------------------------------------------------
+// controls
+// ----------------------------------------------------------------------------
+bool wxStatusBarBase::AddFieldControl(int n, wxWindow* win)
+{
+ wxCHECK_MSG( (unsigned)n < m_panes.size(), false,
+ "invalid status bar field index" );
+ wxCHECK_MSG( !m_panes[n].GetFieldControl(), false,
+ "another control is already added in this field" );
+
+ m_panes[n].SetFieldControl(win);
+
+ return true;
+}
+
+void wxStatusBarBase::OnSize(wxSizeEvent& event)
+{
+ event.Skip();
+
+ if ( GetChildren().empty() )
+ return;
+
+ for ( int i = 0; i < (int)m_panes.size(); ++i )
+ {
+ wxWindow* const win = m_panes[i].GetFieldControl();
+ if ( win )
+ {
+ wxRect rect;
+ if ( GetFieldRect(i, rect) )
+ {
+ win->SetSize(rect);
+ }
+ }
+ }
+}
+
#endif // wxUSE_STATUSBAR
diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp
index edc549d301..4fbc018ca2 100644
--- a/src/common/strconv.cpp
+++ b/src/common/strconv.cpp
@@ -1753,10 +1753,6 @@ wxMBConvUTF16swap::FromWChar(char *dst, size_t dstLen,
#define wxMBConvUTF32straight wxMBConvUTF32LE
#endif
-
-WXDLLIMPEXP_DATA_BASE(wxMBConvUTF32LE) wxConvUTF32LE;
-WXDLLIMPEXP_DATA_BASE(wxMBConvUTF32BE) wxConvUTF32BE;
-
/* static */
size_t wxMBConvUTF32Base::GetLength(const char *src, size_t srcLen)
{
diff --git a/src/common/string.cpp b/src/common/string.cpp
index 9014dd472e..c530ffc053 100644
--- a/src/common/string.cpp
+++ b/src/common/string.cpp
@@ -169,17 +169,29 @@ std::ostream& operator<<(std::ostream& os, const wxString& str)
return os << str.c_str();
}
-std::ostream& operator<<(std::ostream& os, const wxScopedCharBuffer& str)
+std::ostream&
+wxPrivate::OutputCharBuffer(std::ostream& os, const char* str)
+{
+ return os << str;
+}
+
+std::ostream& operator<<(std::ostream& os, const wxCharBuffer& str)
{
return os << str.data();
}
-std::ostream& operator<<(std::ostream& os, const wxScopedWCharBuffer& str)
+std::ostream&
+wxPrivate::OutputWCharBuffer(std::ostream& os, const wchar_t* wstr)
{
// There is no way to write wide character data to std::ostream directly,
// but we need to define this operator for compatibility, as we provided it
// since basically always, even if it never worked correctly before. So do
// the only reasonable thing and output it as UTF-8.
+ return os << wxConvWhateverWorks.cWC2MB(wstr);
+}
+
+std::ostream& operator<<(std::ostream& os, const wxWCharBuffer& str)
+{
return os << wxConvWhateverWorks.cWC2MB(str.data());
}
@@ -195,7 +207,13 @@ std::wostream& operator<<(std::wostream& wos, const wxCStrData& str)
return wos << str.AsWChar();
}
-std::wostream& operator<<(std::wostream& wos, const wxScopedWCharBuffer& str)
+std::wostream&
+wxPrivate::OutputWCharBuffer(std::wostream& wos, const wchar_t* wstr)
+{
+ return wos << wstr;
+}
+
+std::wostream& operator<<(std::wostream& wos, const wxWCharBuffer& str)
{
return wos << str.data();
}
diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp
index 6fe7eee522..abbdadd4dc 100644
--- a/src/common/utilscmn.cpp
+++ b/src/common/utilscmn.cpp
@@ -1437,7 +1437,7 @@ wxVersionInfo wxGetLibraryVersionInfo()
wxMINOR_VERSION,
wxRELEASE_NUMBER,
msg,
- wxString::Format(wxS("Copyright %s 1992-2023 wxWidgets team"),
+ wxString::Format(wxS("Copyright %s 1992-2024 wxWidgets team"),
copyrightSign));
}
diff --git a/src/common/valgen.cpp b/src/common/valgen.cpp
index 3625f1fc1f..f73516d27a 100644
--- a/src/common/valgen.cpp
+++ b/src/common/valgen.cpp
@@ -41,6 +41,9 @@
#if wxUSE_TOGGLEBTN
#include "wx/tglbtn.h"
#endif
+#if wxUSE_COLOURPICKERCTRL
+ #include "wx/clrpicker.h"
+#endif
#include "wx/filename.h"
#include "wx/valgen.h"
@@ -99,6 +102,18 @@ wxGenericValidator::wxGenericValidator(double *val)
m_pDouble = val;
}
+wxGenericValidator::wxGenericValidator(wxColour* val)
+{
+ Initialize();
+ m_pColour = val;
+}
+
+wxGenericValidator::wxGenericValidator(wxCheckBoxState* val)
+{
+ Initialize();
+ m_pCheckBoxState = val;
+}
+
wxGenericValidator::wxGenericValidator(const wxGenericValidator& val)
: wxValidator()
{
@@ -119,6 +134,8 @@ bool wxGenericValidator::Copy(const wxGenericValidator& val)
m_pFileName = val.m_pFileName;
m_pFloat = val.m_pFloat;
m_pDouble = val.m_pDouble;
+ m_pColour = val.m_pColour;
+ m_pCheckBoxState = val.m_pCheckBoxState;
return true;
}
@@ -139,6 +156,11 @@ bool wxGenericValidator::TransferToWindow()
pControl->SetValue(*m_pBool);
return true;
}
+ else if (m_pCheckBoxState && pControl->Is3State())
+ {
+ pControl->Set3StateValue(*m_pCheckBoxState);
+ return true;
+ }
} else
#endif
#if wxUSE_RADIOBTN
@@ -377,6 +399,17 @@ bool wxGenericValidator::TransferToWindow()
return true;
}
+ else if (m_pInt)
+ {
+ wxCHECK_MSG(
+ !pControl->HasMultipleSelection(),
+ false,
+ "multi-select control requires wxArrayInt"
+ );
+ pControl->Check(*m_pInt);
+
+ return true;
+ }
else
return false;
} else
@@ -398,6 +431,31 @@ bool wxGenericValidator::TransferToWindow()
for ( i = 0 ; i < count; i++ )
pControl->SetSelection(m_pArrayInt->Item(i));
+ return true;
+ }
+ else if (m_pInt)
+ {
+ wxCHECK_MSG(
+ !pControl->HasMultipleSelection(),
+ false,
+ "multi-select control requires wxArrayInt"
+ );
+ pControl->SetSelection(*m_pInt);
+
+ return true;
+ }
+ } else
+#endif
+
+ // colour controls
+#if wxUSE_COLOURPICKERCTRL
+ if (wxDynamicCast(m_validatorWindow, wxColourPickerCtrl))
+ {
+ wxColourPickerCtrl* pControl = (wxColourPickerCtrl*)m_validatorWindow;
+ if (m_pColour)
+ {
+ pControl->SetColour(*m_pColour);
+
return true;
}
} else
@@ -425,6 +483,11 @@ bool wxGenericValidator::TransferFromWindow()
*m_pBool = pControl->GetValue() ;
return true;
}
+ else if (m_pCheckBoxState && pControl->Is3State())
+ {
+ *m_pCheckBoxState = pControl->Get3StateValue();
+ return true;
+ }
} else
#endif
#if wxUSE_RADIOBTN
@@ -654,6 +717,26 @@ bool wxGenericValidator::TransferFromWindow()
return true;
}
+ else if (m_pInt)
+ {
+ wxCHECK_MSG(
+ !pControl->HasMultipleSelection(),
+ false,
+ "multi-select control requires wxArrayInt"
+ );
+
+ size_t i,
+ count = pControl->GetCount();
+ for ( i = 0; i < count; i++ )
+ {
+ if (pControl->IsChecked(i))
+ {
+ *m_pInt = i;
+ }
+ }
+
+ return true;
+ }
else
return false;
} else
@@ -676,10 +759,35 @@ bool wxGenericValidator::TransferFromWindow()
m_pArrayInt->Add(i);
}
+ return true;
+ }
+ else if (m_pInt)
+ {
+ wxCHECK_MSG(
+ !pControl->HasMultipleSelection(),
+ false,
+ "multi-select control requires wxArrayInt"
+ );
+
+ *m_pInt = pControl->GetSelection();
+
return true;
}
} else
#endif
+#if wxUSE_COLOURPICKERCTRL
+ if (wxDynamicCast(m_validatorWindow, wxColourPickerCtrl))
+ {
+ wxColourPickerCtrl* pControl = (wxColourPickerCtrl*)m_validatorWindow;
+ if (m_pColour)
+ {
+ *m_pColour = pControl->GetColour();
+
+ return true;
+ }
+ }
+ else
+#endif
// unrecognized control, or bad pointer
return false;
@@ -702,6 +810,8 @@ void wxGenericValidator::Initialize()
m_pFileName = nullptr;
m_pFloat = nullptr;
m_pDouble = nullptr;
+ m_pColour = nullptr;
+ m_pCheckBoxState = nullptr;
}
#endif // wxUSE_VALIDATORS
diff --git a/src/common/zipstrm.cpp b/src/common/zipstrm.cpp
index 1f7fa388a6..6393596de0 100644
--- a/src/common/zipstrm.cpp
+++ b/src/common/zipstrm.cpp
@@ -2016,7 +2016,7 @@ bool wxZipInputStream::OpenDecompressor(bool raw /*=false*/)
}
}
- m_crcAccumulator = crc32(0, Z_NULL, 0);
+ m_crcAccumulator = crc32(0, nullptr, 0);
m_lasterror = m_decomp ? m_decomp->GetLastError() : wxSTREAM_READ_ERROR;
return IsOk();
}
@@ -2296,7 +2296,7 @@ bool wxZipOutputStream::DoCreate(wxZipEntry *entry, bool raw /*=false*/)
m_pending->SetOffset(m_headerOffset);
- m_crcAccumulator = crc32(0, Z_NULL, 0);
+ m_crcAccumulator = crc32(0, nullptr, 0);
if (raw)
m_raw = true;
diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp
index 437c9943fb..f5e111e519 100644
--- a/src/generic/datavgen.cpp
+++ b/src/generic/datavgen.cpp
@@ -5641,7 +5641,7 @@ bool wxDataViewCtrl::Create(wxWindow *parent,
SetInitialSize(size);
#ifdef __WXMAC__
- MacSetClipChildren( true );
+ MacSetClipChildren();
#endif
m_clientArea = new wxDataViewMainWindow( this, wxID_ANY );
diff --git a/src/generic/editlbox.cpp b/src/generic/editlbox.cpp
index 5f040ef227..641e541641 100644
--- a/src/generic/editlbox.cpp
+++ b/src/generic/editlbox.cpp
@@ -113,6 +113,10 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id,
m_style = style;
+ // wxEL_ALLOW_NEW requires ability to edit labels so implicitly add wxEL_ALLOW_EDIT
+ if ( m_style & wxEL_ALLOW_NEW )
+ m_style |= wxEL_ALLOW_EDIT;
+
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
wxPanel *subp = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
@@ -167,7 +171,7 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id,
sizer->Add(subp, wxSizerFlags().Expand());
long st = wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL | wxSUNKEN_BORDER;
- if ( style & wxEL_ALLOW_EDIT )
+ if ( m_style & wxEL_ALLOW_EDIT )
st |= wxLC_EDIT_LABELS;
m_listCtrl = new CleverListCtrl(this, wxID_ELB_LISTCTRL,
wxDefaultPosition, wxDefaultSize, st);
diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp
index fec78cd1f6..44b476ec0a 100644
--- a/src/generic/grid.cpp
+++ b/src/generic/grid.cpp
@@ -2789,6 +2789,10 @@ void wxGrid::InitPixelFields()
m_defaultRowHeight += 4;
#endif
+ // Scroll by row height to avoid showing partial rows when all heights are
+ // the same.
+ m_yScrollPixelsPerLine = m_defaultRowHeight;
+
// Don't change the value when called from OnDPIChanged() later if the
// corresponding label window is hidden, these values should remain zeroes
// then.
@@ -6095,72 +6099,12 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
case 'C':
if ( event.GetModifiers() == wxMOD_CONTROL )
{
- // Coordinates of the selected block to copy to clipboard.
- wxGridBlockCoords sel;
-
- // Check if we have any selected blocks and if we don't
- // have too many of them.
- const wxGridBlocks blocks = GetSelectedBlocks();
- wxGridBlocks::iterator iter = blocks.begin();
- if ( iter == blocks.end() )
+ if ( !CopySelection() )
{
- // No selection, copy just the current cell.
- if ( m_currentCellCoords == wxGridNoCellCoords )
- {
- // But we don't even have it -- nothing to do then.
- event.Skip();
- break;
- }
-
- sel = wxGridBlockCoords(GetGridCursorRow(),
- GetGridCursorCol(),
- GetGridCursorRow(),
- GetGridCursorCol());
+ wxLogWarning(_("Error copying grid to the clipboard. "
+ "Either selected cells were not contiguous or "
+ "no cell was selected."));
}
- else // We do have at least one selected block.
- {
- sel = *blocks.begin();
-
- if ( ++iter != blocks.end() )
- {
- // As we use simple text format, we can't copy more
- // than one block to clipboard.
- wxLogWarning
- (
- _("Copying more than one selected block "
- "to clipboard is not supported.")
- );
- break;
- }
- }
-
- wxClipboardLocker lockClipboard;
- if ( !lockClipboard )
- {
- // Error message should have been already given and we
- // don't have much to add.
- break;
- }
-
- wxString buf;
- for ( int row = sel.GetTopRow(); row <= sel.GetBottomRow(); row++ )
- {
- bool first = true;
-
- for ( int col = sel.GetLeftCol(); col <= sel.GetRightCol(); col++ )
- {
- if ( first )
- first = false;
- else
- buf += '\t';
-
- buf += GetCellValue(row, col);
- }
-
- buf += wxTextFile::GetEOL();
- }
-
- wxTheClipboard->SetData(new wxTextDataObject(buf));
break;
}
wxFALLTHROUGH;
@@ -9905,8 +9849,11 @@ void wxGrid::DoSetRowSize( int row, int height )
int cw, ch;
GetClientSize(&cw, &ch);
- const wxRect updateRect(0, y, cw, ch - y);
- Refresh(true, &updateRect);
+ if (ch > y)
+ {
+ const wxRect updateRect(0, y, cw, ch - y);
+ Refresh(true, &updateRect);
+ }
}
}
@@ -10046,8 +9993,11 @@ void wxGrid::DoSetColSize( int col, int width )
int cw, ch;
GetClientSize(&cw, &ch);
- const wxRect updateRect(x, 0, cw - x, ch);
- Refresh(true, &updateRect);
+ if (cw > x)
+ {
+ const wxRect updateRect(x, 0, cw - x, ch);
+ Refresh(true, &updateRect);
+ }
}
}
@@ -10846,6 +10796,76 @@ void wxGrid::ClearSelection()
m_selection->ClearSelection();
}
+bool wxGrid::CopySelection()
+{
+#if wxUSE_CLIPBOARD
+ // Coordinates of the selected block to copy to clipboard.
+ wxGridBlockCoords sel;
+
+ // Check if we have any selected blocks and if we don't
+ // have too many of them.
+ const wxGridBlocks blocks = GetSelectedBlocks();
+ wxGridBlocks::iterator iter = blocks.begin();
+ if (iter == blocks.end())
+ {
+ // No selection, copy just the current cell.
+ if (m_currentCellCoords == wxGridNoCellCoords)
+ {
+ // But we don't even have it -- nothing to do then.
+ return false;
+ }
+
+ sel = wxGridBlockCoords(GetGridCursorRow(),
+ GetGridCursorCol(),
+ GetGridCursorRow(),
+ GetGridCursorCol());
+ }
+ else // We do have at least one selected block.
+ {
+ sel = *blocks.begin();
+
+ if (++iter != blocks.end())
+ {
+ // As we use simple text format, we can't copy more
+ // than one block to clipboard.
+ return false;
+ }
+ }
+
+ wxClipboardLocker lockClipboard;
+ if (!lockClipboard)
+ {
+ return false;
+ }
+
+ bool firstRow = true;
+ wxString buf;
+ for (int row = sel.GetTopRow(); row <= sel.GetBottomRow(); row++)
+ {
+ if (firstRow)
+ firstRow = false;
+ else
+ buf += wxTextFile::GetEOL();
+
+ bool firstColumn = true;
+
+ for (int col = sel.GetLeftCol(); col <= sel.GetRightCol(); col++)
+ {
+ if (firstColumn)
+ firstColumn = false;
+ else
+ buf += '\t';
+
+ buf += GetCellValue(row, col);
+ }
+ }
+
+ wxTheClipboard->SetData(new wxTextDataObject(buf));
+#endif // wxUSE_CLIPBOARD
+
+ return true;
+}
+
// This function returns the rectangle that encloses the given block
// in device coords clipped to the client size of the grid window.
//
diff --git a/src/generic/headerctrlg.cpp b/src/generic/headerctrlg.cpp
index d24a615f9f..8df6a27826 100644
--- a/src/generic/headerctrlg.cpp
+++ b/src/generic/headerctrlg.cpp
@@ -456,7 +456,22 @@ bool wxHeaderCtrl::EndReordering(int xPhysical)
const unsigned pos = GetColumnPos(colNew);
event.SetNewOrder(pos);
- if ( !GetEventHandler()->ProcessEvent(event) || event.IsAllowed() )
+ const bool processed = GetEventHandler()->ProcessEvent(event);
+
+ if ( !processed )
+ {
+ // get the reordered columns
+ wxArrayInt order = GetColumnsOrder();
+ MoveColumnInOrderArray(order, colOld, pos);
+
+ // As the event wasn't processed, call the virtual function
+ // callback.
+ UpdateColumnsOrder(order);
+
+ // update columns order
+ SetColumnsOrder(order);
+ }
+ else if ( event.IsAllowed() )
{
// do reorder the columns
DoMoveCol(colOld, pos);
diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp
index 2a768cd12f..e78522633f 100644
--- a/src/generic/imaglist.cpp
+++ b/src/generic/imaglist.cpp
@@ -125,6 +125,7 @@ int wxGenericImageList::Add( const wxBitmap &bitmap )
// Cannot add image to invalid list
wxCHECK_MSG( m_size != wxSize(0, 0), -1, "Invalid image list" );
+ const int index = GetImageCount();
const wxSize bitmapSize = bitmap.GetSize();
// There is a special case: a bitmap may contain more than one image,
@@ -155,7 +156,7 @@ int wxGenericImageList::Add( const wxBitmap &bitmap )
return -1;
}
- return GetImageCount() - 1;
+ return index;
}
int wxGenericImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask )
diff --git a/src/generic/laywin.cpp b/src/generic/laywin.cpp
index 1564b3a3f7..9367b14fea 100644
--- a/src/generic/laywin.cpp
+++ b/src/generic/laywin.cpp
@@ -50,7 +50,7 @@ void wxSashLayoutWindow::Init()
m_orientation = wxLAYOUT_HORIZONTAL;
m_alignment = wxLAYOUT_TOP;
#ifdef __WXMAC__
- MacSetClipChildren( true ) ;
+ MacSetClipChildren() ;
#endif
}
diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp
index 4f347509be..148722a598 100644
--- a/src/generic/scrlwing.cpp
+++ b/src/generic/scrlwing.cpp
@@ -444,7 +444,7 @@ void wxScrollHelperBase::DoSetTargetWindow(wxWindow *target)
{
m_targetWindow = target;
#ifdef __WXMAC__
- target->MacSetClipChildren( true ) ;
+ target->MacSetClipChildren() ;
#endif
// install the event handler which will intercept the events we're
@@ -955,12 +955,12 @@ void wxScrollHelperBase::HandleOnMouseLeave(wxMouseEvent& event)
else // we're lower or to the right of the window
{
wxSize size = m_targetWindow->GetClientSize();
- if ( pt.x > size.x )
+ if ( pt.x >= size.x )
{
orient = wxHORIZONTAL;
pos = m_xScrollLines;
}
- else if ( pt.y > size.y )
+ else if ( pt.y >= size.y )
{
orient = wxVERTICAL;
pos = m_yScrollLines;
diff --git a/src/generic/splitter.cpp b/src/generic/splitter.cpp
index 0cd9009cc2..5636704951 100644
--- a/src/generic/splitter.cpp
+++ b/src/generic/splitter.cpp
@@ -69,30 +69,19 @@ wxBEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow)
#endif // wxMSW
wxEND_EVENT_TABLE()
+bool wxSplitterWindow::AlwaysUsesLiveUpdate() const
+{
+ return !wxClientDC::CanBeUsedForDrawing(this);
+}
+
static bool IsLive(wxSplitterWindow* wnd)
{
// with wxSP_LIVE_UPDATE style the splitter windows are always resized
// following the mouse movement while it drags the sash, without it we only
// draw the sash at the new position but only resize the windows when the
- // dragging is finished
-#if defined( __WXMAC__ ) && defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX == 1
- return true; // Mac can't paint outside paint event - always need live mode
-#else
- // wxClientDC doesn't work with Wayland either, so check if we're using it.
- #if defined(__WXGTK3__) && defined(__UNIX__)
- switch ( wxGetDisplayInfo().type )
- {
- case wxDisplayNone:
- case wxDisplayX11:
- break;
-
- case wxDisplayWayland:
- return true;
- }
- #endif // wxGTK3
-
- return wnd->HasFlag(wxSP_LIVE_UPDATE);
-#endif
+ // dragging is finished -- but drawing the sash is done using wxClientDC,
+ // so check if we can use it and always use live resizing if we can't
+ return wnd->AlwaysUsesLiveUpdate() || wnd->HasFlag(wxSP_LIVE_UPDATE);
}
bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id,
@@ -531,9 +520,14 @@ void wxSplitterWindow::OnSize(wxSizeEvent& event)
void wxSplitterWindow::OnDPIChanged(wxDPIChangedEvent& event)
{
+ // On platforms requiring scaling by DPI factor we need to do it whenever
+ // DPI changes, but elsewhere we shouldn't do it as the same logical
+ // coordinates are used irrespectively of the current DPI value.
+#ifndef wxHAS_DPI_INDEPENDENT_PIXELS
m_minimumPaneSize = event.ScaleX(m_minimumPaneSize);
m_sashPosition = event.ScaleX(m_sashPosition);
m_lastSize = event.Scale(m_lastSize);
+#endif // !wxHAS_DPI_INDEPENDENT_PIXELS
event.Skip();
}
diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp
index c86486d0d9..02f21c659c 100644
--- a/src/generic/treectlg.cpp
+++ b/src/generic/treectlg.cpp
@@ -297,7 +297,8 @@ public:
// set them
void SetAttributes(wxItemAttr *attr)
{
- if ( m_ownsAttr ) delete m_attr;
+ if ( m_ownsAttr )
+ delete m_attr;
m_attr = attr;
m_ownsAttr = false;
m_width = 0;
@@ -642,7 +643,8 @@ wxGenericTreeItem::~wxGenericTreeItem()
{
delete m_data;
- if (m_ownsAttr) delete m_attr;
+ if (m_ownsAttr)
+ delete m_attr;
wxASSERT_MSG( m_children.IsEmpty(),
"must call DeleteChildren() before deleting the item" );
@@ -684,9 +686,11 @@ void wxGenericTreeItem::GetSize( int &x, int &y,
const wxGenericTreeCtrl *theButton )
{
int bottomY=m_y+theButton->GetLineHeight(this);
- if ( y < bottomY ) y = bottomY;
+ if ( y < bottomY )
+ y = bottomY;
int width = m_x + m_width;
- if ( x < width ) x = width;
+ if ( x < width )
+ x = width;
if (IsExpanded())
{
@@ -781,7 +785,8 @@ wxGenericTreeItem *wxGenericTreeItem::HitTest(const wxPoint& point,
}
// if children are expanded, fall through to evaluate them
- if (m_isCollapsed) return nullptr;
+ if (m_isCollapsed)
+ return nullptr;
}
// evaluate children
@@ -824,7 +829,8 @@ int wxGenericTreeItem::GetCurrentImage() const
// maybe it doesn't have the specific image we want,
// try the default one instead
- if ( image == NO_IMAGE ) image = GetImage();
+ if ( image == NO_IMAGE )
+ image = GetImage();
return image;
}
@@ -898,10 +904,7 @@ wxGenericTreeItem::DoCalculateSize(wxGenericTreeCtrl* control,
int img_h = wxMax(state_h, image_h);
m_height = wxMax(img_h, text_h);
- if (m_height < 30)
- m_height += 2; // at least 2 pixels
- else
- m_height += m_height / 10; // otherwise 10% extra spacing
+ m_height += control->FromDIP(2); // See CalculateLineHeight().
if (m_height > control->m_lineHeight)
control->m_lineHeight = m_height;
@@ -944,6 +947,7 @@ wxBEGIN_EVENT_TABLE(wxGenericTreeCtrl, wxTreeCtrlBase)
EVT_KILL_FOCUS (wxGenericTreeCtrl::OnKillFocus)
EVT_TREE_ITEM_GETTOOLTIP(wxID_ANY, wxGenericTreeCtrl::OnGetToolTip)
EVT_SYS_COLOUR_CHANGED(wxGenericTreeCtrl::OnSysColourChanged)
+ EVT_DPI_CHANGED(wxGenericTreeCtrl::OnDPIChanged)
wxEND_EVENT_TABLE()
// -----------------------------------------------------------------------------
@@ -960,8 +964,8 @@ void wxGenericTreeCtrl::Init()
m_dirty = false;
m_lineHeight = 10;
- m_indent = 15;
- m_spacing = 18;
+ m_indent = 0;
+ m_spacing = 0;
m_dragCount = 0;
m_isDragging = false;
@@ -996,15 +1000,6 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent,
name ) )
return false;
- // If the tree display has no buttons, but does have
- // connecting lines, we can use a narrower layout.
- // It may not be a good idea to force this...
- if (!HasButtons() && !HasFlag(wxTR_NO_LINES))
- {
- m_indent= 10;
- m_spacing = 10;
- }
-
m_hasExplicitFgCol = m_hasFgCol;
m_hasExplicitBgCol = m_hasBgCol;
m_hasExplicitFont = m_hasFont;
@@ -1068,6 +1063,9 @@ void wxGenericTreeCtrl::InitVisualAttributes()
m_normalFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
#endif
m_boldFont = m_normalFont.Bold();
+
+ m_indent = FromDIP(10);
+ m_spacing = FromDIP(10);
}
// -----------------------------------------------------------------------------
@@ -1094,7 +1092,7 @@ unsigned int wxGenericTreeCtrl::GetCount() const
void wxGenericTreeCtrl::SetIndent(unsigned int indent)
{
- m_indent = (unsigned short) indent;
+ m_indent = indent;
m_dirty = true;
}
@@ -2191,7 +2189,8 @@ void wxGenericTreeCtrl::DoSelectItem(const wxTreeItemId& itemId,
// ctrl press
if (unselect_others)
{
- if (is_single) Unselect(); // to speed up thing
+ if (is_single)
+ Unselect(); // to speed up thing
else UnselectAll();
}
@@ -2286,7 +2285,8 @@ void wxGenericTreeCtrl::EnsureVisible(const wxTreeItemId& item)
{
wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
- if (!item.IsOk()) return;
+ if (!item.IsOk())
+ return;
wxGenericTreeItem *gitem = (wxGenericTreeItem*) item.m_pItem;
@@ -2310,8 +2310,6 @@ void wxGenericTreeCtrl::EnsureVisible(const wxTreeItemId& item)
}
}
- //if (parent) CalculatePositions();
-
ScrollTo(item);
}
@@ -2401,7 +2399,7 @@ void wxGenericTreeCtrl::SortChildren(const wxTreeItemId& itemId)
void wxGenericTreeCtrl::CalculateLineHeight()
{
wxClientDC dc(this);
- m_lineHeight = (int)(dc.GetCharHeight() + 4);
+ m_lineHeight = dc.GetCharHeight() + FromDIP(4);
if ( HasImages() )
{
@@ -2419,7 +2417,8 @@ void wxGenericTreeCtrl::CalculateLineHeight()
{
int width = 0, height = 0;
m_imagesState.GetImageLogicalSize(this, i, width, height);
- if (height > m_lineHeight) m_lineHeight = height;
+ if (height > m_lineHeight)
+ m_lineHeight = height;
}
}
@@ -2433,14 +2432,12 @@ void wxGenericTreeCtrl::CalculateLineHeight()
{
int width = 0, height = 0;
m_imagesButtons.GetImageLogicalSize(this, i, width, height);
- if (height > m_lineHeight) m_lineHeight = height;
+ if (height > m_lineHeight)
+ m_lineHeight = height;
}
}
- if (m_lineHeight < 30)
- m_lineHeight += 2; // at least 2 pixels
- else
- m_lineHeight += m_lineHeight/10; // otherwise 10% extra spacing
+ m_lineHeight += FromDIP(2); // Add some extra interline space.
}
void wxGenericTreeCtrl::OnImagesChanged()
@@ -2843,7 +2840,7 @@ wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item,
{
// draw the horizontal line here
int x_start = x;
- if (x > (signed)m_indent)
+ if (x > (int)m_indent)
x_start -= m_indent;
else if (HasFlag(wxTR_LINES_AT_ROOT))
x_start = 3;
@@ -2910,7 +2907,8 @@ wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item,
{
// draw line down to last child
oldY += GetLineHeight(children[n-1])>>1;
- if (HasButtons()) y_mid += 5;
+ if (HasButtons())
+ y_mid += 5;
// Only draw the portion of the line that is visible, in case
// it is huge
@@ -3294,7 +3292,8 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
while (current.IsOk() && !next)
{
current = GetItemParent( current );
- if (current) next = GetNextSibling( current );
+ if (current)
+ next = GetNextSibling( current );
}
}
if (next)
@@ -3426,11 +3425,16 @@ wxGenericTreeCtrl::DoTreeHitTest(const wxPoint& point, int& flags) const
int w, h;
GetSize(&w, &h);
flags=0;
- if (point.x<0) flags |= wxTREE_HITTEST_TOLEFT;
- if (point.x>w) flags |= wxTREE_HITTEST_TORIGHT;
- if (point.y<0) flags |= wxTREE_HITTEST_ABOVE;
- if (point.y>h) flags |= wxTREE_HITTEST_BELOW;
- if (flags) return wxTreeItemId();
+ if (point.x<0)
+ flags |= wxTREE_HITTEST_TOLEFT;
+ if (point.x>w)
+ flags |= wxTREE_HITTEST_TORIGHT;
+ if (point.y<0)
+ flags |= wxTREE_HITTEST_ABOVE;
+ if (point.y>h)
+ flags |= wxTREE_HITTEST_BELOW;
+ if (flags)
+ return wxTreeItemId();
if (m_anchor == nullptr)
{
@@ -3568,7 +3572,8 @@ void wxGenericTreeCtrl::OnRenameTimer()
void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
{
- if ( !m_anchor )return;
+ if ( !m_anchor )
+ return;
wxPoint pt = CalcUnscrolledPosition(event.GetPosition());
@@ -4004,7 +4009,8 @@ wxGenericTreeCtrl::CalculateLevel(wxGenericTreeItem *item,
void wxGenericTreeCtrl::CalculatePositions()
{
- if ( !m_anchor ) return;
+ if ( !m_anchor )
+ return;
wxClientDC dc(this);
PrepareDC( dc );
@@ -4203,4 +4209,16 @@ wxSize wxGenericTreeCtrl::DoGetBestSize() const
return size;
}
+void wxGenericTreeCtrl::OnDPIChanged(wxDPIChangedEvent& event)
+{
+ // For the platforms using DPI-dependent pixels we need to adjust various
+ // metrics after the DPI change.
+#ifndef wxHAS_DPI_INDEPENDENT_PIXELS
+ m_indent = event.ScaleX(m_indent);
+ m_spacing = event.ScaleX(m_spacing);
+#endif // !wxHAS_DPI_INDEPENDENT_PIXELS
+
+ event.Skip();
+}
+
#endif // wxUSE_TREECTRL
diff --git a/src/generic/vscroll.cpp b/src/generic/vscroll.cpp
index 66db08c8eb..2f14570630 100644
--- a/src/generic/vscroll.cpp
+++ b/src/generic/vscroll.cpp
@@ -435,7 +435,7 @@ void wxVarScrollHelperBase::DoSetTargetWindow(wxWindow *target)
{
m_targetWindow = target;
#ifdef __WXMAC__
- target->MacSetClipChildren( true ) ;
+ target->MacSetClipChildren() ;
#endif
// install the event handler which will intercept the events we're
diff --git a/src/generic/wizard.cpp b/src/generic/wizard.cpp
index bb0978936b..a346e0be14 100644
--- a/src/generic/wizard.cpp
+++ b/src/generic/wizard.cpp
@@ -999,7 +999,7 @@ bool wxWizard::ResizeBitmap(wxBitmap& bmp)
if (!m_statbmp->GetBitmap().IsOk() || m_statbmp->GetBitmap().GetLogicalHeight() != bitmapHeight)
{
wxBitmap bitmap;
- bitmap.CreateWithDIPSize(bitmapWidth, bitmapHeight, bmp.GetScaleFactor(), bmp.GetDepth());
+ bitmap.CreateWithLogicalSize(bitmapWidth, bitmapHeight, bmp.GetScaleFactor(), bmp.GetDepth());
{
wxMemoryDC dc;
dc.SelectObject(bitmap);
diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp
index e11a1144aa..06722a437f 100644
--- a/src/gtk/checkbox.cpp
+++ b/src/gtk/checkbox.cpp
@@ -141,25 +141,17 @@ bool wxCheckBox::Create(wxWindow *parent,
m_parent->DoAddChild( this );
-#ifdef __WXGTK3__
- // CSS added if the window has wxNO_BORDER inside base class PostCreation()
- // makes checkbox look broken in the default GTK 3 theme, so avoid doing
- // this by temporarily turning this flag off.
- if ( style & wxNO_BORDER )
- ToggleWindowStyle(wxNO_BORDER);
-#endif
-
PostCreation(size);
-#ifdef __WXGTK3__
- // Turn it back on if necessary.
- if ( style & wxNO_BORDER )
- ToggleWindowStyle(wxNO_BORDER);
-#endif
-
return true;
}
+void wxCheckBox::GTKRemoveBorder()
+{
+ // CSS added if the window has wxBORDER_NONE makes
+ // checkbox look broken in the default GTK 3 theme
+}
+
void wxCheckBox::GTKDisableEvents()
{
g_signal_handlers_block_by_func(m_widgetCheckbox,
diff --git a/src/gtk/control.cpp b/src/gtk/control.cpp
index 8af81617a7..5787a26774 100644
--- a/src/gtk/control.cpp
+++ b/src/gtk/control.cpp
@@ -78,15 +78,11 @@ wxSize wxControl::DoGetBestSize() const
// Do not return any arbitrary default value...
wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );
- wxSize best;
+ wxSize best(GTKGetPreferredSize(m_widget));
if (m_wxwindow)
{
- // this is not a native control, size_request is likely to be (0,0)
- best = wxControlBase::DoGetBestSize();
- }
- else
- {
- best = GTKGetPreferredSize(m_widget);
+ // For non-native controls, GTK preferred size may not be useful
+ best.IncTo(base_type::DoGetBestSize());
}
return best;
@@ -96,11 +92,6 @@ void wxControl::PostCreation(const wxSize& size)
{
wxWindow::PostCreation();
-#ifdef __WXGTK3__
- if (HasFlag(wxNO_BORDER))
- GTKApplyCssStyle("*{ border:none; border-radius:0; padding:0 }");
-#endif
-
#ifndef __WXGTK3__
// NB: GetBestSize needs to know the style, otherwise it will assume
// default font and if the user uses a different font, determined
@@ -113,6 +104,13 @@ void wxControl::PostCreation(const wxSize& size)
SetInitialSize(size);
}
+void wxControl::GTKRemoveBorder()
+{
+#ifdef __WXGTK3__
+ GTKApplyCssStyle("*{ border:none; border-radius:0; padding:0 }");
+#endif
+}
+
// ----------------------------------------------------------------------------
// Work around a GTK+ bug whereby button is insensitive after being
// enabled
diff --git a/src/gtk/dc.cpp b/src/gtk/dc.cpp
index 2c0e3d77c9..4cb49d135f 100644
--- a/src/gtk/dc.cpp
+++ b/src/gtk/dc.cpp
@@ -486,6 +486,25 @@ wxClientDCImpl::wxClientDCImpl(wxClientDC* owner, wxWindow* window)
else
SetGraphicsContext(wxGraphicsContext::Create());
}
+
+/* static */
+bool wxClientDCImpl::CanBeUsedForDrawing(const wxWindow* WXUNUSED(window))
+{
+#ifdef __UNIX__
+ switch ( wxGetDisplayInfo().type )
+ {
+ case wxDisplayNone:
+ case wxDisplayX11:
+ break;
+
+ case wxDisplayWayland:
+ return false;
+ }
+#endif // __UNIX__
+
+ return true;
+}
+
//-----------------------------------------------------------------------------
wxPaintDCImpl::wxPaintDCImpl(wxPaintDC* owner, wxWindow* window)
diff --git a/src/gtk/gauge.cpp b/src/gtk/gauge.cpp
index 52c8690ff0..56ff299dde 100644
--- a/src/gtk/gauge.cpp
+++ b/src/gtk/gauge.cpp
@@ -39,7 +39,8 @@ bool wxGauge::Create( wxWindow *parent,
m_widget = gtk_progress_bar_new();
g_object_ref(m_widget);
- if ( style & wxGA_VERTICAL )
+ const bool isVertical = (style & wxGA_VERTICAL) != 0;
+ if (isVertical)
{
#ifdef __WXGTK3__
gtk_orientable_set_orientation(GTK_ORIENTABLE(m_widget), GTK_ORIENTATION_VERTICAL);
@@ -56,6 +57,29 @@ bool wxGauge::Create( wxWindow *parent,
m_parent->DoAddChild( this );
PostCreation(size);
+#ifdef __WXGTK3__
+ int wh = isVertical ? size.x : size.y;
+ if (wh > 0 && gtk_check_version(3,20,0) == nullptr)
+ {
+ GtkCssProvider* provider = gtk_css_provider_new();
+ const char* whStr = isVertical ? "width" : "height";
+ char buf[40];
+ snprintf(buf, sizeof(buf), "*{min-%s:%dpx}", whStr, wh);
+ GTKApplyCssStyle(provider, buf);
+
+ int min;
+ if (isVertical)
+ gtk_widget_get_preferred_width(m_widget, &min, nullptr);
+ else
+ gtk_widget_get_preferred_height(m_widget, &min, nullptr);
+
+ // Adjust the min{width,height} to get the right overall size
+ wh -= min - wh;
+ snprintf(buf, sizeof(buf), "*{min-%s:%dpx}", whStr, wxMax(wh, 1));
+ GTKApplyCssStyle(provider, buf);
+ g_object_unref(provider);
+ }
+#endif
SetInitialSize(size);
return true;
diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp
index 53d4be47e6..50950df161 100644
--- a/src/gtk/listbox.cpp
+++ b/src/gtk/listbox.cpp
@@ -378,7 +378,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
m_parent->DoAddChild( this );
PostCreation(size);
- SetInitialSize(size); // need this too because this is a wxControlWithItems
g_signal_connect_after (selection, "changed",
G_CALLBACK (gtk_listitem_changed_callback), this);
@@ -936,7 +935,15 @@ wxSize wxListBox::DoGetBestSize() const
// Don't make the listbox too tall but don't make it too small either
lbHeight = (cy+4) * wxMin(wxMax(count, 3), 10);
- return wxSize(lbWidth, lbHeight);
+ wxSize size(lbWidth, lbHeight);
+#ifdef __WXGTK3__
+ // Ensure size is at least the required minimum
+ wxSize min;
+ gtk_widget_get_preferred_width(m_widget, &min.x, nullptr);
+ gtk_widget_get_preferred_height_for_width(m_widget, min.x, &min.y, nullptr);
+ size.IncTo(min);
+#endif
+ return size;
}
// static
diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp
index 41e5279bd3..bcfd30895b 100644
--- a/src/gtk/textctrl.cpp
+++ b/src/gtk/textctrl.cpp
@@ -797,11 +797,8 @@ bool wxTextCtrl::Create( wxWindow *parent,
// new, empty control, see https://github.com/wxWidgets/wxWidgets/issues/11409
gtk_entry_get_text((GtkEntry*)m_text);
-#ifndef __WXGTK3__
if (style & wxNO_BORDER)
gtk_entry_set_has_frame((GtkEntry*)m_text, FALSE);
-#endif
-
}
g_object_ref(m_widget);
@@ -2156,24 +2153,13 @@ wxSize wxTextCtrl::DoGetSizeFromTextSize(int xlen, int ylen) const
//multiline
else
{
- // add space for vertical scrollbar
- if ( m_scrollBar[1] && !(m_windowStyle & wxTE_NO_VSCROLL) )
- tsize.IncBy(GTKGetPreferredSize(GTK_WIDGET(m_scrollBar[1])).x + 3, 0);
-
// height
if ( ylen <= 0 )
- {
tsize.y = 1 + cHeight * wxMax(wxMin(GetNumberOfLines(), 10), 2);
- // add space for horizontal scrollbar
- if ( m_scrollBar[0] && (m_windowStyle & wxHSCROLL) )
- tsize.IncBy(0, GTKGetPreferredSize(GTK_WIDGET(m_scrollBar[0])).y + 3);
- }
- if ( !HasFlag(wxBORDER_NONE) )
- {
- // hardcode borders, margins, etc
- tsize.IncBy(5, 4);
- }
+ GtkRequisition req;
+ gtk_widget_get_preferred_size(m_widget, &req, nullptr);
+ tsize.IncTo(wxSize(req.width, req.height));
}
// We should always use at least the specified height if it's valid.
diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp
index 590dd7543f..3ebd0cd052 100644
--- a/src/gtk/toplevel.cpp
+++ b/src/gtk/toplevel.cpp
@@ -737,7 +737,8 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
wxWindow *topParent = wxGetTopLevelParent(m_parent);
if (topParent && (((GTK_IS_WINDOW(topParent->m_widget)) &&
(GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)) ||
- (style & wxFRAME_FLOAT_ON_PARENT)))
+ (style & wxFRAME_FLOAT_ON_PARENT) ||
+ (style & wxSTAY_ON_TOP)))
{
gtk_window_set_transient_for( GTK_WINDOW(m_widget),
GTK_WINDOW(topParent->m_widget) );
diff --git a/src/gtk/win_gtk.cpp b/src/gtk/win_gtk.cpp
index 12dca59764..7c3d768553 100644
--- a/src/gtk/win_gtk.cpp
+++ b/src/gtk/win_gtk.cpp
@@ -458,6 +458,9 @@ struct AdjustData {
extern "C" {
static void scroll_adjust(GtkWidget* widget, void* data)
{
+ if (!gtk_widget_get_visible(widget))
+ return;
+
const AdjustData* p = static_cast(data);
GtkAllocation a;
gtk_widget_get_allocation(widget, &a);
diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp
index f6c7899c64..23d85f0b23 100644
--- a/src/gtk/window.cpp
+++ b/src/gtk/window.cpp
@@ -1968,27 +1968,54 @@ gtk_window_motion_notify_callback( GtkWidget * WXUNUSED(widget),
if ( g_captureWindow )
{
// synthesise a mouse enter or leave event if needed
- GdkWindow* winUnderMouse =
- wx_gdk_device_get_window_at_position(gdk_event->device, nullptr, nullptr);
+ GdkWindow* winUnderMouse = nullptr;
+ bool isOut = true;
- GdkDisplay* display = winUnderMouse
- ? gdk_window_get_display(winUnderMouse)
- : nullptr;
- if ( !display )
- display = gdk_display_get_default();
+ if (gdk_event->x >= 0 && gdk_event->y >= 0)
+ {
+ const wxSize size(win->GetClientSize());
+ if (gdk_event->x < size.x && gdk_event->y < size.y)
+ {
+ isOut = false;
+ winUnderMouse =
+ wx_gdk_device_get_window_at_position(
+ gdk_event->device, nullptr, nullptr);
+ }
+ }
- // This seems to be necessary and actually been added to
- // GDK itself in version 2.0.X
- gdk_display_flush(display);
+ const bool hadMouse = g_captureWindowHasMouse;
+ g_captureWindowHasMouse = false;
- bool hasMouse = winUnderMouse == gdk_event->window;
- if ( hasMouse != g_captureWindowHasMouse )
+ if (winUnderMouse == gdk_event->window)
+ g_captureWindowHasMouse = true;
+#ifdef __WXGTK3__
+ else if (winUnderMouse)
+ {
+ // Avoid treating overlay scrollbar as a different window
+ void* widgetUnderMouse;
+ gdk_window_get_user_data(winUnderMouse, &widgetUnderMouse);
+ if (GTK_IS_SCROLLBAR(widgetUnderMouse))
+ {
+ GtkWidget* parent = gtk_widget_get_parent(GTK_WIDGET(widgetUnderMouse));
+ if (parent == win->m_widget && GTK_IS_SCROLLED_WINDOW(parent))
+ g_captureWindowHasMouse = true;
+ }
+ }
+#endif
+
+ if (g_captureWindowHasMouse != hadMouse)
{
// the mouse changed window
- g_captureWindowHasMouse = hasMouse;
-
wxMouseEvent eventM(g_captureWindowHasMouse ? wxEVT_ENTER_WINDOW
: wxEVT_LEAVE_WINDOW);
+ if (!g_captureWindowHasMouse && isOut)
+ {
+ // Ensure fractional coordinate is outside window when converted to int
+ if (gdk_event->x < 0)
+ gdk_event->x = floor(gdk_event->x);
+ if (gdk_event->y < 0)
+ gdk_event->y = floor(gdk_event->y);
+ }
InitMouseEvent(win, eventM, gdk_event);
eventM.SetEventObject(win);
win->GTKProcessEvent(eventM);
@@ -2001,10 +2028,9 @@ gtk_window_motion_notify_callback( GtkWidget * WXUNUSED(widget),
// reset the event object and id in case win changed.
event.SetEventObject( win );
event.SetId( win->GetId() );
- }
- if ( !g_captureWindow )
SendSetCursorEvent(win, event.m_x, event.m_y);
+ }
bool ret = win->GTKProcessEvent(event);
@@ -4913,11 +4939,20 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase )
return true;
}
+void wxWindowGTK::GTKRemoveBorder()
+{
+}
+
void wxWindowGTK::DoAddChild(wxWindowGTK *child)
{
wxASSERT_MSG( (m_widget != nullptr), wxT("invalid window") );
wxASSERT_MSG( (child != nullptr), wxT("invalid child window") );
+ // If parent is already showing, changing CSS after adding child
+ // can cause transitory visual glitches, so change it here
+ if (HasFlag(wxBORDER_NONE))
+ GTKRemoveBorder();
+
/* add to list */
AddChild( child );
diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp
index 334917c28e..6f06027f14 100644
--- a/src/msw/bitmap.cpp
+++ b/src/msw/bitmap.cpp
@@ -775,6 +775,17 @@ bool wxBitmap::CreateWithDIPSize(const wxSize& size, double scale, int depth)
return true;
}
+bool
+wxBitmap::CreateWithLogicalSize(const wxSize& size, double scale, int depth)
+{
+ if ( !Create(size, depth) )
+ return false;
+
+ GetBitmapData()->m_scaleFactor = scale;
+
+ return true;
+}
+
bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc)
{
UnRef();
diff --git a/src/msw/brush.cpp b/src/msw/brush.cpp
index 3c07666f0c..f1cfe69048 100644
--- a/src/msw/brush.cpp
+++ b/src/msw/brush.cpp
@@ -282,7 +282,7 @@ wxBitmap *wxBrush::GetStipple() const
WXHANDLE wxBrush::GetResourceHandle() const
{
- wxCHECK_MSG( IsOk(), FALSE, wxT("invalid brush") );
+ wxCHECK_MSG( IsOk(), nullptr, wxT("invalid brush") );
return (WXHANDLE)M_BRUSHDATA->GetHBRUSH();
}
diff --git a/src/msw/crashrpt.cpp b/src/msw/crashrpt.cpp
index 9d4cd22c08..1b591451db 100644
--- a/src/msw/crashrpt.cpp
+++ b/src/msw/crashrpt.cpp
@@ -129,7 +129,7 @@ void wxCrashReportImpl::Output(const wxChar *format, ...)
wxString s = wxString::FormatV(format, argptr);
wxCharBuffer buf(s.mb_str(wxConvUTF8));
- ::WriteFile(m_hFile, buf.data(), strlen(buf.data()), &cbWritten, 0);
+ ::WriteFile(m_hFile, buf.data(), strlen(buf.data()), &cbWritten, nullptr);
va_end(argptr);
}
diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp
index cf956ef7d5..cc2549ca7c 100644
--- a/src/msw/dcclient.cpp
+++ b/src/msw/dcclient.cpp
@@ -95,28 +95,6 @@ private:
wxDECLARE_NO_COPY_CLASS(wxPaintDCInfoOur);
};
-// This subclass contains information for the HDCs we receive from outside, as
-// WPARAM of WM_PAINT itself.
-class wxPaintDCInfoExternal : public wxPaintDCInfo
-{
-public:
- wxPaintDCInfoExternal(HDC hdc)
- : wxPaintDCInfo(hdc),
- m_state(::SaveDC(hdc))
- {
- }
-
- virtual ~wxPaintDCInfoExternal()
- {
- ::RestoreDC(m_hdc, m_state);
- }
-
-private:
- const int m_state;
-
- wxDECLARE_NO_COPY_CLASS(wxPaintDCInfoExternal);
-};
-
// The global map containing HDC to use for the given window. The entries in
// this map only exist during WM_PAINT processing and are destroyed when it is
// over.
diff --git a/src/msw/debughlp.cpp b/src/msw/debughlp.cpp
index 1dd33a5d6a..a4495401a7 100644
--- a/src/msw/debughlp.cpp
+++ b/src/msw/debughlp.cpp
@@ -105,7 +105,7 @@ static wxString gs_errMsg;
// ----------------------------------------------------------------------------
#define DEFINE_SYM_FUNCTION(func, name) \
- wxDbgHelpDLL::func ## _t wxDbgHelpDLL::func = 0
+ wxDbgHelpDLL::func ## _t wxDbgHelpDLL::func = nullptr
wxDO_FOR_ALL_SYM_FUNCS(DEFINE_SYM_FUNCTION);
diff --git a/src/msw/dialup.cpp b/src/msw/dialup.cpp
index c7547df737..6aeba14b34 100644
--- a/src/msw/dialup.cpp
+++ b/src/msw/dialup.cpp
@@ -815,7 +815,7 @@ bool wxDialUpManagerMSW::Dial(const wxString& nameOfISP,
&rasDialParams,
0, // use callback for notifications
async ? (void *)wxRasDialFunc // cast needed for gcc 3.1
- : 0, // no notifications, sync operation
+ : nullptr, // no notifications, sync operation
&ms_hRasConnection
);
diff --git a/src/msw/dir.cpp b/src/msw/dir.cpp
index a842a08b9a..074e6008a7 100644
--- a/src/msw/dir.cpp
+++ b/src/msw/dir.cpp
@@ -75,7 +75,7 @@ CheckFoundMatch(const FIND_STRUCT* finddata, const wxString& filter)
if ( filter.empty() )
return true;
- return ::PathMatchSpec(finddata->cFileName, filter) == TRUE;
+ return ::PathMatchSpec(finddata->cFileName, filter.t_str()) == TRUE;
}
inline bool
diff --git a/src/msw/dragimag.cpp b/src/msw/dragimag.cpp
index b62a027911..51c8e0f209 100644
--- a/src/msw/dragimag.cpp
+++ b/src/msw/dragimag.cpp
@@ -113,7 +113,7 @@ bool wxDragImage::Create(const wxBitmap& image, const wxCursor& cursor)
else
flags = ILC_COLOR32;
- bool mask = (image.GetMask() != 0);
+ bool mask = image.GetMask() != nullptr;
// Curiously, even if the image doesn't have a mask,
// we still have to use ILC_MASK or the image won't show
diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp
index f685688a63..ffd83aa7ba 100644
--- a/src/msw/filedlg.cpp
+++ b/src/msw/filedlg.cpp
@@ -1023,8 +1023,11 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
{
// NB: all style checks are done by wxFileDialogBase::Create
+}
- m_data = nullptr;
+wxFileDialog::~wxFileDialog()
+{
+ delete m_data;
// Must set to zero, otherwise the wx routines won't size the window
// the second time you call the file dialog, because it thinks it is
@@ -1033,11 +1036,6 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
gs_rectDialog.y = 0;
}
-wxFileDialog::~wxFileDialog()
-{
- delete m_data;
-}
-
wxFileDialogMSWData& wxFileDialog::MSWData()
{
if ( !m_data )
diff --git a/src/msw/fswatcher.cpp b/src/msw/fswatcher.cpp
index 6057ecc138..11fd4a9652 100644
--- a/src/msw/fswatcher.cpp
+++ b/src/msw/fswatcher.cpp
@@ -62,7 +62,7 @@ wxFSWatcherImplMSW::~wxFSWatcherImplMSW()
{
// order the worker thread to finish & wait
m_workerThread.Finish();
- if (m_workerThread.Wait() != 0)
+ if (m_workerThread.Wait())
{
wxLogError(_("Ungraceful worker thread termination"));
}
@@ -210,7 +210,7 @@ wxThread::ExitCode wxIOCPThread::Entry()
while ( ReadEvents() );
wxLogTrace(wxTRACE_FSWATCHER, "[iocp] Ended IOCP thread");
- return (ExitCode)0;
+ return nullptr;
}
// wait for events to occur, read them and send to interested parties
@@ -349,6 +349,8 @@ void wxIOCPThread::ProcessNativeEvents(wxVector& events)
}
wxFileSystemWatcherEvent event(flags, oldpath, newpath);
SendEvent(event);
+ if ( it == events.end() )
+ break;
}
// all other events
else
diff --git a/src/msw/glcanvas.cpp b/src/msw/glcanvas.cpp
index 21e0b5ea45..96d49c8228 100644
--- a/src/msw/glcanvas.cpp
+++ b/src/msw/glcanvas.cpp
@@ -170,7 +170,6 @@ inline T wxWGLProcCast(PROC proc)
// compilers (e.g. MinGW) this needs to be done at makefiles level.
#ifdef _MSC_VER
# pragma comment( lib, "opengl32" )
-# pragma comment( lib, "glu32" )
#endif
//-----------------------------------------------------------------------------
diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp
index 7d31c0c5d4..6faaa4e6de 100644
--- a/src/msw/graphicsd2d.cpp
+++ b/src/msw/graphicsd2d.cpp
@@ -2593,7 +2593,7 @@ public:
protected:
void DoAcquireResource() override
{
- HRESULT hr = GetContext()->CreateBitmapFromWicBitmap(m_srcBitmap, 0, &m_nativeResource);
+ HRESULT hr = GetContext()->CreateBitmapFromWicBitmap(m_srcBitmap, nullptr, &m_nativeResource);
wxCHECK_HRESULT_RET(hr);
}
diff --git a/src/msw/headerctrl.cpp b/src/msw/headerctrl.cpp
index a0b474c8ab..c152d7bb8e 100644
--- a/src/msw/headerctrl.cpp
+++ b/src/msw/headerctrl.cpp
@@ -38,6 +38,8 @@
#include "wx/msw/private/darkmode.h"
#include "wx/msw/private/winstyle.h"
+#include
+
#ifndef HDM_SETBITMAPMARGIN
#define HDM_SETBITMAPMARGIN 0x1234
#endif
@@ -59,7 +61,6 @@ public:
explicit wxMSWHeaderCtrl(wxHeaderCtrl& header) :
m_header(header)
{
- Init();
}
bool Create(wxWindow *parent,
@@ -69,8 +70,6 @@ public:
long style,
const wxString& name);
- virtual ~wxMSWHeaderCtrl();
-
// Override to implement colours support via custom drawing.
virtual bool SetBackgroundColour(const wxColour& colour) override;
virtual bool SetForegroundColour(const wxColour& colour) override;
@@ -104,9 +103,6 @@ private:
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const override;
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) override;
- // common part of all ctors
- void Init();
-
// wrapper around Header_InsertItem(): insert the item using information
// from the given column at the given index
void DoInsertItem(const wxHeaderColumn& col, unsigned int idx);
@@ -144,7 +140,7 @@ private:
// the number of columns in the control, including the hidden ones (not
// taken into account by the native control, see comment in DoGetCount())
- unsigned int m_numColumns;
+ unsigned int m_numColumns = 0;
// this is a lookup table allowing us to check whether the column with the
// given index is currently shown in the native control, in which case the
@@ -164,20 +160,20 @@ private:
wxArrayInt m_colIndices;
// the image list: initially nullptr, created on demand
- wxImageList *m_imageList;
+ std::unique_ptr m_imageList;
// the offset of the window used to emulate scrolling it
- int m_scrollOffset;
+ int m_scrollOffset = 0;
// actual column we are dragging or -1 if not dragging anything
- int m_colBeingDragged;
+ int m_colBeingDragged = -1;
// a column is currently being resized
- bool m_isColBeingResized;
+ bool m_isColBeingResized = false;
// the custom draw helper: initially nullptr, created on demand, use
// GetCustomDraw() to do it
- wxMSWHeaderCtrlCustomDraw *m_customDraw;
+ std::unique_ptr m_customDraw;
};
// ============================================================================
@@ -190,18 +186,6 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxMSWHeaderCtrlNameStr[] = "wxMSWHeader
// wxMSWHeaderCtrl construction/destruction
// ----------------------------------------------------------------------------
-void wxMSWHeaderCtrl::Init()
-{
- m_numColumns = 0;
- m_imageList = nullptr;
- m_scrollOffset = 0;
- m_colBeingDragged = -1;
- m_isColBeingResized = false;
- m_customDraw = nullptr;
-
- Bind(wxEVT_DPI_CHANGED, &wxMSWHeaderCtrl::WXHandleDPIChanged, this);
-}
-
bool wxMSWHeaderCtrl::Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
@@ -219,9 +203,15 @@ bool wxMSWHeaderCtrl::Create(wxWindow *parent,
if ( !MSWCreateControl(WC_HEADER, wxT(""), pos, size) )
return false;
+ Bind(wxEVT_DPI_CHANGED, &wxMSWHeaderCtrl::WXHandleDPIChanged, this);
+
if ( wxMSWDarkMode::IsActive() )
{
- m_customDraw = new wxMSWHeaderCtrlCustomDraw();
+ // Note that it may have been already allocated by MSWCreateControl()
+ // which calls SetFont() from InheritAttributes(), so don't recreate it
+ // in this case.
+ if ( !m_customDraw )
+ m_customDraw.reset(new wxMSWHeaderCtrlCustomDraw());
m_customDraw->UseHeaderThemeColors(GetHwnd());
}
@@ -262,12 +252,6 @@ bool wxMSWHeaderCtrl::MSWGetDarkModeSupport(MSWDarkModeSupport& support) const
return true;
}
-wxMSWHeaderCtrl::~wxMSWHeaderCtrl()
-{
- delete m_imageList;
- delete m_customDraw;
-}
-
// ----------------------------------------------------------------------------
// wxMSWHeaderCtrl scrolling
// ----------------------------------------------------------------------------
@@ -325,8 +309,7 @@ void wxMSWHeaderCtrl::MSWUpdateFontOnDPIChange(const wxSize& newDPI)
void wxMSWHeaderCtrl::WXHandleDPIChanged(wxDPIChangedEvent& event)
{
- delete m_imageList;
- m_imageList = nullptr;
+ m_imageList.reset();
for (unsigned int i = 0; i < m_numColumns; ++i)
{
UpdateHeader(i);
@@ -458,7 +441,7 @@ void wxMSWHeaderCtrl::DoInsertItem(const wxHeaderColumn& col, unsigned int idx)
if ( !m_imageList )
{
bmpSize = bb.GetPreferredBitmapSizeFor(this);
- m_imageList = new wxImageList(bmpSize.x, bmpSize.y);
+ m_imageList.reset(new wxImageList(bmpSize.x, bmpSize.y));
(void) // suppress mingw32 warning about unused computed value
Header_SetImageList(GetHwnd(), GetHimagelistOf(m_imageList));
}
@@ -662,20 +645,16 @@ wxMSWHeaderCtrlCustomDraw* wxMSWHeaderCtrl::GetCustomDraw()
// any longer.
if ( !m_hasBgCol && !m_hasFgCol && !wxMSWDarkMode::IsActive() )
{
- if ( m_customDraw )
- {
- delete m_customDraw;
- m_customDraw = nullptr;
- }
-
- return nullptr;
+ m_customDraw.reset();
+ }
+ else
+ {
+ // We do have at least one custom colour, so enable custom drawing.
+ if ( !m_customDraw )
+ m_customDraw.reset(new wxMSWHeaderCtrlCustomDraw());
}
- // We do have at least one custom colour, so enable custom drawing.
- if ( !m_customDraw )
- m_customDraw = new wxMSWHeaderCtrlCustomDraw();
-
- return m_customDraw;
+ return m_customDraw.get();
}
bool wxMSWHeaderCtrl::SetBackgroundColour(const wxColour& colour)
@@ -990,7 +969,17 @@ bool wxMSWHeaderCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
// internal column indices array if this is allowed to go ahead as
// the native control is going to reorder its columns now
if ( evtType == wxEVT_HEADER_END_REORDER )
- m_header.MoveColumnInOrderArray(m_colIndices, idx, order);
+ {
+ // If the event handler didn't process the event, call the
+ // virtual function callback.
+ wxArrayInt colIndices = m_header.GetColumnsOrder();
+ m_header.MoveColumnInOrderArray(colIndices, idx, order);
+ if ( !processed )
+ m_header.UpdateColumnsOrder(colIndices);
+
+ // And update internally columns indices in any case.
+ m_colIndices = colIndices;
+ }
if ( processed )
{
diff --git a/src/msw/mediactrl_qt.cpp b/src/msw/mediactrl_qt.cpp
index 06773ad699..11334ac77b 100644
--- a/src/msw/mediactrl_qt.cpp
+++ b/src/msw/mediactrl_qt.cpp
@@ -236,14 +236,14 @@ public:
wxDL_VOIDMETHOD_DEFINE(SetMovieBox, (Movie m, Rect* r), (m,r))
wxDL_VOIDMETHOD_DEFINE(SetMovieTimeScale, (Movie m, long s), (m,s))
wxDL_METHOD_DEFINE(long, GetMovieDuration, (Movie m), (m), 0)
- wxDL_METHOD_DEFINE(TimeBase, GetMovieTimeBase, (Movie m), (m), 0)
+ wxDL_METHOD_DEFINE(TimeBase, GetMovieTimeBase, (Movie m), (m), nullptr)
wxDL_METHOD_DEFINE(TimeScale, GetMovieTimeScale, (Movie m), (m), 0)
wxDL_METHOD_DEFINE(long, GetMovieTime, (Movie m, void* cruft), (m,cruft), 0)
wxDL_VOIDMETHOD_DEFINE(SetMovieTime, (Movie m, TimeRecord* tr), (m,tr) )
wxDL_METHOD_DEFINE(short, GetMovieVolume, (Movie m), (m), 0)
wxDL_VOIDMETHOD_DEFINE(SetMovieVolume, (Movie m, short sVolume), (m,sVolume) )
wxDL_VOIDMETHOD_DEFINE(SetMovieTimeValue, (Movie m, long s), (m,s))
- wxDL_METHOD_DEFINE(ComponentInstance, NewMovieController, (Movie m, const Rect* mr, long fl), (m,mr,fl), 0)
+ wxDL_METHOD_DEFINE(ComponentInstance, NewMovieController, (Movie m, const Rect* mr, long fl), (m,mr,fl), nullptr)
wxDL_VOIDMETHOD_DEFINE(DisposeMovieController, (ComponentInstance ci), (ci))
wxDL_METHOD_DEFINE(int, MCSetVisible, (ComponentInstance m, int b), (m, b), 0)
@@ -251,9 +251,9 @@ public:
wxDL_VOIDMETHOD_DEFINE(PrerollMovie, (Movie m, long t, Fixed r), (m,t,r) )
wxDL_METHOD_DEFINE(Fixed, GetMoviePreferredRate, (Movie m), (m), 0)
wxDL_METHOD_DEFINE(long, GetMovieLoadState, (Movie m), (m), 0)
- wxDL_METHOD_DEFINE(void*, NewRoutineDescriptor, (WXFARPROC f, int l, void* junk), (f, l, junk), 0)
+ wxDL_METHOD_DEFINE(void*, NewRoutineDescriptor, (WXFARPROC f, int l, void* junk), (f, l, junk), nullptr)
wxDL_VOIDMETHOD_DEFINE(DisposeRoutineDescriptor, (void* f), (f))
- wxDL_METHOD_DEFINE(void*, GetCurrentArchitecture, (), (), 0)
+ wxDL_METHOD_DEFINE(void*, GetCurrentArchitecture, (), (), nullptr)
wxDL_METHOD_DEFINE(int, MCDoAction, (ComponentInstance ci, long f, void* p), (ci,f,p), 0)
wxDL_VOIDMETHOD_DEFINE(MCSetControllerBoundsRect, (ComponentInstance ci, Rect* r), (ci,r))
wxDL_VOIDMETHOD_DEFINE(DestroyPortAssociation, (CGrafPtr g), (g))
diff --git a/src/msw/nativewin.cpp b/src/msw/nativewin.cpp
index c166f3e04e..a4f10d7bdc 100644
--- a/src/msw/nativewin.cpp
+++ b/src/msw/nativewin.cpp
@@ -111,6 +111,8 @@ bool wxNativeContainerWindow::Create(wxNativeContainerWindowHandle hwnd)
// inherit the other attributes we can from the native HWND
AdoptAttributesFromHWND();
+ wxTopLevelWindows.Append(this);
+
return true;
}
diff --git a/src/msw/ole/oleutils.cpp b/src/msw/ole/oleutils.cpp
index 4a6c90ac0c..72f5b29cc8 100644
--- a/src/msw/ole/oleutils.cpp
+++ b/src/msw/ole/oleutils.cpp
@@ -299,7 +299,12 @@ WXDLLEXPORT bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& ole
oleVariant.vt = VT_I8;
oleVariant.llVal = variant.GetLongLong().GetValue();
}
-#endif
+ else if (type == wxT("ulonglong"))
+ {
+ oleVariant.vt = VT_UI8;
+ oleVariant.ullVal = variant.GetULongLong().GetValue();
+ }
+#endif // wxUSE_LONGLONG
else if (type == wxT("char"))
{
oleVariant.vt=VT_I1; // Signed Char
@@ -469,6 +474,9 @@ wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant, long fla
case VT_I8:
variant = wxLongLong(oleVariant.llVal);
break;
+ case VT_UI8:
+ variant = wxULongLong(oleVariant.ullVal);
+ break;
#endif // wxUSE_LONGLONG
case VT_I4:
diff --git a/src/msw/overlay.cpp b/src/msw/overlay.cpp
index 030df35636..7df05aca45 100644
--- a/src/msw/overlay.cpp
+++ b/src/msw/overlay.cpp
@@ -103,7 +103,7 @@ void wxOverlayImpl::Init(wxDC* dc, int , int , int , int )
m_rect.SetSize(m_window->GetClientSize());
m_rect.SetPosition(m_window->GetScreenPosition());
- m_bitmap.CreateWithDIPSize(m_rect.GetSize(), m_window->GetDPIScaleFactor());
+ m_bitmap.CreateWithLogicalSize(m_rect.GetSize(), m_window->GetDPIScaleFactor());
m_overlayWindow = wxCreateOverlayWindow(m_rect);
}
diff --git a/src/msw/printdlg.cpp b/src/msw/printdlg.cpp
index 4a1f8a6994..21d7681529 100644
--- a/src/msw/printdlg.cpp
+++ b/src/msw/printdlg.cpp
@@ -520,6 +520,7 @@ void wxWindowsPrintNativeData::InitializeDevMode(const wxString& printerName, Wi
}
// Try to initialize devmode to user or system default.
+ GlobalPtr newDevMode;
if (m_devMode)
{
GlobalPtrLock lockDevMode(m_devMode);
@@ -548,18 +549,21 @@ void wxWindowsPrintNativeData::InitializeDevMode(const wxString& printerName, Wi
if ( pDevMode )
{
DWORD devModeSize = pDevMode->dmSize + pDevMode->dmDriverExtra;
- GlobalPtr newDevMode(devModeSize, GMEM_FIXED | GMEM_ZEROINIT);
+ newDevMode.Init(devModeSize, GMEM_FIXED | GMEM_ZEROINIT);
if ( newDevMode )
{
memcpy(newDevMode, pDevMode, devModeSize);
-
- ::GlobalFree(m_devMode);
- m_devMode = newDevMode.Release();
}
}
}
}
}
+
+ if ( newDevMode )
+ {
+ ::GlobalFree(static_cast(m_devMode));
+ m_devMode = newDevMode.Release();
+ }
}
bool wxWindowsPrintNativeData::TransferFrom( const wxPrintData &data )
diff --git a/src/msw/stackwalk.cpp b/src/msw/stackwalk.cpp
index 98d514bf74..eb9fc167ae 100644
--- a/src/msw/stackwalk.cpp
+++ b/src/msw/stackwalk.cpp
@@ -153,7 +153,7 @@ void wxStackFrame::OnGetParam()
(
::GetCurrentProcess(),
&imagehlpStackFrame,
- 0 // unused
+ nullptr // unused
) )
{
// for symbols from kernel DLL we might not have access to their
diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp
index c6f0b9f75e..05e7114fd9 100644
--- a/src/msw/statbox.cpp
+++ b/src/msw/statbox.cpp
@@ -719,7 +719,8 @@ void wxStaticBox::OnPaint(wxPaintEvent& WXUNUSED(event))
const double scale = dc.GetContentScaleFactor();
wxBitmap bitmap;
- bitmap.CreateWithDIPSize(rc.right / scale, rc.bottom / scale, scale);
+ // Physical and logical sizes are the same in wxMSW.
+ bitmap.CreateWithLogicalSize(rc.right, rc.bottom, scale);
memdc.SelectObject(bitmap);
PaintBackground(memdc, rc);
diff --git a/src/msw/stdpaths.cpp b/src/msw/stdpaths.cpp
index 5fbaf97b1f..fca59bbfd4 100644
--- a/src/msw/stdpaths.cpp
+++ b/src/msw/stdpaths.cpp
@@ -189,6 +189,9 @@ wxString wxStandardPaths::GetUserDir(Dir userDir) const
case Dir_Cache:
csidl = CSIDL_LOCAL_APPDATA;
break;
+ case Dir_Config:
+ csidl = CSIDL_APPDATA;
+ break;
case Dir_Desktop:
csidl = CSIDL_DESKTOPDIRECTORY;
break;
diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp
index 8bd3364efb..df1d343e3c 100644
--- a/src/msw/thread.cpp
+++ b/src/msw/thread.cpp
@@ -1340,7 +1340,7 @@ bool wxThreadModule::OnInit()
// main thread doesn't have associated wxThread object, so store 0 in the
// TLS instead
- if ( !::TlsSetValue(gs_tlsThisThread, (LPVOID)0) )
+ if ( !::TlsSetValue(gs_tlsThisThread, nullptr) )
{
::TlsFree(gs_tlsThisThread);
gs_tlsThisThread = TLS_OUT_OF_INDEXES;
diff --git a/src/msw/tooltip.cpp b/src/msw/tooltip.cpp
index a9d0eb7ab9..17edcda974 100644
--- a/src/msw/tooltip.cpp
+++ b/src/msw/tooltip.cpp
@@ -571,7 +571,7 @@ bool wxToolTip::AdjustMaxWidth()
// use TTM_SETMAXTIPWIDTH to make tooltip multiline using the
// extent of its first line as max value
HFONT hfont = (HFONT)
- SendTooltipMessage(GetToolTipCtrl(), WM_GETFONT, 0);
+ SendTooltipMessage(GetToolTipCtrl(), WM_GETFONT, nullptr);
if ( !hfont )
{
@@ -631,7 +631,7 @@ bool wxToolTip::AdjustMaxWidth()
// one would result in breaking the longer lines unnecessarily as
// all our tooltips share the same maximal width
if ( maxWidth > SendTooltipMessage(GetToolTipCtrl(),
- TTM_GETMAXTIPWIDTH, 0) )
+ TTM_GETMAXTIPWIDTH, nullptr) )
{
SendTooltipMessage(GetToolTipCtrl(), TTM_SETMAXTIPWIDTH,
wxUIntToPtr(maxWidth));
diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp
index 2930894a57..a5f93a3788 100644
--- a/src/msw/toplevel.cpp
+++ b/src/msw/toplevel.cpp
@@ -708,7 +708,7 @@ bool wxTopLevelWindowMSW::IsMaximized() const
void wxTopLevelWindowMSW::Iconize(bool iconize)
{
- if ( iconize == MSWIsIconized() )
+ if ( iconize == IsIconized() )
{
// Do nothing, in particular don't restore non-iconized windows when
// Iconize(false) is called as this would wrongly un-maximize them.
diff --git a/src/msw/version.rc b/src/msw/version.rc
index 085bcbcc6b..d78d80dccc 100644
--- a/src/msw/version.rc
+++ b/src/msw/version.rc
@@ -86,7 +86,7 @@ BEGIN
VALUE "FileDescription", "wxWidgets " WXLIBDESC " library\0"
VALUE "FileVersion", wxVERSION_NUM_DOT_STRING "\0"
VALUE "InternalName", wxSTRINGIZE(WXDLLNAME) "\0"
- VALUE "LegalCopyright", L"Copyright \xa9 1992-2023 wxWidgets development team\0"
+ VALUE "LegalCopyright", L"Copyright \xa9 1992-2024 wxWidgets development team\0"
VALUE "OriginalFilename", wxSTRINGIZE(WXDLLNAME) ".dll\0"
VALUE "ProductName", "wxWidgets\0"
VALUE "ProductVersion", wxVERSION_NUM_DOT_STRING "\0"
diff --git a/src/msw/window.cpp b/src/msw/window.cpp
index d12dd5f19d..b3c813dae8 100644
--- a/src/msw/window.cpp
+++ b/src/msw/window.cpp
@@ -4503,7 +4503,7 @@ bool wxWindowMSW::HandleDropFiles(WXWPARAM wParam)
(
(HDROP)hFilesInfo,
(UINT)-1,
- (LPTSTR)0,
+ nullptr,
(UINT)0
);
diff --git a/src/osx/cocoa/renderer.mm b/src/osx/cocoa/renderer.mm
index 1fe4a98b0b..484de678ee 100644
--- a/src/osx/cocoa/renderer.mm
+++ b/src/osx/cocoa/renderer.mm
@@ -618,7 +618,7 @@ void wxRendererMac::ApplyMacControlFlags(wxWindow* win, NSCell* cell, int flags)
size = NSSmallControlSize;
else if (win->GetWindowVariant() == wxWINDOW_VARIANT_MINI || (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI))
size = NSMiniControlSize;
-#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_11_0
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0
else if (win->GetWindowVariant() == wxWINDOW_VARIANT_LARGE|| (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_LARGE))
{
if (WX_IS_MACOS_AVAILABLE(11, 0))
diff --git a/src/osx/cocoa/stdpaths.mm b/src/osx/cocoa/stdpaths.mm
index 85418fb5af..584362c4bd 100644
--- a/src/osx/cocoa/stdpaths.mm
+++ b/src/osx/cocoa/stdpaths.mm
@@ -101,12 +101,18 @@ wxStandardPaths::GetLocalizedResourcesDir(const wxString& lang,
wxString wxStandardPaths::GetUserDir(Dir userDir) const
{
+ wxString subdir;
+
NSSearchPathDirectory dirType;
switch (userDir)
{
case Dir_Cache:
dirType = NSCachesDirectory;
break;
+ case Dir_Config:
+ dirType = NSLibraryDirectory;
+ subdir = "/Preferences";
+ break;
case Dir_Desktop:
dirType = NSDesktopDirectory;
break;
@@ -127,7 +133,7 @@ wxString wxStandardPaths::GetUserDir(Dir userDir) const
break;
}
- return GetFMDirectory(dirType, NSUserDomainMask);
+ return GetFMDirectory(dirType, NSUserDomainMask) + subdir;
}
wxString
diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm
index 96cf8cbfc0..b13d85b1b7 100644
--- a/src/osx/cocoa/utils.mm
+++ b/src/osx/cocoa/utils.mm
@@ -585,7 +585,7 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
const wxSize bitmapSize(subrect ? subrect->GetSize() : m_window->GetSize());
wxBitmap bitmap;
- bitmap.CreateWithDIPSize(bitmapSize, m_contentScaleFactor);
+ bitmap.CreateWithLogicalSize(bitmapSize, m_contentScaleFactor);
NSView* view = (NSView*) m_window->GetHandle();
if ( [view isHiddenOrHasHiddenAncestor] == NO )
@@ -617,7 +617,7 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
CGRect r = CGRectMake( 0 , 0 , CGImageGetWidth(cgImageRef) , CGImageGetHeight(cgImageRef) );
- // The bitmap created by wxBitmap::CreateWithDIPSize() above is scaled,
+ // The bitmap created by wxBitmap::CreateWithLogicalSize() above is scaled,
// so we need to adjust the coordinates for it.
r.size.width /= m_contentScaleFactor;
r.size.height /= m_contentScaleFactor;
diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm
index d8e863bce1..83d876e75f 100644
--- a/src/osx/cocoa/window.mm
+++ b/src/osx/cocoa/window.mm
@@ -917,7 +917,7 @@ static void SetDrawingEnabledIfFrozenRecursive(wxWidgetCocoaImpl *impl, bool ena
[super viewDidMoveToWindow];
}
-#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12
- (void) viewWillDraw
{
if ( WX_IS_MACOS_AVAILABLE(11, 0) )
@@ -4077,7 +4077,7 @@ void wxWidgetCocoaImpl::AdjustClippingView(wxScrollBar* horizontal, wxScrollBar*
}
}
-void wxWidgetCocoaImpl::UseClippingView(bool clip)
+void wxWidgetCocoaImpl::UseClippingView()
{
wxWindow* peer = m_wxPeer;
diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp
index 20718d0e13..e2f31c8c76 100644
--- a/src/osx/core/bitmap.cpp
+++ b/src/osx/core/bitmap.cpp
@@ -973,7 +973,7 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
wxBitmap ret;
double scale = GetScaleFactor();
- ret.CreateWithDIPSize( rect.GetSize(), scale, GetDepth() );
+ ret.CreateWithLogicalSize( rect.GetSize(), scale, GetDepth() );
wxASSERT_MSG( ret.IsOk(), wxT("GetSubBitmap error") );
if ( HasAlpha() )
ret.UseAlpha() ;
diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp
index 448e360bb7..3c3eceac8f 100644
--- a/src/osx/window_osx.cpp
+++ b/src/osx/window_osx.cpp
@@ -261,11 +261,11 @@ wxWindowMac::~wxWindowMac()
delete GetPeer() ;
}
-void wxWindowMac::MacSetClipChildren( bool clip )
+void wxWindowMac::MacSetClipChildren()
{
- m_clipChildren = clip ;
+ m_clipChildren = true ;
if ( m_peer )
- m_peer->UseClippingView(clip);
+ m_peer->UseClippingView();
}
WXWidget wxWindowMac::GetHandle() const
@@ -394,7 +394,7 @@ bool wxWindowMac::Create(wxWindowMac *parent,
SetPeer(wxWidgetImpl::CreateUserPane( this, parent, id, pos, size , style, GetExtraStyle() ));
MacPostControlCreate(pos, size) ;
if ( m_clipChildren )
- m_peer->UseClippingView(m_clipChildren);
+ m_peer->UseClippingView();
}
wxWindowCreateEvent event((wxWindow*)this);
@@ -2715,7 +2715,7 @@ void wxWidgetImpl::AdjustClippingView(wxScrollBar* WXUNUSED(horizontal), wxScrol
{
}
-void wxWidgetImpl::UseClippingView(bool WXUNUSED(clip))
+void wxWidgetImpl::UseClippingView()
{
}
diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp
index f7f4ef3f5d..360e14d20c 100644
--- a/src/propgrid/advprops.cpp
+++ b/src/propgrid/advprops.cpp
@@ -31,6 +31,7 @@
#include "wx/uilocale.h"
#include
+#include
// Drawing ARGB on standard DC is supported by OSX and GTK3
#if defined(__WXOSX__) || defined(__WXGTK3__)
@@ -334,7 +335,12 @@ bool wxPGSpinCtrlEditor::OnEvent(wxPropertyGrid* propgrid, wxPGProperty* propert
stepScale *= spins;
wxVariant v = prop->AddSpinStepValue(stepScale);
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ SetControlStringValue(prop, propgrid->GetEditorControl(), prop->ValueToStringWithCheck(v));
+#else
SetControlStringValue(prop, propgrid->GetEditorControl(), prop->ValueToString(v));
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
return true;
}
}
@@ -485,35 +491,56 @@ void wxPGDatePickerCtrlEditor::SetValueToUnspecified( wxPGProperty* property,
// NB: Do not use wxS here since unlike wxT it doesn't translate to wxChar*
//
-static const wxChar* const gs_fp_es_family_labels[] = {
+static constexpr std::array gs_fp_es_family_labels
+{
wxT("Default"), wxT("Decorative"),
wxT("Roman"), wxT("Script"),
wxT("Swiss"), wxT("Modern"),
wxT("Teletype"), wxT("Unknown"),
- (const wxChar*) nullptr
+ nullptr
};
-static const long gs_fp_es_family_values[] = {
+#if wxCHECK_CXX_STD(201402L) // [] is constexpr since C++14
+static_assert(gs_fp_es_family_labels[gs_fp_es_family_labels.size() - 1] == nullptr,
+ "nullptr has to mark the end of table");
+#endif // >+ C++ 14
+
+static constexpr std::array gs_fp_es_family_values
+{
wxFONTFAMILY_DEFAULT, wxFONTFAMILY_DECORATIVE,
wxFONTFAMILY_ROMAN, wxFONTFAMILY_SCRIPT,
wxFONTFAMILY_SWISS, wxFONTFAMILY_MODERN,
wxFONTFAMILY_TELETYPE, wxFONTFAMILY_UNKNOWN
};
-static const wxChar* const gs_fp_es_style_labels[] = {
+static_assert(gs_fp_es_family_values.size() == gs_fp_es_family_labels.size() - 1,
+ "Values table has to have one item less than labels table");
+
+static constexpr std::array gs_fp_es_style_labels
+{
wxT("Normal"),
wxT("Slant"),
wxT("Italic"),
- (const wxChar*) nullptr
+ nullptr
};
-static const long gs_fp_es_style_values[] = {
+#if wxCHECK_CXX_STD(201402L) // [] is constexpr since C++14
+static_assert(gs_fp_es_style_labels[gs_fp_es_style_labels.size() - 1] == nullptr,
+ "nullptr has to mark the end of table");
+#endif // >= C++ 14
+
+static constexpr std::array gs_fp_es_style_values
+{
wxFONTSTYLE_NORMAL,
wxFONTSTYLE_SLANT,
wxFONTSTYLE_ITALIC
};
-static const wxChar* const gs_fp_es_weight_labels[] = {
+static_assert(gs_fp_es_style_values.size() == gs_fp_es_style_labels.size() - 1,
+ "Values table has to have one item less than labels table");
+
+static constexpr std::array gs_fp_es_weight_labels
+{
wxT("Thin"),
wxT("ExtraLight"),
wxT("Light"),
@@ -524,10 +551,16 @@ static const wxChar* const gs_fp_es_weight_labels[] = {
wxT("ExtraBold"),
wxT("Heavy"),
wxT("ExtraHeavy"),
- (const wxChar*) nullptr
+ nullptr
};
-static const long gs_fp_es_weight_values[] = {
+#if wxCHECK_CXX_STD(201402L) // [] is constexpr since C++14
+static_assert(gs_fp_es_weight_labels[gs_fp_es_weight_labels.size() - 1] == nullptr,
+ "nullptr has to mark the end of table");
+#endif // >= C++ 14
+
+static constexpr std::array gs_fp_es_weight_values
+{
wxFONTWEIGHT_THIN,
wxFONTWEIGHT_EXTRALIGHT,
wxFONTWEIGHT_LIGHT,
@@ -540,6 +573,9 @@ static const long gs_fp_es_weight_values[] = {
wxFONTWEIGHT_EXTRAHEAVY
};
+static_assert(gs_fp_es_weight_values.size() == gs_fp_es_weight_labels.size() - 1,
+ "Values table has to have one item less than labels table");
+
// Class body is in advprops.h
@@ -579,18 +615,18 @@ wxFontProperty::wxFontProperty( const wxString& label, const wxString& name,
wxPGProperty* p = new wxEnumProperty(_("Face Name"), wxS("Face Name"),
*wxPGGlobalVars->m_fontFamilyChoices);
- p->SetValueFromString(faceName, wxPG_FULL_VALUE);
+ p->SetValueFromString(faceName, wxPGPropValFormatFlags::FullValue);
AddPrivateChild( p );
/* TRANSLATORS: Label of font style */
AddPrivateChild( new wxEnumProperty(_("Style"), wxS("Style"),
- gs_fp_es_style_labels,gs_fp_es_style_values,
+ gs_fp_es_style_labels.data(), gs_fp_es_style_values.data(),
font.GetStyle()) );
/* TRANSLATORS: Label of font weight */
AddPrivateChild( new wxEnumProperty(_("Weight"), wxS("Weight"),
- gs_fp_es_weight_labels,gs_fp_es_weight_values,
+ gs_fp_es_weight_labels.data(), gs_fp_es_weight_values.data(),
font.GetWeight()) );
/* TRANSLATORS: Label of underlined font */
@@ -599,7 +635,7 @@ wxFontProperty::wxFontProperty( const wxString& label, const wxString& name,
/* TRANSLATORS: Label of font family */
AddPrivateChild( new wxEnumProperty(_("Family"), wxS("PointSize"),
- gs_fp_es_family_labels,gs_fp_es_family_values,
+ gs_fp_es_family_labels.data(), gs_fp_es_family_values.data(),
font.GetFamily()) );
}
@@ -615,9 +651,9 @@ void wxFontProperty::OnSetValue()
}
wxString wxFontProperty::ValueToString( wxVariant& value,
- int argFlags ) const
+ wxPGPropValFormatFlags flags ) const
{
- return wxEditorDialogProperty::ValueToString(value, argFlags);
+ return wxEditorDialogProperty::ValueToString(value, flags);
}
bool wxFontProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value)
@@ -652,7 +688,7 @@ void wxFontProperty::RefreshChildren()
wxFont font;
font << m_value;
Item(0)->SetValue( (long)font.GetPointSize() );
- Item(1)->SetValueFromString( font.GetFaceName(), wxPG_FULL_VALUE );
+ Item(1)->SetValueFromString( font.GetFaceName(), wxPGPropValFormatFlags::FullValue );
Item(2)->SetValue( (long)font.GetStyle() );
Item(3)->SetValue( (long)font.GetWeight() );
Item(4)->SetValue( font.GetUnderlined() );
@@ -758,17 +794,10 @@ void wxFontProperty::OnCustomPaint(wxDC& dc,
// wxSystemColourProperty
// -----------------------------------------------------------------------
-#if WXWIN_COMPATIBILITY_3_2
-// wxEnumProperty based classes cannot use wxPG_PROP_RESERVED_1
-wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_HIDE_CUSTOM_COLOUR is intended for internal use.")
-constexpr wxPGPropertyFlags wxPG_PROP_HIDE_CUSTOM_COLOUR = wxPG_PROP_RESERVED_2;
-wxDEPRECATED_BUT_USED_INTERNALLY_MSG("wxPG_PROP_COLOUR_HAS_ALPHA is intended for internal use.")
-constexpr wxPGPropertyFlags wxPG_PROP_COLOUR_HAS_ALPHA = wxPG_PROP_RESERVED_3;
-#endif // if WXWIN_COMPATIBILITY_3_2
-
#include "wx/colordlg.h"
-static const char* const gs_cp_es_syscolour_labels[] = {
+static constexpr std::array gs_cp_es_syscolour_labels
+{
/* TRANSLATORS: Keyword of system colour */ wxTRANSLATE("AppWorkspace"),
/* TRANSLATORS: Keyword of system colour */ wxTRANSLATE("ActiveBorder"),
/* TRANSLATORS: Keyword of system colour */ wxTRANSLATE("ActiveCaption"),
@@ -797,7 +826,13 @@ static const char* const gs_cp_es_syscolour_labels[] = {
nullptr
};
-static const long gs_cp_es_syscolour_values[] = {
+#if wxCHECK_CXX_STD(201402L) // [] is constexpr since C++14
+static_assert(gs_cp_es_syscolour_labels[gs_cp_es_syscolour_labels.size() - 1] == nullptr,
+ "nullptr has to mark the end of table");
+#endif // >= C++ 14
+
+static constexpr std::array gs_cp_es_syscolour_values
+{
wxSYS_COLOUR_APPWORKSPACE,
wxSYS_COLOUR_ACTIVEBORDER,
wxSYS_COLOUR_ACTIVECAPTION,
@@ -825,6 +860,8 @@ static const long gs_cp_es_syscolour_values[] = {
wxPG_COLOUR_CUSTOM
};
+static_assert(gs_cp_es_syscolour_values.size() == gs_cp_es_syscolour_labels.size() - 1,
+ "Colour values table has to have one item less than colour labels table");
IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(wxColourPropertyValue, WXDLLIMPEXP_PROPGRID)
@@ -846,7 +883,7 @@ void wxSystemColourProperty::Init( int type, const wxColour& colour )
cpv.Init(type, colour.IsOk() ? colour : *wxWHITE);
- m_flags |= wxPG_PROP_STATIC_CHOICES; // Colour selection cannot be changed.
+ m_flags |= wxPGPropertyFlags_StaticChoices; // Colour selection cannot be changed.
m_value = WXVARIANT(cpv);
@@ -861,8 +898,8 @@ wxSystemColourProperty::wxSystemColourProperty( const wxString& label, const wxS
const wxColourPropertyValue& value )
: wxEnumProperty( label,
name,
- gs_cp_es_syscolour_labels,
- gs_cp_es_syscolour_values,
+ gs_cp_es_syscolour_labels.data(),
+ gs_cp_es_syscolour_values.data(),
&gs_wxSystemColourProperty_choicesCache )
{
Init( value.m_type, value.m_colour );
@@ -1024,7 +1061,7 @@ void wxSystemColourProperty::OnSetValue()
}
if ( cpv.m_type < wxPG_COLOUR_WEB_BASE ||
- (m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
+ !!(m_flags & wxPGPropertyFlags_HideCustomColour) )
{
ind = GetIndexForValue(cpv.m_type);
}
@@ -1049,7 +1086,7 @@ void wxSystemColourProperty::OnSetValue()
ind = ColToInd(col);
if ( ind == wxNOT_FOUND &&
- !(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
+ !(m_flags & wxPGPropertyFlags_HideCustomColour) )
ind = GetCustomColourIndex();
}
@@ -1062,15 +1099,35 @@ wxColour wxSystemColourProperty::GetColour( int index ) const
return wxSystemSettings::GetColour( (wxSystemColour)index );
}
+#if WXWIN_COMPATIBILITY_3_2
+// By call to obsolete function we want to check if user-overriden function is still in use
+wxString wxSystemColourProperty::ColourToStringWithCheck(const wxColour& col, int index,
+ wxPGPropValFormatFlags flags) const
+{
+ m_oldColourToStringCalled = false;
+ wxString res = ColourToString(col, index, static_cast(flags));
+ if ( m_oldColourToStringCalled )
+ {
+ // Our own function was called - this implies that call was forwarded to the new overriding
+ // function and there is no need to call it explicitly.
+ }
+ else
+ { // User-overriden obsolete function was called
+ wxFAIL_MSG(wxString::Format("in %s use ColourToString with 'flags' argument as wxPGPropValFormatFlags", GetClassInfo()->GetClassName()));
+ }
+ return res;
+}
+#endif // WXWIN_COMPATIBILITY_3_2
+
wxString wxSystemColourProperty::ColourToString( const wxColour& col,
int index,
- int argFlags ) const
+ wxPGPropValFormatFlags flags ) const
{
if ( index == wxNOT_FOUND )
{
- if ( (argFlags & wxPG_FULL_VALUE) || (m_flags & wxPG_PROP_COLOUR_HAS_ALPHA) )
+ if ( !!(flags & wxPGPropValFormatFlags::FullValue) || !!(m_flags & wxPGPropertyFlags_ColourHasAlpha) )
{
return wxString::Format(wxS("(%i,%i,%i,%i)"),
(int)col.Red(),
@@ -1093,22 +1150,22 @@ wxString wxSystemColourProperty::ColourToString( const wxColour& col,
}
wxString wxSystemColourProperty::ValueToString( wxVariant& value,
- int argFlags ) const
+ wxPGPropValFormatFlags flags ) const
{
wxColourPropertyValue val = GetVal(&value);
int index;
- if ( argFlags & wxPG_VALUE_IS_CURRENT )
+ if ( !!(flags & wxPGPropValFormatFlags::ValueIsCurrent) )
{
- // GetIndex() only works reliably if wxPG_VALUE_IS_CURRENT flag is set,
+ // GetIndex() only works reliably if wxPGPropValFormatFlags::ValueIsCurrent flag is set,
// but we should use it whenever possible.
index = GetIndex();
// If custom colour was selected, use invalid index, so that
// ColourToString() will return properly formatted colour text.
if ( index == GetCustomColourIndex() &&
- !(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
+ !(m_flags & wxPGPropertyFlags_HideCustomColour) )
index = wxNOT_FOUND;
}
else
@@ -1116,7 +1173,12 @@ wxString wxSystemColourProperty::ValueToString( wxVariant& value,
index = m_choices.Index(val.m_type);
}
- return ColourToString(val.m_colour, index, argFlags);
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ return ColourToStringWithCheck(val.m_colour, index, flags);
+#else
+ return ColourToString(val.m_colour, index, flags);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
}
@@ -1150,7 +1212,7 @@ bool wxSystemColourProperty::QueryColourFromUser( wxVariant& variant ) const
wxColourData data;
data.SetChooseFull(true);
- data.SetChooseAlpha((m_flags & wxPG_PROP_COLOUR_HAS_ALPHA) != 0);
+ data.SetChooseAlpha(!!(m_flags & wxPGPropertyFlags_ColourHasAlpha));
data.SetColour(val.m_colour);
for ( int i = 0; i < wxColourData::NUM_CUSTOM; i++ )
{
@@ -1175,14 +1237,14 @@ bool wxSystemColourProperty::QueryColourFromUser( wxVariant& variant ) const
}
-bool wxSystemColourProperty::IntToValue( wxVariant& variant, int number, int argFlags ) const
+bool wxSystemColourProperty::IntToValue( wxVariant& variant, int number, wxPGPropValFormatFlags flags ) const
{
int index = number;
const int type = m_choices.GetValue(index);
if ( type == wxPG_COLOUR_CUSTOM )
{
- if ( !(argFlags & wxPG_PROPERTY_SPECIFIC) )
+ if ( !(flags & wxPGPropValFormatFlags::PropertySpecific) )
return QueryColourFromUser(variant);
// Call from event handler.
@@ -1223,7 +1285,7 @@ bool wxSystemColourProperty::OnEvent( wxPropertyGrid* propgrid,
int index = cb->GetSelection();
if ( index == GetCustomColourIndex() &&
- !(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
+ !(m_flags & wxPGPropertyFlags_HideCustomColour) )
askColour = true;
}
}
@@ -1249,7 +1311,7 @@ public:
dc.SetPen(*wxBLACK_PEN);
if ( item >= 0 &&
- ( item < (int)(GetCustomColourIndex) || (prop->HasFlag(wxPG_PROP_HIDE_CUSTOM_COLOUR)))
+ ( item < (int)(GetCustomColourIndex) || (prop->HasFlag(wxPGPropertyFlags_HideCustomColour)))
)
{
int colInd;
@@ -1297,7 +1359,7 @@ void wxSystemColourProperty::OnCustomPaint( wxDC& dc, const wxRect& rect,
if ( paintdata.m_choiceItem >= 0 &&
paintdata.m_choiceItem < (int)m_choices.GetCount() &&
(paintdata.m_choiceItem != GetCustomColourIndex() ||
- m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
+ !!(m_flags & wxPGPropertyFlags_HideCustomColour)) )
{
int colInd = m_choices[paintdata.m_choiceItem].GetValue();
col = GetColour( colInd );
@@ -1349,7 +1411,7 @@ void wxSystemColourProperty::OnCustomPaint( wxDC& dc, const wxRect& rect,
}
-bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& text, int argFlags ) const
+bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& text, wxPGPropValFormatFlags flags ) const
{
const int custIndex = GetCustomColourIndex();
wxString custColName;
@@ -1396,10 +1458,10 @@ bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& te
}
if ( !conversionSuccess && m_choices.GetCount() &&
- !(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) &&
+ !(m_flags & wxPGPropertyFlags_HideCustomColour) &&
isCustomColour )
{
- if ( !(argFlags & wxPG_EDITABLE_VALUE ))
+ if ( !(flags & wxPGPropValFormatFlags::EditableValue ))
{
// This really should not occur...
// wxASSERT(false);
@@ -1408,7 +1470,7 @@ bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& te
if ( !QueryColourFromUser(value) )
{
- if ( !(argFlags & wxPG_PROPERTY_SPECIFIC) )
+ if ( !(flags & wxPGPropValFormatFlags::PropertySpecific) )
return false;
// If query for value comes from the event handler
// use current pending value to be processed later on in OnEvent().
@@ -1425,7 +1487,7 @@ bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& te
{
// Try predefined colour first
int index;
- bool res = ValueFromString_(value, &index, colStr, argFlags);
+ bool res = ValueFromString_(value, &index, colStr, flags);
if ( res && index >= 0 )
{
val.m_type = index;
@@ -1463,24 +1525,24 @@ bool wxSystemColourProperty::DoSetAttribute( const wxString& name, wxVariant& va
{
bool allow = value.GetBool();
- if ( allow && (m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
+ if ( allow && !!(m_flags & wxPGPropertyFlags_HideCustomColour) )
{
// Show custom choice
/* TRANSLATORS: Custom colour choice entry */
m_choices.Add(_("Custom"), wxPG_COLOUR_CUSTOM);
- m_flags &= ~(wxPG_PROP_HIDE_CUSTOM_COLOUR);
+ m_flags &= ~(wxPGPropertyFlags_HideCustomColour);
}
- else if ( !allow && !(m_flags & wxPG_PROP_HIDE_CUSTOM_COLOUR) )
+ else if ( !allow && !(m_flags & wxPGPropertyFlags_HideCustomColour) )
{
// Hide custom choice
m_choices.RemoveAt(GetCustomColourIndex());
- m_flags |= wxPG_PROP_HIDE_CUSTOM_COLOUR;
+ m_flags |= wxPGPropertyFlags_HideCustomColour;
}
return true;
}
else if ( name == wxPG_COLOUR_HAS_ALPHA )
{
- ChangeFlag(wxPG_PROP_COLOUR_HAS_ALPHA, value.GetBool());
+ ChangeFlag(wxPGPropertyFlags_ColourHasAlpha, value.GetBool());
return true;
}
return wxEnumProperty::DoSetAttribute(name, value);
@@ -1491,7 +1553,8 @@ bool wxSystemColourProperty::DoSetAttribute( const wxString& name, wxVariant& va
// wxColourProperty
// -----------------------------------------------------------------------
-static const char* const gs_cp_es_normcolour_labels[] = {
+static constexpr std::array gs_cp_es_normcolour_labels
+{
wxTRANSLATE("Black"),
wxTRANSLATE("Maroon"),
wxTRANSLATE("Navy"),
@@ -1514,7 +1577,13 @@ static const char* const gs_cp_es_normcolour_labels[] = {
nullptr
};
-static const long gs_cp_es_normcolour_values[] = {
+#if wxCHECK_CXX_STD(201402L) // [] is constexpr since C++14
+static_assert(gs_cp_es_normcolour_labels[gs_cp_es_normcolour_labels.size() - 1] == nullptr,
+ "nullptr has to mark the end of table");
+#endif // >= C++ 14
+
+static constexpr std::array gs_cp_es_normcolour_values
+{
0,
1,
2,
@@ -1536,7 +1605,8 @@ static const long gs_cp_es_normcolour_values[] = {
wxPG_COLOUR_CUSTOM
};
-static const unsigned long gs_cp_es_normcolour_colours[] = {
+static constexpr std::array gs_cp_es_normcolour_colours
+{
wxPG_COLOUR(0,0,0),
wxPG_COLOUR(128,0,0),
wxPG_COLOUR(0,0,128),
@@ -1558,6 +1628,11 @@ static const unsigned long gs_cp_es_normcolour_colours[] = {
wxPG_COLOUR(0,0,0)
};
+static_assert(gs_cp_es_normcolour_values.size() == gs_cp_es_normcolour_labels.size() - 1,
+ "Colour values table has to have one item less than colour labels table");
+static_assert(gs_cp_es_normcolour_colours.size() == gs_cp_es_normcolour_values.size(),
+ "Colours table and colour values table have to have the same size");
+
wxPG_IMPLEMENT_PROPERTY_CLASS(wxColourProperty, wxSystemColourProperty,
TextCtrlAndButton)
@@ -1566,16 +1641,16 @@ static wxPGChoices gs_wxColourProperty_choicesCache;
wxColourProperty::wxColourProperty( const wxString& label,
const wxString& name,
const wxColour& value )
- : wxSystemColourProperty(label, name, gs_cp_es_normcolour_labels,
- gs_cp_es_normcolour_values,
+ : wxSystemColourProperty(label, name, gs_cp_es_normcolour_labels.data(),
+ gs_cp_es_normcolour_values.data(),
&gs_wxColourProperty_choicesCache, value )
{
wxASSERT_MSG( wxTheColourDatabase, wxS("No colour database") );
if ( wxTheColourDatabase )
{
// Extend colour database with PG-specific colours.
- const char* const* colourLabels = gs_cp_es_normcolour_labels;
- for ( int i = 0; *colourLabels; colourLabels++, i++ )
+ auto colourLabels = gs_cp_es_normcolour_labels.begin();
+ for ( int i = 0; *colourLabels; ++colourLabels, i++ )
{
// Don't take into account user-defined custom colour.
if (gs_cp_es_normcolour_values[i] != wxPG_COLOUR_CUSTOM)
@@ -1594,7 +1669,7 @@ wxColourProperty::wxColourProperty( const wxString& label,
Init( value );
- m_flags |= wxPG_PROP_TRANSLATE_CUSTOM;
+ m_flags |= wxPGPropertyFlags_TranslateCustom;
}
void wxColourProperty::Init( wxColour colour )
@@ -1609,15 +1684,15 @@ void wxColourProperty::Init( wxColour colour )
}
wxString wxColourProperty::ValueToString( wxVariant& value,
- int argFlags ) const
+ wxPGPropValFormatFlags flags ) const
{
const wxPGEditor* editor = GetEditorClass();
if ( editor != wxPGEditor_Choice &&
editor != wxPGEditor_ChoiceAndButton &&
editor != wxPGEditor_ComboBox )
- argFlags |= wxPG_PROPERTY_SPECIFIC;
+ flags |= wxPGPropValFormatFlags::PropertySpecific;
- return wxSystemColourProperty::ValueToString(value, argFlags);
+ return wxSystemColourProperty::ValueToString(value, flags);
}
wxColour wxColourProperty::GetColour( int index ) const
@@ -1638,9 +1713,8 @@ wxVariant wxColourProperty::DoTranslateVal( wxColourPropertyValue& v ) const
#define wxPG_CURSOR_IMAGE_WIDTH 32
#endif
-#define NUM_CURSORS 28
-
-static const char* const gs_cp_es_syscursors_labels[NUM_CURSORS+1] = {
+static constexpr std::array gs_cp_es_syscursors_labels
+{
wxTRANSLATE_IN_CONTEXT("system cursor name", "Default"),
wxTRANSLATE_IN_CONTEXT("system cursor name", "Arrow"),
wxTRANSLATE_IN_CONTEXT("system cursor name", "Right Arrow"),
@@ -1672,7 +1746,13 @@ static const char* const gs_cp_es_syscursors_labels[NUM_CURSORS+1] = {
nullptr
};
-static const long gs_cp_es_syscursors_values[NUM_CURSORS] = {
+#if wxCHECK_CXX_STD(201402L) // [] is constexpr since C++14
+static_assert(gs_cp_es_syscursors_labels[gs_cp_es_syscursors_labels.size() - 1] == nullptr,
+ "nullptr has to mark the end of table");
+#endif // >= C++ 14
+
+static constexpr std::array gs_cp_es_syscursors_values
+{
wxCURSOR_NONE,
wxCURSOR_ARROW,
wxCURSOR_RIGHT_ARROW,
@@ -1703,6 +1783,9 @@ static const long gs_cp_es_syscursors_values[NUM_CURSORS] = {
wxCURSOR_ARROWWAIT
};
+static_assert(gs_cp_es_syscursors_values.size() == gs_cp_es_syscursors_labels.size() - 1,
+ "Values table has to have one item less than labels table");
+
wxIMPLEMENT_DYNAMIC_CLASS(wxCursorProperty, wxEnumProperty);
static wxPGChoices gs_wxCursorProperty_choicesCache;
@@ -1711,24 +1794,24 @@ wxCursorProperty::wxCursorProperty( const wxString& label, const wxString& name,
int value )
: wxEnumProperty( label,
name,
- gs_cp_es_syscursors_labels,
- gs_cp_es_syscursors_values,
+ gs_cp_es_syscursors_labels.data(),
+ gs_cp_es_syscursors_values.data(),
&gs_wxCursorProperty_choicesCache,
value )
{
- m_flags |= wxPG_PROP_STATIC_CHOICES; // Cursor selection cannot be changed.
+ m_flags |= wxPGPropertyFlags_StaticChoices; // Cursor selection cannot be changed.
}
-wxString wxCursorProperty::ValueToString(wxVariant& value, int argFlags) const
+wxString wxCursorProperty::ValueToString(wxVariant& value, wxPGPropValFormatFlags flags) const
{
- return wxGetTranslation(wxEnumProperty::ValueToString(value, argFlags),
+ return wxGetTranslation(wxEnumProperty::ValueToString(value, flags),
wxString(), "system cursor name");
}
wxSize wxCursorProperty::OnMeasureImage( int item ) const
{
#if wxPG_CAN_DRAW_CURSOR
- if ( item != -1 && item < NUM_CURSORS )
+ if ( item != -1 && item < static_cast(gs_cp_es_syscursors_values.size()) )
return wxSize(wxPG_CURSOR_IMAGE_WIDTH,wxPG_CURSOR_IMAGE_WIDTH);
#else
wxUnusedVar(item);
@@ -1749,7 +1832,7 @@ void wxCursorProperty::OnCustomPaint( wxDC& dc,
{
dc.DrawRectangle( rect );
- if ( paintdata.m_choiceItem < NUM_CURSORS )
+ if ( paintdata.m_choiceItem < static_cast(gs_cp_es_syscursors_values.size()) )
{
wxStockCursor cursorIndex =
(wxStockCursor) gs_cp_es_syscursors_values[paintdata.m_choiceItem];
@@ -1953,10 +2036,10 @@ void wxMultiChoiceProperty::OnSetValue()
}
wxString wxMultiChoiceProperty::ValueToString( wxVariant& value,
- int argFlags ) const
+ wxPGPropValFormatFlags flags ) const
{
// If possible, use cached string
- if ( argFlags & wxPG_VALUE_IS_CURRENT )
+ if ( !!(flags & wxPGPropValFormatFlags::ValueIsCurrent) )
return m_display;
return GenerateValueAsString(value);
@@ -2066,7 +2149,7 @@ bool wxMultiChoiceProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& v
return false;
}
-bool wxMultiChoiceProperty::StringToValue( wxVariant& variant, const wxString& text, int ) const
+bool wxMultiChoiceProperty::StringToValue( wxVariant& variant, const wxString& text, wxPGPropValFormatFlags ) const
{
wxArrayString arr;
@@ -2143,7 +2226,7 @@ void wxDateProperty::OnSetValue()
}
bool wxDateProperty::StringToValue( wxVariant& variant, const wxString& text,
- int WXUNUSED(argFlags) ) const
+ wxPGPropValFormatFlags WXUNUSED(flags) ) const
{
wxDateTime dt;
@@ -2161,7 +2244,7 @@ bool wxDateProperty::StringToValue( wxVariant& variant, const wxString& text,
}
wxString wxDateProperty::ValueToString( wxVariant& value,
- int argFlags ) const
+ wxPGPropValFormatFlags flags ) const
{
wxDateTime dateTime = value.GetDateTime();
@@ -2180,7 +2263,7 @@ wxString wxDateProperty::ValueToString( wxVariant& value,
wxString format;
if ( !m_format.empty() &&
- !(argFlags & wxPG_FULL_VALUE) )
+ !(flags & wxPGPropValFormatFlags::FullValue) )
format = m_format;
// Determine default from locale
diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp
index 0b434cb536..9dfc565e5f 100644
--- a/src/propgrid/editors.cpp
+++ b/src/propgrid/editors.cpp
@@ -191,8 +191,13 @@ void wxPGEditor::SetControlAppearance( wxPropertyGrid* pg,
}
else if ( oCell.HasText() )
{
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ tcText = property->GetValueAsStringWithCheck(
+#else
tcText = property->GetValueAsString(
- property->HasFlag(wxPG_PROP_READONLY)?0:wxPG_EDITABLE_VALUE);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
+ property->HasFlag(wxPGPropertyFlags::ReadOnly)?wxPGPropValFormatFlags::Null:wxPGPropValFormatFlags::EditableValue);
changeText = true;
}
@@ -280,18 +285,23 @@ wxPGWindowList wxPGTextCtrlEditor::CreateControls( wxPropertyGrid* propGrid,
//
// If has children, and limited editing is specified, then don't create.
- if ( property->HasFlag(wxPG_PROP_NOEDITOR) &&
+ if ( property->HasFlag(wxPGPropertyFlags::NoEditor) &&
property->HasAnyChild() )
return nullptr;
- int argFlags = 0;
- if ( !property->HasFlag(wxPG_PROP_READONLY) &&
+ wxPGPropValFormatFlags fmtFlags = wxPGPropValFormatFlags::Null;
+ if ( !property->HasFlag(wxPGPropertyFlags::ReadOnly) &&
!property->IsValueUnspecified() )
- argFlags |= wxPG_EDITABLE_VALUE;
- text = property->GetValueAsString(argFlags);
+ fmtFlags |= wxPGPropValFormatFlags::EditableValue;
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ text = property->GetValueAsStringWithCheck(fmtFlags);
+#else
+ text = property->GetValueAsString(fmtFlags);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
int flags = 0;
- if ( property->HasFlag(wxPG_PROP_PASSWORD) &&
+ if ( property->HasFlag(wxPGPropertyFlags_Password) &&
wxDynamicCast(property, wxStringProperty) )
flags |= wxTE_PASSWORD;
@@ -310,7 +320,7 @@ void wxPGTextCtrlEditor::DrawValue( wxDC& dc, wxPGProperty* property, const wxRe
// Code below should no longer be needed, as the obfuscation
// is now done in GetValueAsString.
- /*if ( property->HasFlag(wxPG_PROP_PASSWORD) &&
+ /*if ( property->HasFlag(wxPGPropertyFlags_Password) &&
wxDynamicCast(property, wxStringProperty) )
{
size_t a = drawStr.length();
@@ -330,7 +340,12 @@ void wxPGTextCtrlEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl )
wxString s;
if ( tc->HasFlag(wxTE_PASSWORD) )
- s = property->GetValueAsString(wxPG_FULL_VALUE);
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ s = property->GetValueAsStringWithCheck(wxPGPropValFormatFlags::FullValue);
+#else
+ s = property->GetValueAsString(wxPGPropValFormatFlags::FullValue);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
else
s = property->GetDisplayedString();
@@ -397,7 +412,12 @@ bool wxPGTextCtrlEditor::GetTextCtrlValueFromControl( wxVariant& variant, wxPGPr
return true;
}
- bool res = property->StringToValue(variant, textVal, wxPG_EDITABLE_VALUE);
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ bool res = property->StringToValueWithCheck(variant, textVal, wxPGPropValFormatFlags::EditableValue);
+#else
+ bool res = property->StringToValue(variant, textVal, wxPGPropValFormatFlags::EditableValue);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
// Changing unspecified always causes event (returning
// true here should be enough to trigger it).
@@ -435,9 +455,14 @@ void wxPGTextCtrlEditor_OnFocus( wxPGProperty* property,
{
// Make sure there is correct text (instead of unspecified value
// indicator or hint text)
- int flags = property->HasFlag(wxPG_PROP_READONLY) ?
- 0 : wxPG_EDITABLE_VALUE;
- wxString correctText = property->GetValueAsString(flags);
+ wxPGPropValFormatFlags fmtFlags = property->HasFlag(wxPGPropertyFlags::ReadOnly) ?
+ wxPGPropValFormatFlags::Null : wxPGPropValFormatFlags::EditableValue;
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ wxString correctText = property->GetValueAsStringWithCheck(fmtFlags);
+#else
+ wxString correctText = property->GetValueAsString(fmtFlags);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
if ( tc->GetValue() != correctText )
{
@@ -494,7 +519,7 @@ protected:
wxMilliClock_t t = ::wxGetLocalTimeMillis();
wxEventType evtType = event.GetEventType();
- if ( m_property->HasFlag(wxPG_PROP_USE_DCC) &&
+ if ( m_property->HasFlag(wxPGPropertyFlags_UseDCC) &&
!m_combo->IsPopupShown() )
{
// Just check that it is in the text area
@@ -564,6 +589,7 @@ public:
wxPGComboBox()
: wxOwnerDrawnComboBox()
, m_dclickProcessor(nullptr)
+ , m_selProp(nullptr)
{
}
@@ -725,7 +751,12 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb,
else
{
if ( !p->IsValueUnspecified() )
- text = p->GetValueAsString(0);
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ text = p->GetValueAsStringWithCheck(wxPGPropValFormatFlags::Null);
+#else
+ text = p->GetValueAsString(wxPGPropValFormatFlags::Null);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
}
}
@@ -798,11 +829,11 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb,
{
renderFlags |= wxPGCellRenderer::Control;
- // If wxPG_PROP_CUSTOMIMAGE was set, then that means any custom
+ // If wxPGPropertyFlags::CustomImage was set, then that means any custom
// image will not appear on the control row (it may be too
// large to fit, for instance). Also do not draw custom image
// if no choice was selected.
- if ( !p->HasFlag(wxPG_PROP_CUSTOMIMAGE) )
+ if ( !p->HasFlag(wxPGPropertyFlags::CustomImage) )
useCustomPaintProcedure = false;
}
else
@@ -940,18 +971,23 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid,
// Since it is not possible (yet) to create a read-only combo box in
// the same sense that wxTextCtrl is read-only, simply do not create
// the control in this case.
- if ( property->HasFlag(wxPG_PROP_READONLY) )
+ if ( property->HasFlag(wxPGPropertyFlags::ReadOnly) )
return nullptr;
const wxPGChoices& choices = property->GetChoices();
wxString defString;
int index = property->GetChoiceSelection();
- int argFlags = 0;
- if ( !property->HasFlag(wxPG_PROP_READONLY) &&
+ wxPGPropValFormatFlags fmtFlags = wxPGPropValFormatFlags::Null;
+ if ( !property->HasFlag(wxPGPropertyFlags::ReadOnly) &&
!property->IsValueUnspecified() )
- argFlags |= wxPG_EDITABLE_VALUE;
- defString = property->GetValueAsString(argFlags);
+ fmtFlags |= wxPGPropValFormatFlags::EditableValue;
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ defString = property->GetValueAsStringWithCheck(fmtFlags);
+#else
+ defString = property->GetValueAsString(fmtFlags);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
wxArrayString labels = choices.GetLabels();
@@ -966,7 +1002,7 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid,
int odcbFlags = extraStyle | wxBORDER_NONE | wxTE_PROCESS_ENTER;
- if ( property->HasFlag(wxPG_PROP_USE_DCC) &&
+ if ( property->HasFlag(wxPGPropertyFlags_UseDCC) &&
wxDynamicCast(property, wxBoolProperty) )
odcbFlags |= wxODCB_DCLICK_CYCLES;
@@ -1134,7 +1170,12 @@ bool wxPGChoiceEditor::GetValueFromControl( wxVariant& variant, wxPGProperty* pr
property->IsValueUnspecified()
)
{
- return property->IntToValue(variant, index, wxPG_PROPERTY_SPECIFIC);
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ return property->IntToValueWithCheck(variant, index, wxPGPropValFormatFlags::PropertySpecific);
+#else
+ return property->IntToValue(variant, index, wxPGPropValFormatFlags::PropertySpecific);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
}
return false;
}
@@ -1198,7 +1239,12 @@ void wxPGComboBoxEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl )
{
wxOwnerDrawnComboBox* cb = (wxOwnerDrawnComboBox*)ctrl;
const int index = property->GetChoiceSelection();
- wxString s = property->GetValueAsString(wxPG_EDITABLE_VALUE);
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ wxString s = property->GetValueAsStringWithCheck(wxPGPropValFormatFlags::EditableValue);
+#else
+ wxString s = property->GetValueAsString(wxPGPropValFormatFlags::EditableValue);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
cb->SetSelection(index);
property->GetGrid()->SetupTextCtrlValue(s);
cb->SetValue(s);
@@ -1246,7 +1292,12 @@ bool wxPGComboBoxEditor::GetValueFromControl( wxVariant& variant, wxPGProperty*
return true;
}
- bool res = property->StringToValue(variant, textVal, wxPG_EDITABLE_VALUE|wxPG_PROPERTY_SPECIFIC);
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ bool res = property->StringToValueWithCheck(variant, textVal, wxPGPropValFormatFlags::EditableValue|wxPGPropValFormatFlags::PropertySpecific);
+#else
+ bool res = property->StringToValue(variant, textVal, wxPGPropValFormatFlags::EditableValue | wxPGPropValFormatFlags::PropertySpecific);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
// Changing unspecified always causes event (returning
// true here should be enough to trigger it).
@@ -1342,7 +1393,7 @@ wxPGWindowList wxPGTextCtrlAndButtonEditor::CreateControls( wxPropertyGrid* prop
{
wxWindow* wnd2;
wxWindow* wnd = propGrid->GenerateEditorTextCtrlAndButton( pos, sz, &wnd2,
- property->HasFlag(wxPG_PROP_NOEDITOR), property);
+ property->HasFlag(wxPGPropertyFlags::NoEditor), property);
return wxPGWindowList(wnd, wnd2);
}
@@ -1626,7 +1677,7 @@ wxPGWindowList wxPGCheckBoxEditor::CreateControls( wxPropertyGrid* propGrid,
const wxPoint& pos,
const wxSize& size ) const
{
- if ( property->HasFlag(wxPG_PROP_READONLY) )
+ if ( property->HasFlag(wxPGPropertyFlags::ReadOnly) )
return nullptr;
wxPoint pt = pos;
@@ -1723,7 +1774,12 @@ bool wxPGCheckBoxEditor::GetValueFromControl( wxVariant& variant, wxPGProperty*
property->IsValueUnspecified()
)
{
- return property->IntToValue(variant, index, wxPG_PROPERTY_SPECIFIC);
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ return property->IntToValueWithCheck(variant, index, wxPGPropValFormatFlags::PropertySpecific);
+#else
+ return property->IntToValue(variant, index, wxPGPropValFormatFlags::PropertySpecific);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
}
return false;
}
@@ -1898,7 +1954,7 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrl( const wxPoint& pos,
int tcFlags = wxTE_PROCESS_ENTER | extraStyle;
- if ( prop->HasFlag(wxPG_PROP_READONLY) && forColumn == 1 )
+ if ( prop->HasFlag(wxPGPropertyFlags::ReadOnly) && forColumn == 1 )
tcFlags |= wxTE_READONLY;
wxPoint p(pos);
@@ -1951,7 +2007,7 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrl( const wxPoint& pos,
// This code is repeated from DoSelectProperty(). However, font boldness
// must be set before margin is set up below in FixPosForTextCtrl().
if ( forColumn == 1 &&
- prop->HasFlag(wxPG_PROP_MODIFIED) &&
+ prop->HasFlag(wxPGPropertyFlags::Modified) &&
HasFlag(wxPG_BOLD_MODIFIED) )
tc->SetFont( m_captionFont );
@@ -2018,7 +2074,7 @@ wxWindow* wxPropertyGrid::GenerateEditorButton( const wxPoint& pos, const wxSize
p.x = pos.x + sz.x - s.x;
but->Move(p);
- if ( selected->HasFlag(wxPG_PROP_READONLY) && !selected->HasFlag(wxPG_PROP_ACTIVE_BTN) )
+ if ( selected->HasFlag(wxPGPropertyFlags::ReadOnly) && !selected->HasFlag(wxPGPropertyFlags_ActiveButton) )
but->Disable();
return but;
@@ -2047,7 +2103,12 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrlAndButton( const wxPoint& pos,
wxString text;
if ( !property->IsValueUnspecified() )
- text = property->GetValueAsString(property->HasFlag(wxPG_PROP_READONLY)?0:wxPG_EDITABLE_VALUE);
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ text = property->GetValueAsStringWithCheck(property->HasFlag(wxPGPropertyFlags::ReadOnly)?wxPGPropValFormatFlags::Null : wxPGPropValFormatFlags::EditableValue);
+#else
+ text = property->GetValueAsString(property->HasFlag(wxPGPropertyFlags::ReadOnly) ? wxPGPropValFormatFlags::Null : wxPGPropValFormatFlags::EditableValue);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
return GenerateEditorTextCtrl(pos, sz, text, but, 0, property->GetMaxLength());
}
diff --git a/src/propgrid/manager.cpp b/src/propgrid/manager.cpp
index 01e16ffa70..639b71991c 100644
--- a/src/propgrid/manager.cpp
+++ b/src/propgrid/manager.cpp
@@ -634,6 +634,8 @@ bool wxPropertyGridManager::Create( wxWindow *parent,
Init2(style);
SetInitialSize(size);
+ // Create controls
+ RecreateControls();
return res;
}
@@ -763,9 +765,6 @@ void wxPropertyGridManager::Init2( int style )
// (see wxPropertyGridManager::ProcessEvent).
ReconnectEventHandlers(wxID_NONE, m_pPropGrid->GetId());
- // Optional initial controls.
- m_width = -12345;
-
m_iFlags |= wxPG_MAN_FL_INITIALIZED;
}
@@ -1454,8 +1453,8 @@ void wxPropertyGridManager::RepaintDescBoxDecorations( wxDC& dc,
void wxPropertyGridManager::UpdateDescriptionBox( int new_splittery, int new_width, int new_height )
{
- int use_hei = new_height-1;
- int use_width = new_width-6;
+ int use_hei = wxMax(1, new_height - 1);
+ int use_width = wxMax(1, new_width - 6);
// Fix help control positions.
int cap_y = new_splittery+m_splitterHeight+5;
@@ -2149,9 +2148,6 @@ void wxPropertyGridManager::OnResize( wxSizeEvent& WXUNUSED(event) )
GetClientSize(&width, &height);
- if ( m_width == -12345 )
- RecreateControls();
-
RecalculatePositions(width, height);
if ( m_pPropGrid && m_pPropGrid->GetParent() )
diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp
index d09c7fe7f8..d955683d8f 100644
--- a/src/propgrid/property.cpp
+++ b/src/propgrid/property.cpp
@@ -273,7 +273,12 @@ bool wxPGDefaultRenderer::Render( wxDC& dc, const wxRect& rect,
imageWidth = paintdata.m_drawnWidth;
}
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ text = property->GetValueAsStringWithCheck();
+#else
text = property->GetValueAsString();
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
// Add units string?
if ( propertyGrid->GetColumnCount() <= 2 )
@@ -582,7 +587,7 @@ void wxPGProperty::Init()
m_maxLen = 0; // infinite maximum length
- m_flags = wxPG_PROP_PROPERTY;
+ m_flags = wxPGPropertyFlags::Property;
m_depth = 1;
@@ -634,24 +639,24 @@ void wxPGProperty::InitAfterAdded( wxPropertyGridPageState* pageState,
// If in hideable adding mode, or if assigned parent is hideable, then
// make this one hideable.
if (
- ( !parentIsRoot && parent->HasFlag(wxPG_PROP_HIDDEN) ) ||
+ ( !parentIsRoot && parent->HasFlag(wxPGPropertyFlags::Hidden) ) ||
( propgrid && (propgrid->HasInternalFlag(wxPropertyGrid::wxPG_FL_ADDING_HIDEABLES)) )
)
- SetFlag( wxPG_PROP_HIDDEN );
+ SetFlag(wxPGPropertyFlags::Hidden);
// Set custom image flag.
int custImgHeight = OnMeasureImage().y;
if ( custImgHeight == wxDefaultCoord )
{
- SetFlag(wxPG_PROP_CUSTOMIMAGE);
+ SetFlag(wxPGPropertyFlags::CustomImage);
}
if ( propgrid && (propgrid->HasFlag(wxPG_LIMITED_EDITING)) )
- SetFlag(wxPG_PROP_NOEDITOR);
+ SetFlag(wxPGPropertyFlags::NoEditor);
// Make sure parent has some parental flags
- if ( !parent->HasFlag(wxPG_PROP_PARENTAL_FLAGS) )
- parent->SetParentalType(wxPG_PROP_MISC_PARENT);
+ if ( !parent->HasFlag(wxPGPropertyFlags::ParentalFlags) )
+ parent->SetParentalType(wxPGPropertyFlags::MiscParent);
if ( !IsCategory() )
{
@@ -707,14 +712,14 @@ void wxPGProperty::InitAfterAdded( wxPropertyGridPageState* pageState,
if ( HasAnyChild() )
{
// Check parental flags
- wxASSERT_MSG( ((m_flags & wxPG_PROP_PARENTAL_FLAGS) ==
- wxPG_PROP_AGGREGATE) ||
- ((m_flags & wxPG_PROP_PARENTAL_FLAGS) ==
- wxPG_PROP_MISC_PARENT),
+ wxASSERT_MSG( ((m_flags & wxPGPropertyFlags::ParentalFlags) ==
+ wxPGPropertyFlags::Aggregate) ||
+ ((m_flags & wxPGPropertyFlags::ParentalFlags) ==
+ wxPGPropertyFlags::MiscParent),
wxS("wxPGProperty parental flags set incorrectly at ")
wxS("this time") );
- if ( HasFlag(wxPG_PROP_AGGREGATE) )
+ if ( HasFlag(wxPGPropertyFlags::Aggregate) )
{
// Properties with private children are not expanded by default.
SetExpanded(false);
@@ -734,7 +739,7 @@ void wxPGProperty::InitAfterAdded( wxPropertyGridPageState* pageState,
}
if ( propgrid && propgrid->HasExtraStyle(wxPG_EX_AUTO_UNSPECIFIED_VALUES) )
- SetFlagRecursively(wxPG_PROP_AUTO_UNSPECIFIED, true);
+ SetFlagRecursively(wxPGPropertyFlags::AutoUnspecified, true);
}
}
@@ -978,7 +983,7 @@ wxString wxPGProperty::GetColumnText( unsigned int col, int choiceIndex ) const
*/
void wxPGProperty::DoGenerateComposedValue( wxString& text,
- int argFlags,
+ wxPGPropValFormatFlags flags,
const wxVariantList* valueOverrides,
wxPGHashMapS2S* childResults ) const
{
@@ -989,13 +994,13 @@ void wxPGProperty::DoGenerateComposedValue( wxString& text,
return;
if ( iMax > PWC_CHILD_SUMMARY_LIMIT &&
- !(argFlags & wxPG_FULL_VALUE) )
+ !(flags & wxPGPropValFormatFlags::FullValue) )
iMax = PWC_CHILD_SUMMARY_LIMIT;
size_t iMaxMinusOne = iMax-1;
if ( !IsTextEditable() )
- argFlags |= wxPG_UNEDITABLE_COMPOSITE_FRAGMENT;
+ flags |= wxPGPropValFormatFlags::UneditableCompositeFragment;
wxPGProperty* curChild = m_children[0];
@@ -1042,17 +1047,23 @@ void wxPGProperty::DoGenerateComposedValue( wxString& text,
if ( !childValue.IsNull() )
{
if ( overridesLeft &&
- curChild->HasFlag(wxPG_PROP_COMPOSED_VALUE) &&
+ curChild->HasFlag(wxPGPropertyFlags::ComposedValue) &&
childValue.IsType(wxPG_VARIANT_TYPE_LIST) )
{
wxVariantList& childList = childValue.GetList();
- DoGenerateComposedValue(s, argFlags|wxPG_COMPOSITE_FRAGMENT,
+ DoGenerateComposedValue(s, flags|wxPGPropValFormatFlags::CompositeFragment,
&childList, childResults);
}
else
{
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ s = curChild->ValueToStringWithCheck(childValue,
+ flags|wxPGPropValFormatFlags::CompositeFragment);
+#else
s = curChild->ValueToString(childValue,
- argFlags|wxPG_COMPOSITE_FRAGMENT);
+ flags|wxPGPropValFormatFlags::CompositeFragment);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
}
}
@@ -1060,7 +1071,7 @@ void wxPGProperty::DoGenerateComposedValue( wxString& text,
(*childResults)[curChild->GetName()] = s;
bool skip = false;
- if ( (argFlags & wxPG_UNEDITABLE_COMPOSITE_FRAGMENT) && s.empty() )
+ if ( !!(flags & wxPGPropValFormatFlags::UneditableCompositeFragment) && s.empty() )
skip = true;
if ( !curChild->HasAnyChild() || skip )
@@ -1071,8 +1082,8 @@ void wxPGProperty::DoGenerateComposedValue( wxString& text,
if ( i < iMaxMinusOne )
{
if ( text.length() > PWC_CHILD_SUMMARY_CHAR_LIMIT &&
- !(argFlags & wxPG_EDITABLE_VALUE) &&
- !(argFlags & wxPG_FULL_VALUE) )
+ !(flags & wxPGPropValFormatFlags::EditableValue) &&
+ !(flags & wxPGPropValFormatFlags::FullValue) )
break;
if ( !skip )
@@ -1096,8 +1107,27 @@ void wxPGProperty::DoGenerateComposedValue( wxString& text,
}
}
+#if WXWIN_COMPATIBILITY_3_2
+// By call to obsolete function we want to check if user-overriden function is still in use
+wxString wxPGProperty::ValueToStringWithCheck(wxVariant& variant, wxPGPropValFormatFlags flags) const
+{
+ m_oldValueToStringCalled = false;
+ wxString res = ValueToString(variant, static_cast(flags));
+ if ( m_oldValueToStringCalled )
+ {
+ // Our own function was called - this implies that call was forwarded to the new overriding
+ // function and there is no need to call it explicitly.
+ }
+ else
+ { // User-overriden obsolete function was called
+ wxFAIL_MSG(wxString::Format("in %s use ValueToString with 'flags' argument as wxPGPropValFormatFlags", GetClassInfo()->GetClassName()));
+ }
+ return res;
+}
+#endif // WXWIN_COMPATIBILITY_3_2
+
wxString wxPGProperty::ValueToString( wxVariant& WXUNUSED(value),
- int argFlags ) const
+ wxPGPropValFormatFlags flags ) const
{
wxCHECK_MSG( HasAnyChild(),
wxString(),
@@ -1105,39 +1135,63 @@ wxString wxPGProperty::ValueToString( wxVariant& WXUNUSED(value),
wxS("override GetValueAsString") );
// FIXME: Currently code below only works if value is actually m_value
- wxASSERT_MSG( argFlags & wxPG_VALUE_IS_CURRENT,
+ wxASSERT_MSG( !!(flags & wxPGPropValFormatFlags::ValueIsCurrent),
wxS("Sorry, currently default wxPGProperty::ValueToString() ")
wxS("implementation only works if value is m_value.") );
wxString text;
- DoGenerateComposedValue(text, argFlags);
+ DoGenerateComposedValue(text, flags);
return text;
}
-wxString wxPGProperty::GetValueAsString( int argFlags ) const
+#if WXWIN_COMPATIBILITY_3_2
+// By call to obsolete function we want to check if user-overriden function is still in use
+wxString wxPGProperty::GetValueAsStringWithCheck(wxPGPropValFormatFlags flags) const
+{
+ m_oldGetValueAsString = false;
+ wxString res = GetValueAsString(static_cast(flags));
+ if ( m_oldGetValueAsString )
+ {
+ // Our own function was called - this implies that call was forwarded to the new overriding
+ // function and there is no need to call it explicitly.
+ }
+ else
+ { // User-overriden obsolete function was called
+ wxFAIL_MSG(wxString::Format("in %s use GetValueAsString with 'flags' argument as wxPGPropValFormatFlags", GetClassInfo()->GetClassName()));
+ }
+ return res;
+}
+#endif // WXWIN_COMPATIBILITY_3_2
+
+wxString wxPGProperty::GetValueAsString(wxPGPropValFormatFlags flags) const
{
wxPropertyGrid* pg = GetGrid();
wxCHECK_MSG( pg, wxString(),
wxS("Cannot get valid value for detached property") );
if ( IsValueUnspecified() )
- return pg->GetUnspecifiedValueText(argFlags);
+ return pg->GetUnspecifiedValueText(flags);
if ( m_commonValue == -1 )
{
wxVariant value(GetValue());
- return ValueToString(value, argFlags|wxPG_VALUE_IS_CURRENT);
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ return ValueToStringWithCheck(value, flags|wxPGPropValFormatFlags::ValueIsCurrent);
+#else
+ return ValueToString(value, flags|wxPGPropValFormatFlags::ValueIsCurrent);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
}
//
// Return common value's string representation
const wxPGCommonValue* cv = pg->GetCommonValue(m_commonValue);
- if ( argFlags & wxPG_FULL_VALUE )
+ if ( !!(flags & wxPGPropValFormatFlags::FullValue) )
{
return cv->GetLabel();
}
- else if ( argFlags & wxPG_EDITABLE_VALUE )
+ else if ( !!(flags & wxPGPropValFormatFlags::EditableValue) )
{
return cv->GetEditableText();
}
@@ -1147,14 +1201,52 @@ wxString wxPGProperty::GetValueAsString( int argFlags ) const
}
}
-bool wxPGProperty::IntToValue( wxVariant& variant, int number, int WXUNUSED(argFlags) ) const
+#if WXWIN_COMPATIBILITY_3_2
+// By call to obsolete function we want to check if user-overriden function is still in use
+bool wxPGProperty::IntToValueWithCheck(wxVariant& variant, int number, wxPGPropValFormatFlags flags) const
+{
+ m_oldIntToValueCalled = false;
+ bool res = IntToValue(variant, number, static_cast(flags));
+ if ( m_oldIntToValueCalled )
+ {
+ // Our own function was called - this implies that call was forwarded to the new overriding
+ // function and there is no need to call it explicitly.
+ }
+ else
+ { // User-overriden obsolete function was called
+ wxFAIL_MSG(wxString::Format("in %s use IntoToValue with 'flags' argument as wxPGPropValFormatFlags", GetClassInfo()->GetClassName()));
+ }
+ return res;
+}
+#endif // WXWIN_COMPATIBILITY_3_2
+
+bool wxPGProperty::IntToValue( wxVariant& variant, int number, wxPGPropValFormatFlags WXUNUSED(flags) ) const
{
variant = (long)number;
return true;
}
+#if WXWIN_COMPATIBILITY_3_2
+// By call to obsolete function we want to check if user-overriden function is still in use#if WXWIN_COMPATIBILITY_3_2
+bool wxPGProperty::StringToValueWithCheck(wxVariant& variant, const wxString& text, wxPGPropValFormatFlags flags) const
+{
+ m_oldStringToValueCalled = false;
+ bool res = StringToValue(variant, text, static_cast(flags));
+ if ( m_oldStringToValueCalled )
+ {
+ // Our own function was called - this implies that call was forwarded to the new overriding
+ // function and there is no need to call it explicitly.
+ }
+ else
+ { // User-overriden obsolete function was called
+ wxFAIL_MSG(wxString::Format("in %s use StringToValue with 'flags' argument as wxPGPropValFormatFlags", GetClassInfo()->GetClassName()));
+ }
+ return res;
+}
+#endif // WXWIN_COMPATIBILITY_3_2
+
// Convert semicolon delimited tokens into child values.
-bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFlags ) const
+bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, wxPGPropValFormatFlags flags ) const
{
if ( !HasAnyChild() )
return false;
@@ -1164,7 +1256,7 @@ bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFla
unsigned int iMax = m_children.size();
if ( iMax > PWC_CHILD_SUMMARY_LIMIT &&
- !(argFlags & wxPG_FULL_VALUE) )
+ !(flags & wxPGPropValFormatFlags::FullValue) )
iMax = PWC_CHILD_SUMMARY_LIMIT;
bool changed = false;
@@ -1181,7 +1273,7 @@ bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFla
wxVariantList temp_list;
wxVariant list(temp_list);
- int propagatedFlags = argFlags & (wxPG_REPORT_ERROR|wxPG_PROGRAMMATIC_VALUE);
+ wxPGPropValFormatFlags propagatedFlags = flags & (wxPGPropValFormatFlags::ReportError|wxPGPropValFormatFlags::ProgrammaticValue);
wxLogTrace("propgrid",
wxS(">> %s.StringToValue('%s')"), GetLabel(), text);
@@ -1216,14 +1308,20 @@ bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFla
token, childName);
// Add only if editable or setting programmatically
- if ( (argFlags & wxPG_PROGRAMMATIC_VALUE) ||
- (!child->HasFlag(wxPG_PROP_DISABLED) &&
- !child->HasFlag(wxPG_PROP_READONLY)) )
+ if ( !!(flags & wxPGPropValFormatFlags::ProgrammaticValue) ||
+ (!child->HasFlag(wxPGPropertyFlags::Disabled) &&
+ !child->HasFlag(wxPGPropertyFlags::ReadOnly)) )
{
if ( len > 0 )
{
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ if ( child->StringToValueWithCheck(variant, token,
+ propagatedFlags | wxPGPropValFormatFlags::CompositeFragment) )
+#else
if ( child->StringToValue(variant, token,
- propagatedFlags|wxPG_COMPOSITE_FRAGMENT) )
+ propagatedFlags | wxPGPropValFormatFlags::CompositeFragment) )
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
{
// We really need to set the variant's name
// *after* child->StringToValue() has been
@@ -1295,14 +1393,20 @@ bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFla
wxVariant oldChildValue = child->GetValue();
wxVariant variant(oldChildValue);
- if ( (argFlags & wxPG_PROGRAMMATIC_VALUE) ||
- (!child->HasFlag(wxPG_PROP_DISABLED) &&
- !child->HasFlag(wxPG_PROP_READONLY)) )
+ if ( !!(flags & wxPGPropValFormatFlags::ProgrammaticValue) ||
+ (!child->HasFlag(wxPGPropertyFlags::Disabled) &&
+ !child->HasFlag(wxPGPropertyFlags::ReadOnly)) )
{
wxString childName = child->GetBaseName();
- bool stvRes = child->StringToValue( variant, token,
- propagatedFlags );
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ bool stvRes = child->StringToValueWithCheck(variant, token,
+ propagatedFlags);
+#else
+ bool stvRes = child->StringToValue(variant, token,
+ propagatedFlags);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
if ( stvRes || (variant != oldChildValue) )
{
variant.SetName(childName);
@@ -1350,19 +1454,19 @@ bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFla
return changed;
}
-bool wxPGProperty::SetValueFromString( const wxString& text, int argFlags )
+bool wxPGProperty::SetValueFromString( const wxString& text, wxPGPropValFormatFlags flags )
{
wxVariant variant(m_value);
- bool res = StringToValue(variant, text, argFlags);
+ bool res = StringToValue(variant, text, flags);
if ( res )
SetValue(variant);
return res;
}
-bool wxPGProperty::SetValueFromInt( long number, int argFlags )
+bool wxPGProperty::SetValueFromInt( long number, wxPGPropValFormatFlags flags )
{
wxVariant variant(m_value);
- bool res = IntToValue(variant, number, argFlags);
+ bool res = IntToValue(variant, number, flags);
if ( res )
SetValue(variant);
return res;
@@ -1474,7 +1578,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, wxPGSetValueFlag
{
//
// However, situation is different for composed string properties
- if ( HasFlag(wxPG_PROP_COMPOSED_VALUE) )
+ if ( HasFlag(wxPGPropertyFlags::ComposedValue) )
{
tempListVariant = value;
pList = &tempListVariant;
@@ -1486,7 +1590,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, wxPGSetValueFlag
//wxLogDebug(wxS(">> %s.SetValue() adapted list value to type '%s'"),GetName(),value.GetType());
}
- if ( HasFlag( wxPG_PROP_AGGREGATE) )
+ if ( HasFlag(wxPGPropertyFlags::Aggregate) )
flags |= wxPGSetValueFlags::Aggregated;
if ( pList && !pList->IsNull() )
@@ -1511,7 +1615,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, wxPGSetValueFlag
//wxLogDebug(wxS("%i: child = %s, childValue.GetType()=%s"),i,child->GetBaseName(),childValue.GetType());
if ( childValue.IsType(wxPG_VARIANT_TYPE_LIST) )
{
- if ( child->HasFlag(wxPG_PROP_AGGREGATE) && !(flags & wxPGSetValueFlags::Aggregated) )
+ if ( child->HasFlag(wxPGPropertyFlags::Aggregate) && !(flags & wxPGSetValueFlags::Aggregated) )
{
wxVariant listRefCopy = childValue;
child->SetValue(childValue, &listRefCopy, flags| wxPGSetValueFlags::FromParent);
@@ -1526,10 +1630,10 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, wxPGSetValueFlag
{
// For aggregate properties, we will trust RefreshChildren()
// to update child values.
- if ( !HasFlag(wxPG_PROP_AGGREGATE) )
+ if ( !HasFlag(wxPGPropertyFlags::Aggregate) )
child->SetValue(childValue, nullptr, flags| wxPGSetValueFlags::FromParent);
if ( !!(flags & wxPGSetValueFlags::ByUser) )
- child->SetFlag(wxPG_PROP_MODIFIED);
+ child->SetFlag(wxPGPropertyFlags::Modified);
}
}
i++;
@@ -1549,9 +1653,9 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, wxPGSetValueFlag
}
if ( !!(flags & wxPGSetValueFlags::ByUser) )
- SetFlag(wxPG_PROP_MODIFIED);
+ SetFlag(wxPGPropertyFlags::Modified);
- if ( HasFlag(wxPG_PROP_AGGREGATE) )
+ if ( HasFlag(wxPGPropertyFlags::Aggregate) )
RefreshChildren();
}
else
@@ -1683,7 +1787,7 @@ void wxPGProperty::Enable( bool enable )
void wxPGProperty::DoEnable( bool enable )
{
- ChangeFlag(wxPG_PROP_DISABLED, !enable);
+ ChangeFlag(wxPGPropertyFlags::Disabled, !enable);
// Apply same to sub-properties as well
for ( wxPGProperty* child : m_children )
@@ -1722,7 +1826,7 @@ void wxPGProperty::AdaptiveSetCell( unsigned int firstCol,
const wxPGCell& cell,
const wxPGCell& srcData,
wxPGCellData* unmodCellData,
- FlagType ignoreWithFlags,
+ wxPGPropertyFlags ignoreWithFlags,
bool recursively )
{
//
@@ -1764,7 +1868,7 @@ void wxPGProperty::AdaptiveSetCell( unsigned int firstCol,
}
}
-void wxPGProperty::ClearCells(FlagType ignoreWithFlags, bool recursively)
+void wxPGProperty::ClearCells(wxPGPropertyFlags ignoreWithFlags, bool recursively)
{
if ( !(m_flags & ignoreWithFlags) && !IsRoot() )
{
@@ -1835,7 +1939,7 @@ void wxPGProperty::SetBackgroundColour(const wxColour& colour, wxPGPropertyValue
newCell,
srcCell,
firstCellData,
- recursively ? wxPG_PROP_CATEGORY : 0,
+ recursively ? wxPGPropertyFlags::Category : wxPGPropertyFlags::Null,
recursively );
}
@@ -1870,7 +1974,7 @@ void wxPGProperty::SetTextColour(const wxColour& colour, wxPGPropertyValuesFlags
newCell,
srcCell,
firstCellData,
- recursively ? wxPG_PROP_CATEGORY : 0,
+ recursively ? wxPGPropertyFlags::Category : wxPGPropertyFlags::Null,
recursively );
}
@@ -1891,7 +1995,7 @@ void wxPGProperty::SetDefaultColours(wxPGPropertyValuesFlags flags)
}
}
- ClearCells(recursively ? wxPG_PROP_CATEGORY : 0,
+ ClearCells(recursively ? wxPGPropertyFlags::Category : wxPGPropertyFlags::Null,
recursively);
}
@@ -1980,22 +2084,22 @@ wxVariant wxPGProperty::GetAttributesAsList() const
// Utility flags are excluded.
// Store the literals in the internal representation for better performance.
-static const std::array, 4> gs_propFlagToString
+static const std::array, 4> gs_propFlagToString
{ {
- { wxPG_PROP_DISABLED, wxS("DISABLED") },
- { wxPG_PROP_HIDDEN, wxS("HIDDEN") },
- { wxPG_PROP_NOEDITOR, wxS("NOEDITOR") },
- { wxPG_PROP_COLLAPSED, wxS("COLLAPSED") }
+ { wxPGPropertyFlags::Disabled, wxS("DISABLED") },
+ { wxPGPropertyFlags::Hidden, wxS("HIDDEN") },
+ { wxPGPropertyFlags::NoEditor, wxS("NOEDITOR") },
+ { wxPGPropertyFlags::Collapsed, wxS("COLLAPSED") }
} };
-wxString wxPGProperty::GetFlagsAsString( FlagType flagsMask ) const
+wxString wxPGProperty::GetFlagsAsString(wxPGPropertyFlags flagsMask) const
{
wxString s;
- const FlagType relevantFlags = m_flags & flagsMask & wxPG_STRING_STORED_FLAGS;
+ const wxPGPropertyFlags relevantFlags = m_flags & flagsMask & wxPGPropertyFlags::StringStoredFlags;
for ( auto& item : gs_propFlagToString )
{
- if ( relevantFlags & item.first )
+ if ( !!(relevantFlags & item.first) )
{
if ( !s.empty() )
{
@@ -2010,7 +2114,7 @@ wxString wxPGProperty::GetFlagsAsString( FlagType flagsMask ) const
void wxPGProperty::SetFlagsFromString( const wxString& str )
{
- FlagType flags = 0;
+ wxPGPropertyFlags flags = wxPGPropertyFlags::Null;
WX_PG_TOKENIZER1_BEGIN(str, wxS('|'))
for ( auto& item : gs_propFlagToString )
@@ -2023,7 +2127,7 @@ void wxPGProperty::SetFlagsFromString( const wxString& str )
}
WX_PG_TOKENIZER1_END()
- m_flags = (m_flags & ~wxPG_STRING_STORED_FLAGS) | flags;
+ m_flags = (m_flags & ~wxPGPropertyFlags::StringStoredFlags) | flags;
}
wxValidator* wxPGProperty::DoGetValidator() const
@@ -2195,7 +2299,7 @@ bool wxPGProperty::Hide( bool hide, wxPGPropertyValuesFlags flags )
bool wxPGProperty::DoHide( bool hide, wxPGPropertyValuesFlags flags )
{
- ChangeFlag(wxPG_PROP_HIDDEN, hide);
+ ChangeFlag(wxPGPropertyFlags::Hidden, hide);
if ( !!(flags & wxPGPropertyValuesFlags::Recurse) )
{
@@ -2210,7 +2314,7 @@ bool wxPGProperty::HasVisibleChildren() const
{
for ( wxPGProperty* child : m_children )
{
- if ( !child->HasFlag(wxPG_PROP_HIDDEN) )
+ if ( !child->HasFlag(wxPGPropertyFlags::Hidden) )
return true;
}
@@ -2220,7 +2324,7 @@ bool wxPGProperty::HasVisibleChildren() const
bool wxPGProperty::RecreateEditor()
{
wxPropertyGrid* pg = GetGrid();
- wxASSERT(pg);
+ wxCHECK_MSG(pg, false, "Cannot recreate editor for detached property");
wxPGProperty* selected = pg->GetSelection();
if ( this == selected )
@@ -2240,12 +2344,12 @@ void wxPGProperty::SetValueImage( const wxBitmapBundle& bmp )
if ( bmp.IsOk() )
{
m_valueBitmapBundle = bmp;
- m_flags |= wxPG_PROP_CUSTOMIMAGE;
+ m_flags |= wxPGPropertyFlags::CustomImage;
}
else
{
m_valueBitmapBundle = wxBitmapBundle();
- m_flags &= ~(wxPG_PROP_CUSTOMIMAGE);
+ m_flags &= ~(wxPGPropertyFlags::CustomImage);
}
}
@@ -2278,12 +2382,12 @@ const wxPGProperty* wxPGProperty::GetLastVisibleSubItem() const
bool wxPGProperty::IsVisible() const
{
- if ( HasFlag(wxPG_PROP_HIDDEN) )
+ if ( HasFlag(wxPGPropertyFlags::Hidden) )
return false;
for (const wxPGProperty* parent = GetParent(); parent != nullptr; parent = parent->GetParent() )
{
- if ( !parent->IsExpanded() || parent->HasFlag(wxPG_PROP_HIDDEN) )
+ if ( !parent->IsExpanded() || parent->HasFlag(wxPGPropertyFlags::Hidden) )
return false;
}
@@ -2359,18 +2463,17 @@ void wxPGProperty::DoPreAddChild( int index, wxPGProperty* prop )
int custImgHeight = prop->OnMeasureImage().y;
if ( custImgHeight == wxDefaultCoord /*|| custImgHeight > 1*/ )
- prop->m_flags |= wxPG_PROP_CUSTOMIMAGE;
+ prop->m_flags |= wxPGPropertyFlags::CustomImage;
prop->m_parent = this;
}
void wxPGProperty::AddPrivateChild( wxPGProperty* prop )
{
- if ( !(m_flags & wxPG_PROP_PARENTAL_FLAGS) )
- SetParentalType(wxPG_PROP_AGGREGATE);
+ if ( !(m_flags & wxPGPropertyFlags::ParentalFlags) )
+ SetParentalType(wxPGPropertyFlags::Aggregate);
- wxASSERT_MSG( (m_flags & wxPG_PROP_PARENTAL_FLAGS) ==
- wxPG_PROP_AGGREGATE,
+ wxASSERT_MSG( (m_flags & wxPGPropertyFlags::ParentalFlags) == wxPGPropertyFlags::Aggregate,
wxS("Do not mix up AddPrivateChild() calls with other ")
wxS("property adders.") );
@@ -2389,11 +2492,10 @@ wxPGProperty* wxPGProperty::InsertChild( int index,
}
else
{
- if ( !(m_flags & wxPG_PROP_PARENTAL_FLAGS) )
- SetParentalType(wxPG_PROP_MISC_PARENT);
+ if ( !(m_flags & wxPGPropertyFlags::ParentalFlags) )
+ SetParentalType(wxPGPropertyFlags::MiscParent);
- wxASSERT_MSG( (m_flags & wxPG_PROP_PARENTAL_FLAGS) ==
- wxPG_PROP_MISC_PARENT,
+ wxASSERT_MSG( (m_flags & wxPGPropertyFlags::ParentalFlags) == wxPGPropertyFlags::MiscParent,
wxS("Do not mix up AddPrivateChild() calls with other ")
wxS("property adders.") );
@@ -2446,7 +2548,7 @@ void wxPGProperty::AdaptListToValue( wxVariant& list, wxVariant* value ) const
// Don't fully update aggregate properties unless all children have
// specified value
- if ( HasFlag(wxPG_PROP_AGGREGATE) )
+ if ( HasFlag(wxPGPropertyFlags::Aggregate) )
allChildrenSpecified = AreAllChildrenSpecified(&list);
else
allChildrenSpecified = true;
@@ -2557,7 +2659,7 @@ int wxPGProperty::GetChildrenHeight( int lh, int iMax ) const
{
wxPGProperty* pwc = Item(i);
- if ( !pwc->HasFlag(wxPG_PROP_HIDDEN) )
+ if ( !pwc->HasFlag(wxPGPropertyFlags::Hidden) )
{
if ( !pwc->IsExpanded() ||
!pwc->HasAnyChild() )
@@ -2585,7 +2687,7 @@ wxPGProperty* wxPGProperty::GetItemAtY( unsigned int y,
for ( wxPGProperty* pwc : m_children )
{
- if ( !pwc->HasFlag(wxPG_PROP_HIDDEN) )
+ if ( !pwc->HasFlag(wxPGPropertyFlags::Hidden) )
{
// Found?
if ( y < iy )
@@ -2630,7 +2732,7 @@ wxPGProperty* wxPGProperty::GetItemAtY( unsigned int y,
void wxPGProperty::Empty()
{
- if ( !HasFlag(wxPG_PROP_CHILDREN_ARE_COPIES) )
+ if ( !HasFlag(wxPGPropertyFlags::ChildrenAreCopies) )
{
for ( wxPGProperty* child : m_children )
{
@@ -2748,7 +2850,7 @@ bool wxPGProperty::AreAllChildrenSpecified( const wxVariant* pendingList ) const
wxPGProperty* wxPGProperty::UpdateParentValues()
{
wxPGProperty* parent = m_parent;
- if ( parent && parent->HasFlag(wxPG_PROP_COMPOSED_VALUE) &&
+ if ( parent && parent->HasFlag(wxPGPropertyFlags::ComposedValue) &&
!parent->IsCategory() && !parent->IsRoot() )
{
wxString s;
@@ -2761,10 +2863,10 @@ wxPGProperty* wxPGProperty::UpdateParentValues()
bool wxPGProperty::IsTextEditable() const
{
- if ( HasFlag(wxPG_PROP_READONLY) )
+ if ( HasFlag(wxPGPropertyFlags::ReadOnly) )
return false;
- if ( HasFlag(wxPG_PROP_NOEDITOR) &&
+ if ( HasFlag(wxPGPropertyFlags::NoEditor) &&
(HasAnyChild() ||
wxString(GetEditorClass()->GetClassInfo()->GetClassName()).EndsWith(wxS("Button")))
)
@@ -2816,7 +2918,7 @@ wxString wxPGProperty::GetHintText() const
int wxPGProperty::GetDisplayedCommonValueCount() const
{
- if ( HasFlag(wxPG_PROP_USES_COMMON_VALUE) )
+ if ( HasFlag(wxPGPropertyFlags::UsesCommonValue) )
{
wxPropertyGrid* pg = GetGrid();
if ( pg )
@@ -2871,7 +2973,7 @@ wxPGRootProperty::wxPGRootProperty( const wxString& name )
{
m_name = name;
m_label = m_name;
- SetParentalType(0);
+ SetParentalType(wxPGPropertyFlags::Null);
m_depth = 0;
}
@@ -2884,7 +2986,7 @@ wxPG_IMPLEMENT_PROPERTY_CLASS(wxPropertyCategory, wxPGProperty, TextCtrl)
void wxPropertyCategory::Init()
{
// don't set colour - prepareadditem method should do this
- SetParentalType(wxPG_PROP_CATEGORY);
+ SetParentalType(wxPGPropertyFlags::Category);
m_capFgColIndex = 1;
m_textExtent = -1;
}
@@ -2903,15 +3005,15 @@ wxPropertyCategory::wxPropertyCategory( const wxString &label, const wxString& n
}
wxString wxPropertyCategory::ValueToString( wxVariant& WXUNUSED(value),
- int WXUNUSED(argFlags) ) const
+ wxPGPropValFormatFlags WXUNUSED(flags) ) const
{
return m_value.IsType(wxPG_VARIANT_TYPE_STRING) ? m_value.GetString() : wxString();
}
-wxString wxPropertyCategory::GetValueAsString( int argFlags ) const
+wxString wxPropertyCategory::GetValueAsString(wxPGPropValFormatFlags flags) const
{
// Unspecified value is always empty string
- return IsValueUnspecified() ? wxString() : wxPGProperty::GetValueAsString(argFlags);
+ return IsValueUnspecified() ? wxString() : wxPGProperty::GetValueAsString(flags);
}
static int DoGetTextExtent(const wxWindow* wnd, const wxString& label, const wxFont& font)
@@ -3086,8 +3188,7 @@ int wxPGChoices::Index( int val ) const
{
for ( unsigned int i = 0; i < m_data->GetCount(); i++ )
{
- const wxPGChoiceEntry& entry = m_data->Item(i);
- if ( entry.GetValue() == val )
+ if ( GetValue(i) == val )
return i;
}
}
diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp
index 0d38410cb7..7112061fca 100644
--- a/src/propgrid/propgrid.cpp
+++ b/src/propgrid/propgrid.cpp
@@ -379,15 +379,15 @@ void wxPropertyGrid::Init1()
m_unspecifiedAppearance.SetFgCol(*wxLIGHT_GREY);
// Set default keys
- AddActionTrigger(wxPGKeyboardActions::NextProperty, WXK_RIGHT);
- AddActionTrigger(wxPGKeyboardActions::NextProperty, WXK_DOWN);
- AddActionTrigger(wxPGKeyboardActions::PrevProperty, WXK_LEFT);
- AddActionTrigger(wxPGKeyboardActions::PrevProperty, WXK_UP);
- AddActionTrigger(wxPGKeyboardActions::ExpandProperty, WXK_RIGHT);
- AddActionTrigger(wxPGKeyboardActions::CollapseProperty, WXK_LEFT);
- AddActionTrigger(wxPGKeyboardActions::CancelEdit, WXK_ESCAPE);
- AddActionTrigger(wxPGKeyboardActions::PressButton, WXK_DOWN, wxMOD_ALT);
- AddActionTrigger(wxPGKeyboardActions::PressButton, WXK_F4);
+ AddActionTrigger(wxPGKeyboardAction::NextProperty, WXK_RIGHT);
+ AddActionTrigger(wxPGKeyboardAction::NextProperty, WXK_DOWN);
+ AddActionTrigger(wxPGKeyboardAction::PrevProperty, WXK_LEFT);
+ AddActionTrigger(wxPGKeyboardAction::PrevProperty, WXK_UP);
+ AddActionTrigger(wxPGKeyboardAction::ExpandProperty, WXK_RIGHT);
+ AddActionTrigger(wxPGKeyboardAction::CollapseProperty, WXK_LEFT);
+ AddActionTrigger(wxPGKeyboardAction::CancelEdit, WXK_ESCAPE);
+ AddActionTrigger(wxPGKeyboardAction::PressButton, WXK_DOWN, wxMOD_ALT);
+ AddActionTrigger(wxPGKeyboardAction::PressButton, WXK_F4);
m_coloursCustomized = 0;
@@ -943,11 +943,11 @@ void wxPropertyGrid::MakeColumnEditable( unsigned int column,
bool editable )
{
// The second column is always editable. To make it read-only is a property
- // by property decision by setting its wxPG_PROP_READONLY flag.
+ // by property decision by setting its wxPGPropertyFlags::ReadOnly flag.
wxASSERT_MSG
(
column != 1,
- wxS("Set wxPG_PROP_READONLY property flag instead")
+ wxS("Set wxPGPropertyFlags::ReadOnly property flag instead")
);
if ( editable )
@@ -2158,7 +2158,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
{
const wxPGProperty* p = *it;
- if ( !p->HasFlag(wxPG_PROP_HIDDEN) )
+ if ( !p->HasFlag(wxPGPropertyFlags::Hidden) )
{
visPropArray.push_back(const_cast(p));
@@ -2365,7 +2365,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
if ( butRect.x > 0 )
butRect.x += IN_CELL_EXPANDER_BUTTON_X_ADJUST;
- if ( p->HasFlag(wxPG_PROP_MODIFIED) &&
+ if ( p->HasFlag(wxPGPropertyFlags::Modified) &&
(windowStyle & wxPG_BOLD_MODIFIED) )
{
dc.SetFont(m_captionFont);
@@ -3000,7 +3000,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
wxVariant* pPendingValue = &pendingValue;
wxVariant* pList = nullptr;
- // If parent has wxPG_PROP_AGGREGATE flag, or uses composite
+ // If parent has wxPGPropertyFlags::Aggregate flag, or uses composite
// string value, then we need treat as it was changed instead
// (or, in addition, as is the case with composite string parent).
// This includes creating list variant for child values.
@@ -3014,7 +3014,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
listValue.SetName(p->GetBaseName());
while ( pwc &&
- (pwc->HasFlag(wxPG_PROP_AGGREGATE) || pwc->HasFlag(wxPG_PROP_COMPOSED_VALUE)) )
+ (pwc->HasFlag(wxPGPropertyFlags::Aggregate) || pwc->HasFlag(wxPGPropertyFlags::ComposedValue)) )
{
wxVariantList tempList;
wxVariant lv(tempList, pwc->GetBaseName());
@@ -3022,7 +3022,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
listValue = lv;
pPendingValue = &listValue;
- if ( pwc->HasFlag(wxPG_PROP_AGGREGATE) )
+ if ( pwc->HasFlag(wxPGPropertyFlags::Aggregate) )
{
baseChangedProperty = pwc;
bcpPendingList = lv;
@@ -3052,9 +3052,9 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
{
// FIXME: After proper ValueToString()s added, remove
// this. It is just a temporary fix, as evt_changing
- // will simply not work for wxPG_PROP_COMPOSED_VALUE
+ // will simply not work for wxPGPropertyFlags::ComposedValue
// (unless it is selected, and textctrl editor is open).
- if ( changedProperty->HasFlag(wxPG_PROP_COMPOSED_VALUE) )
+ if ( changedProperty->HasFlag(wxPGPropertyFlags::ComposedValue) )
{
evtChangingProperty = baseChangedProperty;
if ( evtChangingProperty != p )
@@ -3067,7 +3067,7 @@ bool wxPropertyGrid::PerformValidation( wxPGProperty* p, wxVariant& pendingValue
}
}
- if ( evtChangingProperty->HasFlag(wxPG_PROP_COMPOSED_VALUE) )
+ if ( evtChangingProperty->HasFlag(wxPGPropertyFlags::ComposedValue) )
{
if ( changedProperty == GetSelection() )
{
@@ -3194,7 +3194,7 @@ bool wxPropertyGrid::OnValidationFailure( wxPGProperty* property,
{
// When property selection is being changed, do not display any
// messages, if some were already shown for this property.
- if ( property->HasFlag(wxPG_PROP_INVALID_VALUE) )
+ if ( property->HasFlag(wxPGPropertyFlags::InvalidValue) )
{
m_validationInfo.SetFailureBehavior(
vfb & (~(wxPGVFBFlags::ShowMessage |
@@ -3216,7 +3216,7 @@ bool wxPropertyGrid::OnValidationFailure( wxPGProperty* property,
property->GetEditorClass()->UpdateControl(property, editor);
}
- property->SetFlag(wxPG_PROP_INVALID_VALUE);
+ property->SetFlag(wxPGPropertyFlags::InvalidValue);
return res;
}
@@ -3229,7 +3229,7 @@ bool wxPropertyGrid::DoOnValidationFailure( wxPGProperty* property, wxVariant& W
::wxBell();
if ( !!(vfb & wxPGVFBFlags::MarkCell) &&
- !property->HasFlag(wxPG_PROP_INVALID_VALUE) )
+ !property->HasFlag(wxPGPropertyFlags::InvalidValue) )
{
unsigned int colCount = m_pState->GetColumnCount();
@@ -3381,9 +3381,9 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, wxPGSelectPropertyFlags
wxWindow* editor = GetEditorControl();
// Set as Modified (not if dragging just began)
- if ( !p->HasFlag(wxPG_PROP_MODIFIED) )
+ if ( !p->HasFlag(wxPGPropertyFlags::Modified) )
{
- p->SetFlag(wxPG_PROP_MODIFIED);
+ p->SetFlag(wxPGPropertyFlags::Modified);
if ( p == selected && (m_windowStyle & wxPG_BOLD_MODIFIED) )
{
if ( editor )
@@ -3398,7 +3398,7 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, wxPGSelectPropertyFlags
while ( prevPwc != topPaintedProperty )
{
- pwc->SetFlag(wxPG_PROP_MODIFIED);
+ pwc->SetFlag(wxPGPropertyFlags::Modified);
if ( pwc == selected && (m_windowStyle & wxPG_BOLD_MODIFIED) )
{
@@ -3429,11 +3429,11 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, wxPGSelectPropertyFlags
}
// Sanity check
- wxASSERT( !changedProperty->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) );
+ wxASSERT( !changedProperty->GetParent()->HasFlag(wxPGPropertyFlags::Aggregate) );
// If top parent has composite string value, then send to child parents,
// starting from baseChangedProperty.
- if ( changedProperty->HasFlag(wxPG_PROP_COMPOSED_VALUE) )
+ if ( changedProperty->HasFlag(wxPGPropertyFlags::ComposedValue) )
{
pwc = m_chgInfo_baseChangedProperty;
@@ -3485,7 +3485,12 @@ wxVariant wxPropertyGrid::GetUncommittedPropertyValue()
if ( !tc || !IsEditorsValueModified() )
return value;
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ if ( !prop->StringToValueWithCheck(value, tc->GetValue()) )
+#else
if ( !prop->StringToValue(value, tc->GetValue()) )
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
return value;
if ( !PerformValidation(prop, value, IsStandaloneValidation) )
@@ -3556,7 +3561,7 @@ bool wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event )
// Somehow, event is handled after property has been deselected.
// Possibly, but very rare.
if ( !selected ||
- selected->HasFlag(wxPG_PROP_BEING_DELETED) ||
+ selected->HasFlag(wxPGPropertyFlags::BeingDeleted) ||
m_inOnValidationFailure ||
// Also don't handle editor event if wxEVT_PG_CHANGED or
// similar is currently doing something (showing a
@@ -3865,13 +3870,13 @@ void wxPropertyGrid::CustomSetCursor( int type, bool override )
// -----------------------------------------------------------------------
wxString
-wxPropertyGrid::GetUnspecifiedValueText( int argFlags ) const
+wxPropertyGrid::GetUnspecifiedValueText(wxPGPropValFormatFlags flags) const
{
const wxPGCell& ua = GetUnspecifiedValueAppearance();
if ( ua.HasText() &&
- !(argFlags & wxPG_FULL_VALUE) &&
- !(argFlags & wxPG_EDITABLE_VALUE) )
+ !(flags & wxPGPropValFormatFlags::FullValue) &&
+ !(flags & wxPGPropValFormatFlags::EditableValue) )
return ua.GetText();
return wxString();
@@ -4036,7 +4041,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, wxPGSelectPropertyFlags
prevFirstSel = prevSelection.empty()? nullptr: prevSelection[0];
- if ( prevFirstSel && prevFirstSel->HasFlag(wxPG_PROP_BEING_DELETED) )
+ if ( prevFirstSel && prevFirstSel->HasFlag(wxPGPropertyFlags::BeingDeleted) )
prevFirstSel = nullptr;
// Always send event, as this is indirect call
@@ -4150,7 +4155,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, wxPGSelectPropertyFlags
//
// Only create editor for non-disabled non-caption
- if ( !p->IsCategory() && !p->HasFlag(wxPG_PROP_DISABLED) )
+ if ( !p->IsCategory() && !p->HasFlag(wxPGPropertyFlags::Disabled) )
{
// do this for non-caption items
@@ -4158,7 +4163,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, wxPGSelectPropertyFlags
// Do we need to paint the custom image, if any?
m_iFlags &= ~(wxPG_FL_CUR_USES_CUSTOM_IMAGE);
- if ( p->HasFlag(wxPG_PROP_CUSTOMIMAGE) &&
+ if ( p->HasFlag(wxPGPropertyFlags::CustomImage) &&
!p->GetEditorClass()->CanContainCustomImage()
)
m_iFlags |= wxPG_FL_CUR_USES_CUSTOM_IMAGE;
@@ -4224,7 +4229,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, wxPGSelectPropertyFlags
// If it has modified status, use bold font
// (must be done before capturing m_ctrlXAdjust)
- if ( p->HasFlag(wxPG_PROP_MODIFIED) &&
+ if ( p->HasFlag(wxPGPropertyFlags::Modified) &&
(m_windowStyle & wxPG_BOLD_MODIFIED) )
SetCurControlBoldFont();
// Store x relative to splitter (we'll need it).
@@ -4415,7 +4420,7 @@ void wxPropertyGrid::RefreshEditor()
// calling UpdateControl().
if ( HasFlag(wxPG_BOLD_MODIFIED) )
{
- if ( p->HasFlag(wxPG_PROP_MODIFIED) )
+ if ( p->HasFlag(wxPGPropertyFlags::Modified) )
wnd->SetFont(GetCaptionFont());
else
wnd->SetFont(GetFont());
@@ -4602,10 +4607,10 @@ void wxPropertyGrid::OnResize( wxSizeEvent& event )
if ( !m_doubleBuffer )
{
// Create double buffer bitmap to draw on, if none
- int w = wxMax(width, 250);
- int h = wxMax(height + dblh, 400);
+ int w = wxMax(width, FromDIP(250));
+ int h = wxMax(height + dblh, FromDIP(400));
m_doubleBuffer = new wxBitmap;
- m_doubleBuffer->CreateWithDIPSize( w, h, scaleFactor );
+ m_doubleBuffer->CreateWithLogicalSize( w, h, scaleFactor );
}
else
{
@@ -4619,7 +4624,7 @@ void wxPropertyGrid::OnResize( wxSizeEvent& event )
if ( h < (height+dblh) ) h = height + dblh;
delete m_doubleBuffer;
m_doubleBuffer = new wxBitmap;
- m_doubleBuffer->CreateWithDIPSize( w, h, scaleFactor );
+ m_doubleBuffer->CreateWithLogicalSize( w, h, scaleFactor );
}
}
}
@@ -5098,7 +5103,12 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y,
wxSize imageSize = GetImageSize(m_propHover, -1);
if ( imageSize.x > 0 )
imageWidth = imageSize.x;
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ tipString = m_propHover->GetValueAsStringWithCheck();
+#else
tipString = m_propHover->GetValueAsString();
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
if ( GetColumnCount() <= 2 )
{
wxString unitsString = m_propHover->GetAttribute(wxPG_ATTR_UNITS, wxString());
@@ -5111,7 +5121,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y,
space -= (wxPG_XBEFORETEXT + 1);
int tw, th;
const wxFont* font = nullptr;
- if ( (m_windowStyle & wxPG_BOLD_MODIFIED) && m_propHover->HasFlag(wxPG_PROP_MODIFIED) )
+ if ( (m_windowStyle & wxPG_BOLD_MODIFIED) && m_propHover->HasFlag(wxPGPropertyFlags::Modified) )
font = &m_captionFont;
if ( cell.GetFont().IsOk() )
font = &cell.GetFont();
@@ -5183,7 +5193,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y,
// Since categories cannot be selected along with 'other'
// properties, exclude them from iterator flags.
- int iterFlags = wxPG_ITERATE_VISIBLE & (~wxPG_PROP_CATEGORY);
+ int iterFlags = wxPG_ITERATE_VISIBLE & (~wxPGPropertyFlags::Category);
for ( int i=(selection.size()-1); i>=0; i-- )
{
@@ -5525,9 +5535,9 @@ void wxPropertyGrid::OnMouseUpChild( wxMouseEvent &event )
// wxPropertyGrid keyboard event handling
// -----------------------------------------------------------------------
-std::pair wxPropertyGrid::KeyEventToActions(const wxKeyEvent& event) const
+std::pair wxPropertyGrid::KeyEventToActions(const wxKeyEvent& event) const
{
- // Translates wxKeyEvent to wxPGKeyboardActions::XXX
+ // Translates wxKeyEvent to wxPGKeyboardAction::XXX
int keycode = event.GetKeyCode();
int modifiers = event.GetModifiers();
@@ -5539,16 +5549,16 @@ std::pair wxPropertyGrid::KeyEventToAc
auto it = m_actionTriggers.find(hashMapKey);
if ( it == m_actionTriggers.end() )
- return std::make_pair(wxPGKeyboardActions::Invalid, wxPGKeyboardActions::Invalid);
+ return std::make_pair(wxPGKeyboardAction::Invalid, wxPGKeyboardAction::Invalid);
return it->second;
}
#if WXWIN_COMPATIBILITY_3_2
-wxPGKeyboardActions wxPropertyGrid::KeyEventToActions(wxKeyEvent &event, wxPGKeyboardActions* pSecond) const
+wxPGKeyboardAction wxPropertyGrid::KeyEventToActions(wxKeyEvent &event, wxPGKeyboardAction* pSecond) const
{
- // Translates wxKeyEvent to wxPGKeyboardActions::XXX
- std::pair actions = KeyEventToActions(event);
+ // Translates wxKeyEvent to wxPGKeyboardAction::XXX
+ std::pair actions = KeyEventToActions(event);
if ( pSecond )
{
@@ -5559,18 +5569,18 @@ wxPGKeyboardActions wxPropertyGrid::KeyEventToActions(wxKeyEvent &event, wxPGKey
}
#endif // WXWIN_COMPATIBILITY_3_2
-wxPGKeyboardActions wxPropertyGrid::KeyEventToAction(wxKeyEvent& event) const
+wxPGKeyboardAction wxPropertyGrid::KeyEventToAction(wxKeyEvent& event) const
{
return KeyEventToActions(event).first;
}
-void wxPropertyGrid::AddActionTrigger(wxPGKeyboardActions action, int keycode, int modifiers)
+void wxPropertyGrid::AddActionTrigger(wxPGKeyboardAction action, int keycode, int modifiers)
{
wxASSERT( !(modifiers&~(0xFFFF)) );
int hashMapKey = (keycode & 0xFFFF) | ((modifiers & 0xFFFF) << 16);
- std::pair curActions;
+ std::pair curActions;
auto it = m_actionTriggers.find(hashMapKey);
if ( it != m_actionTriggers.end() )
@@ -5579,20 +5589,20 @@ void wxPropertyGrid::AddActionTrigger(wxPGKeyboardActions action, int keycode, i
curActions = it->second;
// Can add secondary?
- wxASSERT_MSG( curActions.second == wxPGKeyboardActions::Invalid,
+ wxASSERT_MSG( curActions.second == wxPGKeyboardAction::Invalid,
"You can only add up to two separate actions per key combination." );
curActions.second = action;
}
else
{
- curActions = std::make_pair(action, wxPGKeyboardActions::Invalid);
+ curActions = std::make_pair(action, wxPGKeyboardAction::Invalid);
}
m_actionTriggers[hashMapKey] = curActions;
}
-void wxPropertyGrid::ClearActionTriggers(wxPGKeyboardActions action)
+void wxPropertyGrid::ClearActionTriggers(wxPGKeyboardAction action)
{
// wxCHECK_RET(!(action & ~(0xFFFF)), wxS("You can only clear triggers for one action at a time.")
@@ -5601,12 +5611,12 @@ void wxPropertyGrid::ClearActionTriggers(wxPGKeyboardActions action)
{
if ( it->second.second == action )
{
- it->second.second = wxPGKeyboardActions::Invalid;
+ it->second.second = wxPGKeyboardAction::Invalid;
}
if ( it->second.first == action )
{
- if ( it->second.second == wxPGKeyboardActions::Invalid )
+ if ( it->second.second == wxPGKeyboardAction::Invalid )
{
it = m_actionTriggers.erase(it);
continue;
@@ -5679,11 +5689,11 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
return;
}
- wxPGKeyboardActions action;
- wxPGKeyboardActions secondAction;
+ wxPGKeyboardAction action;
+ wxPGKeyboardAction secondAction;
std::tie(action, secondAction) = KeyEventToActions(event);
- if ( editorFocused && action == wxPGKeyboardActions::CancelEdit )
+ if ( editorFocused && action == wxPGKeyboardAction::CancelEdit )
{
//
// Esc cancels any changes
@@ -5727,10 +5737,10 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
wxPGProperty* p = selected;
- if ( action == wxPGKeyboardActions::Edit && !editorFocused )
+ if ( action == wxPGKeyboardAction::Edit && !editorFocused )
{
// Mark as handled only for editable property
- if ( !p->IsCategory() && p->IsEnabled() && !p->HasFlag(wxPG_PROP_READONLY) )
+ if ( !p->IsCategory() && p->IsEnabled() && !p->HasFlag(wxPGPropertyFlags::ReadOnly) )
{
DoSelectProperty( p, wxPGSelectPropertyFlags::Focus );
wasHandled = true;
@@ -5742,12 +5752,12 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
if ( p->GetChildCount() )
{
- if ( action == wxPGKeyboardActions::CollapseProperty || secondAction == wxPGKeyboardActions::CollapseProperty )
+ if ( action == wxPGKeyboardAction::CollapseProperty || secondAction == wxPGKeyboardAction::CollapseProperty )
{
if ( (m_windowStyle & wxPG_HIDE_MARGIN) || DoCollapse(p, true) )
wasHandled = true;
}
- else if ( action == wxPGKeyboardActions::ExpandProperty || secondAction == wxPGKeyboardActions::ExpandProperty )
+ else if ( action == wxPGKeyboardAction::ExpandProperty || secondAction == wxPGKeyboardAction::ExpandProperty )
{
if ( (m_windowStyle & wxPG_HIDE_MARGIN) || DoExpand(p, true) )
wasHandled = true;
@@ -5756,11 +5766,11 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
if ( !wasHandled )
{
- if ( action == wxPGKeyboardActions::PrevProperty || secondAction == wxPGKeyboardActions::PrevProperty )
+ if ( action == wxPGKeyboardAction::PrevProperty || secondAction == wxPGKeyboardAction::PrevProperty )
{
selectDir = -1;
}
- else if ( action == wxPGKeyboardActions::NextProperty || secondAction == wxPGKeyboardActions::NextProperty )
+ else if ( action == wxPGKeyboardAction::NextProperty || secondAction == wxPGKeyboardAction::NextProperty )
{
selectDir = 1;
}
@@ -5774,7 +5784,7 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
wxPGSelectPropertyFlags selFlags = wxPGSelectPropertyFlags::Null;
int reopenLabelEditorCol = -1;
- if ( action == wxPGKeyboardActions::Edit )
+ if ( action == wxPGKeyboardAction::Edit )
{
// Make the next editor focused as well
// if we are actually going to edit the property.
@@ -5792,7 +5802,7 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
if ( reopenLabelEditorCol >= 0 )
DoBeginLabelEdit(reopenLabelEditorCol);
}
- else if ( action == wxPGKeyboardActions::Edit )
+ else if ( action == wxPGKeyboardAction::Edit )
{
// For first and last item just validate the value
CommitChangesFromEditor();
@@ -5804,7 +5814,7 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
{
// If nothing was selected, select the first item now
// (or navigate out of tab).
- if ( action != wxPGKeyboardActions::CancelEdit && secondAction != wxPGKeyboardActions::CancelEdit )
+ if ( action != wxPGKeyboardAction::CancelEdit && secondAction != wxPGKeyboardAction::CancelEdit )
{
wxPGProperty* p = wxPropertyGridInterface::GetFirst();
if ( p ) DoSelectProperty(p);
@@ -5838,15 +5848,15 @@ void wxPropertyGrid::OnKey( wxKeyEvent &event )
// -----------------------------------------------------------------------
-bool wxPropertyGrid::ButtonTriggerKeyTest(wxPGKeyboardActions action, wxKeyEvent& event)
+bool wxPropertyGrid::ButtonTriggerKeyTest(wxPGKeyboardAction action, wxKeyEvent& event)
{
- if ( action == wxPGKeyboardActions::Invalid )
+ if ( action == wxPGKeyboardAction::Invalid )
{
action = KeyEventToActions(event).first;
}
// Does the keycode trigger button?
- if ( action == wxPGKeyboardActions::PressButton &&
+ if ( action == wxPGKeyboardAction::PressButton &&
m_wndEditor2 )
{
wxCommandEvent evt(wxEVT_BUTTON, m_wndEditor2->GetId());
@@ -6373,7 +6383,7 @@ wxPGProperty* wxPropertyGridPopulator::Add( const wxString& propClass,
wxClassInfo* classInfo = wxClassInfo::FindClass(propClass);
wxPGProperty* parent = GetCurParent();
- if ( parent->HasFlag(wxPG_PROP_AGGREGATE) )
+ if ( parent->HasFlag(wxPGPropertyFlags::Aggregate) )
{
ProcessError(wxString::Format(wxS("new children cannot be added to '%s'"),parent->GetName()));
return nullptr;
@@ -6396,8 +6406,8 @@ wxPGProperty* wxPropertyGridPopulator::Add( const wxString& propClass,
m_state->DoInsert(parent, -1, property);
if ( propValue )
- property->SetValueFromString( *propValue, wxPG_FULL_VALUE|
- wxPG_PROGRAMMATIC_VALUE );
+ property->SetValueFromString( *propValue, wxPGPropValFormatFlags::FullValue|
+ wxPGPropValFormatFlags::ProgrammaticValue );
return property;
}
diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp
index 0980fcb86a..d3b3d71714 100644
--- a/src/propgrid/propgridiface.cpp
+++ b/src/propgrid/propgridiface.cpp
@@ -125,7 +125,7 @@ wxPGProperty* wxPropertyGridInterface::RemoveProperty( wxPGPropArg id )
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty)
- wxCHECK( !p->HasAnyChild() || p->HasFlag(wxPG_PROP_AGGREGATE),
+ wxCHECK( !p->HasAnyChild() || p->HasFlag(wxPGPropertyFlags::Aggregate),
wxNullProperty);
wxPropertyGridPageState* state = p->GetParentState();
@@ -228,7 +228,7 @@ bool wxPropertyGridInterface::EnableProperty( wxPGPropArg id, bool enable )
if ( enable )
{
- if ( !p->HasFlag(wxPG_PROP_DISABLED) )
+ if ( !p->HasFlag(wxPGPropertyFlags::Disabled) )
return false;
// If active, Set active Editor.
@@ -237,7 +237,7 @@ bool wxPropertyGridInterface::EnableProperty( wxPGPropArg id, bool enable )
}
else
{
- if ( p->HasFlag(wxPG_PROP_DISABLED) )
+ if ( p->HasFlag(wxPGPropertyFlags::Disabled) )
return false;
// If active, Disable as active Editor.
@@ -258,17 +258,17 @@ void wxPropertyGridInterface::SetPropertyReadOnly( wxPGPropArg id, bool set, wxP
if ( !!(flags & wxPGPropertyValuesFlags::Recurse) )
{
- p->SetFlagRecursively(wxPG_PROP_READONLY, set);
+ p->SetFlagRecursively(wxPGPropertyFlags::ReadOnly, set);
}
else
{
// Do nothing if flag is already set as required.
- if ( set && p->HasFlag(wxPG_PROP_READONLY) )
+ if ( set && p->HasFlag(wxPGPropertyFlags::ReadOnly) )
return;
- if ( !set && !p->HasFlag(wxPG_PROP_READONLY) )
+ if ( !set && !p->HasFlag(wxPGPropertyFlags::ReadOnly) )
return;
- p->ChangeFlag(wxPG_PROP_READONLY, set);
+ p->ChangeFlag(wxPGPropertyFlags::ReadOnly, set);
}
wxPropertyGridPageState* state = p->GetParentState();
@@ -337,7 +337,7 @@ void wxPropertyGridInterface::ClearModifiedStatus()
wxPropertyGridPageState* page;
while ( (page = GetPageState(pageIndex)) != nullptr )
{
- page->DoGetRoot()->SetFlagRecursively(wxPG_PROP_MODIFIED, false);
+ page->DoGetRoot()->SetFlagRecursively(wxPGPropertyFlags::Modified, false);
page->m_anyModified = false;
pageIndex++;
@@ -424,16 +424,16 @@ wxPGProperty* wxPropertyGridInterface::GetPropertyByLabel( const wxString& label
// ----------------------------------------------------------------------------
void wxPropertyGridInterface::DoSetPropertyAttribute( wxPGPropArg id, const wxString& name,
- wxVariant& value, wxPGPropertyValuesFlags argFlags )
+ wxVariant& value, wxPGPropertyValuesFlags flags )
{
wxPG_PROP_ARG_CALL_PROLOG()
p->SetAttribute( name, value ); // property is also refreshed here
- if ( !!(argFlags & wxPGPropertyValuesFlags::Recurse) )
+ if ( !!(flags & wxPGPropertyValuesFlags::Recurse) )
{
for ( unsigned int i = 0; i < p->GetChildCount(); i++ )
- DoSetPropertyAttribute(p->Item(i), name, value, argFlags);
+ DoSetPropertyAttribute(p->Item(i), name, value, flags);
}
}
@@ -456,7 +456,7 @@ void wxPropertyGridInterface::SetPropertyAttributeAll( const wxString& attrName,
// -----------------------------------------------------------------------
void wxPropertyGridInterface::GetPropertiesWithFlag( wxArrayPGProperty* targetArr,
- wxPGProperty::FlagType flags,
+ wxPGPropertyFlags flags,
bool inverse,
int iterFlags ) const
{
@@ -538,9 +538,9 @@ bool wxPropertyGridInterface::HideProperty(wxPGPropArg id, bool hide, wxPGProper
// Do nothing if single property is already hidden/visible as requested.
if ( !(flags & wxPGPropertyValuesFlags::Recurse) )
{
- if ( hide && p->HasFlag(wxPG_PROP_HIDDEN) )
+ if ( hide && p->HasFlag(wxPGPropertyFlags::Hidden) )
return false;
- if ( !hide && !p->HasFlag(wxPG_PROP_HIDDEN) )
+ if ( !hide && !p->HasFlag(wxPGPropertyFlags::Hidden) )
return false;
}
@@ -748,7 +748,12 @@ wxVariant wxPropertyGridInterface::GetPropertyValue(wxPGPropArg id)
wxString wxPropertyGridInterface::GetPropertyValueAsString( wxPGPropArg id ) const
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxString())
- return p->GetValueAsString(wxPG_FULL_VALUE);
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ return p->GetValueAsStringWithCheck(wxPGPropValFormatFlags::FullValue);
+#else
+ return p->GetValueAsString(wxPGPropValFormatFlags::FullValue);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
}
bool wxPropertyGridInterface::GetPropertyValueAsBool( wxPGPropArg id ) const
@@ -844,9 +849,9 @@ bool wxPropertyGridInterface::ChangePropertyValue( wxPGPropArg id, wxVariant new
void wxPropertyGridInterface::BeginAddChildren( wxPGPropArg id )
{
wxPG_PROP_ARG_CALL_PROLOG()
- wxCHECK_RET( p->HasFlag(wxPG_PROP_AGGREGATE), wxS("only call on properties with fixed children") );
- p->ClearFlag(wxPG_PROP_AGGREGATE);
- p->SetFlag(wxPG_PROP_MISC_PARENT);
+ wxCHECK_RET( p->HasFlag(wxPGPropertyFlags::Aggregate), wxS("only call on properties with fixed children") );
+ p->ClearFlag(wxPGPropertyFlags::Aggregate);
+ p->SetFlag(wxPGPropertyFlags::MiscParent);
}
// -----------------------------------------------------------------------
@@ -861,9 +866,9 @@ bool wxPropertyGridInterface::EditorValidate()
void wxPropertyGridInterface::EndAddChildren( wxPGPropArg id )
{
wxPG_PROP_ARG_CALL_PROLOG()
- wxCHECK_RET( p->HasFlag(wxPG_PROP_MISC_PARENT), wxS("only call on properties for which BeginAddChildren was called prior") );
- p->ClearFlag(wxPG_PROP_MISC_PARENT);
- p->SetFlag(wxPG_PROP_AGGREGATE);
+ wxCHECK_RET( p->HasFlag(wxPGPropertyFlags::MiscParent), wxS("only call on properties for which BeginAddChildren was called prior") );
+ p->ClearFlag(wxPGPropertyFlags::MiscParent);
+ p->SetFlag(wxPGPropertyFlags::Aggregate);
}
// -----------------------------------------------------------------------
@@ -952,7 +957,7 @@ wxString wxPropertyGridInterface::SaveEditableState( int includedStates ) const
{
const wxPGProperty* p = it.GetProperty();
- if ( !p->HasFlag(wxPG_PROP_COLLAPSED) )
+ if ( !p->HasFlag(wxPGPropertyFlags::Collapsed) )
result += EscapeDelimiters(p->GetName());
result += wxS(",");
diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp
index e5e29f793f..dfb5543371 100644
--- a/src/propgrid/propgridpagestate.cpp
+++ b/src/propgrid/propgridpagestate.cpp
@@ -47,7 +47,7 @@ void wxPropertyGridIteratorBase::Init( wxPropertyGridPageState* state, int flags
m_property = property;
- wxPG_ITERATOR_CREATE_MASKS(flags, m_itemExMask, m_parentExMask)
+ wxPGCreateIteratorMasks(flags, m_itemExMask, m_parentExMask);
// Need to skip first?
if ( property && property->HasFlag(m_itemExMask) )
@@ -108,9 +108,8 @@ void wxPropertyGridIteratorBase::Prev()
property = parent->Item(index);
- // Go to last children?
- if ( property->HasAnyChild() &&
- wxPG_ITERATOR_PARENTEXMASK_TEST(property, m_parentExMask) )
+ // Go to last child if children of property should be iterated through)
+ if ( property->HasAnyChild() && !property->HasFlag(m_parentExMask) )
{
// First child
property = property->Last();
@@ -143,8 +142,8 @@ void wxPropertyGridIteratorBase::Next( bool iterateChildren )
if ( !property )
return;
- if ( property->HasAnyChild() &&
- wxPG_ITERATOR_PARENTEXMASK_TEST(property, m_parentExMask) &&
+ // Go to first child if children of property should be iterated through
+ if ( property->HasAnyChild() && !property->HasFlag(m_parentExMask) &&
iterateChildren )
{
// First child
@@ -219,12 +218,14 @@ wxPropertyGridPageState::~wxPropertyGridPageState()
void wxPropertyGridPageState::InitNonCatMode()
{
- if ( !m_abcArray )
- {
- m_abcArray = new wxPGRootProperty(wxS(""));
- m_abcArray->SetParentState(this);
- m_abcArray->SetFlag(wxPG_PROP_CHILDREN_ARE_COPIES);
- }
+ // Initialize and populate array holding properties in alphabetic (non-categoric)
+ // mode only once.
+ if (m_abcArray)
+ return;
+
+ m_abcArray = new wxPGRootProperty(wxS(""));
+ m_abcArray->SetParentState(this);
+ m_abcArray->SetFlag(wxPGPropertyFlags::ChildrenAreCopies);
// Must be called when state::m_properties still points to regularArray.
wxPGProperty* oldProperties = m_properties;
@@ -246,7 +247,8 @@ void wxPropertyGridPageState::InitNonCatMode()
if ( parent->IsCategory() || parent->IsRoot() )
{
m_abcArray->DoAddChild(p);
- p->m_parent = &m_regularArray;
+ // Restore parent modified in AddChild()
+ p->m_parent = parent;
}
}
}
@@ -399,12 +401,13 @@ wxPGProperty* wxPropertyGridPageState::GetLastItem( int flags )
if ( !m_properties->HasAnyChild() )
return nullptr;
- wxPG_ITERATOR_CREATE_MASKS(flags, wxPGProperty::FlagType itemExMask, wxPGProperty::FlagType parentExMask)
+ wxPGPropertyFlags itemExMask;
+ wxPGPropertyFlags parentExMask;
+ wxPGCreateIteratorMasks(flags, itemExMask, parentExMask);
- // First, get last child of last parent
+ // First, get last child of last parent if children of 'pwc' should be iterated through
wxPGProperty* pwc = m_properties->Last();
- while ( pwc->HasAnyChild() &&
- wxPG_ITERATOR_PARENTEXMASK_TEST(pwc, parentExMask) )
+ while ( pwc->HasAnyChild() && !pwc->HasFlag(parentExMask) )
pwc = pwc->Last();
// Then, if it doesn't fit our criteria, back up until we find something that does
@@ -606,7 +609,7 @@ void wxPropertyGridPageState::DoSortChildren(wxPGProperty* p, wxPGPropertyValues
return;
// Never sort children of aggregate properties
- if ( p->HasFlag(wxPG_PROP_AGGREGATE) )
+ if ( p->HasFlag(wxPGPropertyFlags::Aggregate) )
return;
if ( !!(flags & wxPGPropertyValuesFlags::SortTopLevelOnly)
@@ -1217,11 +1220,16 @@ bool wxPropertyGridPageState::DoSetPropertyValueString( wxPGProperty* p, const w
{
if ( p )
{
- int flags = wxPG_REPORT_ERROR|wxPG_FULL_VALUE|wxPG_PROGRAMMATIC_VALUE;
+ constexpr wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::ReportError|wxPGPropValFormatFlags::FullValue|wxPGPropValFormatFlags::ProgrammaticValue;
wxVariant variant = p->GetValueRef();
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ if ( p->StringToValueWithCheck(variant, value, flags) )
+#else
if ( p->StringToValue(variant, value, flags) )
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
{
p->SetValue(variant);
if ( p == m_pPropGrid->GetSelection() && IsDisplayed() )
@@ -1382,12 +1390,12 @@ wxVariant wxPropertyGridPageState::DoGetPropertyValues(const wxString& listname,
{
if ( !!(flags & wxPGPropertyValuesFlags::KeepStructure) )
{
- wxASSERT( !pwc->HasFlag(wxPG_PROP_AGGREGATE) );
+ wxASSERT( !pwc->HasFlag(wxPGPropertyFlags::Aggregate) );
for ( unsigned int i = 0; i < pwc->GetChildCount(); i++ )
{
wxPGProperty* p = pwc->Item(i);
- if ( !p->HasAnyChild() || p->HasFlag(wxPG_PROP_AGGREGATE) )
+ if ( !p->HasAnyChild() || p->HasFlag(wxPGPropertyFlags::Aggregate) )
{
wxVariant variant = p->GetValue();
variant.SetName( p->GetBaseName() );
@@ -1411,7 +1419,7 @@ wxVariant wxPropertyGridPageState::DoGetPropertyValues(const wxString& listname,
const wxPGProperty* p = it.GetProperty();
// Use a trick to ignore wxParentProperty itself, but not its sub-properties.
- if ( !p->HasAnyChild() || p->HasFlag(wxPG_PROP_AGGREGATE) )
+ if ( !p->HasAnyChild() || p->HasFlag(wxPGPropertyFlags::Aggregate) )
{
wxVariant variant = p->GetValue();
variant.SetName( p->GetName() );
@@ -1666,7 +1674,7 @@ wxPGProperty* wxPropertyGridPageState::DoInsert( wxPGProperty* parent, int index
if ( !parent )
parent = m_properties;
- wxCHECK_MSG( !parent->HasFlag(wxPG_PROP_AGGREGATE),
+ wxCHECK_MSG( !parent->HasFlag(wxPGPropertyFlags::Aggregate),
wxNullProperty,
wxS("when adding properties to fixed parents, use BeginAddChildren and EndAddChildren.") );
@@ -1736,7 +1744,7 @@ wxPGProperty* wxPropertyGridPageState::DoInsert( wxPGProperty* parent, int index
// Update editor controls of all parents if they are containers of composed values.
for( wxPGProperty *p = property->GetParent();
- p && !p->IsRoot() && !p->IsCategory() && p->HasFlag(wxPG_PROP_COMPOSED_VALUE);
+ p && !p->IsRoot() && !p->IsCategory() && p->HasFlag(wxPGPropertyFlags::ComposedValue);
p = p->GetParent() )
{
p->RefreshEditor();
@@ -1784,7 +1792,7 @@ void wxPropertyGridPageState::DoMarkChildrenAsDeleted(wxPGProperty* p,
{
wxPGProperty* child = p->Item(i);
- child->SetFlag(wxPG_PROP_BEING_DELETED);
+ child->SetFlag(wxPGPropertyFlags::BeingDeleted);
if ( recursive )
{
@@ -1887,7 +1895,7 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
wxPGProperty* parent = item->GetParent();
- wxCHECK_RET( !parent->HasFlag(wxPG_PROP_AGGREGATE),
+ wxCHECK_RET( !parent->HasFlag(wxPGPropertyFlags::Aggregate),
wxS("wxPropertyGrid: Do not attempt to remove sub-properties.") );
wxASSERT( item->GetParentState() == this );
@@ -1954,13 +1962,13 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
wxS("Current category cannot be deleted") );
// Prevent property and its children from being re-selected
- item->SetFlag(wxPG_PROP_BEING_DELETED);
+ item->SetFlag(wxPGPropertyFlags::BeingDeleted);
DoMarkChildrenAsDeleted(item, true);
unsigned int indinparent = item->GetIndexInParent();
// Delete children
- if ( item->HasAnyChild() && !item->HasFlag(wxPG_PROP_AGGREGATE) )
+ if ( item->HasAnyChild() && !item->HasFlag(wxPGPropertyFlags::Aggregate) )
{
// deleting a category
item->DeleteChildren();
diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp
index 3370a1ac61..6d8a90bfed 100644
--- a/src/propgrid/props.cpp
+++ b/src/propgrid/props.cpp
@@ -29,6 +29,8 @@
#include "wx/propgrid/private.h"
#include
+#include
+#include
constexpr double wxPG_DBL_MIN = std::numeric_limits::min();
constexpr double wxPG_DBL_MAX = std::numeric_limits::max();
@@ -58,9 +60,9 @@ wxStringProperty::wxStringProperty( const wxString& label,
void wxStringProperty::OnSetValue()
{
if ( !m_value.IsNull() && m_value.GetString() == wxS("") )
- SetFlag(wxPG_PROP_COMPOSED_VALUE);
+ SetFlag(wxPGPropertyFlags::ComposedValue);
- if ( HasFlag(wxPG_PROP_COMPOSED_VALUE) )
+ if ( HasFlag(wxPGPropertyFlags::ComposedValue) )
{
wxString s;
DoGenerateComposedValue(s);
@@ -69,23 +71,23 @@ void wxStringProperty::OnSetValue()
}
wxString wxStringProperty::ValueToString( wxVariant& value,
- int argFlags ) const
+ wxPGPropValFormatFlags flags ) const
{
wxString s = value.GetString();
- if ( HasAnyChild() && HasFlag(wxPG_PROP_COMPOSED_VALUE) )
+ if ( HasAnyChild() && HasFlag(wxPGPropertyFlags::ComposedValue) )
{
// Value stored in m_value is non-editable, non-full value
- if ( (argFlags & wxPG_FULL_VALUE) ||
- (argFlags & wxPG_EDITABLE_VALUE) ||
+ if ( !!(flags & wxPGPropValFormatFlags::FullValue) ||
+ !!(flags & wxPGPropValFormatFlags::EditableValue) ||
s.empty() )
{
// Calling this under incorrect conditions will fail
- wxASSERT_MSG( argFlags & wxPG_VALUE_IS_CURRENT,
+ wxASSERT_MSG( !!(flags & wxPGPropValFormatFlags::ValueIsCurrent),
wxS("Sorry, currently default wxPGProperty::ValueToString() ")
wxS("implementation only works if value is m_value.") );
- DoGenerateComposedValue(s, argFlags);
+ DoGenerateComposedValue(s, flags);
}
return s;
@@ -93,16 +95,16 @@ wxString wxStringProperty::ValueToString( wxVariant& value,
// If string is password and value is for visual purposes,
// then return asterisks instead the actual string.
- if ( (m_flags & wxPG_PROP_PASSWORD) && !(argFlags & (wxPG_FULL_VALUE|wxPG_EDITABLE_VALUE)) )
+ if ( !!(m_flags & wxPGPropertyFlags_Password) && !(flags & (wxPGPropValFormatFlags::FullValue|wxPGPropValFormatFlags::EditableValue)) )
return wxString(wxS('*'), s.length());
return s;
}
-bool wxStringProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const
+bool wxStringProperty::StringToValue( wxVariant& variant, const wxString& text, wxPGPropValFormatFlags flags ) const
{
- if ( HasAnyChild() && HasFlag(wxPG_PROP_COMPOSED_VALUE) )
- return wxPGProperty::StringToValue(variant, text, argFlags);
+ if ( HasAnyChild() && HasFlag(wxPGPropertyFlags::ComposedValue) )
+ return wxPGProperty::StringToValue(variant, text, flags);
if ( variant != text )
{
@@ -117,7 +119,7 @@ bool wxStringProperty::DoSetAttribute( const wxString& name, wxVariant& value )
{
if ( name == wxPG_STRING_PASSWORD )
{
- ChangeFlag(wxPG_PROP_PASSWORD, value.GetBool());
+ ChangeFlag(wxPGPropertyFlags_Password, value.GetBool());
RecreateEditor();
return true;
}
@@ -158,16 +160,16 @@ wxNumericPropertyValidator::
style |= wxFILTER_DIGITS;
}
- if ( numericType == Signed )
+ if ( numericType == NumericType::Signed )
{
allowedChars += wxS("-+");
}
- else if ( numericType == Float )
+ else if ( numericType == NumericType::Float )
{
allowedChars += wxS("-+eE");
// Use locale-specific decimal point
- allowedChars += wxString::Format(wxS("%g"), 1.1)[1];
+ allowedChars.append(wxNumberFormatter::GetDecimalSeparator());
}
SetStyle(style);
@@ -250,8 +252,13 @@ namespace {
{
// Round value to the required precision.
wxVariant variant = value;
- wxString strVal = prop->ValueToString(variant, wxPG_FULL_VALUE);
- strVal.ToDouble(&value);
+#if WXWIN_COMPATIBILITY_3_2
+ // Special implementation with check if user-overriden obsolete function is still in use
+ wxString strVal = prop->ValueToStringWithCheck(variant, wxPGPropValFormatFlags::FullValue);
+#else
+ wxString strVal = prop->ValueToString(variant, wxPGPropValFormatFlags::FullValue);
+#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
+ wxNumberFormatter::FromString(strVal, &value);
return value;
}
} // namespace
@@ -259,9 +266,19 @@ namespace {
// Common validation code to be called in ValidateValue() implementations.
// Note that 'value' is reference on purpose, so we can write
// back to it when mode is wxPG_PROPERTY_VALIDATION_SATURATE or wxPG_PROPERTY_VALIDATION_WRAP.
+#if WXWIN_COMPATIBILITY_3_2
template
bool wxNumericProperty::DoNumericValidation(T& value, wxPGValidationInfo* pValidationInfo,
int mode, T defMin, T defMax) const
+{
+ return DoNumericValidation(value, pValidationInfo,
+ static_cast(mode), defMin, defMax);
+}
+#endif // WXWIN_COMPATIBILITY_3_2
+
+template
+bool wxNumericProperty::DoNumericValidation(T& value, wxPGValidationInfo* pValidationInfo,
+ wxPGNumericValidationMode mode, T defMin, T defMax) const
{
T min = defMin;
T max = defMax;
@@ -298,7 +315,7 @@ bool wxNumericProperty::DoNumericValidation(T& value, wxPGValidationInfo* pValid
{
if ( value < min )
{
- if ( mode == wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE )
+ if ( mode == wxPGNumericValidationMode::ErrorMessage )
{
wxString msg;
wxVariant vmin = WXVARIANT(min);
@@ -313,7 +330,7 @@ bool wxNumericProperty::DoNumericValidation(T& value, wxPGValidationInfo* pValid
}
pValidationInfo->SetFailureMessage(msg);
}
- else if ( mode == wxPG_PROPERTY_VALIDATION_SATURATE )
+ else if ( mode == wxPGNumericValidationMode::Saturate )
value = min;
else
value = max - (min - value);
@@ -325,7 +342,7 @@ bool wxNumericProperty::DoNumericValidation(T& value, wxPGValidationInfo* pValid
{
if ( value > max )
{
- if ( mode == wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE )
+ if ( mode == wxPGNumericValidationMode::ErrorMessage )
{
wxString msg;
wxVariant vmax = WXVARIANT(max);
@@ -340,7 +357,7 @@ bool wxNumericProperty::DoNumericValidation(T& value, wxPGValidationInfo* pValid
}
pValidationInfo->SetFailureMessage(msg);
}
- else if ( mode == wxPG_PROPERTY_VALIDATION_SATURATE )
+ else if ( mode == wxPGNumericValidationMode::Saturate )
value = max;
else
value = min + (value - max);
@@ -371,7 +388,7 @@ wxIntProperty::wxIntProperty( const wxString& label, const wxString& name,
#endif
wxString wxIntProperty::ValueToString( wxVariant& value,
- int WXUNUSED(argFlags) ) const
+ wxPGPropValFormatFlags WXUNUSED(flags) ) const
{
const wxString valType(value.GetType());
if ( valType == wxPG_VARIANT_TYPE_LONG )
@@ -389,7 +406,7 @@ wxString wxIntProperty::ValueToString( wxVariant& value,
return wxString();
}
-bool wxIntProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const
+bool wxIntProperty::StringToValue( wxVariant& variant, const wxString& text, wxPGPropValFormatFlags flags ) const
{
if ( text.empty() )
{
@@ -444,13 +461,13 @@ bool wxIntProperty::StringToValue( wxVariant& variant, const wxString& text, int
}
}
}
- else if ( argFlags & wxPG_REPORT_ERROR )
+ else if ( !!(flags & wxPGPropValFormatFlags::ReportError) )
{
}
return false;
}
-bool wxIntProperty::IntToValue( wxVariant& variant, int value, int WXUNUSED(argFlags) ) const
+bool wxIntProperty::IntToValue( wxVariant& variant, int value, wxPGPropValFormatFlags WXUNUSED(flags) ) const
{
if ( !variant.IsType(wxPG_VARIANT_TYPE_LONG) || variant != (long)value )
{
@@ -464,29 +481,18 @@ bool wxIntProperty::IntToValue( wxVariant& variant, int value, int WXUNUSED(argF
bool wxIntProperty::DoValidation( const wxNumericProperty* property,
wxLongLong& value,
wxPGValidationInfo* pValidationInfo,
- int mode )
+ wxPGNumericValidationMode mode )
{
return property->DoNumericValidation(value,
pValidationInfo,
mode, wxLongLong(wxPG_LLONG_MIN), wxLongLong(wxPG_LLONG_MAX));
}
-
-#if defined(wxLongLong_t)
-bool wxIntProperty::DoValidation( const wxNumericProperty* property,
- wxLongLong_t& value,
- wxPGValidationInfo* pValidationInfo,
- int mode )
-{
- return property->DoNumericValidation(value, pValidationInfo,
- mode, wxPG_LLONG_MIN, wxPG_LLONG_MAX);
-}
-#endif // wxLongLong_t
#endif // wxUSE_LONGLONG
bool wxIntProperty::DoValidation(const wxNumericProperty* property,
long& value,
wxPGValidationInfo* pValidationInfo,
- int mode)
+ wxPGNumericValidationMode mode)
{
return property->DoNumericValidation(value, pValidationInfo,
mode, wxPG_LONG_MIN, wxPG_LONG_MAX);
@@ -501,7 +507,7 @@ bool wxIntProperty::ValidateValue( wxVariant& value,
long ll = value.GetLong();
#endif
return DoValidation(this, ll, &validationInfo,
- wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
+ wxPGNumericValidationMode::ErrorMessage);
}
wxValidator* wxIntProperty::GetClassValidator()
@@ -510,7 +516,7 @@ wxValidator* wxIntProperty::GetClassValidator()
WX_PG_DOGETVALIDATOR_ENTRY()
wxValidator* validator = new wxNumericPropertyValidator(
- wxNumericPropertyValidator::Signed);
+ wxNumericPropertyValidator::NumericType::Signed);
WX_PG_DOGETVALIDATOR_EXIT(validator)
#else
@@ -525,8 +531,8 @@ wxValidator* wxIntProperty::DoGetValidator() const
wxVariant wxIntProperty::AddSpinStepValue(long stepScale) const
{
- int mode = m_spinWrap ? wxPG_PROPERTY_VALIDATION_WRAP
- : wxPG_PROPERTY_VALIDATION_SATURATE;
+ wxPGNumericValidationMode mode = m_spinWrap ? wxPGNumericValidationMode::Wrap
+ : wxPGNumericValidationMode::Saturate;
wxVariant value = GetValue();
if ( value.GetType() == wxPG_VARIANT_TYPE_LONG )
{
@@ -596,9 +602,9 @@ wxUIntProperty::wxUIntProperty( const wxString& label, const wxString& name,
}
#endif
-wxString wxUIntProperty::ValueToString(wxVariant& value, int argFlags) const
+wxString wxUIntProperty::ValueToString(wxVariant& value, wxPGPropValFormatFlags flags) const
{
- static const wxStringCharType* const gs_uintTemplates32[wxPG_UINT_TEMPLATE_MAX] =
+ static constexpr std::array gs_uintTemplates32
{
wxS("%lx"), wxS("0x%lx"), wxS("$%lx"),
wxS("%lX"), wxS("0x%lX"), wxS("$%lX"),
@@ -607,7 +613,7 @@ wxString wxUIntProperty::ValueToString(wxVariant& value, int argFlags) const
// In the edit mode we want to display just the numeric value,
// without prefixes.
- static const wxStringCharType* const gs_uintEditTemplates32[wxPG_UINT_TEMPLATE_MAX] =
+ static constexpr std::array gs_uintEditTemplates32
{
wxS("%lx"), wxS("%lx"), wxS("%lx"),
wxS("%lX"), wxS("%lX"), wxS("%lX"),
@@ -615,7 +621,7 @@ wxString wxUIntProperty::ValueToString(wxVariant& value, int argFlags) const
};
#if wxUSE_LONGLONG
- static const wxStringCharType* const gs_uintTemplates64[wxPG_UINT_TEMPLATE_MAX] =
+ static constexpr std::array gs_uintTemplates64
{
wxS("%") wxS(wxLongLongFmtSpec) wxS("x"),
wxS("0x%") wxS(wxLongLongFmtSpec) wxS("x"),
@@ -629,7 +635,7 @@ wxString wxUIntProperty::ValueToString(wxVariant& value, int argFlags) const
// In the edit mode we want to display just the numeric value,
// without prefixes.
- static const wxStringCharType* const gs_uintEditTemplates64[wxPG_UINT_TEMPLATE_MAX] =
+ static constexpr std::array gs_uintEditTemplates64
{
wxS("%") wxS(wxLongLongFmtSpec) wxS("x"),
wxS("%") wxS(wxLongLongFmtSpec) wxS("x"),
@@ -649,7 +655,7 @@ wxString wxUIntProperty::ValueToString(wxVariant& value, int argFlags) const
const wxString valType(value.GetType());
if ( valType == wxPG_VARIANT_TYPE_LONG )
{
- const wxStringCharType* fmt = argFlags & wxPG_EDITABLE_VALUE ?
+ const wxStringCharType* fmt = !!(flags & wxPGPropValFormatFlags::EditableValue) ?
gs_uintEditTemplates32[index] :
gs_uintTemplates32[index];
return wxString::Format(fmt, (unsigned long)value.GetLong());
@@ -657,7 +663,7 @@ wxString wxUIntProperty::ValueToString(wxVariant& value, int argFlags) const
#if wxUSE_LONGLONG
else if ( valType == wxPG_VARIANT_TYPE_ULONGLONG )
{
- const wxStringCharType* fmt = argFlags & wxPG_EDITABLE_VALUE ?
+ const wxStringCharType* fmt = !!(flags & wxPGPropValFormatFlags::EditableValue) ?
gs_uintEditTemplates64[index] :
gs_uintTemplates64[index];
wxULongLong ull = value.GetULongLong();
@@ -667,7 +673,7 @@ wxString wxUIntProperty::ValueToString(wxVariant& value, int argFlags) const
return wxString();
}
-bool wxUIntProperty::StringToValue(wxVariant& variant, const wxString& text, int argFlags) const
+bool wxUIntProperty::StringToValue(wxVariant& variant, const wxString& text, wxPGPropValFormatFlags flags) const
{
if ( text.empty() )
{
@@ -717,14 +723,14 @@ bool wxUIntProperty::StringToValue(wxVariant& variant, const wxString& text, int
return true;
}
}
- else if ( argFlags & wxPG_REPORT_ERROR )
+ else if ( !!(flags & wxPGPropValFormatFlags::ReportError) )
{
}
return false;
}
-bool wxUIntProperty::IntToValue( wxVariant& variant, int number, int WXUNUSED(argFlags) ) const
+bool wxUIntProperty::IntToValue( wxVariant& variant, int number, wxPGPropValFormatFlags WXUNUSED(flags) ) const
{
if ( variant != (long)number )
{
@@ -738,28 +744,17 @@ bool wxUIntProperty::IntToValue( wxVariant& variant, int number, int WXUNUSED(ar
bool wxUIntProperty::DoValidation(const wxNumericProperty* property,
wxULongLong& value,
wxPGValidationInfo* pValidationInfo,
- int mode )
+ wxPGNumericValidationMode mode )
{
return property->DoNumericValidation