Commit graph

2578 commits

Author SHA1 Message Date
Vadim Zeitlin
a2f7a933e8 Merge branch 'no-global-ops'
Don't define operators for wx types in global scope.

This results in much better error messages when the compiler gives an
error about failing to resolve a call to some operator in user code
because it doesn't list all the wx-defined operators as candidates. In
practice, this cuts down error messages from 500 (!) lines to 2 with
gcc.

See #24190.
2024-01-12 18:42:39 +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
53b4f4ddf2 Use physical size in wxImageList
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.
2023-11-06 21:18:34 +01:00
Joan Bruguera Micó
19936c2176 Don't clobber std::string_view equality with char *
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.
2023-09-06 02:44:11 +02:00
Vadim Zeitlin
a89577e8a4 Deprecate useless wxWindow::GetDefaultBorderForControl()
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.
2023-06-16 15:55:35 +01:00
Vadim Zeitlin
7824391f64 Merge branch 'use-std-containers'
Remove avoidable uses of legacy container classes by replacing them with
the standard containers.

See #23440.
2023-04-17 17:02:27 +02:00
Vadim Zeitlin
35c35c235e Remove wxUSE_STL which is not really used any longer
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.
2023-04-15 17:22:09 +02:00
Vadim Zeitlin
4f075139c3 Briefly describe the changes to private container classes
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.
2023-04-12 18:15:46 +01:00
Vadim Zeitlin
89e4f51f62 Update documentation after setting wxUSE_STD_CONTAINERS=1
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.
2023-04-10 20:39:50 +01:00
Vadim Zeitlin
cb03ddf63f Restore compatibility with 3.0-like DrawCaptionSelectionRect()
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.
2023-03-23 13:29:30 +01:00
Vadim Zeitlin
46857a73ba Don't use multi-sampling in wxGLAttributes::Defaults()
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.
2023-02-14 15:40:04 +00:00
Vadim Zeitlin
1cf59d345b Remove fallback on locale using different region under Unix
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.
2023-02-07 00:23:31 +01:00
Vadim Zeitlin
bed3896189 Allow, and even require, semicolon after wxTEST_DIALOG() macro
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.
2023-01-13 17:27:53 +01:00
Vadim Zeitlin
e89f05faba Remove memory debugging/tracing support and all related options
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.
2023-01-05 21:41:38 +01:00
Vadim Zeitlin
e0db72d80e Include arch-specific suffix in the DLLs names in makefile.vc too
This is similar to edcfeab29d (Include arch-specific suffix in the DLL
names in CMake builds too, 2022-12-23).

See #23053.
2022-12-28 22:06:41 +01:00
Vadim Zeitlin
208142c14a Merge branch 'msw-dark-mode'
Add experimental support for dark mode for wxMSW.

See #23028.
2022-12-27 22:20:34 +01:00
Vadim Zeitlin
7ce2ba9b0c Add wxSystemAppearance::AreAppsDark() and IsSystemDark()
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().
2022-12-26 22:02:11 +00:00
ali kettab
2578ffb54a Assert if wxListCtrl::EditLabel() is used without wxLC_EDIT_LABELS
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.
2022-12-10 12:57:46 +01:00
Vadim Zeitlin
d737d98d27 Consistently include trailing NUL in wxMSW wxTextDataObject size
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.
2022-12-06 02:25:44 +01:00
Vadim Zeitlin
20bbc43a20 Redefine wxTRANSPARENT_WINDOW as 0 and stop using it
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.
2022-11-28 19:04:56 +00:00
Vadim Zeitlin
5c6bce627b Check wxImageList validity in all of its methods
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.
2022-11-26 23:29:13 +01:00
Vadim Zeitlin
5904d177fb Merge branch 'msw-drop-pre7-support'
Drop pre Windows 7 versions support.

Closes #22961.
2022-11-12 18:02:32 +01:00
Vadim Zeitlin
63696b55cf Merge branch 'searchctrl-textentry'
Derive generic wxSearchCtrl from wxTextEntry too.

See #22954.
2022-11-12 17:52:16 +01:00
Vadim Zeitlin
d9734baed5 Add msw.window.no-composited system option
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.
2022-11-12 17:51:27 +01:00
Vadim Zeitlin
c501fd0c0f Derive generic wxSearchCtrl from only wxTextEntry too
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.
2022-11-08 23:28:24 +00:00
Vadim Zeitlin
cf474d7f48 Remove wxOnAssert() overload used in ANSI build only
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.
2022-10-28 18:38:41 +01:00
Vadim Zeitlin
340998fe77 Add a note about not supporting wxUSE_UNICODE=0 to the change log 2022-10-27 19:43:30 +02:00
Vadim Zeitlin
c2eab06e4b Merge branch 'remove-motif-and-gtk1'
Remove obsolete and unmaintained wxMotif and wxGTK1 ports.

