Commit Graph

67209 Commits

Author SHA1 Message Date
Artur Wieczorek
96cb3b6714 Add tests of retrieving sub-bitmaps 2019-09-29 16:16:55 +02:00
Vadim Zeitlin
66526adf7a Document issues with event handlers called when mouse is captured
Notably mention that showing modal dialogs won't work in this case.

Also link to this explanation from wxListCtrl documentation as
wxEVT_LIST_ITEM_SELECTED is one of the perhaps less expected cases in
which this problem arises.

See #9973.
2019-09-29 14:57:59 +02:00
Vadim Zeitlin
7a1bc568e5 Document that move events are only generated for non-TLW in wxMSW
wxGTK only sends these events for TLWs.

Closes #18485.
2019-09-29 00:08:21 +02:00
Liam Treacy
121336a3d8 Fix setting the initial value of non-editable wxComboBox in wxQt
Use setCurrentText(), which works for non-editable combo boxes as well
as for editable ones, instead of setEditText(), which only works for the
latter ones.

Closes https://github.com/wxWidgets/wxWidgets/pull/1542
2019-09-28 23:53:01 +02:00
Maarten Bent
a24d58a6d3 Use wxWindow instead of wxDisplay for wxGraphicsContext::GetDPI 2019-09-28 23:47:04 +02:00
Maarten Bent
459ffcff61 Remember wxBitmapComboBox selection when recreating the control
Recreate the control with the correct height when adding the first item with bitmap.
2019-09-28 23:47:04 +02:00
Maarten Bent
092d507714 Update comment in wxRendererMSW::GetCheckBoxSize related to DPI 2019-09-28 23:47:04 +02:00
Maarten Bent
85a2769ae5 Use the already determined hwnd in wxWindowMSW::GetDPI 2019-09-28 23:47:04 +02:00
Maarten Bent
b39c79cb4a Set column count to 1 in wxListCtrl with list view 2019-09-28 23:47:04 +02:00
Maarten Bent
370ae40b35 Use more FromDIP for hardcoded sizes 2019-09-28 23:47:04 +02:00
Vadim Zeitlin
ff3c005519 Merge branch 'msw-encodings'
Recognize a few more system encodings under MSW, including UTF-8.
2019-09-28 23:45:05 +02:00
Vadim Zeitlin
e46385e964 Test that adding window to 2 sizers results in an assert
Check that adding a window to either the same, or different, sizer the
second time asserts -- but that it can still be moved to another sizer
if it is detached from the first one first.

Also document that SetContainingSizer() should never be called from
outside the library.

See #17166.
2019-09-28 23:42:37 +02:00
Vadim Zeitlin
7bba2d09fd Merge branch 'drop-cppunit-window-test'
Get rid of CppUnit compatibility macros in wxWindow unit tests.

See https://github.com/wxWidgets/wxWidgets/pull/1568
2019-09-28 23:42:37 +02:00
Maarten Bent
54d514489e Update custom header font after DPI change 2019-09-28 23:37:01 +02:00
Maarten Bent
017978a139 Fix font of custom attributes in wxTreeCtrl on DPI change 2019-09-28 23:37:01 +02:00
Maarten Bent
b075465645 Fix wxSearchCtrl buttons on DPI change 2019-09-28 23:37:01 +02:00
Maarten Bent
a98d8448fa Fix size of wxDateTimePickerCtrl after DPI change
Do not use DateTime_GetIdealSize or DTM_GETIDEALSIZE. They return
incorrect sizes after the DPI of the window has changed. For every DPI
change, the returned size is 4 pixels higher, even if the DPI is
lowered.

Improve the existing method to also take the minimum height of the
scroll-arrows into account.
2019-09-28 23:37:01 +02:00
Maarten Bent
2c6d132efe Resize wxListCtrl columns on DPI change
Fix font of custom attributes in wxListCtrl on DPI change.
2019-09-28 23:37:01 +02:00
Maarten Bent
56fab0aabb Improve wxDataView on DPI change
Fix the row heights after a DPI change and adjust the column widths.
Use DPIChangedEvent instead of MSWUpdateFontOnDPIChange because the child
controls (m_clientArea, m_headerArea) need to update their font sizes first.
2019-09-28 23:37:01 +02:00
Maarten Bent
fd2cf1f4e2 Fix wx[Check]ListBox font and margin on DPI change
These control are drawn using a wxDC. When the DPI changes, call SetFont
to update the font of the wxDC. First call wxListBoxBase::SetFont() so
m_font is updated to the new DPI, then use this font in the wxDC.
For wxCheckListBox update the margins to fit the changed checkbox size.
2019-09-28 23:37:01 +02:00
Maarten Bent
123da53306 Fix wxBitmapComboBox size in high DPI
Convert hard-coded sizes to DPI depended size, remove unused size.
Implement MSWUpdateFontOnDPIChange() and update the control elements.
2019-09-28 23:37:01 +02:00
Vadim Zeitlin
37be4adec6 Don't change RICHEDIT control font on DPI change
The control seems to somehow react to DPI changes on its own (which is
rather mysterious as we don't forward WM_DPICHANGED to it, so it's not
really clear how does it do it, but it does) and changing its font is
worse than useless, as it's not just redundant, but also resets all the
styles used inside the control and so is really undesirable.

