Commit Graph

68420 Commits

Author SHA1 Message Date
Vadim Zeitlin
f72f2bec3a Merge branch 'dpi-stc' of https://github.com/MaartenBent/wxWidgets
Fix and improve DPI handling in wxStyledTextCtrl.

Fix cursor size after DPI change.

Enable handling DPI events in wxSTCPopupWindow and other popup windows
(that do not inherit from wxTopLevelWindow).

Some cleanup of STC example, and add option to select drawing
technology.

See https://github.com/wxWidgets/wxWidgets/pull/1885
2020-06-09 23:56:37 +02:00
Vadim Zeitlin
de2fba540b Document wxSizer::RecalcSizes() and RepositionChildren() better
Mention that RecalcSizes() shouldn't be called any more, after the
changes of 622deec262 (Replace wxSizer::RecalcSizes() with
RepositionChildren(), 2015-10-11), and that RepositionChildren()
replacing it shouldn't be directly called neither.
2020-06-08 13:26:59 +02:00
Maarten Bent
9b8cc49568 Fix missing include for WM_DPICHANGED 2020-06-07 19:14:36 +02:00
Maarten Bent
71773d40ab Avoid ugly casts to wxMemoryDC 2020-06-07 19:14:05 +02:00
Vadim Zeitlin
0d68a6d42e Fix formatting of @since in the list items in wxGauge docs
The line break after "Since" doesn't look good in this context, so avoid
using @since and spell it out explicitly.
2020-06-07 18:55:11 +02:00
Vadim Zeitlin
90783fec05 Merge branch 'generic-dvc-improve-dnd'
Improve drag-and-drop in generic wxDataViewCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/1836
2020-06-07 17:22:05 +02:00
Konstantin S. Matveyev
1795ecdb78 Show the proposed drop index in the dataview sample
This allows to check interactively that the proposed index is set
correctly depending on the drop position.
2020-06-07 17:21:35 +02:00
Vadim Zeitlin
f9780847b8 Refactor dialog testing code to avoid gcc 10 -Wduplicated-branches
The old version resulted in

error: this condition has identical branches [-Werror=duplicated-branches]
    |                                 (dlg ? typeid(*dlg) : typeid(T)).name());
    |                                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~

from gcc 10 when compiling with -O2.

Change the code to avoid using this condition entirely: not only this
avoids the warning, but it also makes it unnecessary to make
wxGetDialogClassDescription() function a template, so should result in
slightly faster compilation and smaller code size too.

No real changes.
2020-06-07 13:00:14 +02:00
Ian McInerney
0941b25a97 Improve wxBitmapButton best size for small bitmaps in wxOSX
The correct condition for adding the extra border to the buttons that
would be clipped without it due to the bezel style used for them is to
check that their height is < 20, as SetBezelStyleFromBorderFlags(),
which determines the bezel to use, does, and not if their width is 16,
as this is not the same thing, especially for non-square buttons.

Closes https://github.com/wxWidgets/wxWidgets/pull/1887
2020-06-07 12:47:56 +02:00
Paul Cornett
d0ed90075c Fix wxToggleButton image when state is changed programmatically
See #18779
2020-06-02 12:16:57 -07:00
Vadim Zeitlin
cbe21c0cc9 Recommend SetMinSize() instead of wxSizerItem::SetInitSize()
It's not really clear why do we have this function at all, but
SetMinSize() name is more clear and consistent with wxWindow, so prefer
using it instead.
2020-06-02 18:33:57 +02:00
Ian McInerney
68561ecea8 Minor doc fixes for wxSizerItem methods
Fix typo in GetRatio() documentation and add documentation for
SetInitSize().

Closes https://github.com/wxWidgets/wxWidgets/pull/1882
2020-06-02 18:33:02 +02:00
Stefan Brüns
d56d676450 Add missing QPainterPath include required with Qt 5.15
The header is no longer pulled in by QPainter, omitting it causes
failing builds due to incomplete type QPainterPath.

Closes https://github.com/wxWidgets/wxWidgets/pull/1880
2020-06-02 16:48:38 +02:00
Maarten Bent
379cff7d19 Fix building with wxUSE_POPUP==0 2020-06-01 18:16:52 +02:00
Vadim Zeitlin
5b810b129d Fix wxUIActionSimulator::Text() parameter documentation
This function explicitly accepts ASCII strings only, so it's limited to
"const char*", but was incorrectly documented as taking wxString.

Closes https://github.com/wxWidgets/wxWidgets/pull/1879
2020-06-01 17:25:41 +02:00
Maarten Bent
5fa8280fd8 Hide wxSTC popup when the DPI changes
After a DPI change, the position of the popup is wrong. It is not shown at the
cursor position anymore.
The correct size and position are calculated by scintilla, and there is no easy
way to access this without modifying scintilla sources.
2020-06-01 17:02:08 +02:00
Maarten Bent
54e0521fd7 Improve setting wxSTCPopupWindow size
DoSetSize needs to accept absolute size, because other code can call it.
2020-06-01 16:55:42 +02:00
Maarten Bent
83a98e1a3c Handle DPI change in wxSTCListBox popup 2020-06-01 16:54:54 +02:00
Maarten Bent
4700298c26 Move DPI handling from wxTopLevelWindow to wxNonOwnedWindow
This way, other windows (like wxPopupWindow) will also be able to handle DPI events.

