Commit Graph

66605 Commits

Author SHA1 Message Date
Vadim Zeitlin
63c118f186 Fix DPI used in wxTextCtrl::GetStyle()
Using the window DPI resulted in returning a twice bigger size in points
than the size really used for the windows on high-DPI monitors as,
apparently, RichEdit always uses DPI of 96 internally (tested with both
wxTE_RICH and wxTE_RICH2 in 192 DPI under Windows 10.0.16299.785).
2019-07-12 18:48:03 +02:00
Vadim Zeitlin
69586bb03b Reuse wxNativeFontInfo::GetLogFontHeightAtPPI()
Instead of calling ::MulDiv() directly, reuse GetLogFontHeightAtPPI()
as it is more readable.
2019-07-12 18:48:03 +02:00
Vadim Zeitlin
de6d7472a2 Add static GetLogFontHeightAtPPI() overload taking point size
This will be useful elsewhere too and makes SetFractionalPointSize()
implementation less fragile as we don't have to be careful about
changing pointSize member before setting lf.lfHeight any more.
2019-07-12 18:48:03 +02:00
Vadim Zeitlin
72a225924d Remove wxCreateFontFromLogFont() and wxFillLogFont()
These functions are not really useful as converting between wxFont and
LOGFONT can be done trivially by passing via wxNativeFontInfo and, in
fact, wxCreateFontFromLogFont() managed to do the conversion wrongly by
forgetting to update wxNativeFontInfo::pointSize member when changing
wxNativeFontInfo::lf.

This fixes one unit test failure after the latest changes, although not
yet the other one, see the upcoming commit for this.
2019-07-12 18:48:03 +02:00
Vadim Zeitlin
90186f7740 Refactor handling point size in wxNativeFontInfo
No real changes yet, this commit just prepares for adding support for
per-monitor DPI by reorganizing some code.
2019-07-12 18:48:04 +02:00
Vadim Zeitlin
fda3bcbfc5 Remove unused static variable from wxMSW wxDisplay code
This should have been done in f936a54000
which removed dynamic loading of display-related functions.

No real changes.
2019-07-12 16:35:01 +02:00
Vadim Zeitlin
b62563b907 Remove redundant Free() from wxFont::SetFractionalPointSize()
Free() is already called from wxFontRefData::SetFractionalPointSize(),
so there is no need to call it from wxFont too and doing this makes this
method gratuitously inconsistent with all the other setters.

No real changes.
2019-07-12 00:11:54 +02:00
Vadim Zeitlin
b24d7e3ae4 Add a simple wxSetWindowFont() helper
This function is a just a very thin wrapper for WM_SETFONT, but it's
still better to have it rather than write casts to WPARAM and
MAKELPARAM() in several different places.

Note that this removes the assert for font validity from
wxWindow::SetFont() which really doesn't make much sense (and if we
wanted to have it, it would be better to have it for all ports in
wxWindowBase instead) and was never triggered since more than 20 years
of its existence.
2019-07-12 00:11:53 +02:00
pk
b93fce30f3 CMake: CMAKE_COMPILER_IS_GNUCC has been replaced 2019-07-11 12:01:38 +03:00
Maarten Bent
f5b3b6a84d Determine underline type and colour in wxTextCtrl::GetStyle 2019-07-11 00:50:38 +02:00
Maarten Bent
f248f82aa9 Update wxTextAttr underline documentation 2019-07-11 00:50:31 +02:00
Maarten Bent
e62f86f3c3 Remove trailing white-space 2019-07-11 00:34:30 +02:00
Maarten Bent
4afea28aab Improve underline changes of wxTextCtrl
Get rid of m_fontUnderlined, use m_fontUnderlineType instead.
Bugfixes in wxMSW, wxGTK and wxOSX code.
Show more underline usage in the text sample.
2019-07-11 00:34:27 +02:00
Igor Korot
f99ae84d7c Implement different underline styles for wxTextCtrl 2019-07-11 00:23:18 +02:00
Vadim Zeitlin
7d229dd695 Allow really using wxHeaderCtrl in the grid sample
The "Native" menu item actually only toggled drawing native-lookalike
labels, but didn't use wxHeaderCtrl as could be expected. Rename the
existing menu item to "Native-like" and add the new "Native" one which
really enables the use of wxHeaderCtrl.
2019-07-10 16:51:31 +02:00
Deamhan
e0ad857a2d CMake: MinGW multiple definition issue has been fixed (wxBUILD_USE_STATIC_RUNTIME) 2019-07-10 11:30:31 +03:00
Vadim Zeitlin
2c6dcc2e51 Coalesce wxEVT_TEXT events in wxGTK wxTextCtrl and wxComboBox
For consistency with the other platforms, coalesce multiple wxEVT_TEXT
events resulting from a single user action into a single one in wxGTK
too. For example, when pressing a key in a control with some text
selected, wxGTK previously generated 2 wxEVT_TEXT events: one
corresponding to the removal of the selection and another one to the
addition of the new text. Now only a single event with the new text is
generated, as in the other ports.

