Commit graph

72880 commits

Author SHA1 Message Date
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
Maarten Bent
efa5cfcaa9 CMake: Prevent double directory separators 2022-06-18 15:37:52 +02: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
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
Vadim Zeitlin
7de27d30ac Destroy global wxConfig even if main loop didn't run
Move the code freeing the global wxConfig object from wxApp::OnExit(),
which is called only after running the main loop, to wxApp::CleanUp(),
which is always called.

This fixes memory leaks when not running the main loop at all, as e.g.
when showing a modal dialog instead of doing it.
2022-06-15 20:27:34 +01:00
Vadim Zeitlin
08cd516749 Document that clang is required for building wxOSX
Due to the use of Apple-specific extensions in the SDK headers, gcc
can't be used to compile wxOSX any more.

Closes #22519.
2022-06-15 03:07:11 +02:00
Paul Cornett
a35705d8e0 Fix wxBitmap::GetSubBitmap() with GTK3 when bitmap is HiDPI
The rectangle needs to be scaled to the bitmap.
2022-06-14 11:42:59 -07:00
Paul Cornett
8e4a4c8dc6 Fix wxDC::Blit() with GTK3 when source bitmap is HiDPI
The source coordinates need to be scaled to the bitmap.
See #22512
2022-06-14 11:38:47 -07:00
Vadim Zeitlin
7f3baa9abf Rename wxMenuItem::m_bmpChecked to m_bitmap in wxMSW and wxUniv
These two ports were the only ones to use something other than m_bitmap
for wxBitmapBundle storing the item bitmap, rename it for consistency
with the other ports and to allow moving this field into the base class
in the upcoming commit.

No real changes.
2022-06-14 18:27:07 +01:00
Paul Cornett
64171daf74 Avoid blurred mask edges in DrawBitmap() and Blit() when scaling with GTK3
CAIRO_FILTER_NEAREST also needs to be set for the mask.
2022-06-13 11:48:37 -07:00
Vadim Zeitlin
78f30e3e56 Document that clang is required for building wxOSX
Due to the use of Apple-specific extensions in the SDK headers, gcc
can't be used to compile wxOSX any more.

Closes #22519.
2022-06-12 21:16:29 +02:00
Vadim Zeitlin
475c2ca201 Add an example of customizing "Save" file dialog too
Show doing it in the sample and also add a missing line to the example
in the documentation.
2022-06-12 00:51:31 +01:00
Vadim Zeitlin
88bade66ac Fix creating IFileDialog-based "Save" file dialogs
We need IFileDialog and not an IFileOpenDialog when creating a generic
file dialog, all the code had been already updated to only use the
former and not the latter, except for CoCreateInstance() itself which
still always asked for the latter, resulting in a failure when trying to
obtain IFileOpenDialog from a "Save" file dialog not providing it.

Also update some log messages to use the generally correct interface.

See #22521.
2022-06-12 00:51:20 +01:00
Vadim Zeitlin
124e3116b5 Fix calling TransferDataFromCustomControls() with common dialogs
When using common dialogs, because IFileDialog-based implementation is
not available either at compile- or run-time, this function needs to be
called while the extra controls still exist, i.e. before ShowModal()
returns, so do it from CDN_FILEOK handler.

Move the code that called it previously into the new MSWOnFileOK() for
consistency with the other callbacks.

Closes #22521.
2022-06-11 23:39:03 +01:00
taler21
1a5bb42407 Fix refresh after calling generic wxListCtrl::EnsureVisible()
The control still needs to be repainted after calling
RecalculatePositions(), so don't reset the dirty flag in it and do it
only in RecalculatePositionsAndRefresh() instead.

Arguably, EnsureVisible() should call the latter function itself, but
don't change this for now and just correct the regression caused by the
changes of d8fe06891e (Avoid bool argument in wxListMainWindow::
RecalculatePositions(), 2021-08-06).

Closes #22511.
2022-06-11 17:46:14 +02:00
Adrian Lopez
f59ae865db Fix TAB navigation in wxSimplebook
Derive wxSimplebook from wxNavigationEnabled<>: this is needed for at
least wxGTK and shouldn't do any harm even for the platforms where TAB
navigation worked even without it, such as wxMSW.

Closes #22517.
2022-06-11 15:19:31 +02:00
Vadim Zeitlin
96cb1b5d7d Add new wx/filedlgcustomize.h to the list of files
Notably install it together with the other headers.

Closes #22516.
2022-06-11 15:13:38 +02:00
Randalphwa
d7c7d95cc9 Add wxAUI_TB_DEFAULT_STYLE as valid style
Also, fix incorrect filename in header block.
2022-06-10 11:36:50 -07:00
Vadim Zeitlin
e7785ac224 Merge branch 'bmp-read-fixes'
Fix and improve/simplify BMP reading code, in particular restoring
support for loading BI_BITFIELDS bitmaps broken some time ago.

See #22504.
2022-06-10 17:17:56 +01:00
Vadim Zeitlin
7faa70a4a9 Merge branch 'listctrl-col-count'
Ensure wxListCtrl::GetColumnCount() behaves consistently on all
platforms with wxLC_LIST style.

See #22497.

Closes #22482.
2022-06-10 17:16:47 +01:00
Vadim Zeitlin
84de9c0ac3 Activate macOS applications with LSUIElement set to true manually
Without doing this, such applications (e.g. wxTaskBarIcon-based ones)
don't get any events on startup and wxApp::OnInit() doesn't get called.

See #22508.

Closes #16156.
2022-06-10 18:14:46 +02:00
Randalphwa
8083c9440c Minor fixes to XRC format overview
Fix missing option description, wrong handler name in an example.

Closes #22503.
2022-06-10 18:14:35 +02:00
Vadim Zeitlin
94a7251d81 Make the issue template even more prescriptive
Some things that seem too obvious to say apparently are not, so do say
them explicitly, as having the leftover from the template in the bug
reports is really confusing.
2022-06-10 18:14:35 +02:00
Roberto Boriotti
7c80ad47c3 Update Italian translations for 3.1.7 2022-06-10 18:14:35 +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
Paul Cornett
3423df5fdb Remove some duplicated branches
The two LOCALE_S* values are the same, so just use the newer one.
2022-06-10 07:39:53 -07:00
Paul Cornett
f576b21366 Fix object identifier comparison for 64-bit in WM_GETOBJECT handler
LPARAM is a signed 64-bit type, and OBJID_CLIENT is defined as ((LONG)0xFFFFFFFC),
so converting to LPARAM will sign-extend and the comparison will always fail.
Fixed by comparing as DWORD, as the Microsoft documentation recommends.
2022-06-10 07:34:02 -07:00