See #22877.
2022-10-18 18:30:58 +02:00
Vadim Zeitlin
b0ed71658d Document WS_EX_COMPOSITED impact on wxClientDC
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.
2022-10-17 17:22:43 +01:00
Vadim Zeitlin
fb4f0b590c Remove wxGTK1 port and GPE support
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.
2022-10-16 22:01:02 +02:00
Vadim Zeitlin
0ef1cdcc21 Remove support for wxMotif
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.
2022-10-16 16:39:56 +02:00
Vadim Zeitlin
e2a6eac6e8 Merge branch 'grid-freeze-no-size-check'
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.
2022-09-02 19:18:40 +02:00
Vadim Zeitlin
de345d33b2 Merge branch 'docview-onclosedoc'
Improvements to closing wxDocument: don't call OnCloseDocument() twice.

See #22627.
2022-08-30 11:12:58 +01:00
Vadim Zeitlin
eb1242cc1c Merge branch 'compat-32'
Remove WXWIN_COMPATIBILITY_2_8 and associated code, add
WXWIN_COMPATIBILITY_3_2.

See #22692.

Closes #22686.
2022-08-03 18:13:44 +02:00
Vadim Zeitlin
6917b6b0f1 Document wxTHREAD_WAIT_DEFAULT value change
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.
2022-08-03 17:39:48 +02:00
Vadim Zeitlin
541be26e78 Mention that changes in 3.2.x should also be part of 3.3.0
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.
2022-07-24 16:24:33 +02:00
Vadim Zeitlin
ee6d58abe2 Don't call wxDocument::OnCloseDocument() twice when closing
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.
2022-07-15 00:15:40 +01:00
Vadim Zeitlin
304f173924 Rename the existing changelog to changes_32.txt and add a new one
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.
2022-07-11 00:21:21 +02:00
Vadim Zeitlin
90ef7d0a5a Add changes since 3.2.0 RC1 to the change log 2022-06-30 00:25:13 +02:00
Vadim Zeitlin
844e51e672 Revert "Temporarily change the release to 3.2.0-rc1"
This reverts commit 4a286c1868 to set the
version to 3.2.0 again.
2022-06-30 00:21:33 +02:00
Vadim Zeitlin
4a286c1868 Temporarily change the release to 3.2.0-rc1
This commit will be simply reverted before the final 3.2.0 release.
2022-06-27 17:19:35 +02:00
Vadim Zeitlin
741647f076 Add more changes since v3.1.7 to the change log 2022-06-27 17:09:21 +02:00
Vadim Zeitlin
434f9647dc Add change log for 3.2.0
List the changes directly instead of using Git notes for them under the
optimistic assumption that there won't be that many changes.
2022-06-21 00:54:26 +02:00
Vadim Zeitlin
8e3fd46e92 Document that linking with oleacc.lib is also required now
This wasn't mentioned in the change log before, but is also new since
3.0, see #22507.
2022-06-10 18:14:35 +02:00
PB
7f04c30098 Fix typos and wording in changes.txt
Fix typos and make language consistent in 3.1.7 changelog.

Closes #22494.
2022-06-07 00:01:58 +02:00
Vadim Zeitlin
53e08d36ff Add wxPopupTransientWindow wxOSX fix to the change log 2022-06-06 16:23:26 +02:00
Vadim Zeitlin
58f7dade1d Copy the changes in 3.1.7 from Git notes to the change log
Replace the comment explaining how the change log should be updated with
the result of actually doing just this.
2022-06-05 19:26:33 +02:00
Artur Wieczorek
502ede23ab Don't expose internal wxPropertyGridPageState functions
Functions designed for internal use shouldn't be exposed as public ones
to avoid calling them directly from the user code by mistake.
2022-05-27 19:13:42 +02:00
Artur Wieczorek
b06b950574 Document changes in wxImageFileProperty
Remove references to the non-public member variables
from documentation.
2022-04-18 22:17:31 +02:00
Vadim Zeitlin
71426a168a Add change log section for the next 3.1.7 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).
2022-04-07 17:39:56 +02:00