Commit graph

75636 commits

Author SHA1 Message Date
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
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
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
e97d27165a Merge branch 'point-cleanup-and-new-operators'
Clean up wxPoint and wxRealPoint arithmetic operators: add missing ones,
fix parameter names,

See #24191.
2024-01-05 19:35:48 +01:00
David Miguel Susano Pinto
68bef2fbf3 Add compound operators * and / to wxPoint and wxRealPoint
Also add unit tests for them as well as for the existing additive
compound operators.
2024-01-05 19:34:43 +01:00
David Miguel Susano Pinto
1300c56f0d Put wxRealPoint operators in the same order as wxPoint ones 2024-01-05 19:31:14 +01:00
David Miguel Susano Pinto
11c3034177 Implement unary minus for wxRealPoint, same as wxPoint. 2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
b9b0cce41b include/wx/gdicmn.h: reorder to match the order in interface/wx/gdicmn.h. 2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
8638db50da Document a series of undocumented wxPoint and wxRealPoint operators.
Unary minus of wxPoint and multiplication with double are implemented
but undocumented.  Many of operators that use integers types other
than int remain undocumented though.
2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
66e7d0bce8 Implement + and - between wxRealPoint and wxSize.
These operators are part of the documented interface for wxRealPoint
but were never implemented.  This commit implements them.
2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
8ccbd7e95d Implement operator/=(int) and operator*=(int) for wxPoint and wxRealPoint.
These operators are part of the documented interface but were never
implemented.  This commit implements them.
2024-01-05 12:43:57 +00:00
David Miguel Susano Pinto
9a5d2ffade Correct names of variables in wxPoint and wxRealPoint arithmetic operators.
The arithmetic operators for wxPoint and wxRealPoint are quite
repetitive and were made by copy-paste from the wxSize operators.
Because of that, some of the names are a bit misleading which this
commit changes.  The changes are:

1. replace s/sz with p/pt for point variables (likely 's' comes from
   copied code used for wxSize variables)

2. replace 'i' with 'f' for floating point types (likely 'i' comes
   from copied code used for integer types)

3. replace 'factor' with 'divisor' for division operations (factors
   are the multiplication operands, not division)
2024-01-05 11:28:11 +00:00
Vadim Zeitlin
3dde6bdeb0 Disable swap interval in GLX wxGLCanvas implementation too
We need to do it when using XWayland for the same reasons as we had to
do it in the EGL version when using either XWayland or Wayland directly:
without this, we can block for up to 1 second in glXSwapBuffers() if the
window is hidden, see #23512.

Closes #24163.

Closes #24165.
2024-01-05 01:05:30 +01:00
David Miguel Susano Pinto
11ebffe7b0 Add operator/(wxPoint, double) and operator/(wxRealPoint, double)
Do this for consistency with wxSize which already had this operator/()
overload and operator*() in these classes which was already overloaded
for double.

Closes #24185.

Closes #24187.
2024-01-05 00:45:57 +01:00
Paul Cornett
a5e9befd4d Remove unused class
Unused since 025f5d1450 (Don't cache HDC used by wxPaintDCEx in wxMSW., 2013-03-09)
2024-01-04 12:49:37 -08:00
Paul Cornett
071e3187f5 Remove unused variables
These have been unused since e95354ec54 (added UTF-16/32-[LB]E conversions; got
rid of wxCharacterSet and simplified and fixed some bugs in remaining code, 2003-09-22)
2024-01-04 12:34:56 -08:00
Paul Cornett
cd93c73900 Remove another reference to GLU
Should have been part of ce1d317768 (Remove GLU dependency, 2023-12-28)
2024-01-04 12:22:39 -08:00
Paul Cornett
31a672b858 Improve our best size calculation for multi-line wxTextCtrl with GTK
Instead of trying to figure it out ourselves, just ask the control
what its minimum size is.
2024-01-04 12:11:50 -08:00
Vadim Zeitlin
e21b27019f Merge branch 'mac-build'
Improve Mac build documentation and build itself.

See #24128.
2024-01-03 20:27:00 +01:00
David Miguel Susano Pinto
a8b14edc40 Correct wxRealPoint and wxPoint operator return types in the docs
Use the correct types instead of wxSize which was erroneously used
there ever since a5664fd6ef (Increase interoperability between wxPoint
and wxRealPoint introducing constructors which convert between the two
classes., 2010-06-09).

Closes #23804.
2024-01-03 20:24:17 +01:00
Vadim Zeitlin
261490d5e2 Ignore failures in tests handling mouse clicks under AppVeyor
For some completely mysterious reason we don't get the expected mouse
click events when running under AppVeyor, something might be covering
the window and stealing the clicks for itself there.

As there doesn't seem to be anything to do about it, just skip the test
in this case.

Closes #24082.
2024-01-03 20:21:59 +01:00
Vadim Zeitlin
989829891a Fix memory leak when calling wxInitialize(void)
We still allocated argv arrays when argc was 0, but didn't free them in
this case.

Fix this by just not bothering to allocate them.
2024-01-03 18:36:25 +01:00
Paul Cornett
a65ada2a5e Simplify mm-to-pixel conversion
wxDisplay can already tell us the PPI, just convert it to mm.
2024-01-01 13:52:10 -08:00
Paul Cornett
64d1d27da9 Fix wxMM_METRIC scaling with wxGCDC for non-macOS platforms
Don't override the default mm-to-pixel calculation, it will get the right answer.
2024-01-01 13:46:18 -08:00
Vadim Zeitlin
8bb8eb5108 Increase buffer size in wxXmlDocument::Load()
The 1KB buffer used before was really too small and should have been
increased to at least 4KB, but increase it to 16KB as it should do no
harm neither.
2024-01-01 22:08:28 +01:00
Vadim Zeitlin
20845d85a5 Deprecate "encoding" parameter of wxXmlDocument ctor and Load()
This parameter wasn't used for anything as it specified the encoding of
the data contents in memory and not the encoding of the XML file as
might be believed, so it only created unnecessary confusion.

See #24167.
2024-01-01 22:08:28 +01:00
Vadim Zeitlin
268b2b98e0 Use WaitForEventAt() in Grid::ReorderedColumnsCellClick test too
This test also sporadically fails on AppVeyor.
2024-01-01 22:04:41 +01:00
Vadim Zeitlin
9ee9f4e8dd Remove documentation of wxXmlDocument::GetEncoding()
This function was removed in 4519d8e08a (Remove wxUSE_UNICODE checks as
they're always true now, 2022-10-27).
2024-01-01 21:00:08 +01:00
Vadim Zeitlin
0b049be4b7 Use unique_ptr<> in wxXmlDocument
Replace manual use of raw pointer with std::unique_ptr<>.

No real changes.
2024-01-01 20:54:08 +01:00
Vadim Zeitlin
2a5eac26f4 Remove unnecessary calls to wxDELETE()
Replace them with just calls to delete as it doesn't matter if the
pointer is null or not in all these cases and using just "delete" is
more clear.
2024-01-01 20:54:08 +01:00
Vadim Zeitlin
326876eb60 Initialize wxXmlDocument::m_docNode in its declaration too
Similar to the previous commit.
2024-01-01 20:54:08 +01:00