Commit Graph

20106 Commits

Author SHA1 Message Date
Vadim Zeitlin
fdcaeb050f Move GetExtraControlSize() hack from wxFileDialogBase to MSW code
The hack with creating a dummy dialog just to get the size of the extra
controls is only used in wxMSW, so move it to MSW-specific file from the
common code.

To allow doing this there, add CreateExtraControlWithParent() helper,
which is still not really used anywhere else than in wxMSW, but at least
doesn't do anything particularly ugly and doesn't really penalize the
common code for wxMSW sins.

No real changes.
2022-06-03 01:35:31 +01:00
Vadim Zeitlin
751a73a2ca Add optional label to wxFileDialogCustomize::AddTextCtrl()
Creating a text with a label is a common operation and can be
implemented to look slightly better than AddStaticText() followed by
AddTextCtrl() without a label when using IFileDialog.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
095c4dfc94 Add event generation to MSW IFileDialog-based implementation
Inherit wxFileDialogCustomControl from wxEvtHandler to allow Bind()ing
to events on it and use this to handle wxEVT_BUTTON and wxEVT_CHECKBOX
in the sample.

And inherit from IFileDialogControlEvents in wxMSW code to actually
generate these events when they happen.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
359ab98cb2 Start adding new API for wxFileDialog customization
wxFileDialog::SetCustomizeHook() can be implemented in terms of
IFileDialogCustomize in wxMSW, which means that it can be used with the
new style dialogs shown by IFileDialog, unlike SetExtraControlCreator(),
which could only be supported when using older style common dialogs.

Add support for a few different controls and wxMSW implementation, more
controls, generic implementation and the documentation will be updated
later.

Also update the sample to show the new API in action and allow toggling
between using it and the old API for testing.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
0caddb4472 Document important COM implementation macro limitation
These macros can't be used with multiple inheritance, as they don't do
anything to cast the pointer to the correct type in this case.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
63f44b5bfa Call MSWOnInitDone() when using IFileDialog too
This allows to use the new style dialog for the file dialogs for which
Centre() or SetSize() had been called, as we can now position the window
even when not using a hook function.

As there is no IFileDialogEvents function corresponding to CDN_INITDONE
notification, use the first call to OnTypeChange() instead.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
a137145a44 Update the currently selected file when using IFileDialog too
Implement IFileDialogEvents::OnSelectionChange() to react to the changes
in the dialog selection.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
5bd765355b Make ConvertIShellItemToPath() public and rename
Extract a private function from src/msw/dirdlg.cpp, change its return
type to avoid losing information about the error and rename it to a more
clear name now that it's used outside of this file.

No real changes.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
0a1714b709 Start using IFileDialogEvents to get notifications about changes
For now only update the currently selected file type using this
interface, but it will be used for more notifications later.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
a341efec34 Add helper FileDialogGetFileTypeIndex()
This is just a refactoring to allow reusing this function later.

No real changes.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
db7cf34e30 Remove unused HWND parameter of MSWOnTypeChange()
Also simplify the hook function code a little by using OPENFILENAME
local variable directly instead of using OFNOTIFY only to always use its
OPENFILENAME member and nothing else.

No real changes.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
895b4a0710 Make wxFileDialog::MSWOnXXX() private
These functions were always marked as being implementation-only, but we
can actually do better and make them private, by making the dialog hook
function a (static) member of wxFileDialogMSWData and making this class
(which is now a class and not a struct any more, as it's not just a
collection of fields any longer) a friend of wxFileDialog.

No real changes.
2022-06-03 01:35:30 +01:00
Vadim Zeitlin
cf81527cfc Move private wxFileDialog members to wxFileDialogMSWData
No real changes, just make it possibly to add more fields to the private
struct in the future without affecting the ABI.

This commit is best viewed with git --color-moved
--color-moved-ws=ignore-all-space options.
2022-06-03 01:35:29 +01:00
Vadim Zeitlin
cdba0ba961 Add IFileDialog-based wxFileDialog implementation
If possible, i.e. if none of the features not supported by IFileDialog
are needed, prefer to use IFileDialog for wxFileDialog rather than the
old common dialog functions.

There are no real differences in appearance because the old functions
actually already forward to the new IFileDialog-based implementation
internally anyhow, if possible, but this provides us with more
flexibility and some things that were ignored by the common dialog
functions now work, such as setting the initial dialog directory.
2022-05-25 21:06:42 +01:00
Vadim Zeitlin
4bcbff00f3 Split wxIFileDialog::Show() in multiple functions
No real changes, just refactor the code to have separate ctor, setter
functions and Show() instead of doing everything in a single function.

This commit is best viewed ignoring whitespace-only changes.
2022-05-25 21:06:42 +01:00
Vadim Zeitlin
d77a373118 Extract wxIFileDialog::Show() from wxDirDialog code
Add a trivial class for showing an IFileDialog (and not just
IFileOpenDialog) and getting result(s) from it.

