Commit graph

73103 commits

Author SHA1 Message Date
Ulrich Telle
adc7b31c0b
Introduce helper function IsDefaultCLocale 2022-06-18 23:01:48 +02:00
Ulrich Telle
5b4208de78
Determine locale name and codeset in ctor
For all use cases the locale name and the codeset are now determined in the `wxUILocaleImplUnix` ctor.
If `locale_t` support is not available, the use of explicit locales with `wxUILocale` will be problematic.
2022-06-18 22:51:54 +02:00
Vadim Zeitlin
04d6353b18 Formally deprecate wxDataViewModel::GetColumn{Count,Type}()
While there is no real harm in keeping them, it still seems better to
tell people that they're not needed.

Don't put them inside WXWIN_COMPATIBILITY_3_0 for now, however:
considering how late in 3.2 development this deprecation comes, it seems
better to wait until after it and then use WXWIN_COMPATIBILITY_3_2
instead.
2022-06-18 19:21:26 +02:00
Vadim Zeitlin
dbd211dbc2 Don't require overriding wxDataViewModel::GetColumn{Count,Type}()
Neither of these methods was actually ever used after the changes of the
last two commits (and they hadn't been used when not using wxGTK even
before), so don't force the user-defined model classes to override them.

Also stop using them, as the stub versions don't return correct values
any longer.

Still keep the virtual functions in the base class for compatibility
however as it doesn't cost us much and avoids breaking the existing code
using "override".
2022-06-18 19:19:16 +02:00
Vadim Zeitlin
f6d9c13e11 Stop using wxDataViewModel::GetColumnCount() in wxGTK code too
We must use wxDataViewCtrl::GetColumnCount() instead, as using the model
column count was just wrong if the control didn't use all of the model
columns.
2022-06-18 18:23:17 +02:00
Vadim Zeitlin
72171059b4 Stop using wxDataViewModel::GetColumnType() in wxGTK code
We don't seem to really need it as we can just convert everything to
strings and this will allow to remove the requirement to override it in
the derived model classes.

This commit is best viewed ignoring whitespace-only changes.
2022-06-18 18:23:11 +02:00
Vadim Zeitlin
8536c9d683 Fix typo in wxART_STOP definition in GTK art provider
This should have been part of the grandparent commit but was forgotten
there.

See #22550.
2022-06-18 18:13:12 +02:00
Maarten Bent
94262cad6a Fix warnings in MinGW build
Closes #22551.
2022-06-18 17:52:53 +02:00
Vadim Zeitlin
af113afabf Add wxART_REFRESH and wxART_STOP to GTK art provider
This provider is supposed to have all the icons that the Tango provider
has because this is the justification for turning off support for the
latter when using wxGTK, see logic for setting wxUSE_ARTPROVIDER_TANGO
in configure.in, but it didn't provide two of the recently added ones.

Do add them and also add a reminder to Tango provider code to ensure
this doesn't happen again.

Closes #22550.
2022-06-18 17:49:25 +02:00
Paul Cornett
33c2de748a Avoid assertions from wxGtkImage when bitmap is missing
See #22550
2022-06-18 08:09:25 -07:00
Maarten Bent
978271ee81 CMake: Support target files of multiple builds
For example vc_lib, vc_x64_lib, vc_dll, vc_x64_dll, gcc_lib and gcc_dll all in
the same installation location. Disable the architecture (32 vs 64 bit)
compatibility check in the version file.
2022-06-18 17:06:16 +02:00
Maarten Bent
818135942f CMake: Set correct variable in AppVeyor build
CONFIG mode uses the <packageName>_DIR variable.

CMake has an error when generating the solution because the
lib/vc_x64_dll/mswud directory does not exist; it is not built and installed.
So only add the used configuration.
2022-06-18 17:06:16 +02:00
Maarten Bent
629866d71b CMake: Use find_package with CONFIG mode in the minimal sample 2022-06-18 17:06:15 +02:00
Maarten Bent
f6631a3d6a CMake: Create a config file for use with find_package
The config file uses the wxWidgetsTargets file to find all the libraries that
can be linked to.

