Commit graph

76092 commits

Author SHA1 Message Date
mcorino
c1b7ce5932 Fix typing error in interface def.
missing whitespace between arg type and name
2024-01-10 17:56:08 +01:00
Vadim Zeitlin
6655f6e41c Fix wrong uses of wxBitmap::CreateWithDIPSize()
In portable code CreateWithLogicalSize() must be used when its arguments
are logical coordinates, e.g. window sizes, so using CreateWithDIPSize()
was wrong and resulted in missized bitmaps in high DPI under MSW.
2024-01-09 15:09:31 +01:00
Vadim Zeitlin
006a84db14 Use CreateWithLogicalSize() instead of ...DIPSize() in wxOSX
These functions behave in exactly the same way in this port, but using
CreateWithLogicalSize() seems to be more clear, as we're passing it the
coordinates in logical pixels (e.g. window sizes etc) and not DIPs.

No real changes.
2024-01-09 15:09:31 +01:00
Vadim Zeitlin
d254a7d752 Use wxBitmap::CreateWithLogicalSize() in wxSTC code
This is simpler than using ToPhys() to explicitly compute the needed
bitmap size and more clear.

No real changes.
2024-01-09 15:09:31 +01:00
Vadim Zeitlin
2cef35b321 Use wxBitmap::CreateWithLogicalSize() in wxMSW wxStaticBox code
This is slightly simpler and hopefully more clear than creating bitmap
using the physical size and then setting the scale factor.

No real changes.
2024-01-09 03:15:56 +01:00
Vadim Zeitlin
9cc5e5d276 Add wxBitmap::CreateWithLogicalSize()
This function should be used instead of CreateWithDIPSize() in portable
code, the latter is currently often used to do what this function is
doing, but this only works correctly in wxOSX and wxGTK3 but not wxMSW.
2024-01-09 03:15:56 +01:00
Vadim Zeitlin
8967bed190 Merge branch 'log-collect'
Add wxLogCollector helper and use it to improve error reporting in
wxFileConfig::MigrateLocalFile().

See #24194.
2024-01-09 02:42:20 +01:00
Vadim Zeitlin
e2cc16ef9c Fix test suite on Linux/s390x and maybe other architectures
We can't rely on file /sys/power/state always existing, so just skip the
test (with a warning) instead of failing it if it does not exist, as is
the case at least under s390x and seemingly other non-desktop platforms.

Closes #24197.

Co-authored-by: Cliff Zhao <qzhao@suse.com>
2024-01-09 02:38:43 +01:00
Vadim Zeitlin
d7b9548c19 Create output directory in wxFileConfig if it doesn't exist
This seems like the most sensible thing to do. Alternative would be to
not use XDG directories if ~/.config doesn't exist yet, but this doesn't
seem right, especially if wxCONFIG_USE_XDG is explicitly specified.
2024-01-08 02:02:18 +01:00
Vadim Zeitlin
6586afb0a5 Use XDG-compliant location by default in wxFileConfig
Still use the traditional dot file if it already exists, but prefer
using the new location otherwise, i.e. for the new program installation.

Add wxCONFIG_USE_HOME to allow forcing the use of the old location if
really necessary.

Also use the new style as default "old style" of MigrateLocalFile() so
that calling it even when using XDG layout in wxStandardPaths still
works as expected.
2024-01-08 00:43:26 +01:00
Vadim Zeitlin
e717ac5a86 Return more detailed errors from wxFileConfig::MigrateLocalFile()
Add the errors logged by various file functions called from this
function to the returned error message instead of letting wxLog show
them as usual because it may be necessary to show an interactive message
box, asking the user about the action to take, if migrating the existing
file failed, and it is poor UI to show both the message box from wxLog
and this message box at the same time -- so avoid showing the former.
2024-01-07 22:44:09 +01:00
Vadim Zeitlin
4fc2281286 Add wxLogCollector
This class is more convenient than wxLogBuffer that it uses and can be
used to collect all the logged messages in a string during its lifetime.
2024-01-07 22:43:55 +01:00
Vadim Zeitlin
2566a1abf5 Add wxLogFormatterNone
This trivial class allows to easily disable all log formatting,
including time stamping and level-dependent prefixes.
2024-01-07 22:31:52 +01:00
Vadim Zeitlin
30dd7e9095 Add wxLogBuffer::Clear()
This can be used to prevent the log buffer contents from being flushed
when replacing it with another logger, which is typically undesirable.
2024-01-07 22:12:52 +01:00
Vadim Zeitlin
e38a61a09b Merge branch 'cmake-cxx-std'
Improve C++ standard handling in CMake.