Doing this requires delaying sending wxEVT_TEXT until GTK itself ends
handling the key press, however we delay it as little as possible, so
hopefully this shouldn't have any visible effects at wx API level.

Closes #10050.
2019-07-10 02:14:21 +02:00
Vadim Zeitlin
e8712b3c56 Make wxTreeCtrl::EnsureVisible() work while frozen in wxMSW
Scrolling the item into view to make it visible didn't work since the
changes of badf6bc300, which suppressed
scrolling completely while frozen, any longer.

Work around it by remembering the item to make visible and actually
doing it when the control is thawed.

Also add menu item to call Freeze()/Thaw() on wxTreeCtrl in the sample
to make testing this and similar problems easier.

Closes #18435.
2019-07-09 23:00:11 +02:00
Vadim Zeitlin
1cdba2b5ab Remove unnecessary headers included from src/msw/control.cpp
They are not needed any more since the changes removing the dynamic
casts to wx{List,Tree}Ctrl in c45a8d49f1.

No real changes.
2019-07-09 22:58:09 +02:00
Vadim Zeitlin
7715bd5170 Remove obsolete note about limited wxFileDataObject support
This class seems to be implemented in all the major ports, so remove
note saying that it supports dragging files from the applications only
under MSW.

Closes #18437.
2019-07-09 22:36:20 +02:00
Vadim Zeitlin
958df5fb74 Use IME in wxGTK wxComboBox too
There was confusing with the method GTKIMFilterKeypress() in wxGTK
wxTextEntry: it was called the same as wxWindow virtual method of the
same name, but didn't override it, of course, as wxTextEntry doesn't
derive from wxWindow.

It also wasn't called for wxComboBox which inherited from wxTextEntry
but didn't override wxWindow::GTKIMFilterKeypress() to actually call its
method.

Fix this and rename the wxTextEntry to use a different name for clarity.
2019-07-09 19:37:21 +02:00
Deamhan
afcec3eefc CMake: wxBUILD_USE_STATIC_RUNTIME is available for GCC now 2019-07-09 17:48:59 +03:00
Jouk
d3a3353a8d Merge recent stattext chages also into WXgtk1 2019-07-09 09:02:14 +02:00
Vadim Zeitlin
5c766c0b8b Use the same "changed" GTK callback for wxComboBox and wxTextCtrl
And reuse EnableTextChangedEvents() between these classes as well.

No real changes so far, this is just a refactoring to centralize the
code in a single place before modifying it.
2019-07-08 18:50:58 +02:00
Vadim Zeitlin
c024944d78 Move logic from GTK callback to GTKOnTextChanged() virtual method
Check whether we should ignore the event and mark the control as being
dirty if necessary in a virtual method, which can be defined in
wxTextEntry and overridden by wxTextCtrl, instead of doing it in GTK
callback itself.

This will allow to reuse wxTextEntry callback for wxTextCtrl too in the
upcoming commits.

No real changes so far.
2019-07-08 18:31:57 +02:00
Vadim Zeitlin
c75067f0b4 Simplify wxComboBox::GetEditable()
Use m_entry that we already store instead of retrieving it from GTK.

No real changes.
2019-07-08 18:31:57 +02:00
Jouk
acef902ea6 add src/xrc/xh_dataview.cpp to OpenVMS makefiles 2019-07-08 14:48:32 +02:00
Vadim Zeitlin
3d9656395a Fix unwanted message boxes in widgets sample once and for all
Add IsUsingLogWindow() that can be used to check if the log messages go
into the listbox instead of being shown in a message box, which was
annoying when starting or quitting the sample.