It supports checking for components (e.g. base, core, aui, gl) and fails if a
requested component is not found.

Set the version compatibility to SameMinorVersion (when CMake supports this),
because different minor wxWidgets versions (3.0 and 3.1/3.2) are expected to
break API.

Because the default libraries are named like wx::wxname, create an alias that
is just called wx::name. CMake older than 3.18 does not support creating an
alias to non-global imported targets, so manually create a library with the
same properties.

The wxWidgets CMake build only builds the Release and Debug configurations, but
when creating a (MSVC) CMake project it also contains MinSizeRel and
RelWithDebInfo configurations. By default these seems to use the Debug
libraries, causing build errors. Map them to the Release libraries instead.

Also create a wxWidgets_LIBRARIES variable that can be used to link with, so
users can keep using the same variables from FindwxWidgets.
2022-06-18 17:06:15 +02:00
Maarten Bent
ef29f744bf CMake: Allow to use wxLIB_TARGETS in install.cmake
Move include of install.cmake below library inclusions, so wxLIB_TARGETS will
be filled with all the built libraries once install.cmake is executed.
2022-06-18 16:08:35 +02:00
Maarten Bent
9ffe6f5575 CMake: Use correct INSTALL_INTERFACE include directory on Linux
The headers are installed in 'include/wx-3.1/', so also use this in the INSTALL_INTERFACE.
Determine wxINSTALL_INCLUDE_DIR only once and reuse it in install.cmake.
2022-06-18 16:08:35 +02:00
Maarten Bent
9d7577677e CMake: Consistent [wx_]install usage
Use wx_install macro so install is only used when wxBUILD_INSTALL is set.
The install.cmake script has a check for wxBUILD_INSTALL, so don't use it there.
2022-06-18 16:08:35 +02:00
Maarten Bent
2e2e96f8aa CMake: Don't use Windows path separators in install prefix
Sometimes CMake complains that the backslash is interpreted as unknown escape symbol.
2022-06-18 16:08:29 +02:00
Ulrich Telle
b1aa647a53
Handle C/POSIX locale in FindLanguageInfo methods
Handle the locale tags "C" resp "POSIX" as "en_US" in the `FindLanguageInfo` methods of `wxUILocale`
2022-06-18 16:03:26 +02:00
Ulrich Telle
e70053fb40
Change method wxUILocaleImplUnix::GetName
Determine the name of the default user locale in the `wxUILocaleImplUnix` ctor and store it in a memeber variable for later reference in method `wxUILocaleImplUnix::GetName`
Remove locale name inconsistency (using "en_US" instead of "en-US")
2022-06-18 15:56:41 +02:00
Maarten Bent
efa5cfcaa9 CMake: Prevent double directory separators 2022-06-18 15:37:52 +02:00
Ulrich Telle
9861b09e61
Remove trailing whitespace 2022-06-17 16:26:19 +02:00
Ulrich Telle
bfeac2c440
Determine codeset properly
In case of the system default locale the codeset can't be determined in the constructor, because the requested locale is actually not yet set up, so that typically the C locale is queried for the codeset resulting in a usually wrong value. Therefore the codeset has to be determined in `wxUILocaleImplUnix::Use()` (again).
2022-06-17 16:22:31 +02:00
Vadim Zeitlin
f4cdb30646 Make wxSashWindow resizing work with wxGTK3 with X11
Apply similar changes as to wxSplitterWindow to make the existing
wxINVERT-based code work at least in this case, i.e.

1. Don't use wxScreenDC with wxGTK3 (although this is more involved in
   this case, as we can't just use wxClientDC for this window itself).
