Commit Graph

66982 Commits

Author SHA1 Message Date
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
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
Vadim Zeitlin
1ca012240a Merge branch 'qt_statictext_create' of https://github.com/GeoTeric/wxWidgets into qt-fixes
Call SetLabel() from wxStaticText ctor instead of bypassing its logic by
using QLabel directly.

Closes https://github.com/wxWidgets/wxWidgets/pull/1424
2019-09-22 02:40:31 +02:00
Vadim Zeitlin
54c1359d1f Add precondition checks to Do{Get,Set}ClientSize()
Don't crash if these methods are called before the window is created.
2019-09-22 02:38:59 +02:00
Graham Dawes
cd7594e639 Don't include scrollbars in client area size
Return the size of just the viewport when using QScrollArea.

Closes https://github.com/wxWidgets/wxWidgets/pull/1418
2019-09-22 02:37:11 +02:00
David Roberts
18b87b2ab5 Send wxEVT_CHECKLISTBOX when a checkbox is clicked
Fix sending events from wxCheckListBox in wxQt.

Closes https://github.com/wxWidgets/wxWidgets/pull/1403
2019-09-22 02:30:05 +02:00
Graham Dawes
cc1ec9e562 Show tooltip in wxTreeCtrl when item text doesn't fit on screen
This matches the behaviour of the native control in wxMSW and is
generally useful.

Closes https://github.com/wxWidgets/wxWidgets/pull/1397
2019-09-22 02:12:35 +02:00
Matthew Griffin
273448fb80 Fix Qt implementation of wxTreeCtrl::Toggle()
It was mistakenly implemented as toggling selected item, not whether
item is collapsed or expanded.

Closes https://github.com/wxWidgets/wxWidgets/pull/1395
2019-09-22 02:08:48 +02:00
Matthew Griffin
9434a443f5 Ensure that QCloseEvents can be vetoed by wx
These events use a different convention from all the other ones in Qt
and need to be ignored, rather than accepted, to prevent the default
action from occurring.

And these events are also sent to disabled windows, which are never
supposed to receive them in wx API.

Closes https://github.com/wxWidgets/wxWidgets/pull/1371
2019-09-22 02:05:32 +02:00
Jay Nabonne
fcd6ee5324 Disable Qt's automatic "auto default" state for buttons
Let the wx layer handle default-ness, as the auto behaviour has unhappy
consequences that can't be controlled via the wx API. (For example, a
Delete button being considered default simply because it's the first
button in the dialog.)

Closes https://github.com/wxWidgets/wxWidgets/pull/1366
2019-09-22 01:54:56 +02:00
Vadim Zeitlin
3b491c0776 Don't skip event after capturing mouse in wxAUI in all ports
This was previously done only under Mac, but it doesn't seem to make
much sense to skip the mouse event if we handled it by capturing the
mouse and it seems to create problems in wxQt too, so just generalize
the Mac behaviour to all platforms.

See https://github.com/wxWidgets/wxWidgets/pull/1360
2019-09-22 01:45:30 +02:00
Mick Waites
9a64acbb79 Ensure correct previous page is sent for notebook events
Qt notebook page changed events had the wrong "previous page" index in
circumstances where the page has been changed by methods other than
clicking on the tabs, for example using the "Pages->Next page" menu
option in the notebook sample.

Closes https://github.com/wxWidgets/wxWidgets/pull/1359
2019-09-22 01:36:28 +02:00