This is a bit more complicated than the hack previously used in
TextWidgetsPage::OnText(), but more general and can be easily reused for
the focus loss messages, for example.
2019-07-08 12:53:02 +02:00
Vadim Zeitlin
7206194d08 Show new wxTextCtrl value in the widgets sample
This is useful for quickly checking that we're getting expected events
when modifying the control and/or not getting any unexpected ones and
was already done on wxComboBox page, but not for wxTextCtrl.
2019-07-08 11:08:53 +02:00
Vadim Zeitlin
a2ffca0d96 Merge branch 'msvs2019'
Add full MSVS 2019 support.

See https://github.com/wxWidgets/wxWidgets/pull/1375
2019-07-08 10:43:10 +02:00
dos
d846cfae6f Add use of Visual Studio 2019 (vc142) to official build scripts
Build binaries using MSVS 2019/vc142 toolset too.

Closes https://github.com/wxWidgets/wxWidgets/pull/1384
2019-07-08 10:42:26 +02:00
Vadim Zeitlin
8a4fc479e0 Fix wxTextCtrl using hints and handling wxEVT_TEXT in wxGTK2 etc
With the generic hint support (used in pre-Vista wxMSW, wxGTK2, ...),
defining a wxEVT_TEXT handler not skipping the event completely broke
the control functionality as it was cleared, i.e. replaced the
user-entered text with the hint, whenever it lost focus.

This happened because wxTextEntryHintData::OnTextChanged() was never
called in this case, as the user-defined wxEVT_TEXT handler preempted
it. Work around this by pushing an event handler to the front of the
window event handlers chain instead of just binding to the window events
directly -- this could still potentially result in the same problem if
the user code pushes their own event handler, but this should be much
more rare and, in any case, there is not much we can do about this (the
only solution would seem to be to modify all platform-specific code to
update wxTextEntryHintData explicitly whenever the text changes).
2019-07-08 10:28:10 +02:00
Vadim Zeitlin
4a6f16cf15 Merge branch 'statictext-setlabel'
wxControl label-related fixes and improvements.

See https://github.com/wxWidgets/wxWidgets/pull/1364
2019-07-08 10:09:49 +02:00
Vadim Zeitlin
958521183a Add minimal support for ellipsization to wxQt wxStaticText
Set the visible label to the ellipsized value, if necessary.

Also call AutoResizeIfNecessary() for consistency with the other ports.
2019-07-08 10:09:14 +02:00
Vadim Zeitlin
1f9dd05797 Stop passing wxString by value to wxLog::GetComponentLevel()
This function is almost exclusively called from IsLevelEnabled() which
doesn't get inlined (at least by MSVS) when wxString is passed by value
to it, and so had to be updated to take a const reference instead, which
means that a copy is always going to be made anyhow, so don't try to be
smart and avoid it -- it doesn't work anyhow and just results in unusual
code, requiring explanatory comments (not needed any longer) and
upsetting static code analyzers.

No real changes.

See https://github.com/wxWidgets/wxWidgets/pull/1387
2019-07-08 10:04:14 +02:00
iwbnwif
a7fe78eda8 Implement wxSlider ticks support in wxGTK
Tick marks were not available for wxSlider under GTK+ 2 or GTK+ 3
implementations of wxWidgets. However, tick marks have been available
for the GtkScale widget since GTK+ 2 version 2.16.

This change adds similar functionality in relation to tick marks
as was already available in wxMSW builds.

Closes https://github.com/wxWidgets/wxWidgets/pull/1355
2019-07-07 17:04:55 +02:00
Vadim Zeitlin
0c64345890 Add instructions for adding support for new MSVS version
Try to collect all the information in a single place to make things
easier for the next update.
2019-07-07 15:32:33 +02:00
Igor Korot
e8991252ec Improve documentation of wxAuiPaneInfo direction-related methods
Mention the corresponding flag in the documentation of all helper
functions, not just some of them.

Closes #9722.

