Using Bind() with a method of the class deriving from wxEvtHandler
non-publicly used to result in a compile-time error, but at least with C++11
we can detect this case and allow the code to compile.
Closes#17623.
It's not really clear why, but clang 4.0 has decided to start giving warnings
about using the result of an expression constructed using the preprocessor
"defined" operation in #if checks, so trivially avoid doing this.
Instead of combining the language, country and codepage and passing the
resulting string to setlocale(), the locale name can be used instead for
setlocale() on Windows Vista and onwards.
Closes https://github.com/wxWidgets/wxWidgets/pull/358
This fixes a crash that occurs when switching locale from Korean to
Norwegian Bokmål, since the language_country.codepage string resolves to
"Norwegian Bokmål_Norway.1252" and mbstowcs trips up on the non-ASCII
character.
Use the length provided to SetData() instead of assuming it is NUL-terminated
in the wxNEEDS_UTF16_FOR_TEXT_DATAOBJ case too, and not only in the
wxNEEDS_UTF8_FOR_TEXT_DATAOBJ onem, as was done by the previous attempt to fix
this in 20c130a578.
Closes#9522.
This was broken by 05857e66c0 which introduced
dependencies on protocols only declared in 10.11 headers.
Fix build by checking if we're using 10.11 SDK and using these protocols only
in this case.
This is more efficient than calling GetTextExtent() with a growing string in a
loop as we used to do (with ~60 character string wrapped on 2 lines it brings
wrapping time down from 4ms to 600us).
It is also slightly more accurate under macOS, even though it's still off and
some text may be truncated when wrapping.
The native EDIT control doesn't handle this key combination, but RICHEDIT does
and people just expect it to work, so handle it at wxMSW level.
Closes https://github.com/wxWidgets/wxWidgets/pull/300
For some reason known only to Apple, NSSecureTextField allows pasting text
into it using its standard context menu, but not using the standard Cmd+V
keyboard shortcut. Moreover, apparently the control does something special to
disable it because pressing Cmd+V does result in a call to
-[NSSecureTextField control:textView:doCommandBySelector:], but with a dummy
"noop:" selector.
Detect this specific situation and check if we're called while handling Cmd+V
event and, if this is indeed the case, do paste the text into the control.
While it could be argued that this changes the platform behaviour, it seems
very hard, if not impossible, to imagine a situation in which this would be a
problem while not being able to easily paste into password fields is
definitely a real usability bug.
When using non-default row height, text would be aligned to the top of
the row. This is a known limitation of NSTextFieldCell and the solution
is to either switch to modern view-based rendering or customize the cell
as this commit does.
See https://red-sweater.com/blog/148/what-a-difference-a-cell-makes for
Daniel Jalkut's description of this solution.
Don't override renderer's wxDVR_DEFAULT_ALIGNMENT alignment when
column's alignment is set. Call a method to recompute effective
alignment instead.
Related to a6be5bda that fixed a similar issue in wxGTK.
A convenience helper for writing generic code that may operate on
different kinds of DCs, all supported by wxGraphicsContext, but without
knowing its specific type.
Don't make the controls with wxTE_DONTWRAP (a.k.a. wxHSCROLL) style
"infinitely" wide, but just "very" wide to allow alignment still work in it.
See #17529.
Disabled controls are not supposed to accept any input, so don't send any
mouse events to them.
This fixes the behaviour of wxSlider which could be moved (and generated the
corresponding events) even when it was disabled.
Closes#17194.
Make wxListBox behave the same as in the other ports and invalidate its best
size after inserting items into it.
In the future it would be nice to call this from the base wxWindowWithItems
class itself, rather than doing it in port-specific DoInsertItems() for all
ports, but for now this will do.
Closes#17606.
Postpone resetting indent in wxOSX wxDataViewCtrl to avoid always removing,
and hence never showing the expanders at all, for wxTreeListCtrl whose model
starts its life as a list but becomes a tree as soon as any items with
children are added to it.
By postponing the call to IsListModel() until the next resize, we give the
model the time it needs to decide what it's going to be, while still removing
the unnecessary indent if there is no need for it.
Closes#17409.
Use more clear "src" and "dest" names for wxConcatFiles, wxCopyFile, and
wxRenameFile functions arguments instead of non-self-descriptive file1, file2,
etc used before.
No real changes.
Implement wxSysErrorMsg's functionality without using static buffers;
have the caller provide the buffer. When the caller uses the original
API and does not provide a buffer, a static buffer is still used.
wxSysErrorMsgStr() returns a wxString.
Also use strerror_r() instead of strerror() on platforms other than MSW.
The returned string being capitalized is not 'bad' as the ancient comment
from the 90s suggested.
At least on Windows 7+, system error messages are full sentences beginning
with a capital letter, ending in a full stop; there is no point in
lowercasing the first letter.
The changes in 065135adcc caused AVKit to be linked even when the deployment target was set to 10.7 or 10.8 which would not be available on the target machine. The deployment target is now checked before using AVKit.
::abs() truncates floating point values to ints, so use fabs() instead. This
could have been also corrected by using std::abs(), which is overloaded for
multiple types, but use fabs() for consistency with the existing code.
This fixes a problem introduced in 1e0719ad81.
See #17557.
Add support for alpha channel in the #rrggbbaa format to
wxColour::GetAsString() and FromString(). This syntax is introduced in
CSS4 spec draft (see https://drafts.csswg.org/css-color/#hex-notation)
and already used by Pango for markup as well.
Also recognize #rgb and #rgba shorter variants in FromString().
Don't unconditionally use wxWidgets' implementation of IAccessible for
all windows when wxUSE_ACCESSIBILITY is 1, because it is inferior to the
system provided one: it often lacks appropriate labels, doesn't fully
support navigation and wxIAccessible isn't fully implemented.
The approach, when using MSAA, recommended by Microsoft documentation is
to customize accessibility for custom controls only, by proxying to the
standard and overriding what is necessary. By making this change, user
code is still allowed to customize accessibility if needed, without
negatively impacting standard controls that don't need any custom code.
See also https://github.com/wxWidgets/wxWidgets/pull/340
Avoid having entries differing just by name or email address (or, in the case
of Václav, by the use of composed vs decomposed form!) in "git shortlog"
output.
Closes https://github.com/wxWidgets/wxWidgets/pull/326
Ensure that m_pIDataObject is reset to avoid assertions from DragEnter()
during the next drag-and-drop operation after the one which resulted in an
exception being thrown.