Commit graph

20769 commits

Author SHA1 Message Date
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
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
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
0da3f1c11f Add wxDisplay::GetFromRect()
For now this is just the same thing as GetFromPoint(center-of-rectangle)
but it's already more convenient to use and it will also be changed in
the upcoming commits.
2023-05-08 22:47:04 +01:00
Vadim Zeitlin
d39aac0fa8 Merge branch 'aui-tbar-items'
Fix regression in code using pointers to wxAuiToolBar elements.

See #23529.
2023-05-08 15:15:02 +01:00
Vadim Zeitlin
50dcf06bff Revert to using wxBaseObjectArray for wxAuiToolBarItemArray
This partially undoes the changes of bc23b1f4f0 (Use wxBaseArray instead
of object array for wxAuiToolBarItemArray, 2023-04-11) as they broke the
existing code using wxAuiToolBar because the pointers to the tools were
not stable any more.

At least avoid the use of the ugly -WX_DECLARE_USER_EXPORTED_OBJARRAY()
macro by just using wxBaseObjectArray<> directly, which is simpler now,
after the change in the parent commit.

Add a trivial test checking that pointers to wxAuiToolBar tools remain
stable when more tools are added.

Closes #23514.
2023-05-07 00:52:07 +01:00
Ivan Sorokin
8a01942f1a Add WXK_NUMPAD_CENTER to refer to numpad "5" in portable code
This key produces events with different key codes in wxMSW (WXK_CLEAR)
and the other ports (WXK_NUMPAD_BEGIN), so add a new constant to allow
to refer to it under the same name everywhere.

Also generate a key event for it in wxOSX where it previously wasn't
generated at all.

Closes #23478.

Closes #23491.
2023-05-06 21:57:47 +01:00
Vadim Zeitlin
91ded239e9 Allow using wxBaseObjectArray without defining traits
This makes it possible to use this class with the complete classes
without using any macros.
2023-05-06 19:59:44 +01:00
Lauri Nurmi
9f94f4069c Support wxDP_DROPDOWN mode for native date pickers on macOS
According to Apple's documentation, the presentsCalendarOverlay property
is supported in macOS 10.15.4 and later.

Closes #23520.
2023-05-05 15:19:49 +02:00
Vadim Zeitlin
0329dfecd8 Update wxSlider thumb before processing wxEVT_DPI_CHANGED
This changes of 4713301cf5 (Fix font and thumb size of wxSlider after
DPI change, 2019-08-27) fixed updating the slider thumb length on DPI
change, but this happened too late because it was done after executing
the user-defined handler for this event which could have updated the
slider size, which led to a call to its overridden DoMoveWindow() which
would use the old thumb length, resulting in the size remaining too big
when switching from higher to lower DPI and, worse, too small (and not
showing the thumb entirely) when switching in the other direction.

Fix this by updating the thumb length earlier, by using the just added
MSWBeforeDPIChangedEvent() for doing it instead of doing it in the event
handler.
2023-05-01 17:23:09 +01:00
Vadim Zeitlin
0f19c0a074 Pass wxDPIChangedEvent to the just added MSWBeforeDPIChangedEvent()
This is unusual, but this function may need to rescale some coordinates
and it's convenient to just call event.Scale() then.

So pass it the event that we are preparing to process to it instead of
passing it new and old DPI separately and forcing it to deal with them
itself (instead of using Scale()).
2023-05-01 17:21:03 +01:00
Vadim Zeitlin
7cee6d59c3 Fix updating wxFrame client size in wxEVT_DPI_CHANGED handler
This didn't work correctly when switching from higher to lower DPI if
the frame had a status bar because this status bar still had its old,
bigger height, by the time SetClientSize() was called from the event
handler, resulting in the frame size becoming too big.

It notably resulted in having an unwanted gap between the frame contents
and the status bar if the event handler called GetSizer()->Fit().

Fix this by calling PositionStatusBar(), which also updates the status
bar height to correspond to the new DPI as a side effect, from a new
virtual MSWBeforeDPIChangedEvent() function which had to be added to
allow wxFrame to customize DPI handling.

Adding this new virtual function just for this isn't great, but the only
alternatives seem even worse.
2023-05-01 17:21:03 +01:00
Vadim Zeitlin
b2bb68dc36 Add wxDPIChangedEvent::Scale() overloads for wxPoint and wxRect
Allow scaling positions, in addition to the sizes, and, also, entire
rectangles.
2023-05-01 17:21:03 +01:00
Vadim Zeitlin
1093bb492b Merge branch 'msw-statusbar-improv'
Minor MSW wxStatusBar cleanup.