Closes https://github.com/wxWidgets/wxWidgets/pull/1388
2019-07-07 14:01:21 +02:00
Andreas Falkenhahn
c3ce5244e3 Return -1 from GetLineLength() if line number is out of range
Make wxTextCtrl behaviour in all ports consistent with the documentation
and also update wxStyledTextCtrl to behave accordingly.

Closes #18431.
2019-07-07 03:35:21 +02:00
Andreas Falkenhahn
6e556d4a71 Check parameters of XYToPosition() and PositionToXY() in wxSTC too
For consistency with wxTextCtrl, return -1 if input parameters are out
of range.

Closes #18430.
2019-07-07 03:30:37 +02:00
Vadim Zeitlin
cc41ddf62a Document wxGCDC::SetGraphicsContext() difference from ctor
Document the discrepancy between constructing wxGCDC from
wxGraphicsContext directly or default-constructing it and calling
SetGraphicsContext() later.

Current behaviour is somewhat inconsistent, but useful, because it
allows to draw on wxGraphicsContext using wxDC API using any kind of pen
and brush, even those not supported by this API, while remaining
backwards-compatible (i.e. we can't change SetGraphicsContext() to not
re-apply font, pen and brush, as this would break any existing code
relying on this happening), so it seems like the best alternative.
2019-07-07 03:18:18 +02:00
Vadim Zeitlin
8926928a8f Fix regression in wxGCDC initialization from wxGraphicsContext
The changes of ae2cb7d347 resulted in
transformation matrix not being initialized correctly any more.

Fix this by adding yet another helper, DoInitContext(), called both when
initializing wxGCDC using an existing wxGraphicsContext in the
corresponding ctor and the just created one in the other ones.

Closes #18429.
2019-07-07 03:14:21 +02:00
Vadim Zeitlin
a1bd57d1d8 Make wxLog non-copyable
It doesn't make sense to copy objects of this class and this wouldn't
work correctly due to the presence of m_formatter field.

See https://github.com/wxWidgets/wxWidgets/pull/1389
2019-07-07 02:54:20 +02:00
Vadim Zeitlin
c5f6836d6f Upgrade bundled Expat to post-2.2.7 version with a security fix
This upgrade includes the fix for CVE-2018-20843.

Closes https://github.com/wxWidgets/wxWidgets/pull/1374
2019-07-03 23:49:20 +02:00
Chris Lemin
efe9236b16 Add support for alignment flags to wxStaticText in wxQt
Ensure static text fields use the alignment specified by WX on creation.

This is the second commit doing this, the first one was reverted because
it accidentally included unrelated changes, sorry for the trouble.

See https://github.com/wxWidgets/wxWidgets/pull/1381
2019-07-03 23:48:22 +02:00
Vadim Zeitlin
a51af03670 Revert "Add support for alignment flags to wxStaticText in wxQt"
This reverts commit 0f49825d64 because it
accidentally included unrelated changes. It will be re-committed again
soon.

See https://github.com/wxWidgets/wxWidgets/pull/1381
2019-07-03 23:47:09 +02:00
Vadim Zeitlin
8e15849706 Use wxOVERRIDE for deprecated wxBitmap methods in wxQt too
When WXWIN_COMPATIBILITY_3_0 is on, compiling this header results in a
bunch of harmless but annoying -Winconsistent-missing-override clang
warnings, so add wxOVERRIDE to silence them.

No real changes.
2019-07-03 15:31:15 +02:00
Chris Lemin
0f49825d64 Add support for alignment flags to wxStaticText in wxQt
Ensure static text fields use the alignment specified by WX on creation.

Closes https://github.com/wxWidgets/wxWidgets/pull/1381
2019-07-03 15:28:55 +02:00
Graham Dawes
e5ba6d9393 Implement SetForegroundColour and SetBackgroundColour for wxQt
Closes https://github.com/wxWidgets/wxWidgets/pull/1373
2019-07-03 13:25:55 +02:00
Graham Dawes
9e35bb92c0 Avoid focus loss event when wxComboBox popup is opened in wxQt
Prevent wxComboBox from generating a wxEVT_KILL_FOCUS event when the
user opens the drop-down list under wxQt, as logically the drop-down is
part of wxComboBox, even if it's a separate window at Qt level.

Closes https://github.com/wxWidgets/wxWidgets/pull/1377
2019-07-03 13:18:30 +02:00