Commit Graph

17103 Commits

Author SHA1 Message Date
Vadim Zeitlin
d4e595adb0 Add wxWindow::CreateUsingMSWClass() helper function
This method allows to use the Windows class to use for the window being
created instead of always using "wxWindow" or "wxWindowNR".

This can be useful to make it possible to handle some windows specially from
outside the application, e.g. use specific class names for accessibility
purposes as will be done by the next commit.
2016-12-18 22:39:06 +01:00
Vadim Zeitlin
842c441f01 Allow registering only a single window class in wxMSW
Add a flag to let wxApp::GetRegisteredClassName() register just a single Win32
class instead of always registering two of them: the "normal" (but rarely used)
version and the "NR" version used unless wxFULL_REPAINT_ON_RESIZE style is
specified.

With the new RegClass_OnlyNR, only the latter is registered and used.

This is not used yet, but will be soon.
2016-12-18 22:39:04 +01:00
Vadim Zeitlin
097f8a7f14 Refactor code finding the name of the windows class to use in wxMSW
Determine which class name to use in MSWCreate() caller instead of doing it
partly there and partly in MSWCreate() itself, which used to add the "NR"
suffix if necessary -- now it doesn't do this any more and just really created
the window using the given class.

No real changes, just prepare for future enhancements.
2016-12-18 22:39:02 +01:00
Vadim Zeitlin
34f8ae85e0 Simplify wxPersistentTLW code and avoid warnings in it
Use wxPoint and wxSize instead of individual "int" variables to make the code
slightly shorter and avoid clang warnings about "y" and "h" being possibly
uninitialized (which couldn't happen, but the compiler didn't understand it,
at least in non-optimized builds).
2016-12-14 02:21:40 +01:00
Václav Slavík
8b5387bc3d Enable wxUSE_ACCESSIBILITY by default (MSW)
Compile accessibility support on Windows by default now that the generic
wxDataViewCtrl control implements accessible interface. After the
changes from 7dab555f71, accessibility
support is much more lightweight and doesn't interfere with normal win32
behavior, so this change shouldn't affect accessibility-unaware code in
any way.
2016-12-13 18:56:20 +01:00
Vadim Zeitlin
04428890b7 Fix warning about undefined macro when cross-compiling with MinGW
__USE_MINGW_ANSI_STDIO is apparently not defined when using MinGW as a
cross-compiler from Linux, so 7c730334a2
resulted in -Wundef warning about this.

Fix this by checking if the macro is defined before testing its value.

See #17736.
2016-12-12 23:39:01 +01:00
Václav Slavík
ff1dba498e Add wxDataViewValueAdjuster
Add wxDataViewRenderer:: SetValueAdjuster() and a
wxDataViewValueAdjuster class. This can be used to customize rendering
of values depending on whether they are highlighted (selection) or not,
without having to implement an entire new custom renderer.
2016-12-11 15:20:42 +01:00
Václav Slavík
13862ad8e6 Fix GetInstallPrefix availability check
Add wxHAS_STDPATHS_INSTALL_PREFIX to make checking for
wxStandardPaths::GetInstallPrefix()'s availability simpler, as the
condition under which it is compiled is nontrivial.

