Commit Graph

61994 Commits

Author SHA1 Message Date
Graham Dawes
d639e4ffce Fix wxQt build errors when using gcc 4.4
Closes #17733.
2016-11-30 16:13:46 +01:00
VZ
5551932c25 Allow using Bind() with non-public inheritance in C++11 code
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.
2016-11-29 19:32:40 +01:00
VZ
4212202a9a Add support for cache directory to wxStandardPaths::GetUserDir()
This has direct equivalent under macOS and when using XDG.

See #17727.
2016-11-29 19:32:14 +01:00
VZ
ac31c85901 Merge macOS version-related fixes
Notably fix build with pre-10.11 SDK.
2016-11-29 00:53:33 +01:00
scootergrisen
90bd2523d1 Danish translation improvements 2016-11-28 02:25:42 +01:00
Vadim Zeitlin
2b764a1b8a Avoid clang 4.0 -Wexpansion-to-defined warnings
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.
2016-11-28 01:50:30 +01:00
Jonathan Li
713c3f9d1b Use locale name directly for Windows Vista and later
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.
2016-11-28 00:55:59 +01:00
Vadim Zeitlin
fec4d61377 Merge branch 'syserrormsgstr'
Add thread-safe wxSysErrorMsgStr() to be used instead of wxSysErrorMsg().

Closes https://github.com/wxWidgets/wxWidgets/pull/343
2016-11-27 15:08:31 +01:00
Vadim Zeitlin
9e24755d00 Minor improvements to wxSysErrorMsgStr() documentation
Link to the new function, instead of wxSysErrorMsg(), from the other functions
documentation.

Also mention that this function is new since 3.1.0.
2016-11-27 15:02:53 +01:00
Vadim Zeitlin
110d1b03e5 Another blind fix for wxTextDataObject under macOS
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.
2016-11-26 18:44:00 +01:00
Vadim Zeitlin
295576f78f Fix compilation of WebView code in wxOSX with SDK < 10.11
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.
2016-11-26 17:29:27 +01:00
Vadim Zeitlin
50190395c6 Get rid of macOS 10.7 version checks, they're always true
We don't support OS X < 10.7 anyhow any more.
2016-11-26 17:28:12 +01:00
Vadim Zeitlin
2638869fc7 Move HAVE_<strfunc> definitions to wx/osx/config_xcode.h
They are not needed in wx/osx/cocoa/chkconf.h as they are detected by
configure normally, so only define them when using Xcode.
2016-11-26 17:15:54 +01:00
Vadim Zeitlin
cb2474f040 Use wxDC::GetPartialTextExtents() in wxStaticText::Wrap()
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.
2016-11-24 02:17:41 +01:00
Jens Göpfert
c43b59616f Make Ctrl+A not work in multiline wxTextCtrl in MSW
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
2016-11-24 02:10:39 +01:00
Paul Cornett
0ef695ef9b Revert d30673e5, it's completely broken. See #17089 2016-11-23 09:28:28 -08:00
VZ
05857e66c0 Declare Objective-C protocols in the code using web view
This avoids clang -Wincompatible-pointer-types warnings when setting
delegates.
2016-11-23 16:25:09 +01:00
Vadim Zeitlin
fe685bc4c6 Allow pasting using Cmd+V in wxTextCtrl with wxTE_PASSWORD style
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.
2016-11-22 15:01:19 +01:00
Václav Slavík
92dc929b3f Implement vertical alignment in wxDataViewCtrl in wxOSX
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.
2016-11-22 14:51:55 +01:00
Václav Slavík
818b084b4b Fix wxOSX wxDataViewRenderers' alignment handling
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.
2016-11-22 14:51:55 +01:00
Václav Slavík
f32362bc79 Support background colors in wxMarkupText::RenderItemText
DrawItemText() doesn't respect text background so we have to render the
background rectangle manually.
2016-11-22 14:51:39 +01:00
Václav Slavík
7833c65c2a Add wxGraphicsContext::CreateFromUnknownDC()
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.
2016-11-22 14:51:39 +01:00
Andreas Falkenhahn
6615c06d31 Respect alignment in wxOSX wxTextCtrl::SetStyle()
Honour the alignment specified in the style, if any.