This class will be also used by wxFileDialog soon, but this commit only
updates wxDirDialog to use it.

This commit is best viewed with git --color-moved
--color-moved-ws=ignore-all-spac options.
2022-05-25 21:06:42 +01:00
Vadim Zeitlin
20430728bc Add wxFileDialog::ShowCommFileDialog()
No changes, just extract this function from ShowModal() before adding an
alternative implementation in the upcoming commits.
2022-05-25 21:06:41 +01:00
Vadim Zeitlin
411c150bba Merge branch 'print-preview-layout'
Print preview layout and appearance fixes.

See #22441.
2022-05-23 22:25:16 +01:00
Vadim Zeitlin
9042b529fa Merge branch 'dvc-bitmap-renderer-bundle'
Allow using wxBitmapBundle with wxDataViewBitmapRenderer.

See #22411.
2022-05-23 22:22:53 +01:00
Vadim Zeitlin
663fa1c77b Still use wxPreviewFrame size if it was explicitly specified
Even though it's better to not specify the preview frame size at all,
the size should still be used if it was explicitly specified, but this
didn't happen any more after the addition of the call to Fit().

Fix this now by only doing the equivalent of Fit() if no size was
explicitly given.

Also add advice about not setting the size explicitly to the
documentation.
2022-05-23 15:07:06 +01:00
Artur Wieczorek
21fe682187 Don't store wxBitmap objects on the heap in wxPropertyGrid
To simplify managing the life cycle of the objects.
2022-05-21 22:08:02 +02:00
Artur Wieczorek
5e417302c5 Don't store wxCursor object on the heap in wxPropertyGrid
To simplify managing the life cycle of the object.
2022-05-21 22:07:42 +02:00
Artur Wieczorek
44bc305eb1 Move code after #include directives 2022-05-21 22:05:33 +02:00
Artur Wieczorek
d872229be3 Get rid of redundant casts 2022-05-21 22:05:12 +02:00
Artur Wieczorek
6652243b6f Don't override Refresh() in wxPropertyGridManager
It just forwards call to the base class so it's redundant.
2022-05-21 22:04:26 +02:00
Artur Wieczorek
547afc66c4 Pass large object by a const reference 2022-05-21 22:03:08 +02:00
Artur Wieczorek
1c292cfe2c Initialize data members in initialization lists 2022-05-21 22:01:58 +02:00
Vadim Zeitlin
dd80f16fc2 Fix wxGTK build with glib < 2.50
This was recently broken by bffcb88266 (Optionally detect not filtered
GTK log messages, 2022-05-12), see #22424.

Fix it by providing a trivial "do nothing" version of LogFilterByMessage
even if we can't implement it -- this seems to be preferable to using
preprocessor checks in the code using it.

Closes #22434.
2022-05-18 18:47:37 +02:00
Vadim Zeitlin
2efa26cc1f Merge branch 'gtk-log-suppress'
Allow suppressing GTK log messages.

See #22424.
2022-05-17 16:36:06 +02:00
Vadim Zeitlin
bffcb88266 Optionally detect not filtered GTK log messages
In the future it might be useful to run the code with WXTRACE=gtklog to
see if any GTK log messages we're filtering don't need to be filtered
any longer.
2022-05-12 16:13:19 +02:00
Vadim Zeitlin
4602caf49d Add LogFilterByMessage GTK log filter
This will allow suppressing GTK log messages with the specified
fixed contents.
2022-05-12 00:34:14 +02:00
Vadim Zeitlin
f137f19bb7 Factor out wxGTKImpl::LogFilter from GTKSuppressDiagnostics()
Refactor the code to separate setting of the log callback from the
filtering decision.

Right now the only existing filter is the one just checking the log
level, which is used by GTKSuppressDiagnostics(), but this will allow
adding other filters in the upcoming commits.
2022-05-12 00:25:08 +02:00
Vadim Zeitlin
2ba9007d0e Add wxCHECK_CXX_STD() and use it to test for C++17 and C++20
Unlike direct tests of __cplusplus, using this macro also works with
(recent enough, i.e. MSVS 2015.3 or later) MSVC versions, even if
/Zc:__cplusplus is not used.

This simplifies some checks and makes some other ones (notably the check
for C++20 used before wxALLOW_COMBINING_ENUMS macro definition) work
with MSVC versions with C++20 support as intended.
2022-05-11 16:57:18 +01:00
Vadim Zeitlin
d311a07b7a Remove unnecessary test which was needed for macOS < 10.7 only
There is no need to check for the weird case of using a C++11 compiler
with C++98 standard library any longer, this is not supposed to happen
and we don't support macOS < 10.7 since a very long time anyhow.
2022-05-11 16:49:43 +01:00
Vadim Zeitlin
a7eee933c6 Merge branch 'tsan-warnings'
Fix a harmless warning from thread sanitizer and make wxAtomicInc() more
useful.