2. Use white brush so that wxCOMPOSITION_DIFF works as wxINVERT.
2022-06-17 01:34:48 +01:00
Vadim Zeitlin
946baf7884 Always use live resizing in wxSplitterWindow under Wayland
Drawing the sash using wxClientDC doesn't work when using Wayland, so
non-live resizing mode is unusable due to the sash being completely
invisible and so we need to force live-resizing, just as we already do
under Mac.
2022-06-17 01:34:41 +01:00
Vadim Zeitlin
46a4ef6494 Make wxSplitterWindow sash visible during resize with wxGTK3/X11
While drawing using wxClientDC still doesn't work when using Wayland,
the sash can be at least made visible when using X11 with GTK 3 if we
use white foreground with wxINVERT logical function.
2022-06-17 01:34:17 +01:00
Vadim Zeitlin
5783b22d3d Add wxCOMPOSITION_DIFF composition mode
This is implemented in Cairo and CoreGraphics renderers only, but this
is still useful as these renderers are used on the platforms where wxDC
wxINVERT logical function is not supported and this composition mode can
partially replace it.
2022-06-17 01:32:07 +01:00
Vadim Zeitlin
6fea2b4ad7 Use wxClientDC instead of wxScreenDC in wxGTK3 wxSplitterWindow
wxScreenDC doesn't work at all in wxGTK3, so use wxClientDC there,
which, unfortunately, does not work for drawing the splitter sash in
wxMSW, so we have to use different classes depending on the platform.

This doesn't change anything yet, as using wxINVERT logical function
doesn't work in wxGTK neither yet, but this gives us a fighting chance
to make this work later.
2022-06-17 01:31:53 +01:00
Vadim Zeitlin
d14e651980 Just rename "screenDC" variable in wxSplitterWindow code
No real changes, simply rename the variable, because it won't always be
a wxScreenDC after the next commit, and remove the unnecessary
SetLogicalFunction() call restoring wxCOPY -- this doesn't matter for an
object going out of scope anyhow.
2022-06-17 01:31:53 +01:00
Vadim Zeitlin
49bbb00850 Merge branch 'mac-filedlg'
Fix transferring data from custom wxFileDialog controls and some
simplifications in wxOSX wxFileDialog code.

See #22544.
2022-06-17 01:12:50 +02:00
Vadim Zeitlin
a0ea9ba631 Fix data transfer to wxFileDialogCustomizeHook in non-wxMSW ports
Calling TransferDataFromCustomControls() in custom panel destructor
suffered from two fatal flaws:

1. It happened whether the dialog was accepted or cancelled, while
   we're only supposed to call this function when it's accepted.
2. It was done too late, when the customization hook itself could
   have been already destroyed, as it only has to live until ShowModal()
   returns but doesn't have (and typically doesn't) survive wxFileDialog
   itself.

Fix this by adding TransferDataFromExtraControl() and calling it
explicitly when, and only if, the dialog is accepted.

This fixes accessing invalid stack memory (thanks ASAN!) under GTK and
Mac and allows to remove the ugly workaround from wxMSW code, which can
now also just call TransferDataFromExtraControl().
2022-06-16 21:56:03 +02:00
Vadim Zeitlin
a68f8653d9 Deduplicate code for setting the selected filter index
It's identical for "Save" and "Open" dialogs, so don't repeat it twice.

No real changes.
2022-06-16 21:43:21 +02:00
Vadim Zeitlin
eb3adf73a4 Define NSSavePanel variable at function scope
As NSOpenPanel is a subclass of NSSavePanel, we can define "sPanel" in
any case, whether we're working with "Save" or "Open" dialog, and doing
this allows reusing this variable instead of writing another ugly cast.

Also use static_cast<> rather than C-style casts.

No real changes.
2022-06-16 21:40:47 +02:00
Vadim Zeitlin
93143152de Slight simplification in wxFileDialog code
Define "wasAccepted" variable and use it instead of testing "returnCode"
several times and setting another "result" variable, which is actually
not needed at all.

No real changes.
2022-06-16 21:38:39 +02:00
Vadim Zeitlin
bcff3d17e8 Remove unnecessary assignment in wxFileDialog code
"panel" here is an input argument, it's confusing to change it and it's
unnecessary anyhow, so just don't do it.

No real changes.
2022-06-16 21:35:13 +02:00
Artur Wieczorek
72b914c28d Simplify loops 2022-06-16 14:54:57 +02:00
Artur Wieczorek
a49a2e7390 Fix expression with different enum types
Arithmetic conversions on operands of different enumeration types
are deprecated in C++20 so we need to explicitly cast the operand
to the compatible type.