Closes #17529.
2016-11-22 02:31:11 +01:00
Andreas Falkenhahn
d5c008da03 Fix setting alignment for wxOSX wxTextCtrl with wxTE_DONTWRAP
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.
2016-11-22 02:29:13 +01:00
Vadim Zeitlin
dcb1229f41 Don't send mouse events to disabled windows in wxOSX
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.
2016-11-22 02:10:40 +01:00
Igor Korot
27ca9ad556 Invalidate wxOSX wxListBox best size after adding items to it
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.
2016-11-22 01:55:27 +01:00
Vadim Zeitlin
28f96bdff0 Fix wxTreeListCtrl under wxOSX
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.
2016-11-22 01:42:28 +01:00
Václav Slavík
cbc386b2fb Add stock accelerator for wxID_SELECTALL
Ctrl+A (or Cmd+A) is used on all three major platforms.
2016-11-21 18:44:32 +01:00
Lauri Nurmi
bdb3f6fea7 Use more descriptive argument names for wxCopyFile() and others
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.
2016-11-21 18:22:22 +01:00
Lauri Nurmi
902130f64e Use the new wxSysErrorMsgStr() instead of wxSysErrorMsg() 2016-11-21 19:15:20 +02:00
Lauri Nurmi
343318d73e Add a thread-safe wxSysErrorMsgStr()
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.
2016-11-21 19:15:19 +02:00
Tim Kosse
b99ad85b6f Weight pixels by their respective alpha value in wxImage::ResampleBox
Without this weighting, even the color value of invisible pixels with a zero
alpha would influence the result.

Closes #17724.
2016-11-21 18:09:07 +01:00
Lauri Nurmi
3926538fea Don't de-capitalize system error messages on 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.
2016-11-21 18:07:55 +02:00
Lauri Nurmi
de70fa5b2f Fix a possible out-of-bounds access to an array 2016-11-21 18:07:55 +02:00
TcT2k
7684f92083 Fix wxMediaCtrl linking on OS X 10.7 and 10.8
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.
2016-11-21 14:36:44 +01:00
Vadim Zeitlin
0bfc8c4d63 Use fabs() instead of abs() for non-integer variables in SVG DC
::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.
2016-11-20 22:09:32 +01:00
Paul Cornett
cb19499c90 Fix layout of drawing sample System colours screen for colors with non-opaque alpha 2016-11-20 09:59:33 -08:00
Václav Slavík
39bc670409 Don't include wx/except.h twice 2016-11-20 18:20:59 +01:00
Václav Slavík
fb27932e4c Support #rrggbbaa, #rgb and #rgba colors syntax
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().
2016-11-20 18:15:54 +01:00
Václav Slavík
4aacaa88b7 Compilation fix for droptgt.cpp's use of wxTRY 2016-11-20 18:15:54 +01:00
Václav Slavík
7dab555f71 Don't create wxWindowAccessible by default
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
2016-11-20 17:35:32 +01:00
Vadim Zeitlin
9c1689b850 Add mailmap file to normalize author names in git log
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
2016-11-19 19:02:29 +01:00
Paul Cornett
d24fbc7808 Implement wxLB_NO_SB style
See https://github.com/wxWidgets/wxWidgets/pull/346
2016-11-19 08:36:26 -08:00
Mikko P
2326ca72f1 Fix owner drawn dropdown row height.
While m_combo->GetFont(); sets the proper font, the size of that font did not affect the character height.
2016-11-17 14:45:01 +01:00
Vadim Zeitlin
5ffb8de44d Mention that wxOSX doesn't implement SetLayoutDirection()
At least avoid wasting people time with debugging why it doesn't work.
2016-11-17 02:02:06 +01:00
Vadim Zeitlin
3404d55be0 Merge branch 'helloworld-doc'
Modernize "Hello world" page: Bind(), C++11 etc.

Closes https://github.com/wxWidgets/wxWidgets/pull/317
2016-11-16 18:02:28 +01:00
Vadim Zeitlin
8072481f86 Show using C++11 lambda in the "Hello world" example
This is so useful, that it should be mentioned even on this introductory page.
2016-11-16 18:01:47 +01:00
Vadim Zeitlin
2d56fb5298 Use Bind() instead of event tables on the "Hello World" page
Let the new users know that Bind() is the preferred way to handle events in
modern wxWidgets.
2016-11-16 18:01:46 +01:00
Paul Cornett
1b0e7c17e3 Enable choosing paper size and orientation on print dialog, see #17712 2016-11-14 22:32:03 -08:00
Vadim Zeitlin
b06c909385 Avoid assertions if user-defined OnDrop() throws in wxMSW
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.
2016-11-15 01:15:22 +01:00