Commit graph

75532 commits

Author SHA1 Message Date
Vadim Zeitlin
a2a8fc1d65 Avoid harmless MSVC shadowing warning in the test
Using "argc" and "argv" for parameter names triggers C4458 with MSVS
2022, warning about hiding class members with the same names.

As we can't rename the latter, rename the parameters to avoid this.
2023-12-25 17:56:10 +01:00
Vadim Zeitlin
2573e61c19 Fix harmless MSVC warning about uninitialized variables in a test
MSVS 2022 gave C4701 when std::isinf(d) was used below in release build.
2023-12-25 17:24:55 +01:00
PB
24952d0203 Fix confusing argument names in wxPersistentWindow docs
Use the same argument name as in the actual code in the class
constructor as well as the convenience function, instead of
wrongly copypasted "book".

See also 33de6dc (Fix confusing wxPersistentTLW ctor argument name,
2023-12-22).

Closes #24158.
2023-12-25 17:11:53 +01:00
Artur Wieczorek
5725f0be41 Replace macro with inline function in wxPGPropertyGridIterator-related code
Replace wxPG_ITERATOR_CREATE_MASKS macro with inline function to ensure
type safety.
2023-12-25 15:10:14 +01:00
Artur Wieczorek
6a5b0667b5 Remove macro from wxPGPropertyGridIterator-related code
Remove simple wxPG_ITERATOR_PARENTEXMASK_TEST macro and use just the code
to increase code readability.
2023-12-25 15:10:08 +01:00
Artur Wieczorek
c8552aec0c Make wxPGPropertyFlags a bitmask
To improve type safety of flags.
2023-12-25 15:09:50 +01:00
Artur Wieczorek
1b5a43599a Preserve wxPGProperty parent while adding property to alphabetic items array
Real wxPGProperty parent has to be preserved for wxPropertyGridIterator
to work properly.
2023-12-23 18:58:33 +01:00
Artur Wieczorek
6dd129049f Initialize array for wxPropertyGrid alphabetic mode only once
Array holding items to use in non-categoric mode should be created and
initially populated only once.

Closes #24145.
2023-12-23 18:57:38 +01:00
Vadim Zeitlin
99434fa005 Add wx/persist/combobox.h to the headers list
In particular this ensures that it is installed by "make install".

See #24157.
2023-12-22 18:43:57 +01:00
Vadim Zeitlin
27585bf2c3 Hardcode minimal widget sample notebook size
Not doing this resulted in the window being tiny by default, so it's
better than nothing, even if it's clearly still not ideal.

See #24154.
2023-12-22 17:40:00 +01:00
ali kettab
7c592ba361 Make WidgetsPage pages scrollable in the widgets sample
Because some pages in the sample contain too much content to fit entirely
in the visible area of the page. Under wxQt port, this is true regardless
of the state of the window (whether it is maximized or not) some content
remains hidden and inaccessible.

Closes #24154.
2023-12-22 12:29:45 +01:00
Blake-Madden
a059061eb7 Replace wxDECLARE_NO_COPY_CLASS with deleted functions in samples
Use standard C++11 way of making classes non-copyable instead of
wx-specific macro.

Closes #24150.
2023-12-22 12:21:54 +01:00
mcorino
33de6dce6f Fix confusing wxPersistentTLW ctor argument name
Fix an obvious copy/paste error.

Closes #24156.
2023-12-22 12:18:29 +01:00
mcorino
f80e2459de Fix missing semicolon in HasMultipleSelection() documentation
Missing semicolon on latest method addition causes doxygen parsing
issues which in turn causes problems for dependent projects like wxRuby
and wxPython.

Closes #24155.
2023-12-22 12:18:29 +01:00
Scott Hanson
1bf80138e9 Fix wxDir compilation with wxUSE_STD_STRING_CONV_IN_WXSTRING
When enabling this build option, implicit conversion to wchar_t * is
not available, so convert wxString to it explicitly.

Closes #24149.
2023-12-22 12:18:29 +01:00
Paul Cornett
44248eb78a Support setting thickness when creating wxGauge with GTK >= 3.20
This stopped working in GTK 3.14, but became possible to fix in 3.20
with the addition of the "min-width"/"min-height" properties.
See #24107
2023-12-21 12:31:25 -08:00
Viachaslau Lisouski
ca405352e0 Add wxFileSystemHandler for "data" scheme
This notably allows embedding images directly in HTML.

Closes #24138.
2023-12-18 22:19:11 +01:00
Vadim Zeitlin
68eaff5c02 Merge branch 'valgen-wxlb_single' of https://github.com/wsu-cb/wxWidgets
Extend wxGenericValidator to work with single selection wxListBox,
3-state wxCheckBox and wxColourPickerCtrl.

See #24134.
2023-12-18 20:02:24 +01:00
Blake-Madden
0a743cdf12 Don't free a locked HGLOBAL in wxMSW printing code
This resulted in at least a use-after-free ASAN warning and possibly
actual memory corruption, so ensure that we unlock m_devMode before
freeing and resetting it.

Closes #24146.

Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>
2023-12-18 19:57:28 +01:00
Bill Su
ff68b61b84
Update interface/wx/valgen.h
Co-authored-by: VZ <vz-github@zeitlins.org>
2023-12-18 11:43:28 -05:00
Vadim Zeitlin
50325bd2cd Reset stored position in wxMSW wxFileDialog dtor, not ctor
As there is more then one ctor since 11ed91af8f (Add missing default
constructor of wxFileDialog in wxMSW, 2023-12-03), this code would need
to be duplicated in the default ctor too now, but it seems simpler and
more logical to move it to the dtor instead.

