Commit graph

20972 commits

Author SHA1 Message Date
Vadim Zeitlin
f8a6f0cd39 Initialize wxFileDialog::m_data in default ctor in wxMSW too
This corrects a problem introduced in 11ed91af8f (Add missing default
constructor of wxFileDialog in wxMSW, 2023-12-03) as m_data remained
uninitialized when default ctor was used.

See #24113.
2023-12-18 16:49:35 +01:00
Artur Wieczorek
41109f64f0 Initialize member variables 2023-12-17 16:47:52 +01:00
Artur Wieczorek
a8f3e0da70 Get rid of of unsupported overloads of wxIntProperty::DoValidation()
wxIntProperty::DoValidation() overloads for wxLongLong_t and wxULongLong_t
parameters are not supported because for these types there are no direct
conversions to wxVariant.
Arguments of such types will be handled by overloads for wxLongLong
and wxULongLong.
2023-12-17 16:47:30 +01:00
Blake-Madden
6d89a14c72 Add wxGrid::CopySelection()
This code was already used for Ctrl-C handling, refactor it into a
separate function that can be called from the application now.

This commit is best viewed with --color-moved-ws=ignore-all-space Git
option.

Closes #24124.
2023-12-12 20:18:59 +01:00
Vadim Zeitlin
188b5b8942 Merge branch 'generic-tree-icon-fixes'
Generic tree icon fixes, notably fixing regression in icons position in
high DPI for the legacy code using wxImageList.

See #24127.
2023-12-12 20:18:05 +01:00
Vadim Zeitlin
18ce5a07fd Merge branch 'misc-mac-fixes'
Some minor changes to get rid of a few warnings in Mac build.

See #24123.
2023-12-12 20:03:56 +01:00
Vadim Zeitlin
60f6c0f4e1 Adjust indent and spacing after DPI change if necessary
Although wxGenericTreeCtrl is not used under MSW by default, it still
doesn't hurt to adjust its metrics when DPI changes there.

Note that this shouldn't be done for the platforms using DIPs.
2023-12-11 02:19:02 +01:00
Vadim Zeitlin
7c7429c015 Stop using "short" for wxGenericTreeCtrl::m_indent
There doesn't seem no reason at all not to use "int" for this member.
2023-12-11 02:09:26 +01:00
Vadim Zeitlin
0999976f6d Fix using wxImageList in wxTreeCtrl in wxGTK in high DPI
The icons positioning was broken by 53b4f4ddf2 (Use physical size in
wxImageList, 2023-11-03) because the logical size was calculated
incorrectly in the case when wxImageList was used for the icons and
ended up being 8x8 for 16x16 icons when using 200% scaling, which was
clearly wrong and resulted in the icons not fitting in the space
allocated for them because they actually took 32x32 physical pixels due
to scaling of all bitmaps from wxImageList.

Fix this by correctly taking account of the window DPI scale factor.
This is a bit roundabout because using FromPhys() later just undoes
this, but it allows to keep using the same code when using wxImageList
and wxBitmapBundle for storing bitmaps and so is simpler.

Note that we must only do this when wxImageList was provided by the
user, i.e. with the legacy code, but not when it was created internally
in addition to wxBitmapBundle, as in this case we recreate it on DPI
change using the correct, DPI-adjusted size, already, so restrict this
scaling to the case when we don't have wxBitmapBundle only.

This commit is best viewed ignoring whitespace-only changes.
2023-12-11 01:47:10 +01:00
Vadim Zeitlin
5dffb76d0a Remove bool parameter from MacSetClipChildren()
This parameter was always "true" in the existing calls to this function
and the underlying UseClippingView() didn't support passing "false" to
it anyhow, so it seems simpler and more clear to just remove the
parameter.

It also avoids clang warnings about it being unused.

No real changes.
2023-12-11 00:41:48 +01:00
Vadim Zeitlin
d4b5c21de7 Fix compile-time check for macOS 11
This fixes warnings about MAC_OS_X_VERSION_11_0 not being defined when
using older SDKs, as 21da0e128d (Change wxRendererNative to use
NSCell-based methods under Mac, 2023-11-12) used a wrong name for the
version constant: since macOS 11 these constants don't use "X" in their
names any longer.