Fixes compilation after 2c24ee9216 on
Cygwin, which is a UNIX, but its wxStandardPaths implementation is a
Windows one.
2016-12-11 15:18:24 +01:00
Paul Cornett
d5681ee4a8 Fix infinite sizing loop caused by 3b4ee5a0
Avoid the problems 3b4ee5a0 attempted to address in a much simpler way:
when a "size-allocate" is in progress, call gtk_widget_size_allocate()
directly, rather than deferring a call to gtk_widget_queue_resize().
See #17585
2016-12-09 21:38:35 -08:00
Vadim Zeitlin
9db6f6ca1a Make wx/valnum.h self-contained by including wx/textentry.h
This header uses (i.e. forward declaration wouldn't be sufficient)
wxTextEntry, so it must include the header declaring it.
2016-12-09 01:58:14 +01:00
Václav Slavík
60542745f6 Fix accel handling when removing item from submenu
wxMSW propagates accelerators to the top menu in wxMenu::UpdateAccel(),
but the reverse operation in wxMenu::DoRemove() didn't do it, resulting
in leaked leftover accelerator entries that could prevent the same
accelerator from working if an item using it was later added. Fix by
adding RemoveAccel() helper method that behaves analogously to
UpdateAccel().
2016-12-05 17:59:03 +01:00
Václav Slavík
c9b1ebf816 Remove ATSU-related dead code from wxOSX
ATSU was deprecated for a long time and was finally removed from OS X
SDK in 10.11. wxOSX_USE_ATSU_TEXT was unconditionally disabled already,
so the code was never used and can be safely removed.
2016-12-03 12:44:10 +01:00
Laurent Poujoulat
7c730334a2 Fix long long format specifier when using MinGW with ANSI STDIO
When using MinGW own, more standard-compliant, STDIO library, the correct
format specified to use for long long values is "%lld" and not "%I64d" as when
using MSVC CRT.

Closes #17736.
2016-12-02 20:47:43 +01:00
Tobias Schlager
73f6f622f9 Allow specifying the maximum width of static text in dialogs
This patch allows specification of the maximum width of static texts
created with wxDialog::CreateTextSizer.

The patch preserves backwards compatibility by setting the previous
width value as the default argument value.

Closes https://github.com/wxWidgets/wxWidgets/pull/355
2016-12-01 14:06:43 +01:00
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
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
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
Paul Cornett
0ef695ef9b Revert d30673e5, it's completely broken. See #17089 2016-11-23 09:28:28 -08: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
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
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
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
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
Paul Cornett
1b0e7c17e3 Enable choosing paper size and orientation on print dialog, see #17712 2016-11-14 22:32:03 -08:00
Vadim Zeitlin
239469457d Factor out exception handling code in a new WXConsumeException()
This will allow using this code from other places and not only when executing
user-defined event handlers.

No changes in this commit yet.
2016-11-15 00:59:40 +01:00
Paul Cornett
101c43d0aa Partial workaround for stale styling information with GTK3
We can trigger size events when we know the style cache has been updated.
See #16088
2016-11-01 23:18:26 -07:00
Václav Slavík
c146103c64 Make wxStatusBar look (more) native on macOS
Significantly improve the appearance of wxStatusBar on macOS, both the
modern flat look since 10.10 and older versions. Increase the size to
match native bottom bars, center the text inside it, use appropriate
background and border colors and the same gray for the text as Finder
uses, correctly change the appearance for inactive windows.

This is still far from ideal - that would be using
setContentBorderThickness:forEdge: and rendering the text atop it. But
that seems to be much easier said than done due to interference from
other parts of wx. This is much better than the previous state.
2016-10-31 14:31:11 +01:00
Artur Wieczorek
9b8f46df36 Implement wxDataViewCustomRenderer::GetAccessibleDescription()
This is a default description of the renderer content (for accessibility purposes).
Thanks to this implementation there is not necessary to override GetAccessibleDescription() in the renderers derived from wxDataViewCustomRenderer.
2016-10-30 20:59:51 +01:00
Artur Wieczorek
fb219aaf35 Add accessibility event notifications to wxDVC 2016-10-30 20:49:56 +01:00
Artur Wieczorek
fa4b077421 Remove wxDataViewTreeCtrlAccessibilty class
Since wxDataViewCtrlAccessible::GetName() calls to wxDataViewIconTextRenderer::GetAccessibleDescription() to directly retrieve the content of the renderer, there is no need to override wxDataViewCtrlAccessible::GetName() in order to get a proper content of the renderer in wxDataViewTreeCtrl.
2016-10-24 22:22:31 +02:00
Artur Wieczorek
d9fbde805b Implement wxDataViewRenderer::GetAccessibleDescription() method
The purpose of this method is to provide a textual description of the renderer's content to the class implementing accessibility framework in wxDVC (wxDataViewCtrlAccessible).
It is exposed if wxUSE_ACCESSIBILITY is set to 1.
2016-10-24 21:52:22 +02:00
Vadim Zeitlin
c9ec981a28 Fix MinGW builds by defining HDS_NOSIZING if it's not defined
Blind fix for compilation failures in MinGW builds after the changes of
92a1f643ba which started using HDS_NOSIZING
apparently not present in this compiler SDK headers.
2016-10-21 22:54:46 +02:00
Václav Slavík
a6be5bdae3 Fix wxGTK wxDataViewRenderers' alignment handling
Don't apply alignment to native controls in SetAlignment() method, where
it may not be known yet due to column-to-renderer inheritance if
wxDVR_DEFAULT_ALIGNMENT is used (the default). Move such code to
GtkUpdateAlignment() (which was made virtual) in all renderers.

This fixes unintended right-aligning of columns with GTK+ 2 when default
alignment was used.
2016-10-21 17:50:34 +02:00
Václav Slavík
7546989c44 Fix wxMarkupParserAttr's unwinding of colors
Fix the logic for restoring previous span's colors to account for the
possibility of spans that don't change the color, such as in "<i><span
color='red'>...</span></i>foo". Previously, "foo" would always be
rendered black, because unwinding the attributes stack would encounter
an invalid color (which has r=g=b=0) and set it, disregarding and
preexisting attributes.

Because there's code in there that checks whether the attributes are
valid, we need to keep track of both the actually specified attributes
and the currently effective ones, and use the latter for restoration.
2016-10-21 17:36:32 +02:00
Václav Slavík
5e5ffad0b8 Respect item font when rendering markup (wxOSX)
Respect per-item attributes and namely the font (which may differ from
the control's font) when rendering markup items in wxDataViewCtrl.
2016-10-21 17:36:32 +02:00
Václav Slavík
58fc33d7c2 Support ellipsizing of markup text in wxDVC
Fix wxDataViewTextRenderer to at least partially respect ellipsize mode
when using markup text. Generic implementation only supports
wxELLIPSIZE_END and wxELLIPSIZE_NONE at the moment, but the wxOSX and
wxGTK ones have full support.
2016-10-21 17:36:32 +02:00
Václav Slavík
ec45fc5ae0 Return IAccessible from GetIAccessibleStd()
There's no reason to return an untyped void* pointer when we can
forward-declare IAccessible.
2016-10-19 10:36:07 +02:00
Artur Wieczorek
cfe0eaa7f2 Create wxAccessible object on demand in wxDVC
Create wxAccessible objects only in response to calls to GetOrCreateAccessible() to save resources.
2016-10-16 23:48:27 +02:00
Václav Slavík
90e1769569 Add API to control OS X wxTextCtrl’s smart behavior
Allow the user to customize smart quotes and dashes substutions on OS X
and also provide the OSXDisableAllSmartSubstitutions() method for
disabling them all at once.
2016-10-16 16:49:18 +02:00
Artur Wieczorek
d8b2da0334 Remove wxUSE_VARIANT guards
wxDataViewCtrl requires wxVariant so these guards are not necessary.
2016-10-15 21:02:05 +02:00
Artur Wieczorek
9c3c6074eb Add accessibility support for wxDataViewCtrl and wxDataViewTreeCtrl
Implemented wxDataViewCtrlAccessible and wxDataViewTreeCtrlAccessible classes.
2016-10-09 21:13:00 +02:00
Václav Slavík
29d310c6f0 Implement wxDataViewCtrl::SetFont() on OS X
wxDataViewCtrl now behaves consistently with other ports on OS X:
calling SetFont() sets the default font used by renderers and adjusts
row height to fit.
2016-10-09 16:10:31 +02:00
Václav Slavík
8a6a20b1e3 Implement wxDataViewCtrl::SetRowHeight() on OS X 2016-10-09 16:10:30 +02:00