This seems to be the only way to fix using this class, which is
fundamentally incompatible with high DPI support, with bitmaps of
different logical but identical physical sizes.
By using physical size we ensure that the code chopping up the provided
bitmap in multiple images doesn't do it with the bitmap having the same
physical size but a different logical size from all the other bitmaps.
And, conceptually, logical size of the bitmaps in it really shouldn't
matter to the image list as it doesn't have a scaling factor and so
can't do anything useful with the logical size.
Moreover, we can't add wxImageList::SetScaleFactor() neither because
this class is, by design, supposed to be shareable between different
controls which may use different scale factors, so it doesn't make sense
to speak of the scale factor of the image list itself.
This undoes the changes made in the generic implementation back in
c374eefd34 (Fold wxOSX-specific wxImageList into generic version,
2018-10-30) and also eb52e86553 (Take into account scale factor of
images added to wxImageList, 2021-04-03).
Also update a couple of places where wxImageList is still used to use
physical sizes. Unfortunately some others can't be easily fixed, e.g.
global wxFileIconsTable would have to be completely rewritten.
Finally, add a unit test checking that things work as expected now:
previously the size of 24x24 bitmap in the image list containing
(scaled) 32x32 bitmaps would be 21x21 due to sub-bitmap extraction
kicking in.
Closes#23994.
Make the wxString(std::string_view) constructor explicit.
Otherwise, when comparing a std::string_view with a const char *, the
cast to wxString will be considered as a candidate for the comparison,
ultimately causing an "ambiguous overload for 'operator=='" error.
For example, this sample only builds if the constructor is explicit:
#include <wx/string.h>
#include <string_view>
int main() {
std::string_view view = "abc";
const char *str = "abc";
return view == str;
}
However, making the constructor explicit will break assignment:
std::string_view view = "abc";
wxString s;
s = view; // Error: no match for "operator="
That we can fix by implementing operator=(std::string_view)
That, however, introduces another ambiguity:
std::string str = "abc";
wxString s;
s = str; // Ambiguous between s = wxString(str)
and s = std::string_view(str)
That we can fix by implementing operator=(std::string)
Finally, note that some rather obscure ambiguities remain, such as:
wxString s;
s = {"abc", 2}; // Ambiguous between s = wxString("abc", 2)
and s = std::string_view("abc", 2)
Avoiding them is not simple (https://cplusplus.github.io/LWG/issue2946)
and doesn't add much value.
Closes#23834.
This function was added back in a047aff270 (Added wxBORDER_THEME,
wxWindow::GetDefaultBorderForControl(), wxWindow::CanApplyThemeBorder(),
2007-08-07) but seems to have been made completely unnecessary by
dc797d8e1b (More border rationalisation. GetDefaultBorder is now mostly
defined in base class files., 2007-11-13) soon afterwards and never did
anything other than returning wxBORDER_THEME, with no explanation as to
when it might be useful to override it not to do it.
It also doesn't seem to be really used anywhere outside wxWidgets and
has never been documented, so make it non-virtual and deprecate it to
avoid confusion and simplify things.
wxString is always based on std::[w]string since 2c0c727f49 (Remove wx
own wxStringImpl implementation, 2022-11-16) and all containers use
standard containers by default too now -- and there is a separate
wxUSE_STD_CONTAINERS for this anyhow.
The only remaining use of wxUSE_STL was as the default value for
wxUSE_STD_STRING_CONV_IN_WXSTRING option, but it's not really needed
for this neither, and this option can just be set to 0 by default.
Also add wxUSE_CHAR_CONV_IN_WXSTRING which can now be set to 0 too to
disable all unwanted implicit conversions (even "safe" ones, to wide
strings, in addition to the unsafe ones to narrow strings that could be
already disabled with wxUSE_UNSAFE_WXSTRING_CONV) to allow people who
don't want to have any implicit conversions at all to do it.
Keep --enable-stl configure option for compatibility, but warn if it is
used to tell people that it is not needed any longer.
This is intentionally not very detailed, as we might find more container
classes to change in the future and listing all of the affected ones
here would require updating this list later.
Explain that the legacy container classes now inherit from the standard
classes by default and also how to update the existing code to compile
when using standard library-based implementations.
This function was not called any longer after 35a8d0f908 (Fix building
wxPropertyGrid with v3.0 compatibility enabled, 2023-03-22), which
silently broke any applications resulting on this to happen, so call it
again, even if it's rather painful and ugly to do.
Also add wxDEPRECATED_BUT_USED_INTERNALLY_MSG() and use it instead of the
plain wxDEPRECATED_MSG() for the deprecated overload of this function to
avoid warnings when calling it from wxWidgets itself.
Finally, document the change to DrawCaptionSelectionRect() as this
wasn't done back in c63b1604b3 (Use native renderer to draw rectangle
indicating that wxPG category property is selected., 2015-08-30) when
its signature was changed.
This prevents wxGLCanvas from working on limited OpenGL implementations
not providing it, such as VMWare OpenGL driver, and doesn't seem to be
really necessary as multi-sampling can always be explicitly requested if
the application does want to use it.
Closes#23121.
Historically, we used to fall back on any locale using the same
language, if the exactly requested locale was unavailable. This doesn't
seem such a great idea, and results in unexpected behaviour, such as
returning true from wxUILocale::IsSupported() for locales such as
"en-FR" that are not really supported at all.
Remove this fallback and just return false if the locale with the
specified region is not supported.
Still choose any supported region if the region is omitted entirely,
however.
This macro was documented (in its comment) and even used with a
semicolon after it, but it didn't require one and using one after it
resulted in a warning with gcc in pedantic mode.
Change the macro definition to use wxSTATEMENT_MACRO_BEGIN/END to
require (and, trivially, also allow to be used without warnings) a
semicolon after it now.
Drop disabled by default and pretty useless memory tracing code and all
the overlapping and poorly documented build options related to it.
Remove memory.cpp entirely and update all the make/project files, but
preserve the now completely trivial wx/memory.h for compatibility and
also keep including wx/string.h from wx/object.h as it seems like a lot
of existing code actually depends on this, even if it should not.
Replace the options in the propgrid sample with a couple of other
debug-related options that were not used before to avoid leaving the
"Debugging Section" completely empty.
This allows to determine if dark mode is enabled (for the applications
and/or the system UI itself, respectively) system-wide which is useful
now that IsDark() returns false unless MSWEnableDarkMode() is called.
Also document the incompatible change to IsDark().
Since wxListCtrl under wxMSW cannot edit labels without the presence of
this flag, and an assertion failure triggered if the flag is missing to
it and also all the other ports for consistency.
Also document that wxLC_EDIT_LABELS flag is required in EditLabel()
description.
See #23024.
Fix a long-standing bug in wxMSW wxTextDataObject which returned the
size including the trailing NUL from its GetDataSize() and used the same
convention in GetData(), but didn't account for this NUL being included
into the buffer passed to SetData().
This was partially compensated by also passing the wrong (too small)
buffer size when calling SetData() from wxIDataObject, but still
resulted in problems when using SetData() with the length returned from
GetDataSize(), as done in wxDataViewCtrl code.
Fix this by now always considering NUL part of the buffer (as this is
the platform convention, i.e. all CF_TEXT data on the system clipboard
must include the trailing NUL) and taking it into account when
determining the buffer size in wxIDataObject.
This change is not fully backwards-compatible as it breaks any code
calling SetData() directly, as e.g. wxURLDataObject in wxMSW itself did,
so document it as such, but it's still worth making it as there doesn't
seem to be any other way of fixing the problem described in the linked
issue and direct calls to SetData() should be rare as simpler SetText()
should be used instead.
Also add a unit test for wxTextDataObject and extend the existing test
of wxURLDataObject.
Closes#22928.
This style never did anything useful in wxMSW and did nothing at all in
all the other ports, so always was rather useless, but became actively
harmful not that WS_EX_COMPOSITED is used in wxMSW because using it and
WS_EX_TRANSPARENT, enabled by wxTRANSPARENT_WINDOW, together doesn't
work and results in an endless stream of WM_PAINT messages being sent to
the _siblings_ of the window with wxTRANSPARENT_WINDOW style.
Some of wxImageList methods asserted when called on an invalid image
list while others just failed silently.
Assert in all of them now for consistency and to help detecting problems
in the code using invalid wxImageList objects.
Extend the documentation and the tests.
For some applications turning off double buffering for individual
windows may be infeasible, so allow doing it globally using this system
option.
Note that wxAutoBufferedPaintDC still does no buffering in wxMSW now,
even when this option is set, so setting it will result in flickering in
any code using it. The solution is to use wxBufferedPaintDC directly in
the programs that use this option.
Closes#22953.
This is similar to the changes of 020b6ebcb8 (Derive from wxTextEntry
instead of wxTextCtrlBase, 2019-12-29) for wxGTK and removes the methods
that don't exist in the other ports from the generic wxSearchCtrl too.
This could be also used by the applications if they decided to call it
directly, for whatever reason, but, hopefully, this shouldn't be a
common occurrence, as passing wide file name is really inconvenient, and
it was deprecated since 2.8, so should be safe to remove by now.
This is a big and incompatible change but, arguably, is still worth
making because it makes wxMSW behaviour similar to that of wxOSX and
wxGTK when using Wayland.
Do document it prominently and also document MSWDisableComposited() as
it will probably end up being used in quite a lot of existing code.
Remove the port files and references to it from the common headers and
elsewhere.
Also remove GPE (GNOME PDA Environment) support as libgpewidget is
unmaintained since 2006 or so and has never been really used.
Use __WXGTK__ to test for any version of wxGTK now. Still define
__WXGTK20__ for compatibility, but always define it now and don't test
for it in the library code.
This port hasn't been updated for ages and is not used by anybody any
longer, so remove its code to facilitate maintenance.
Also remove references to this port from the documentation and most of
the other places (VMS-specific descrip.vms files still check for it
because it's not clear how to update them all), including configure.
Regenerate the latter and rebake all makefiles.
Finally document that this port is not available any longer.
Fix checks in wxGrid::FreezeTo(): do not silently do nothing if the grid
is too small or all rows/columns are frozen. Do assert if the parameters
are out of range.
See #22766.
It has been a long-time coming, see b95a7c3144 (Allow wxThread::Wait()
and Delete() to block, even under wxMSW., 2011-03-14), but do still
document that it has finally changed.
It's a bit wasteful to also mention these changes in the Git notes, so
don't do it and just leave a reminder to copy the existing change log
entries from 3.2 branch instead when it's time to release 3.3.0.
When closing the document using wxDocManager::CloseDocument(), which is
what happens when using the standard wxID_CLOSE menu command handler,
OnCloseDocument() was called twice: first when wxDocument::Close() was
called directly from CloseDocument() itself and once again later when it
was implicitly called from DeleteAllViews().
This was unexpected and also resulted in calling DeleteContents() twice,
which is even more so for a function supposed to perform cleanup.
Fix this by not calling Close() itself but instead a new CanClose()
function from CloseDocument() to check whether we can close and then
relying on DeleteAllViews() to actually close the document.
To prevent the changelog file from growing too big, start a new one for
the next release.
Also restore the instructions about updating it from Git notes just
before the release.
Add a placeholder for the changes in the next release, restoring the
text removed in d8ec020109 (Copy the changes in 3.1.6 from Git notes to
the change log, 2022-04-04).
The RFC accepts 2-digit years, and it makes most sense to interpret
e.g. 95 as 1995. However, this is an incompatible change, as earlier
95 was literally decoded as 95 AD.
Years 00..29 are considered to mean 20xx; 30..99 means 19xx.
Closes#22196.