Commit Graph

66942 Commits

Author SHA1 Message Date
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
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
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
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
Ilya Sinitsyn
7f91481294 Add XRC handler for wxInfoBar
Update the schema and the sample to show it in action.

Closes https://github.com/wxWidgets/wxWidgets/pull/1564
2019-09-27 12:57:01 +02:00
Vadim Zeitlin
68b36aed6d Only give messages about unsupported accelerators in wxGTK
Doing this under all platforms results in too many false positives,
which can't be avoided currently, e.g. even if an application uses "Tab"
as an accelerator only under MSW, these messages still appear (in debug
builds, but this is more than sufficient for them to be annoying).

For now, restrict the messages to wxGTK only. In the future we could
revert to giving them under all platforms if we provide some way of
disabling them, e.g. qualifying accelerators with "[port]" or "[!port]"
string before them.

This partially reverts 6596f5a98d, see
https://github.com/wxWidgets/wxWidgets/pull/1505

Closes https://github.com/wxWidgets/wxWidgets/pull/1566
2019-09-27 12:47:03 +02:00
Vadim Zeitlin
9a0072b12e Remove wxDECLARE_NO_COPY_CLASS from a local class in wxGrid test
Declaring the copy ctor/assignment operator for a local class without
defining them triggers MSVC warning C4822, so don't do this to avoid
unnecessary noise in the build logs (we could disable the warning or
conditionally do this for non-MSVC compilers, but it doesn't seem to be
worth doing this for a class used inside a single function and very
unlikely to be copied accidentally).
2019-09-26 22:23:36 +02:00
Vadim Zeitlin
6789e69e4b Only call tzset() once and not from each wxGetTimeZone() call
Doing this resulted in noticeable performance problems under MSW,
especially when using non-default locale.

Closes #17094.
2019-09-26 01:30:04 +02:00
Paul Cornett
1753ed4037 Fix typo in wxXmlDocument documentation 2019-09-24 11:49:58 -07:00
Vadim Zeitlin
aeef8295c8 Update bundled Expat to 2.2.8
This notably fixes CVE-2019-15903.

Closes https://github.com/wxWidgets/wxWidgets/pull/1562
2019-09-24 02:31:19 +02:00
Vadim Zeitlin
b0ff3bf3ea Ensure that wxGrid appearance always reflects its enabled state
Override DoEnable() in wxGrid instead of Enable() to ensure that the
grid is shown appropriately for its current state whenever either it or
its parent is disabled.

Note that this also fixes the bug with only the main grid window being
refreshed, but not the row/column headers, which also need to be.
2019-09-24 01:44:55 +02:00
Vadim Zeitlin
ec76367afd Grey out grid headers if its parent is disabled too
It doesn't really matter whether the grid is disabled because it was
explicitly disabled itself or because it's implicitly disabled due to
its parent being disabled, it should still show its disabled status to
the user by rendering its headers in a greyed out state.
2019-09-24 01:32:53 +02:00
Mick Waites
1214676988 Set default page size for wxSlider as in the other ports
Make the page size 1/10 of the total range, as in wxMSW.

Closes https://github.com/wxWidgets/wxWidgets/pull/1524
2019-09-22 03:07:43 +02:00
Jay Nabonne
cd9a8fb695 Do not switch state if drag-and-drop is not allowed in wxTreeCtrl
Avoid setting state to DragSelectingState unless dragging items in
wxTreeCtrl is explicitly allowed, as this this causes bad behaviour
downstream with subsequent selections when the client does anything in
the event handler beyond simply not allowing the event.

Basically, we can't be guaranteed of the mouse state on return from the
event handler, so dropping into drag selection mode is potentially
inappropriate (or just plain bad).

Closes https://github.com/wxWidgets/wxWidgets/pull/1523
2019-09-22 03:03:20 +02:00
Matthew Griffin
337644f702 Cancel any edit in progress when wxTreeCtrl is scrolled
Otherwise the editor could be scrolled out of view, confusing the user.

Closes https://github.com/wxWidgets/wxWidgets/pull/1522
2019-09-22 03:00:36 +02:00
Graham Dawes
8c18ee8c25 Apply font family for wxFont in wxQt
Closes https://github.com/wxWidgets/wxWidgets/pull/1512
2019-09-22 02:53:57 +02:00
Graham Dawes
39cb337008 Generate events when selecting tree items programmatically
In wx API, calling wxTreeCtrl::SelectItem() is supposed to generate an
event.

Also use Qt selection model to support single-selection mode.

Closes https://github.com/wxWidgets/wxWidgets/pull/1453
2019-09-22 02:44:59 +02:00
Graham Dawes
c8eef72417 Fix wxNotebook::CalcSizeFromPage() to account for tabs height
Actually implement this function instead of just returning the size
passed into it.

Closes https://github.com/wxWidgets/wxWidgets/pull/1425
2019-09-22 02:42:21 +02:00