Hence override the just added MSWUpdateFontOnDPIChange() to do nothing
for rich edit controls, while still updating the font for the plain EDIT
ones (which is required as they don't scale correctly on their own).
2019-09-28 23:37:01 +02:00
Maarten Bent
32aabf7a41 Update font of wxSpinCtrl when DPI changes
Fix position of spin control in wxSpinCtrlDouble after DPI change
The old size of the control was used to determine the position. Use GetBestSize
instead, which will return the correct size.
2019-09-28 23:37:01 +02:00
Maarten Bent
8bff737438 Support DPI change in wxToolBar
Manually resize the embedded controls and Realize the toolbar again.
2019-09-28 23:37:01 +02:00
Maarten Bent
e57139bb21 Use system DPI for some native Windows dialogs
Some native dialogs do not scale correctly (color picker, font picker,
open file with custom controls). ALl other native dialogs do scale correctly
(open file, open directory, find replace, print).

Change the DPI Awareness Context temporarily to SystemAware, so Windows handles
the scaling.
2019-09-28 23:37:01 +02:00
Václav Slavík
17e2f8c477 Fix EOLs buffer shortening in wxFFile::ReadAll()
As the comments in the function explain, fread() may return a shorter
buffer than expected due to CRT's implicit conversion of DOS EOLs to
\n.
The logic for handling this was however broken: it NUL-terminated the
buffer appropriately, but that had no effect when later used in
wxString constructor, which used buffer's length for string length.

This resulted in slightly larger strings with uninitialized tails that
were mostly invisible to the user as the tail would disappear anywhere
the string was handled as a NULL-terminated C string. It also caused
occassional UTF-8 conversion failures when the tailing bytes didn't
form a valid sequence.

Fixed by using wxCharBuffer::shrink() to properly truncate the buffer.
2019-09-28 18:57:26 +02:00
Ilya Sinitsin
ce01d8286b Xcode iphone (#1565)
* Adapt xcodeproj for iPhone to generic imaglist.cpp

* Fix the installation error in the iPhone minimal sample

Fix "Failed to install the requested application" error.
2019-09-28 17:16:35 +02:00
Vadim Zeitlin
4b832dbc25 Merge branch 'stcreplaceraw' of https://github.com/NewPagodi/wxWidgets
Add "Raw" variants for replacement functions to wxSTC.

Closes #18108.

See https://github.com/wxWidgets/wxWidgets/pull/1571
2019-09-28 14:36:00 +02:00
New Pagodi
203074567c Regenerate wxSTC files after recent changes 2019-09-28 00:50:47 -05:00
New Pagodi
97713e81a1 Remove the flag wxSTC_FIND_CXX11REGEX from wxSTC docs
wxSTC is currently built without c++11 regex support, but the search
flag wxSTC_FIND_CXX11REGEX was included with wxSTC any way. This commit
modifies gen_iface.py so that this flag will no longer be generated or
documented. To prevent any code that is currently using this flag from
being broken, the flag is manually defined in stc.h.in.

In short, the flag will be preserved as it currently is but will be
undocumented so users won't mistakenly try to use it.
2019-09-28 00:50:12 -05:00
New Pagodi
2976c64821 Add Raw variants for replacement functions to wxSTC
Implement ReplaceSelectionRaw, ReplaceTargetRaw, and ReplaceTargetRERaw
in the same manner as AddTextRaw, InsertTextRaw, and the other raw
variants.
2019-09-28 00:49:46 -05:00
Vadim Zeitlin
194870fe5e Recognize system UTF-8 encoding under MSW too
Recent versions of Windows 10 (finally!) allow to set up UTF-8 as the
system encoding, so recognize when it is returned by GetACP() in
wxLocale::GetSystemEncoding() and GetSystemEncodingName().
2019-09-27 19:34:32 +02:00
Vadim Zeitlin
7feaa024b3 Add support for code page 1361 (Johab Korean)
As with the previous commit, recognize the system CP1361 encoding, which
can be mapped to an existing wxFONTENCODING_CP1361 constant.
2019-09-27 19:31:38 +02:00
Vadim Zeitlin
5dbfff839e Add support for code page 1258 (Vietnamese)
There doesn't seem to be any good reason to not support this one, when
we support (or at least recognize) all the other CP125x encodings.
2019-09-27 19:30:22 +02:00
Vadim Zeitlin
35d9b0f056 Rewrite a chain of "if"s as a switch
No real changes, just make the code a bit more maintainable and easier
to read.
2019-09-27 19:29:42 +02:00
Graham Dawes
11f24369fd Prevent selection by dragging in wxTreeCtrl in wxQt
This prevented the user from dragging the items in wxTreeCtrl, which is
something that's supposed to be possible.

To allow selection by dragging, we'd need to extend wx API with a method
indicating that dragging is not used in this particular control.

Closes https://github.com/wxWidgets/wxWidgets/pull/1458
2019-09-27 19:21:39 +02:00
Vadim Zeitlin
04949050b2 Merge branch 'qt-fixes'
A multitude of miscellaneous Qt fixes and improvements.

See https://github.com/wxWidgets/wxWidgets/pull/1552
2019-09-27 19:18:11 +02:00
Vadim Zeitlin
1dfdd93a2a Merge branch 'qt-listctrl'
New version of wxListCtrl for wxQt, supporting virtual list controls,
checkboxes, sorting and with other fixes.

See https://github.com/wxWidgets/wxWidgets/pull/1551
2019-09-27 19:16:56 +02:00
Vadim Zeitlin
7be12edc7a Replace legacy CppUnit macros with CATCH ones
Still no real changes, just use Catch macros directly instead of doing
it via CppUnit-compatible shims.
2019-09-27 15:58:09 +02:00
Vadim Zeitlin
b176b59ffe Get rid of legacy CppUnit test case machinery in wxWindow test
No real changes, just remove the CPPUNIT_TEST[_SUITE] ugliness.
2019-09-27 15:55:18 +02:00
Matthew Griffin
f608b340c2 Send set cursor events whenever there is mouse movement
This is required in order to allow application code to change the cursor
dynamically.

Closes https://github.com/wxWidgets/wxWidgets/pull/1549
2019-09-27 14:00:02 +02:00
Vadim Zeitlin
99bbc523f7 Use QAction::setShortcut() rather than setShortcuts()
This is simpler and we don't need a list of shortcuts here, as we only
allow specifying a single one anyhow.

See https://github.com/wxWidgets/wxWidgets/pull/1544
2019-09-27 13:52:42 +02:00
Vadim Zeitlin
41caeebd8c Use wxString rather than QString methods
It's preferable to use code which is simpler to understand to wx
developers not necessarily familiar with Qt API and which can also be
reused with the other ports if necessary.

In this particular case, using wxString::AfterFirst() also results in
shorter and more clear code too.

See https://github.com/wxWidgets/wxWidgets/pull/1544
2019-09-27 13:51:01 +02:00
Vadim Zeitlin
8339f12636 Remove old shortcuts when setting new accelerator
Setting a new accelerator should replace the old one, not add to it.

See https://github.com/wxWidgets/wxWidgets/pull/1544
2019-09-27 13:47:54 +02:00
Vadim Zeitlin
3a918864f9 Make accelerators work for menu items created in the code too
The previous commit fixed accelerators support in wxQt for the items
created in XRC, but not for those created directly in the code, as
wxMenuItem::SetItemLabel() is not called in this case.

Refactor the code to extract UpdateShortcutsFromLabel() from
SetItemLabel() and call the new function both from there and from
wxMenuItem ctor, to ensure that the accelerators are taken into account
in any case.

This commit is best viewed with "git diff --color-moved".

See https://github.com/wxWidgets/wxWidgets/pull/1544
2019-09-27 13:47:45 +02:00
Liam Treacy
a6efd027da Support accelerator keys in wxMenuItem::SetItemLabel()
Closes https://github.com/wxWidgets/wxWidgets/pull/1544
2019-09-27 13:33:52 +02:00
catalinr
8c2b9423c2 Fix compilation by using appropriate subdirs for Qt headers
This fixes wxQt build under MSW.

Closes https://github.com/wxWidgets/wxWidgets/pull/1533
2019-09-27 13:27:44 +02:00
Graham Dawes
3668ff5170 Update menu UI before showing a popup menu in wxQt
Give the application code a possibility to disable or otherwise change
the menu items before the popup menu is shown, as in the other ports.

Closes https://github.com/wxWidgets/wxWidgets/pull/1532
2019-09-27 13:26:25 +02:00
Matthew Griffin
2c91463c81 Enable mouse tracking on construction of every wxQt widget
Not all controls use wxWindow::Create(), so move setMouseTracking() call
where it is always executed.

Closes https://github.com/wxWidgets/wxWidgets/pull/1528
2019-09-27 13:24:29 +02:00
Graham Dawes
631ce0e380 Send events when items are selected from keyboard in wxListBox
Handle selection rather than clicks in wxListBox in wxQt to allow
keyboard interactions to generate events.

Closes https://github.com/wxWidgets/wxWidgets/pull/1526
2019-09-27 13:20:41 +02:00