Override InheritAttributes() and use it to set the initial DPI values.
2020-06-01 16:47:50 +02:00
Maarten Bent
a29aae25fc Use a different font for the MinimalEditor in the STC example
wxSYS_ANSI_FIXED_FONT uses 'Courier' font, which is rendered small on high DPI displays.
Use wxFONTFAMILY_TELETYPE instead, which will use font 'Courier New'.
2020-06-01 16:47:50 +02:00
Maarten Bent
a500c60feb Add option to STC example to select drawing technology 2020-06-01 16:47:50 +02:00
Maarten Bent
0195d82832 Remove unimplemented functions and code from STC example 2020-06-01 16:47:50 +02:00
Maarten Bent
951974f808 Reset the wxSTC cursor when the DPI changes
This causes the cursor to be recreated (when necessary) at the correct DPI.
2020-06-01 16:47:47 +02:00
Maarten Bent
6eb357f038 Improve DPI handling in wxSTC
Adjusting the zoom level does not work correctly. It could lead to ever
increasing zoom.
Instead, set the correct DPI of the underlying device context.
2020-06-01 16:45:21 +02:00
Maarten Bent
9b0cdc8d7d Only create the wxSTC cursor when it is needed 2020-06-01 16:07:49 +02:00
Maarten Bent
5166ddea2b Create cursors with correct size when DPI changes
GetIconInfo does not return DPI aware results.
Adjust it to the DPI of the display that shows the cursor.
2020-06-01 16:07:48 +02:00
Vadim Zeitlin
66c8437952 Add notes about standard threading classes to the documentation
There is no reason to use wxMutex and wxCondition in C++11 programs as
they have about the same API as the corresponding standard classes but
are, well, non-standard.

wxThread API is different from std::thread, so it's a less obvious
replacement, but still at least mention the standard class in its
documentation.
2020-06-01 15:10:24 +02:00
Vadim Zeitlin
192e8befb8 Fix example showing wxMutex usage in documentation
Fix wrong use of pointer and wrong variable name.

Closes #18778.
2020-06-01 15:04:45 +02:00
Vadim Zeitlin
68feb3e7ff Fix linking monolithic wxMSW DLL after STC IME changes
Link wxMSW monolithic library with imm32.lib as it's not required by
wxscintilla.lib.

This should have been been part of f730da3c14 (Add imm32.lib to
wxStyledTextCtrl, 2020-05-10).

See https://github.com/wxWidgets/wxWidgets/pull/1852

Closes #18776.
2020-05-31 14:33:30 +02:00
Vadim Zeitlin
789c7cec7b Merge branch 'grid-col-row-sel'
Fix returning duplicates from Get{Row,Col}Selection(); add more tests.

See https://github.com/wxWidgets/wxWidgets/pull/1874
2020-05-31 00:43:23 +02:00
Jouk
e59a5d17da Make gtk1.x happy again 2020-05-29 09:16:25 +02:00
Vadim Zeitlin
27495c5484 Merge branch 'textctrl-getsizefromtextsize'
Improve wxTextCtrl and wxSpinCtrl sizing under macOS.

See https://github.com/wxWidgets/wxWidgets/pull/1861
2020-05-28 02:21:35 +02:00
Vadim Zeitlin
316bbd2189 Use the same code in generic wxSpinCtrl in all ports
Use Mac version for the other ports too, instead of the weird hardcoded
numbers introduced back in 40aa1a7e60 (Implement GetSizeFromTextSize()
for wxSpinCtrl., 2012-11-20) which don't make much sense, as they use
vertical text control size to determine the horizontal size of the spin
control.

Do not use the max of spin button height and text control height,
however, as we really want to have the same height as just a normal text
control.
2020-05-28 02:13:43 +02:00
Vadim Zeitlin
8189ce89ed Improve wxTextCtrl::DoGetSizeFromTextSize() in wxOSX
Always return fully initialized wxSize value, even if one of the input
values is unspecified.

Also use TEXTCTRL_BORDER_SIZE to make it slightly more clear what's
going on.
2020-05-28 02:13:43 +02:00
Vadim Zeitlin
43c9b9f658 Use TEXTCTRL_BORDER_SIZE symbolic constant in wxTextCtrl code
This is more readable than hardcoded 5.

No real changes.
2020-05-28 01:34:59 +02:00
Vadim Zeitlin
52eec83245 Merge branch 'pr_fix_macos_hotlight_color' of https://github.com/obfuscated/wxWidgets
Implement wxSYS_COLOUR_HOTLIGHT on macOS.

