Commit graph

74993 commits

Author SHA1 Message Date
Vadim Zeitlin
674592719f Allow customizing wxLog timestamp format via environment variable
Call wxLog::SetTimestamp() with WXLOG_TIME_FORMAT value if it's defined.
2023-05-28 22:35:34 +02:00
Vadim Zeitlin
03c09d703f Document default timestamp in wxLog::GetTimestamp() documentation
It seems like this would be useful to know.
2023-05-28 22:22:38 +02:00
Vadim Zeitlin
21daae3435 Improve WXTRACE documentation
Link to wxLogTrace() documentation and don't speak about "debug build"
any more.
2023-05-28 22:18:28 +02:00
Vadim Zeitlin
726aedd5a4 Improve wxLogDebug() and wxLogTrace() documentation
Refer to the debugging overview instead of outdated documentation
speaking about debug and release build modes.
2023-05-28 22:17:50 +02:00
Vadim Zeitlin
f2f2868de5 Add support for dark mode colours to XRC
Allow specifying a different colour to use in the dark mode in XRC
colour properties.

Closes #23571.
2023-05-27 21:51:51 +02:00
Vadim Zeitlin
e1f9f8f988 Remove outdated comment mentioning Windows CE limitation
This is irrelevant since a very long time, so just remove it.

No real changes.
2023-05-27 21:51:36 +02:00
Vadim Zeitlin
fff31e01b7 Merge branch 'dark-mode-fixes'
Various cosmetic -- but rather important -- fixes for MSW dark mode.

See #23570.
2023-05-27 21:46:34 +02:00
Christian Beier
1a64e17ccc Add EVT_FULLSCREEN event macro
This macro was mentioned in the docs added by 0ff1bdec09 (Add
wxFullScreenEvent for macOS, 2021-03-18), but its implementation was not
added by said commit.

Closes #23566.
2023-05-27 21:44:55 +02:00
Vadim Zeitlin
e51d74f158 Make wxDV_ROW_LINES much more subtle in dark mode
The colour used for odd rows was much too light in the dark mode and was
actually much lighter than the colour used for the selection, which is
much more important than cosmetic zebra striping.

