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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.