Remove this and add a comment to the place where we define them to
document this not quite obvious naming convention.
2023-12-11 00:40:16 +01:00
Paul Cornett
c3d1618cc8 Fix transitory visual glitch with wxBORDER_NONE on GTK3
Changing the CSS after adding child to already-showing parent
can cause a fleeting glimpse of the original style.
See #24105
2023-12-10 09:10:42 -08:00
ali kettab
5c46947c57 Fix wxStatusBar with field controls under wxQt
Postpone the creation of the QStatusBar fields until the first call to
SetStatusText(). This is to account for any field control added by the
user and also to avoid having to call UpdateFields() multiple times.

wxSTB_ELLIPSIZE_XXX and wxSTB_SHOW_TIPS supports are also implemented now.

The statbar sample is also updated: The OnSize() handler is removed because
it doesn't do much. that is: it is defined to keep the bitmap centered in the
status bar field it occupies if it is resized. but this is already done by the
wxStaticBitmap control, at least under wxMSW, wxGTK3 and wxQt.
2023-12-07 17:20:00 +01:00
ali kettab
02610d5d4b Remove trivial Init() from wxStatusBar under wxQt 2023-12-07 17:20:00 +01:00
ali kettab
d3bdf486b3 Don't override Refresh() in wxStatusBar under wxQt
This is not necessary and, more importantly, results in a crash if you try
to recreate the status bar (which can be seen in the statbar example)

Also remove leftover QList declaration
2023-12-07 17:20:00 +01:00
Blake-Madden
5ba009e861 Add Catholic Feasts holiday authority class (US observances)
This includes a static function to calculate Easter that can be used for
other authorities.

Document the wxDateTimeWorkDays and wxDateTimeHolidayAuthority classes.

Closes #24094.
2023-12-05 00:53:26 +01:00
ali kettab
2c9fee3d6f Add wxStatusBar::AddFieldControl() to simplify adding controls
This allows user codes to simply designate where their controls should
appear in the status bar without the need to handle wxEVT_SIZE
themselves.

They can still handle the event if the default positioning does not meet
their needs, but the new API is simpler and can be implemented for wxQt.

Closes #24092.
2023-12-05 00:39:04 +01:00
Kumazuma
11ed91af8f Add missing default constructor of wxFileDialog in wxMSW
This ctor exists in the other ports and there is no reason for it not to
exist in wxMSW too.

Closes #24113.
2023-12-03 15:03:12 +01:00
Vadim Zeitlin
6f501fd022 Merge branch 'qt-overlay' of https://github.com/AliKet/wxWidgets
Add native wxOverlay implementation under wxQt.

See #24080.
2023-12-03 15:00:34 +01:00
Vadim Zeitlin
7e2b0eea19 Merge branch 'args-init-improve'
Minor improvements to command line arguments initialization.

See #24103.
2023-11-30 02:53:44 +01:00
Vadim Zeitlin
5318637839 Merge branch 'fix_SVG_premultiply' of https://github.com/teliseo/wxWidgets
Fix wxBitmapBundle::FromSVG(), which renders incorrectly on GTK and add
wxHAS_PREMULTIPLIED_ALPHA to make the code dealing with alpha more clear
and correct.

See #24097.
2023-11-30 02:35:20 +01:00
Stefan Csomor
bcbc31e97f Fix clipping of scrolled windows under macOS Sonoma
We need to use a native clip view for things to behave correctly under
this OS version, otherwise scrollbars can be overdrawn by the window
contents.

Closes #24067.

Closes #24073.
2023-11-30 02:16:04 +01:00
Vadim Zeitlin
d4484c48c4 Rename wxInitData::InitializeFromWide() to InitIfNecessary()
And do nothing in this function if the arguments had been already
initialized, as it will make it more convenient to call from other
places.