See #22417.
2022-05-11 02:37:26 +02:00
Vadim Zeitlin
bb52a5c5b5 Merge branch 'imaglist-mask'
Make handling of masks in wxImageList simpler and more useful.

See #22400.
2022-05-11 02:35:59 +02:00
Vadim Zeitlin
5a6adf4f58 Merge branch 'nanosvg-lib'
CMake: Support external NanoSVG library.

See #22407.
2022-05-11 02:33:38 +02:00
Maarten Bent
603c13aaba CMake: Add support for external NanoSVG library 2022-05-11 01:54:03 +02:00
Vadim Zeitlin
cf66ce5f94 Return the new value from wxAtomicInc() too
This is easy to do and can be useful when using an atomic initialization
counter.

The only platform where not returning the new value might be more
efficient than returning it is Solaris which is not really relevant any
more and on all the other platforms the functions we were already using
provided this value already (or almost, in case of using gcc builtins,
when we just have to use a different one).
2022-05-11 00:16:47 +02:00
Vadim Zeitlin
1b82a9fe04 Use wxBitmapBundle as default type in wxDataViewBitmapRenderer
The default type doesn't really matter after the previous commits, as
the renderer accepts both wxBitmap and wxBitmapBundle (and also wxIcon)
in any case anyhow, but it seems better to use the preferred type as the
default one.

Also make the documentation more useful, although an example is still
lacking.
2022-05-09 14:36:41 +02:00
Vadim Zeitlin
5556ea8429 Add support for storing wxBitmapBundle in a wxVariant
Define wxBitmapBundleVariantData without using the standard macros that
only work for wxObject-derived classes, but using more or less what they
expand into.

This will allow using wxBitmapBundle with wxDataViewCustomRenderer
subclasses in the upcoming commit.
2022-05-08 21:26:04 +02:00
Vadim Zeitlin
d8abdfbdee Accept either bitmaps or icons in wxDataViewBitmapRenderer
Allow using either wxBitmap or wxIcon in wxDataViewBitmapRenderer
independently of the type the renderer was created with because this is
convenient and there is no real danger in allowing to mix and match
bitmaps and icons together.

Override the just added IsCompatibleVariantType() to implement this.
2022-05-08 21:26:04 +02:00
Vadim Zeitlin
23e815bcf6 Allow relaxing the check for variant type in wxDataViewRenderer
Instead of checking for the exact variant type match, call the new
IsCompatibleVariantType() virtual function, which still does the same
check by default, but can be overridden to allow other types as well if
they're accepted by the renderer.

This will be soon used to allow accepting both wxBitmap (which must
still be accepted for compatibility) and wxBitmapBundle (which is the
simplest way to support high DPI) in wxDataViewBitmapRenderer at once.
2022-05-08 18:39:15 +01:00
Vadim Zeitlin
eb361a182a Use a single wxBitmapBundle in wxDataViewBitmapRenderer
Instead of using either a wxBitmap or a wxIcon, always use the same
wxBitmapBundle object to store whatever we are rendering.

This slightly simplifies the code and prepares for further changes, but
nothing real changes yet.
2022-05-08 15:55:34 +01:00
Vadim Zeitlin
dc90e92110 Add wxBitmapBundle::Clear()
This is just a convenient helper for resetting the bundle contents which
seems more readable than assigning an empty bundle to it.
2022-05-08 15:54:51 +01:00
DietmarSchwertberger
b6fb5109c0 Fix drawing of row/col drag markers in wxGrid
Don't offset the DC in the unwanted direction as this resulted in not
drawing anything at all when the grid was scrolled.

Also fix off by one error in the marker line length.

Closes #22403.
2022-05-07 18:58:07 +02:00
DietmarSchwertberger
84729af324 Fix handling of standard accelerators in wxSpinCtrl in wxMSW
Keys such as Ctrl-C etc could be unexpectedly intercepted by
accelerators defined for the menu items when wxSpinCtrl had focus.

Fix this by always preprocessing such keys in wxSpinCtrl itself, just as
it was already done for wxTextCtrl and even reuse the same function for
doing it (which had to be factored out in order to allow it).

Closes #22404.
2022-05-07 17:12:08 +02:00
Vadim Zeitlin
0e21b52d57 Extract mask creation from wxImage in a separate function
Allow reusing the code for creating a mask from wxImage mask from
elsewhere.

No real changes yet, this is a just a refactoring.

This commit is best viewed with git --color-moved
--color-moved-ws=ignore-all-space options.
2022-05-06 02:12:54 +01:00
Vadim Zeitlin
e75f100841 Make GetImageListBitmap() member of wxGenericImageList too
Just simplify the code a little by avoiding having to pass m_useMask and
m_size to all calls of this function.

No real changes.
2022-05-06 02:12:54 +01:00
Maarten Bent
931370f0ad Add NanoSVG setup options
An option to enable or disable using NanoSVG for rasterizing SVG files.
And an option to indicate an external NanoSVG library is used.
2022-05-05 22:15:49 +02:00