Closes  #22505.
2022-06-16 14:54:57 +02:00
Ulrich Telle
1198900b93
Fix issue #22526
GetSystemLocale() creates internally a default locale instance that is then queried for its identifier. Under Unix this fails, because GetLocaleId() returns any empty wxLocaleIdent. With this change the method will determine the identifier correctly for the default locale.
2022-06-16 14:42:02 +02:00
Kumazuma
3b6595184f Ensure wxMiniFrame title bar height is big enough in wxGTK
Hardcoded 16px could be insufficient for the font size being used,
resulting in the title text being truncated.

Closes #22534.
2022-06-16 13:06:25 +01:00
Vadim Zeitlin
dd5162ee1d Merge branch 'menu-bitmaps'
Fix changing menu bitmaps from wxEVT_MENU_OPEN and provide
wxMenuItem::GetBitmapBundle() in addition to GetBitmap().

See #22532.
2022-06-16 13:03:01 +01:00
Maarten Bent
40847aef4b CMake: Fix building with wxUSE_WEBVIEW_EDGE_STATIC
Add the directory only to the build interface, not to the install
interface. INTERFACE_LINK_DIRECTORIES can't use paths that are prefixed
in the source (or build) directory.

Closes #22524.
2022-06-16 13:02:15 +01:00
Vadim Zeitlin
258c865fc2 Merge branch 'filedlg-custom-transfer-earlier'
Fix calling TransferDataFromCustomControls() with common dialogs.

See #22522.
2022-06-16 13:00:59 +01:00
Randalphwa
385547a946 Add support for SetArtProvider in wxAuiNotebook XRC handler
Allow selecting between the "default" and "simple" providers for now, we
might want to extend this to allow user-defined providers in the future.

Closes #22515.
2022-06-16 12:59:58 +01:00
Vadim Zeitlin
f0ec9974a5 Remove the now unnecessary calls to SetupBitmaps()
After the changes of the previous commit, calling SetupBitmaps()
preemptively is not necessary any more, as it's called in any case just
before showing the menu, so remove the calls to it to simplify the code
and even make it slightly faster (at the cost of slowing it down before
opening the menu, but this needs to be done in any case to avoid
reintroducing the problem fixed by the parent commit).
2022-06-16 01:09:43 +01:00
Vadim Zeitlin
37950c1421 Make changing popup menu items in wxEVT_MENU_OPEN work again
Set up popup menu bitmaps after executing wxEVT_MENU_OPEN handler, so
that any changes to the menu item bitmaps done in it are taken into
account, as this only happens when SetupBitmaps() is called.

Closes #22530.
2022-06-16 01:09:43 +01:00
Vadim Zeitlin
5f8b900078 Add wxMenuItem::GetBitmapBundle()
This is needed to e.g. allow cloning a wxMenuItem fully without losing
any of its data.
2022-06-16 01:09:43 +01:00
Vadim Zeitlin
d0b32e71f5 Document wxMSW-specific wxMenuItem methods separately
Also remove obsolete note about having to call SetBitmap() before
appending the item to the menu as this is not true any longer since
quite some time.
2022-06-16 01:09:43 +01:00
Vadim Zeitlin
c0dbe808a6 Move SetBitmap() and GetBitmap() to wxMenuItemBase
Ensure that all derived classes have these functions and let them to
avoid defining them if they can just use the default implementation,
which was the case for most ports.

Also move m_bitmap to the base class from the derived ones.

No real changes.
2022-06-16 01:09:43 +01:00
Vadim Zeitlin
ddcb047234 Add dependency of richtext on html library to MSVS .sln files
Fix build problem by adding the missing dependency.

Closes #22510.
2022-06-15 23:45:47 +01:00
Kvaz1r
682c405f74 Don't make slider too thick in wxUniv
Avoid making it bigger than the best size as this doesn't look good.

Closes #22528.
2022-06-15 23:38:17 +01:00