See #24188.
2024-01-07 16:14:53 +01:00
Vadim Zeitlin
b294a6b2bc Merge branch 'config-xdg'
Make it easier to use wxFileConfig in XDG-compliant way.

See #24180.
2024-01-07 16:13:15 +01:00
Vadim Zeitlin
cc8fbeed56 Merge branch 'xml-conv-simplify'
Simplify and modernize wxXmlDocument code.

See #24179.
2024-01-07 16:12:31 +01:00
Vadim Zeitlin
d36fd5822d Add MSVS 2022 solutions files for building tests
They're almost identical to MSVS 2019 ones but still convenient to have.
2024-01-07 00:43:48 +01:00
Vadim Zeitlin
cfdfd14c59 Improve frame size in the listctrl sample
Make it bigger on high DPI displays and smaller on normal ones.
2024-01-07 00:35:39 +01:00
Vadim Zeitlin
2349586e28 Hide operator<<() overloads for wxString and related classes
As not defining operator<<() overload taking wxScopedCharBuffer in the
global scope prevents it from being considered as an overload resolution
candidate (which is, of course, the whole point), it also prevents it
from being used for the classes convertible to it, such as wxCharBuffer,
so we need to define operator<<() overloaded for the latter explicitly
too.

We also need a new wxScopedCharTypeBufferStreamSupport helper in order
to define different operators inside different specializations of
wxScopedCharTypeBuffer<>.
2024-01-07 00:28:16 +01:00
Vadim Zeitlin
3b62433a3f Hide overloaded wxTimeSpan and wxDateSpan operator*()
Define them in these classes scope instead of at the global scope.
2024-01-06 23:06:02 +01:00
Vadim Zeitlin
3c151ac815 Hide overloaded operators on wxPoint2DInt and wxPoint2DDouble
Define all the arithmetic operators working with these objects inside
the corresponding classes and not at the global scope.
2024-01-06 23:06:02 +01:00
Vadim Zeitlin
a763de6940 Hide operator+() overloads for wxString::iterator and related
Don't define these operators in the global scope.
2024-01-06 23:06:02 +01:00
Vadim Zeitlin
09eff033d9 Hide operator<<() overloads used for wxVariant support too
Add new wxDECLARE_VARIANT_OBJECT_EXPORTED() macro defining these
operators as friend functions inside the class declaration and replace
all uses of DECLARE_VARIANT_OBJECT_EXPORTED() inside the core library
with the new macro to avoid defining any operator<<() overloads in the
global scope.

Also add wxIMPLEMENT_VARIANT_OBJECT() for consistency, even though it is
not really needed.
2024-01-06 23:06:02 +01:00
Vadim Zeitlin
7f56c7c068 Hide operator<<() and operator>>() overlods for wxLongLong_t
And wxULongLong_t.
2024-01-06 23:06:02 +01:00
Vadim Zeitlin
0122ce20c4 Hide operator<<() overloaded for wxBitmapBundle
Define it inside this class and not in the global scope.
2024-01-06 23:06:02 +01:00
Artur Wieczorek
dc627da250 Use std::array instead of raw array in wxCursorProperty 2024-01-06 22:43:28 +01:00
Artur Wieczorek
084d70fbe2 Use std::array instead of raw array in wxFontProperty 2024-01-06 22:43:22 +01:00
Artur Wieczorek
8095672309 Use std::array instead of raw array in wxSystemColourProperty 2024-01-06 22:43:16 +01:00
Artur Wieczorek
080b778d17 Use std::array instead of raw array in wxColourProperty 2024-01-06 22:43:11 +01:00
Artur Wieczorek
72a909c971 Use std::array instead of raw array in wxUIntProperty 2024-01-06 22:43:06 +01:00
Artur Wieczorek
e2dcdb275b Use wxString() rather than wxEmptyString in propgrid sample 2024-01-06 22:43:01 +01:00
Artur Wieczorek
efa2870cb4 Rename wxPGKeyboardActions type to wxPGKeyboardAction
For regular enumeration singular name is more appropriate.
2024-01-06 22:42:55 +01:00
Artur Wieczorek
3cb3d62212 Use enum class to represent NumericType
This is for better type safety.
2024-01-06 22:42:49 +01:00
Artur Wieczorek
e7ab6a6d53 Use enum class to represent wxPGNumericValidationConstants
This is for better type safety.
2024-01-06 22:42:43 +01:00
Artur Wieczorek
ca3acd7a03 Use enum class to implement wxPGPropValFormatFlags as bitmask
This is for better type safety of the flags.
2024-01-06 22:42:38 +01:00
Artur Wieczorek
031435bd39 Use dedicated function to obtain decimal separator in propgrid sample 2024-01-06 22:42:30 +01:00
Artur Wieczorek
b681a80b96 Explicitly create all sub-controls in wxPropertyGridManager::Create()
Instead of deferring creation of wxPropertyGrid and other controls
to EVT_SIZE handler we can create them when wxPropertyGridManager
is created and its initial size is known.
This way we can avoid using a trick with magic number used as a flag
to determine when to create all controls in OnResize().