No real changes.
2023-11-30 00:41:09 +01:00
Tim Eliseo
fce4941404 Add wxHAS_PREMULTIPLIED_ALPHA to abstract if wxBitmap pixels are premultiplied.
All previous relevant platform-specific tests have been changed to use this
symbol. Also, samples/image now premultiplies conditionally, correcting a
visual anomaly on wxGTK.
2023-11-26 13:23:52 -08:00
ali kettab
d205e331ce Added native wxOverlay implementation under wxQt 2023-11-23 22:49:15 +01:00
ali kettab
0c6e2fafd6 Make wxWindowDC work if constructed outside of a paint event under wxQt
Also prepare wxScreenDC to work with wxOverlay (in the upcoming commit)
2023-11-23 22:49:15 +01:00
ali kettab
41e9fc9a9a Fix wxClientDC not working under wxQt
The problem was: wxClientDC draws in a QPicture owned by the DC. In the destructor,
QtPictureSetter sets the picture to be used by the associated window and generates
a paint event, then resets the picture when it goes out of scope before the paint handler
has a chance to replay the image. In this commit, this setup is changed so that window
owns the picture instead and is responsible for deleting it when it is actually used.
2023-11-23 22:49:15 +01:00
Paul Cornett
4030f3b90c Remove extraneous semicolons 2023-11-23 09:25:03 -08:00
ali kettab
01959690cd Get rid of member variable declaration in wxWindowDC under wxQt
This is harmful because it hides the variable declared in the base class and
as a result, GetWindow() will always return nullptr.
2023-11-22 21:20:19 +01:00
Vadim Zeitlin
dede4b9326 Use "= default" for all trivial default ctors and dtors
Replace user-specified empty constructors and destructors with the
compiler-generated versions, which has a number of advantages for code
generation, in addition to being more clear.

Closes #22965.

Closes #24058.
2023-11-17 01:33:32 +01:00
Vadim Zeitlin
7a73044fd2 Merge branch 'tree-search'
Don't find hidden items when using incremental tree search.

See #24041.
2023-11-17 01:08:19 +01:00
Vadim Zeitlin
ba9fe3481d Merge branch 'gtk-dpi-changed'
Generate DPI changed event in wxGTK too.

See #24040.
2023-11-17 01:06:54 +01:00
Vadim Zeitlin
5a184d423b Merge branch 'qt-uiaction-tests' of https://github.com/AliKet/wxWidgets
Enable automatic tests using wxUIActionSimulator under wxQt.

See #24015.
2023-11-17 01:05:56 +01:00
Vadim Zeitlin
ef4fecc186 Merge branches 'tree-state-bmpbundle' and 'imglist-scalefactor'
Refactor wxImageList and convert it to use physical pixels and
add support for high DPI state images wxTreeCtrl using the new
wxImageList.

See #24000, #24033.
2023-11-17 01:03:27 +01:00
Vadim Zeitlin
8ca1be38e2 Add wxGenericTreeCtrl::DoGetNext(Next_Visible) function
This is similar but not totally identical to the existing
GetNextVisible() as it doesn't require the initial item itself to be
visible (notably, it could be the hidden virtual root).

It is also more efficient than the old GetNextVisible() implementation
calling GetNext() in the loop until finding a visible item, as it avoids
looking inside collapsed items in the first place.
2023-11-08 01:52:00 +01:00
Vadim Zeitlin
88a39aa6f8 Implement wxEVT_DPI_CHANGED generation for wxGTK
Just check if the scale factor has changed when getting a "configure"
event for a TLW as we're guaranteed to get one when the scale factor
does change, according to GTK documentation (and it does seem to work).

Closes #19290.
2023-11-07 20:57:31 +01:00
Vadim Zeitlin
7aef620715 Fix using bitmaps of different dimensions in wxWithImages
Although this is not ideal, it may still happen and sometimes can even
give acceptable results, e.g. using (16, 32) and (24) bitmap bundles
can actuall works nicely enough at x2 scaling if 16px bitmaps are
upscaled by the factor of 3.

To make this work, request the explicit physical bitmap size and
override its scale factor to ensure the resulting bitmap has the correct
logical size.
2023-11-07 00:47:07 +01:00
Vadim Zeitlin
baa56732fc Allow to get the size of all images in wxWithImages
This simplifies wxGenericTreeCtrl code but doesn't change much yet.
2023-11-07 00:26:53 +01:00
Vadim Zeitlin
6080dca576 Add wxWindow::WXNotifyDPIChange() for wxOSX and wxGTK
This refactors the already existing code in wxOSX to make it available
in the common class and allow reusing it in wxGTK.