See #24113.
2023-12-18 16:51:58 +01:00
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
Vadim Zeitlin
eabaec546b Restore "wxSuffix" MSBuild macro for compatibility
Restore the macro removed in 0d6f2f2b85 (Remove wxSuffix from MSBuild
files, it's always "u" now, 2022-10-28) as it can still be used in the
user projects importing wx properties files and it doesn't cost anything
to keep it.
2023-12-18 15:06:33 +01:00
Blake-Madden
0a1042292d Don't add new line when copying only one wxGrid cell to clipboard
Append the new line character only before starting the next line instead
of doing it after each line to avoid having it when there is just one
line, as this as unexpected when copying a single cell.

Closes #24139.
2023-12-18 14:09:37 +01:00
Artur Wieczorek
41109f64f0 Initialize member variables 2023-12-17 16:47:52 +01:00
Artur Wieczorek
74bacb097f Guard function with wxCHECK rather than wxASSERT 2023-12-17 16:47:46 +01:00
Artur Wieczorek
d95074e48d Use dedicated function to get value from wxPGChoicesData 2023-12-17 16:47:40 +01:00
Artur Wieczorek
63805074df Use standard library function to swap items in the array 2023-12-17 16:47:35 +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
Artur Wieczorek
6afdde58b5 Make wxFloatProperty wxUILocale-aware.
wxUILocale settings (especially decimal separator) needs to be taken
into account while formatting and validating numbers.

Closes #24140.
2023-12-17 16:47:18 +01:00
Bill Su
fb6a7d5a8e wxGenericValidator: add support for wxCheckBoxState 2023-12-17 02:10:51 -05:00
Bill Su
486b25bd2a fix #include <> to "" 2023-12-14 21:26:57 -05:00
Bill Su
4d3acc90d7 wxGenericValidator: add wxColourPickerCtrl support 2023-12-14 19:17:32 -05:00
Bill Su
ea4800fcb9 comment that single-select wxListBox allows works with int 2023-12-14 18:58:53 -05:00
Bill Su
8dc3ef4307 document wxListBox::HasMultipleSelection() as public API 2023-12-13 18:31:54 -05:00
Bill Su
bdfeb19d19 HasMultipleSelection() is clearer than handling style bits 2023-12-13 18:26:19 -05:00
Bill Su
cfc5bc6ff2 more convenient API for wxGenericValidator + wxLB_SINGLE
For a single-selection wxListBox, using an int to transfer
data to/from wxGenericValidator is more convenient than
wxArrayInt.
2023-12-12 20:58:40 -05: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
f32e92d55b Merge branch 'splitter-highdpi'
Fix splitter in high DPI under wxGTK and wxOSX by not scaling the
positions by DPI there unnecessarily.

See #24126.
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
David Karoly
149a957f27 Fix wxAnyButton Current/Normal state under wxQt
Do not check for hasMouseTracking in QtGetCurrentState as mouse tracking
is always enabled in any widget derived from wxQtEventSignalHandler.

This resulted in an QtGetCurrentState reporting State_Current when it
should have reported State_Normal i.e. the button showed hovering state
when it was actually not hovering.

After the change, button state will show State_Current only if the mouse
pointer is actually hovered on the button.

Closes #24129.

Closes #24132.
2023-12-12 20:02:43 +01:00
Vadim Zeitlin
b4d5bce060 Make wxSTAY_ON_TOP TLWs transient for parent too in wxGTK
Normally such windows should be remain on top of all the other windows,
but at least under Wayland they do not, so make them at least remain on
top of their parent window -- which should do no harm anyhow and might
do some good (by allowing the WM to associate them with the correct
window) even if they do stay on top of everything.
2023-12-12 00:47:14 +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
809dabfd43 Adjust indent and spacing to DPI scaling
Move their actual initialization to InitVisualAttributes() where we
already have a valid window.
2023-12-11 02:14:04 +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
a98a1a8bd4 Don't put "if" statements on a single line
No real changes, just add line breaks to compound statements for
readability.
2023-12-11 02:06:44 +01:00
Vadim Zeitlin
17b6b9cd28 Simplify tree line height calculation and improve it in high DPI
Remove some code deciding to add 10% of line height between the lines
starting from the arbitrary cutoff of 30px, which was there ever since
f2593d0dda (Calling a Refresh() before the window is created no longer
gives an assert. ..., 1999-12-28) and just add 2 DIPs instead.

Also use FromDIP() for the extra space added to GetCharHeight().
2023-12-11 02:06:23 +01:00
Vadim Zeitlin
8bf8ae8636 Use narrower layout for wxGenericTreeCtrl in all cases
Indent and spacing values were reduced back in 618a5e382a (Applied
Greg's patch to tree control and related., 2001-08-18) compared to the
defaults of 15 and 18 pixels respectively, but only when not using
wxTR_NO_LINES style.

There doesn't seem to be any good reason to for these values to depend
on the style, so use the smaller values always, as they look better and
notably don't result in a lot of blank space between the branch toggle
icon and the image when using images.
2023-12-11 01:49:20 +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