Fix this by strongly decreasing the lightness change in dark mode, from
50% to 10%, which results in using #363636 on #202020 which is the
default dark mode background in wxMSW, instead of #8f8f8f used before
(by comparison, light mode uses #f7f7f7 on #ffffff background).

See #12834.
2023-05-26 01:02:19 +01:00
Vadim Zeitlin
0ca1c14df0 Improve wxListCtrl appearance in dark mode
Switch to using "DarkMode_Explorer" theme for it in dark mode, bringing
the following improvements:

1. Scrollbars are dark now, as they should be.
2. There are no vertical separator lines in the control any more, which
   is unexpected and especially jarring because they misalign (by 1px)
   with the header separators.

To make "DarkMode_Explorer" work we have to take care of drawing the
selected items ourselves, as they appear completely wrongly in this
theme by default, so do take care of this by changing the custom drawing
code to use the colours appropriate for both light and dark mode and
also fix yet another misalignment problem in it by changing the offset
used for the item rectangle: it's not clear why the offset, added back
in c9a695b777 (wxMSW: Fix incorrect subitem rect calculation in
wxListCtrl., 2012-09-07) differed for the first and non-first columns,
but the first column offset is off by 2px under both Windows 10 and
Windows 7 now, which resulted in a noticeable shift of custom-drawn
items compared to the normal ones.
2023-05-26 01:01:38 +01:00
Vadim Zeitlin
308e9b3f14 Fix custom-drawn wxListCtrl items appearance when focused
The focus rectangle wasn't drawn correctly due to the of ClientHDC in
the painting code, which didn't work when using compositing.

Use the provided HDC, as in the rest of the drawing code, as it seems to
work fine now and the comment saying that it didn't, written back in
2006 was either erroneous or, more likely, out of date by now.
2023-05-25 00:18:17 +01:00
Vadim Zeitlin
693de13ce1 Use anonymous namespace for private wxListCtrl drawing functions
No real changes, just use an anonymous namespace instead of making all
the private functions static.
2023-05-25 00:10:31 +01:00
Vadim Zeitlin
6d849f8211 Fix creating Chinese locales under macOS
Creating Chinese locales such as zh_TW didn't work because this string
didn't appear in [NSLocale availableLocaleIdentifiers] return value,
as only the variants explicitly specifying the script were included.

Fix this by ignoring the script part when checking if the locale is
available. This should work well for zh_TW or zh_SG, which exist only in
a single script (traditional and simplified, respectively), but it's not
really clear whether it works, or what should we do if it doesn't work,
for zh_CN or zh_HK both of which exist in both scripts.

See #23209.
2023-05-19 01:39:02 +02:00
Vadim Zeitlin
d2101ca3be Show result of parsing wxLocaleIdent in wxUILocale pseudo test
In addition to showing whether the locale is supported or not, show all
of its components to allow interactively verifying if an identifier is
being parsed correctly.
2023-05-19 01:33:13 +02:00
Vadim Zeitlin
bc72a5d003 Fix drawing of disabled wxStaticText in dark mode
Disabled static controls looked ugly as greying out the label doesn't
work at all when the background is dark, so override their drawing in
this case and just draw them using the same grey-ish colour that is
already used for the disabled menu items.

This is somewhat of a hack, but doesn't seem to have any bad effects and
is much simpler than using owner-drawn controls.
2023-05-18 01:31:25 +01:00
Vadim Zeitlin
844e7e16cb Fix menu bar colours in dark mode
The colours have somehow got completely mixed up when they were made
customizable in 76fffafcd0 (Allow customizing menu bar menus colours in
MSW dark mode, 2023-02-19) and the menu bar looked completely wrong and
too bright as the result.

Also reuse wxSYS_COLOUR_MENU instead of duplicating its 0x2b2b2b value.
2023-05-18 00:32:51 +01:00
Vadim Zeitlin
92664881fe Fix lack of unsharing in wxImage::Clear()
Calling Clear() wrongly modified any other wxImage objects reusing the
same data.

Fix this by adding the missing call to AllocExclusive() to this function
and also add a check for the image validity which was missing there as
well ever since this function was added back in fc3762b5fc (add
wxImage::Clear (patch by troelsk); closes #10141, 2009-01-09).

Also add a unit test.

Closes #23553.
2023-05-18 00:31:15 +02:00
Vadim Zeitlin
d56d773a55 Remove CppUnit boilerplate in wxImage unit test
No real changes, just remove all the ugly compatibility macros.
2023-05-18 00:25:35 +02:00
Vadim Zeitlin
4a2d256e94 Remove CppUnit boilerplate from wxURL unit tests
No real changes, just don't use compatibility macros any longer.

Also remove URLTestCase as it's useless now when we can just use
wxSocketInitializer directly.
2023-05-18 00:10:28 +02:00
Vadim Zeitlin
1afcac9ca5 Use wxSocketInitializer in the unit tests
Prefer using this RAII wrapper to explicit function calls, this is
shorter and more robust.
2023-05-18 00:06:21 +02:00
Vadim Zeitlin
cc07a0fd9b Add trivial wxSocketInitializer helper
This can and will be used instead of calling wxSocketBase::Initialize()
manually.
2023-05-18 00:04:59 +02:00
Vadim Zeitlin
563cc11151 Revert to using wxBaseObjectArray for wxAuiPaneInfoArray
This reverts changes to one of the arrays in 39706e4db0 (Use wxBaseArray
instead of object arrays in wxAuiManager, 2023-04-11) as this array is
returned by wxAuiManager::GetPane() and the existing code relies on the
references to the elements of this array remaining stable even if the
array is modified, which would be impossible with an array storing the
objects directly, so return to storing heap-allocated pointers to it.

There should be no such problems with the other arrays changed by that
commit, so leave them unchanged.

Closes #23545.
2023-05-16 00:12:27 +01:00
Vadim Zeitlin
0188fd95ac Fix a recently introduced typo in wxWizard documentation
This was mistyped in d12c3d0805 (Document that wxWizard can and usually
will be allocated on stack, 2023-05-15).
2023-05-16 00:02:42 +01:00
Vadim Zeitlin
4cc13e1099 Use vector in wxMSW wxAcceleratorTable code
No real changes, just replace manually-allocated buffer with a vector.
2023-05-15 23:59:14 +01:00
Vadim Zeitlin
d12c3d0805 Document that wxWizard can and usually will be allocated on stack
Also make it clear that calling Destroy() is only necessary for
heap-allocated objects.
2023-05-15 23:48:05 +01:00
Vadim Zeitlin
e866db985a Merge branch 'link-col'
Improve wxHyperLinkCtrl colours management and support MSW dark mode.

See #23549.
2023-05-15 23:39:33 +01:00
Antti Nietosvaara
d666d1e222 Fix a memory leak when using non-wx threads
The wxThreadSpecificInfo object created by wxThreadSpecificInfo::Get()
was only released by the wxThreadInternal's cleanup, which meant that it
was leaked if wxThreadSpecificInfo::Get() was called by a thread not
created by wxThread, e.g. when using std::async or std::thread.

Fix this by simply using C++11 thread_local and removing the entire
wxThreadSpecificInfo machinery entirely.

See #23535.

Closes #23543.
2023-05-16 00:36:00 +02:00
Vadim Zeitlin
c41969eff2 Disable wxHyperlinkCtrl colours test under Wine
This doesn't work due to LM_GETITEM not returning the expected result
after changing the state using LM_SETITEM under Wine.

It could be worked around by remembering whether we changed the colours
in our own variable, or maybe just reverted later if Wine fixes this,
but for now disable the test.
2023-05-15 21:50:31 +01:00
Vadim Zeitlin
082b19f863 Use more appropriate colour for wxHyperlinkCtrl in dark mode
The default blue doesn't have enough with the typical dark mode
background, so use a much lighter shade of blue in this case.

The choice of the exact colour to use is pretty arbitrary, but there
doesn't seem any standard value for the link colour in the dark mode.
2023-05-15 21:39:13 +01:00
Vadim Zeitlin
cd28031b4d Document that wxMSW wxHyperlinkCtrl hover colour can't be changed
This isn't supported by the native control, and it doesn't seem worth to
make an extra effort to support it, so just document it and stop
checking that it works in the unit test.
2023-05-15 21:39:13 +01:00
Vadim Zeitlin
89efbf1a80 Add support for changing native wxHyperlinkCtrl colour
Set LIS_DEFAULTCOLORS to allow the already existing code calling
SetForegroundColour() in wxGenericHyperlinkCtrl to work.

Changing the foreground colour has an unfortunate side effect of also
changing the colour of the focus rectangle, but it doesn't seem possible
to avoid this.
2023-05-15 21:39:13 +01:00
Vadim Zeitlin
501cc65933 Implement accessors for native wxHyperlinkCtrl colours
The native control uses wxSYS_COLOUR_HOTLIGHT as its foreground and
doesn't change it when the mouse hovers over it.
2023-05-15 21:39:13 +01:00
Vadim Zeitlin
5b9b817aaa Simplify showing colour values in failing unit tests
Use wxColour::GetAsString() instead of reimplementing it in the test.
2023-05-15 21:39:13 +01:00
Vadim Zeitlin
02eb3a26b6 Fix using colours, fonts etc in CATCH assert messages
Include the header declaring the stream insertion operators for these
types before including catch.hpp itself as otherwise they may not be
seen when these classes are used and Catch::StringMaker is instantiated
using the "unstreamable" alternative for them.

It would probably be better to specialize Catch::StringMaker for these
types directly instead of relying on stream insertion operators, but
this would require more changes and in the meanwhile this improves the
display of failing checks.
2023-05-15 21:39:13 +01:00
Vadim Zeitlin
d1fedc1415 Get rid of CppUnit boilerplate in wxHyperlinkCtrl unit test
No real changes, just avoid using compatibility macros in this test.
2023-05-15 21:39:13 +01:00
Milo Ivir
e85b431686 Update Croatian translation
Closes #23546.
2023-05-15 17:37:47 +02:00
Vadim Zeitlin
0b3d8a3d8b Implement wxGenericHyperlinkCtrl::GetDefaultAttributes()
Return the correct foreground colour from this function for hyper links,
it's different from the default text colour for the links.

This makes it easy to reuse this colour for the link-like elements in
the application code.
2023-05-12 03:58:55 +01:00
Vadim Zeitlin
475477a45f Extract link colour into a reusable helper function
No changes, just a refactoring.
2023-05-12 03:58:14 +01:00
Vadim Zeitlin
7894b56a47 Tweak default wxGenericHyperlinkCtrl colour slightly
Use #0000ee from HTML5 spec instead of #0000ff used previously.
2023-05-12 03:57:50 +01:00
Blake-Madden
c27b711379 Explain how to specify download paths when using wxWebRequest
Add an overview paragraph explaining how to use wxWebRequest's and
wxWebEvent's IDs together to specify a request's download path before
starting it. The sample shows how to interactively prompt for local
paths once a file downloads, but not how to download a file to a
specific location without user prompting, so document how to do it.

See #22986.

Closes #23504.
2023-05-11 22:48:30 +01:00
Vadim Zeitlin
35c328e221 Fix wxStatusBar::GetBackgroundColour() in dark mode under MSW
Get the colour actually used by the theme part we use for the status bar
in the dark mode, which is quite different from the default background
colour (0x333333 vs 0x202020).

This is notably important for the controls that live inside status bar
panes, as they must use the correct background colour to blend in.
2023-05-11 22:45:26 +01:00
Maarten Bent
70c2ddeba3 Add support for wxBG_STYLE_TRANSPARENT to wxMSW
Allow using transparent background style under Windows by mapping it to
WS_EX_TRANSPARENT.

Closes #23412, #23498.
2023-05-11 22:42:13 +01:00
Vadim Zeitlin
f3a4767455 Fix wxMSW wxWindow::GetTextExtent() with given font in high DPI
This function returned wrong results when using a non-default font in
non-standard DPI because it didn't adjust the font to use the window
DPI, as needs to be done manually in wxMSW before using it.

Fix this now and do the same thing here as we already did in
wxWindow::SetFont() (via WXAdjustFontToOwnPPI()) or in wxDC::SetFont().
2023-05-11 18:46:10 +01:00
Vadim Zeitlin
5f5e5c27dd Merge branch 'keep-on-same-display'
Keep window on the same display when its client size is changed.

See #23533.
2023-05-10 22:45:02 +01:00
Vadim Zeitlin
a0e3f1e1ab Use grep instead of fgrep and egrep
The latter are deprecated and shouldn't be used any longer.

No real changes.

Closes #23537.
2023-05-10 23:44:17 +02:00
Vadim Zeitlin
54a8a6ac16 Fix wxTreeCtrl::ScrollTo() with hidden root item in wxMSW
Scroll to the topmost item, as the generic version does, instead of
crashing.

Closes #23534.
2023-05-10 19:08:00 +01:00
Vadim Zeitlin
62b6e1d0f9 Use wxRect::MakeCenteredIn() in DoSetClientSize()
No real changes, just make the code more clear by adding the new helper
function.
2023-05-10 00:13:35 +01:00
Vadim Zeitlin
5fd6be2f64 Add wxRect::MakeCenteredIn() modifying the rectangle in place
This can be more convenient than calling CenterIn().
2023-05-10 00:09:41 +01:00
Vadim Zeitlin
1a22adb80d Get rid of CppUnit boilerplate in wxRect unit test
No real changes, just clean up the test.
2023-05-10 00:02:58 +01:00
Vadim Zeitlin
540d2c2d39 Improve generic implementation of wxDisplay::GetFromRect()
Account for the special case of partly visible rectangle whose center is
off screen, as in this case GetFromRect() would still be expected to
return a valid display and not wxNOT_FOUND.

Also mention this case in the documentation.
2023-05-09 21:59:46 +01:00