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.
There is no need to call this function, just call CreateExtraControl()
directly -- it will do nothing if there are no extra controls to create.
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.
Using the helper macros won't work with multiple inheritance that is
going to be used in the upcoming commits.
We also don't need real reference counting here, so simplify the code by
not using it.
The calls to SetSize() were doing nothing because our own overridden
DoGet{Position,Size}() fooled it into thinking that the window already
had the correct geometry.
Return the actual position and size during MSWOnInitDone(), i.e. when we
have a correct HWND, to prevent this from happening.
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.
Instead of requiring the function itself to use GetParent(), call it in
the hook function and pass the actual dialog HWND to MSWOnInitDone().
No real changes, just refactoring to prepare for further changes.
Call it from the hook function when it gets CDN_INITDONE notification
instead.
This doesn't change anything yet, but will when MSWOnInitDone() is
called from elsewhere.
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.
It was confusing to take the notification code from NMHDR itself in one
place and then from OFNOTIFY just below -- use NMHDR in both places, as
OFNOTIFY field refers to the same thing.
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.
Use different functions for the case of multiple paths and a single path
as they are rather different and even use methods of different
interfaces, which will become important soon.
Also pass just raw pointers to these functions, there is no reason to
use wxCOMPtr here as these functions don't take ownership of the
pointer but just use it during their execution.
No real changes yet.
This commit is best viewed ignoring whitespace-only changes.
This is more flexible and will allow using this function for the file
(and not just directory) dialog too in the future and makes the code
more readable and robust already because it removes the use of
non-obvious boolean parameters.
No real changes.
No real changes, just don't use a separate helper function for something
that we do only once to avoid an extra level of indirection which
doesn't help the comprehensibility of this code.
This commit is best viewed with git --color-moved option.
Add support for the missing wxBU_NOTEXT style, bitmaps for the other
than default states (pressed, focus, disabled and current) and margins
to wxBitmapXmlHandler.
Note that the images for the other states were previously already
supported by wxBitmapButton XRC handler, but not by the wxBitmap one,
even though both bitmap classes support them.
Closes#22451.
Using GetContentScaleFactor() worked just fine for wxOSX and wxGTK,
where it's the same as GetDPIScaleFactor() anyhow, and, until recently,
didn't matter for wxMSW where the scale factor was just ignored.
However since 9e5c8a8027 (Respect bitmap content scale factor in wxMSW
wxMemoryDC, 2022-03-26) it is important to specify the actually correct
scale factor when creating the backing bitmap in wxSTC code, as
otherwise wxMemoryDC would try to compensate for it by rescaling the
font, which should be unnecessary and resulted in a very noticeable
performance regression.
Simply using GetDPIScaleFactor() fixes the problem for wxMSW without
affecting the other platforms.
Closes#22450.
Don't use FromDIP() with m_usedImgSize which is expressed in logical,
and not DPI-independent, pixels already and also update the image size
when the DPI changes.
Closes#22436.
This function didn't work at all in this case because the drag context
wasn't set in target_drag_data_received(), unlike in all the other
callbacks.
Do set it here too to fix it, this notably makes dropping data on
generic wxDataViewCtrl work correctly in wxGTK.
Closes#22453.
Recent changes to wxGrid (see #22292) resulted in an assertion being
triggered when dragging row or column to the corner window. Fix this by
adding a check for the new position validity.
Closes#22432.
Closes#22443.
This was broken by 6feeed9fe9 (Handle transparency to the best of our
ability in wxImageList, 2022-05-05) as using alpha, rather than mask,
for these images resulted in alpha channel being just ignored.
Work around this by making at least one pixel not quite transparent in
this case.
This also makes things work for images using alpha channel with only 0
values, rather than mask covering the entire bitmap.
See #22400.
Closes#22437.
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.