Closes #24171.
2024-01-06 22:42:23 +01:00
Vadim Zeitlin
4833c67f79 Document that wxBitmapBundle also provides wxVariant support
Don't use IMPLEMENT_VARIANT_OBJECT() in the documentation, this is
completely unnecessary.
2024-01-06 19:54:31 +01:00
Vadim Zeitlin
94252d84b1 Merge branch 'msw-fix-hdr-memleak'
Fix memory leak in wxMSWHeaderCtrl in dark mode and some cleanup.

See #24192.
2024-01-06 17:40:01 +01:00
Vadim Zeitlin
97468661c7 Fix drawing right and bottom wxMSW wxStaticBox edges in high DPI
Passing window size divided by "scale" to CreateWithDIPSize() was wrong
as the resulting bitmap could be too small to cover the entire window
due to rounding errors, e.g. at 200% DPI the right and bottom row/column
was never drawn on if the window size in the corresponding direction was
odd.

This notably fixes their (dis)appearance in dark mode, where we always
draw them ourselves (otherwise we mostly only do it when using
non-default colour).
2024-01-06 17:36:29 +01:00
Vadim Zeitlin
a3fc9283f7 Remove useless wxMSWHeaderCtrl::Init()
This was supposed to be "common part of all ctors" but there is just a
single ctor in this class and even this one doesn't really need to call
Bind(), which was the only thing done in Init() since the last commit,
as it can, and should be, called by Create() after successfully creating
the window instead.

No real changes, just a simplification.
2024-01-06 15:35:50 +01:00
Vadim Zeitlin
735fe67182 Initialize wxMSWHeaderCtrl members in their declarations
No real changes, just prefer initializing members directly when
declaring them instead of doing it in a separate Init() function.
2024-01-06 15:35:50 +01:00
Vadim Zeitlin
c1754d4033 Also use std::unique_ptr<wxImageList> instead of raw pointer
Similar to the previous commit and done for consistency and safety.
2024-01-06 15:35:50 +01:00
Vadim Zeitlin
069ffbeaff Use std::unique_ptr<wxMSWHeaderCtrlCustomDraw> and not raw pointer
Make memory leaks, such as the one fixed by the previous commit,
impossible by making a smart pointer instead of a raw one for this
object.

No real changes.
2024-01-06 15:35:50 +01:00
Vadim Zeitlin
9d21630069 Don't leak wxMSWHeaderCtrlCustomDraw in dark mode
The pointer may have been already allocated when the code initializing
it in Create() when using dark mode is executed, so unconditionally
reassigning to it leaked memory.
2024-01-06 15:35:50 +01:00
Vadim Zeitlin
3b06ab65ff Don't set CMAKE_CXX_STANDARD to 11 by default
Use the compiler default C++ dialect if it is C++11 or higher and only
explicitly request C++11 if the compiler can't compile a small test
using C++11 features by default.

This prevents from unnecessarily adding -std=c++11 to the compiler flags
under Unix, even with compilers using e.g. C++17 by default.
2024-01-06 13:59:09 +01:00
Vadim Zeitlin
30c8c64e45 Allow changing wxWebViewBackendChromium data directory path
Use the value provided via wxWebViewConfiguration::SetDataPath() if any.
2024-01-06 03:20:50 +01:00
Vadim Zeitlin
416e241e6a Add wxWebViewConfigurationImplChromium scaffolding
It is perfectly useless for now, but provides place to add more things
in the upcoming commits.
2024-01-06 03:20:50 +01:00
Vadim Zeitlin
e800cb3119 Fix assert due to printing handle value using "%x"
The types of "handle" are completely different for different platforms,
so add a new "handleValue" variable just for the purpose of being able
to use it as wxLogTrace() argument.
2024-01-06 03:20:50 +01:00