No changes yet.
2023-11-06 23:51:30 +01:00
Vadim Zeitlin
e679e5d4c2 Replace Mac-only function with wxWindow::MakeDPIFromScaleFactor()
The new function does the same thing as the Mac-specific
OSXMakeDPIFromScaleFactor() that it replaces but is also defined in
wxGTK where it will be used too.
2023-11-06 23:51:28 +01:00
Vadim Zeitlin
089bf467a9 Allow passing const wxWindow* to more wxBitmapBundle methods
Take const pointer in GetConsensusSizeFor(), which only uses this
parameter to get the DPI scale factor, and CreateImageList(), using it
only to pass it on to GetConsensusSizeFor().

No real changes.
2023-11-06 22:05:25 +01:00
Vadim Zeitlin
53b4f4ddf2 Use physical size in wxImageList
This seems to be the only way to fix using this class, which is
fundamentally incompatible with high DPI support, with bitmaps of
different logical but identical physical sizes.

By using physical size we ensure that the code chopping up the provided
bitmap in multiple images doesn't do it with the bitmap having the same
physical size but a different logical size from all the other bitmaps.
And, conceptually, logical size of the bitmaps in it really shouldn't
matter to the image list as it doesn't have a scaling factor and so
can't do anything useful with the logical size.

Moreover, we can't add wxImageList::SetScaleFactor() neither because
this class is, by design, supposed to be shareable between different
controls which may use different scale factors, so it doesn't make sense
to speak of the scale factor of the image list itself.

This undoes the changes made in the generic implementation back in
c374eefd34 (Fold wxOSX-specific wxImageList into generic version,
2018-10-30) and also eb52e86553 (Take into account scale factor of
images added to wxImageList, 2021-04-03).

Also update a couple of places where wxImageList is still used to use
physical sizes. Unfortunately some others can't be easily fixed, e.g.
global wxFileIconsTable would have to be completely rewritten.

Finally, add a unit test checking that things work as expected now:
previously the size of 24x24 bitmap in the image list containing
(scaled) 32x32 bitmaps would be 21x21 due to sub-bitmap extraction
kicking in.

Closes #23994.
2023-11-06 21:18:34 +01:00
Vadim Zeitlin
a0f7980295 Add wxAuiTabCtrl::DoEndDragging()
No real changes, just refactor the code to reset all drag-related
variables in a single function instead of doing it manually in several
places.

As this function also resets m_clickTab, which could previosuly remain a
dangling pointer, change the code to get its value before calling it.
2023-11-06 00:11:52 +01:00
Vadim Zeitlin
0fd15e405f Initialize wxAuiTabCtrl members in their declarations
Ensure that all of them are initialized, including m_clickTab, which
didn't seem to be always initialized before.

No real changes (as m_clickTab doesn't seem to have been used before it
was initialized).
2023-11-06 00:05:50 +01:00
Vadim Zeitlin
0d4792cc2d Refactor wxImageList classes to use wxImageListBase
This ensures that the native MSW and generic implementations provide the
same API by forcing them to implement the same pure virtual functions.
2023-11-03 01:53:36 +01:00
Vadim Zeitlin
3f971f52c1 Add using declaration for ctors to generic wxImageList
Instead of explicitly forwarding the ctors to the base class manually,
just use them.
2023-11-03 01:38:59 +01:00
Vadim Zeitlin
0003ac6873 Replace wxImageList::Init() with member initializers in wxMSW
No real change, just initialize members in their declarations and get
rid of now unnecessary Init().
2023-11-03 01:36:00 +01:00
Vadim Zeitlin
260a109db6 Remove outdated comment about making wxImageList ref counting
This hasn't happened since 26 years, so don't pretend it's going to
happen now that this class is semi-deprecated.
2023-11-03 01:27:57 +01:00
Vadim Zeitlin
f9a22962e0 Add wxTreeCtrl::GetStateImageCount() and HasStateImages()
Add these functions for consistency with SetStateImages() and to avoid
using GetStateImageList() in the treectrl sample, which can now use
GetStateImageCount() instead.
2023-11-03 00:53:40 +01:00
Vadim Zeitlin
308e902102 Add wxTreeCtrl::SetStateImages()
Unlike the existing SetStateImageList() function, the new one allows to
provide the high-resolution versions of the state images too.

Update the treectrl sample to use the new API.

Closes #23993.
2023-11-03 00:53:40 +01:00