See #23509.
2023-04-30 17:42:45 +02:00
Vadim Zeitlin
484e7ab0b3 Stop caching a DC in wxStatusBar
This was done back in 0cd159592e (save the current status text for each
pane inside wxStatusBarPane [...], 2009-02-09), but without any real
explanation about why is it needed and doesn't seem useful. Besides,
doing this requires updating this DC in several places, so just don't do
it and create the DC only when we need it.
2023-04-30 01:03:35 +02:00
Vadim Zeitlin
81ac38cf65 Remove manual memory management code for tooltips in wxStatusBar
Use a vector of unique_ptr<> to manage memory automatically instead.

No real changes, this just simplifies the code and makes it more robust
by making it impossible to forget to delete a tooltip.
2023-04-29 23:18:24 +01:00
Vadim Zeitlin
454c7e0fb9 Add "windowToUse" to wxXmlResourceHandler::GetPosition() too
There doesn't seem to be any reason to have it in GetSize() and
GetDimension(), where they were added by 0c00c86faf (fixed dialog units
in toplevel windows (bug #1170234), 2005-03-28), but not in this
function, so add it here as well.
2023-04-28 18:14:40 +01:00
Vadim Zeitlin
5d2639d1cf Merge branch 'std-iostream-fixes'
Restore wxDocument::{Save,Load}Object() compatibility with the old
non-STL build.

See #23481.
2023-04-28 15:26:54 +02:00
Vadim Zeitlin
20b3c887f5 Improve wxUSE_STD_IOSTREAM documentation
Clarify that it is 1 by default in the documentation, instead of
implying that it's off by default and needs to be enabled.

Improve the description of this option in setup.h files.

And also document this compilation option in the summary page.
2023-04-28 15:26:46 +02:00
Vadim Zeitlin
9257d36af6 Stop using legacy wxSTD macro in the library code
Just use "std::" directly instead.

No real changes.
2023-04-28 15:26:46 +02:00
Vadim Zeitlin
bf9f8c70b9 Merge remote-tracking branch 'github/msw-univ-fixes'
Fix wxUniv/MSW build and a CI job for it.

See #23476.

Closes #23471.
2023-04-28 15:23:59 +02:00
Vadim Zeitlin
85e88d6af3 Merge branch 'format-unicode-fix' of https://github.com/lanurmi/wxWidgets
Fix for wxLocale breaking Unicode string formatting under macOS.

See #23454.
2023-04-28 15:06:54 +02:00
Vadim Zeitlin
a1f1b791d4 Make wxWindow::EnableTouchEvents() public in wxQt
It was wrongly (and probably accidentally) protected in this port.

Closes #23473.
2023-04-28 14:48:47 +02:00
Vadim Zeitlin
a68db909f0 Generalize wxOSX locale workaround to all ports under Darwin
As all ports use the same CRT, it makes more sense to check for Darwin,
rather than wxOSX, in wxEnsureLocaleIsCompatibleWithCRT(), as other
ports such as wxGTK would also be affected by this problem if they were
to be used under macOS.
2023-04-24 22:51:17 +02:00
Vadim Zeitlin
f5a735ed87 Stop using native MSW wxImageList in wxUniv
This doesn't make any sense, native image list implementation is only
needed for interoperability with the native controls which are not used
by wxUniv, so always use the generic version in it instead.
2023-04-22 19:03:08 +02:00
Vadim Zeitlin
fcde4ac7c6 Add wxEnsureLocaleIsCompatibleWithCRT() helper
No real changes, just refactor the code to use this function instead of
calling setlocale(LC_CTYPE) twice.

This makes it more clear what we're doing and will make it simpler to
get rid of this when we don't have to do it any longer.
2023-04-22 18:58:16 +02:00
Vadim Zeitlin
1f05f3b5a0 Fix wxAboutDialog compilation in wxUniv build
Add missing wxPanel forward declaration as it's used in this header and
not already declared by some other header when using wxUniv.
2023-04-22 16:37:27 +02:00
Vadim Zeitlin
b4a29beecd Merge branch 'llvm-clang-msw' of https://github.com/MaartenBent/wxWidgets
Fix llvm clang issues on Windows.

See #23468.
2023-04-20 15:23:24 +02:00
Vadim Zeitlin
7465d8297e Add wxString::wc_string() for consistency
We have utf8_str() and utf8_string(), but no similar equivalent for
wc_str(), so add one too, it seems nicer to use than ToStdWstring().

Closes #23463.
2023-04-20 15:20:13 +02:00
Blake Madden
2b8c409824 Fix wxWebResponse::GetMimeType() always returning empty string
Return the actual MIME type extracted from the Content-Type header from
the existing function and also add new wxWebResponse::GetContentType()
returning the full value of this header.

Closes #23461.
2023-04-20 15:15:54 +02:00
Maarten Bent
eaab67dee1
Fix runtime exception when running application compiled with clang on Windows
It gives the following error:
The application has failed to start because its side-by-side configuration is incorrect

Fix this by specifying the xml namespace. Examples on the Microsoft website use v2, so change this too.
2023-04-19 22:10:52 +02:00
Vadim Zeitlin
82d2c9f8af Merge remote-tracking branch 'github/use-std-hash'
Fix the wrong merge done in ae13d70ddc (Merge branch 'use-std-hash',
2023-04-18) which forgot some fix ups.

Notably restore wx/wxcrt.h inclusion and fix linking wxWebRequest unit
test.

See #23462.
2023-04-18 15:42:49 +02:00
Vadim Zeitlin
ae13d70ddc Merge branch 'use-std-hash'
Use std::unordered_foo instead of wx hash maps.

See #23462.
2023-04-18 14:38:12 +02:00
utelle
a20aa4de75 Improve generated process for the language database files
Fix some issues and streamline regeneration process:

- A few glitches (like duplicate language symbols, wrong Windows
  language ids etc) were fixed.
- Scripts were added to allow to regenerate the list of supported
  locales from the list of known Windows locales.
- Version info when language symbols became available was added to the
  documentation of the language symbol enum.
- Synonyms are no longer hard-coded in the script genlang.py.

See #23453.

Closes #23437.
2023-04-18 14:27:28 +02:00
Vadim Zeitlin
9eb0842717 Use std::unordered_map<> in XTI wxTypeInfo
Replace a wx synonym with the direct use of the standard class.
2023-04-18 00:42:56 +01:00
Vadim Zeitlin
334b007a19 Use std::unordered_map<> in wxTarInputStream
Replace a wx synonym with the direct use of the standard class.
2023-04-18 00:42:56 +01:00
Vadim Zeitlin
6fc5ef93a6 Use std::unordered_map<> in Unix wxExecute() implementation
Replace a wx synonym with the direct use of the standard class.
2023-04-18 00:42:56 +01:00
Vadim Zeitlin
8e35b647c3 Use std::unordered_map<> in private wxWebRequest headers
Replace wx synonym with the direct use of the standard class.
2023-04-18 00:42:56 +01:00
Vadim Zeitlin
995fd58efd Use std::unordered_map<> in wxMappedFDIODispatcher
Replace a wx synonym with the direct use of the standard class.
2023-04-18 00:42:56 +01:00
Vadim Zeitlin
1784d53466 Use std::unordered_map<> in Unix wxAppConsole
Replace a wx synonym with the direct use of the standard class.
2023-04-18 00:42:56 +01:00
Vadim Zeitlin
eb182ae161 Use std::unordered_map<> in wxPersistenceManager
Replace a wx synonym with the direct use of the standard class.

Also store std::unique_ptr<> instead of raw pointers in this map to
ensure that they get destroyed: previously we could have memory leaks if
some objects were not unregistered before the program exit.
2023-04-18 00:42:56 +01:00
Vadim Zeitlin
48c0f99fa4 Use std::unordered_map<> in wxOSX wxMimeTypesManagerImpl
Replace wx hash maps of tags and file type data with the standard
containers.

Also use auto instead of the explicit iterator type in the code using
these maps.
2023-04-18 00:42:55 +01:00
Vadim Zeitlin
316f43d6e7 Remove useless wxTreeCtrl::m_hasAnyAttr
We can simply check if m_attrs is empty instead.

This was added back in 696e1ea0b7 (in the
last millennium) and apparently there was no simple way to check if
wxHashTable used for m_attrs back then was empty, but it's trivial to do
it with std::unordered_map<>.
2023-04-18 00:42:55 +01:00
Vadim Zeitlin
a9f0a621f2 Use std::unordered_map<> for attributes in wxMSW wxTreeCtrl
Replace a wx synonym with the direct use of the standard class.

Also store std::unique_ptr<> instead of raw pointers in this map.
2023-04-18 00:42:55 +01:00
Vadim Zeitlin
20802d45a0 Move wxTreeCtrl ctors out of line
This is mostly done in preparation for the upcoming change, but already
fixes one minor inefficiency: we now call Init() from non-default ctor
instead of doing it from Create(), so that it's only called once when
the default ctor used instead of twice as before.

No real changes otherwise.
2023-04-18 00:42:55 +01:00
Vadim Zeitlin
a9c8cc4079 Refactor wxMSW wxTreeCtrl code to avoid repetition
Factor out the common part of SetItemFont(), SetItemTextColour() and
SetItemBackgroundColour() into a new helper function.

No real changes.
2023-04-18 00:42:55 +01:00
Vadim Zeitlin
9f914b9285 Use std::unordered_map<> in wxWebView implementation
Replace a wx hash map of handlers with the standard container.
2023-04-18 00:42:55 +01:00
Vadim Zeitlin
ef23491099 Use std::unordered_map<> in HeightCache private class
Replace a wx hash map of raw pointers with a standard container of
objects.
2023-04-18 00:42:55 +01:00
Vadim Zeitlin
dd7452b681 Use std::unordered_map<> in wxPGProperty
Replace a macro-based synonym with the standard container itself.
2023-04-18 00:42:55 +01:00