See https://github.com/wxWidgets/wxWidgets/pull/1841
2020-05-28 01:24:56 +02:00
Vadim Zeitlin
07e36f9bbf Fix error message for failure to load PNG from resources
Remove the extraneous comma which replaced the resource name with the
second part of the error message, resulting in confusing output.

See #18773.
2020-05-27 14:15:15 +02:00
Vadim Zeitlin
5a5ed51528 Merge branch 'aui-repaint-optimize'
Optimize AUI repainting under MSW and always use live resize mode with
GTK3.

See https://github.com/wxWidgets/wxWidgets/pull/1869
2020-05-27 13:40:04 +02:00
Vadim Zeitlin
3307000baa Add wxGrid::GetSelectedRowBlocks() and GetSelectedColBlocks()
These functions are much simpler to use in the application code using
wxGrid in row- or column-only selection mode than GetSelectedBlocks()
itself because they take care of deduplicating, ordering and squashing
together the adjacent ranges, so that the application can use their
results directly, unlike with GetSelectedBlocks().
2020-05-27 03:19:34 +02:00
Tomay
9990d91dfc Fix generated documentation for wxZipEntry::GetInternalName()
Remove the group around it to avoid problems due to the existence of
another overload.

This completes the changes of ca59d38cfd (Add missing static to
wxZipEntry::GetInternalName() documentation, 2020-05-25).

Closes https://github.com/wxWidgets/wxWidgets/pull/1876
2020-05-27 01:46:59 +02:00
Vadim Zeitlin
d48013a322 Disable OpenGL functions deprecation warnings in wxOSX
Don't generate dozens of deprecation warnings (one for each OpenGL
function used in the code) for any program using wxGLCanvas being built
using macOS 10.14 or later SDK.

Closes https://github.com/wxWidgets/wxWidgets/pull/1875
2020-05-27 00:28:21 +02:00
Vadim Zeitlin
445ccb23cc Simplify using wxIntSortedArray in wxGridSelection code
There is no need to specify the comparison function when defining the
variables of this type when we can just specify it once when defining
the array type itself.

No real changes.
2020-05-26 16:37:26 +02:00
Vadim Zeitlin
340a86b3de Use more efficient storage for wxIntSortedArray
As this array contains ints, store them in wxVector<int> instead of
taking twice as much memory (in 64 bit builds) by storing them in
wxVector<void*>.
2020-05-26 16:34:02 +02:00
Vadim Zeitlin
92b6a55fd6 Fix returning duplicates from Get{Row,Col}Selection()
The "unique" rows/columns arrays used in the implementation of these
functions were not unique at all, as we happily added duplicates of the
existing items into them. Fix this by checking that a row/column is not
already present before adding it.

Add a (previously failing) unit test checking that this works correctly
with overlapping selected blocks.
2020-05-26 16:32:05 +02:00
Vadim Zeitlin
f268c02c19 Use "uniqueCols" for an array containing column indices
No real changes, just don't use misleading "Rows" in the name of a
variable containing column indices.
2020-05-26 16:31:34 +02:00
Vadim Zeitlin
f1425dad13 Don't hard code grid lines colour in wxGrid
Use wxSYS_COLOUR_BTNFACE instead of the hardcoded value of this colour
in "Windows Classic" theme, which was probably used back when the commit
73145b0ed1 (Applied patches by Scott Pleiter:, 2002-12-09), which was
supposed to change wxGrid to use system colours (among other things),
was done.

Nowadays wxSYS_COLOUR_BTNFACE is 0xF0F0F0 rather than 0xC0C0C0, which is
quite different visually, but it still seems better to use the system
colour rather than the fixed value, especially for platforms with dark
mode support.

Closes https://github.com/wxWidgets/wxWidgets/pull/1866
2020-05-26 15:11:02 +02:00
Vadim Zeitlin
37b2918c9c Don't consume all 'C'/Insert key presses in wxGrid
Skip the key events other than Ctrl-C/Ins which are used for copying
grid contents to the clipboard, notably Alt-C which should still be
usable for opening the menus.

This fixes a problems introduced in 67c1c412c6 (Implement support for
copying wxGrid cells to clipboard, 2020-04-26), see #13562.
2020-05-26 02:00:18 +02:00
Tomay
ca59d38cfd Add missing static to wxZipEntry::GetInternalName() documentation
Closes https://github.com/wxWidgets/wxWidgets/pull/1872
2020-05-25 22:46:15 +02:00
Vadim Zeitlin
e2562b08a4 Explain that wxApp::OnInitCmdLine() must not call Parse()
Make it clear that this method should only set up the command line
options to recognize, but not actually parse them.

See #18771.
2020-05-25 22:40:11 +02:00
PB
824b36fdc5 Really close the <Import> tag in the comment in wxwidgets.props
Corrects a mistake introduced in a supposed fix in commit a27a7e0,
where the XML-tag-closing slash was wrongly places inside the quotes.

Closes https://github.com/wxWidgets/wxWidgets/pull/1870
2020-05-25 19:12:53 +02:00