Commit Graph

61441 Commits

Author SHA1 Message Date
Vadim Zeitlin
e417913f46 Reset the wxDataViewItem being edited once it's not edited any more
No real changes, just some cleanup to ensure that the item being edited stored
in wxDataViewRendererBase never refers to an item which is not, actually,
being edited any longer.
2016-02-20 17:07:04 +01:00
Vadim Zeitlin
31a10d0355 Fix editing items with custom renderers in wxGTK wxDataViewCtrl
Call FinishEditing() when the cell is done being edited instead of sending
wxEVT_DATAVIEW_ITEM_EDITING_DONE event manually from wxGTK code.

This fixes the bug with not being able to edit an item the second time if the
editor was dismissed by GTK+ itself and not by our own code (which already did
call FinishEditing()) as the old editor still remained alive because
DestroyEditControl(), usually called from FinishEditing(), wasn't executed.

It also removes code duplication and avoids the need to keep a global
s_user_data pointer as the item currently being edited is already stored in
wxDataViewRenderer anyhow.
2016-02-20 17:07:04 +01:00
Vadim Zeitlin
7e37c6763f Test custom editor in the dataview sample
Show how to create and use a custom editor in the custom renderer.
2016-02-20 17:07:04 +01:00
Vadim Zeitlin
29024e39ca Fix duplicate wxEVT_DATAVIEW_ITEM_EDITING_STARTED under GTK
When using a custom renderer, wxEVT_DATAVIEW_ITEM_EDITING_STARTED was sent
twice: once from the generic base class StartEditing() and another time from
the GTK-specific "editing_started" signal handler. And we must send it from
the latter, because otherwise no event would be generated at all for the
standard renderers (i.e. text cells) for which we don't call StartEditing()
ourselves, so don't call it from the former and instead generate the event by
explicitly calling NotifyEditingStarted() after calling StartEditing() in the
generic version (as for wxOSX version, it doesn't use StartEditing() at all
and so doesn't need to be changed).
2016-02-20 17:07:04 +01:00
Vadim Zeitlin
235e8ebd1a Factor out wxDataViewRendererBase::NotifyEditingStarted()
Reuse the same code from the generic and native GTK and OS X implementations
of wxDataViewCtrl instead of triplicating it.

This fixes a small discrepancy between the wxOSX version, which didn't see the
model pointer correctly in the generated event, and all the others, but mainly
paves way for future improvements.
2016-02-20 17:07:04 +01:00
Vadim Zeitlin
40502651f9 Always delete the editor when finishing editing in wxDataViewCtrl
We need to delete the editor control even if GetValueFromEditorCtrl() failed
as otherwise we're never going to be able to edit another item again, at least
with the GTK native implementation, which does nothing when starting to edit
an item if an editor control already exists.
2016-02-20 17:07:04 +01:00
Vadim Zeitlin
f9d907a1d4 Just simplify wxPoint/wxSize creation from wxRect
Use the existing wxRect::Get{Position,Size}() methods instead of explicitly
creating the objects from the wxRect components, this is simpler and more
readable.

No real changes.
2016-02-20 17:07:04 +01:00
Vadim Zeitlin
4edae7238a Fix skipping the event in wxEVT_TEXT_ENTER handler in wxMSW
Skipping the event is supposed to have the same effect as not handling the
event at all, but in wxMSW wxTE_PROCESS_ENTER style must be specified for a
wxEVT_TEXT_ENTER handler to be executed at all and if this style is used, then
the default handling in MSWProcessMessage() which normally happens before
calling the handler doesn't take place at all.

Work around this by explicitly performing the default "Enter" key action if
the event generated by it wasn't handled to make wxMSW behaviour more
intuitive.
2016-02-20 17:07:04 +01:00
Vadim Zeitlin
99a1526ee3 Factor out methods for clicking the default button in wxMSW
This will make it possible to reproduce the default "Enter" key functionality
from elsewhere.

Almost no changes yet, the only minor change is that we now wouldn't try to
"click" any windows using DLGC_DEFPUSHBUTTON dialog code but which are not
really buttons -- but then this shouldn't ever happen anyhow.
2016-02-20 17:07:04 +01:00
Vadim Zeitlin
d3e7833a90 No changes, just replace a useless comment with a more helpful one
Don't describe in English what the next line of code does, which is useless,
but rather explain why do we do this.
2016-02-20 17:07:04 +01:00
Vadim Zeitlin
9bcaa058a0 Replace wxTextCtrl::MSWWindowProc() with MSWHandleMessage()
Override newer and more flexible virtual method: this doesn't change anything
yet but will allow to provide default handling for some messages in a single
overridden method in the future commits, when it would have required to also
override MSWDefWindowProc() with the old method.
2016-02-20 17:07:04 +01:00
Vadim Zeitlin
6b2a6baf2e Allow custom handling of Enter/Tab with modifiers in wxDataViewCtrl
While Enter and Tab on their own should be used to finish cell editing, the
cell editor itself may want to process key combinations involving these keys
with modifiers, e.g. Shift-Enter, so don't intercept those in at least the
generic version of wxDataViewCtrl to allow catching them in the editor.
2016-02-20 17:07:04 +01:00
Vadim Zeitlin
5591a20093 Detect attempts to catch wxEVT_TEXT_ENTER without wxTE_PROCESS_ENTER
This is never going to work, so complain about trying to do it to help with
catching this bug.

This is possible thanks to the new OnDynamicBind() method invoked whenever a
dynamic event handler is bound to a control, so this doesn't detect all
possible occurrences of the bug (such as specifying the handler in a static
event table or in a validator), but it's still better than nothing.

In the future OnDynamicBind() should be extended for other invalid calls, e.g.
binding a handler for wxEVT_TEXT_ENTER to a non-text control shouldn't work
neither, ideally.
2016-02-20 17:07:04 +01:00
Vadim Zeitlin
baff0c942b Try to always give wxDirDialog a valid parent in wxMSW
Use the same GetParentForModalDialog() method as for the normal dialogs to
find the parent to use for this native dialog and ensure that it is shown
modally even if no parent is explicitly specified when constructing it.

Closes #17384.
2016-02-20 13:42:12 +01:00
VZ
b4a0ca1ade Merge pull request #219 from vadz/whatever-conv
Fall back on UTF-8 when converting Unicode to multibyte fails

This is not ideal, but better than just losing data entirely.
2016-02-19 17:10:52 +01:00
Tobias Taschner
9bcfdc65aa Fix building with OS X < 10.9
wxNotificationMessage changes in bf5e403 included a 10.9+ property runtime
check but was missing a compile guard.

Closes https://github.com/wxWidgets/wxWidgets/pull/220
2016-02-19 13:41:21 +01:00
Paul Cornett
becb7864f7 add missing wxOVERRIDE 2016-02-18 23:31:20 -08:00
Vadim Zeitlin
704055f200 Don't lose data when converting wxExecute() arguments under Unix
Use wxConvWhateverWorks when converting the command line given as a string to
individual arguments: we already used wxSafeConvertWX2MB() when converting the
arguments specified as an array, but not here.

Closes #16206.
2016-02-19 03:10:47 +01:00
Vadim Zeitlin
956edbb309 Reimplement wxSafeConvertXXX() functions using wxWhateverWorksConv
These functions were almost but not quite identical to it:
wxSafeConvertMB2WX() tried the current locale encoding before UTF-8 while
wxConvWhateverWorks tries UTF-8 first and then the current locale encoding.

The latter behaviour is more correct as valid UTF-8 could be misinterpreted as
some legacy multibyte encoding otherwise, so get rid of this difference and
just forward these functions to wxConvWhateverWorks.
2016-02-19 02:57:20 +01:00
Vadim Zeitlin
8eac125e86 Revert "Temporarily ensure that the file functions test uses UTF-8"
This reverts commit a44bcb4746 which is not
necessary any more since the fixes to file name conversions in the previous
commit.
2016-02-19 02:52:43 +01:00
Vadim Zeitlin
a11456c078 Add wxWhateverWorksConv and use it for file names under Unix
This ensures that we can create output files with Unicode names even when
they're not representable in the current locale encoding, notably when the
current locale has never been changed and is still the default "C" one, not
supporting anything else other than 7 bit ASCII.

Credits for the new class name go to Woody Allen.
2016-02-19 02:52:43 +01:00
Vadim Zeitlin
837e6d186d Don't lose Unicode data when outputting wxString to std::ostream
Fall back to UTF-8 rather than not outputting anything at all if the string is
not representable in the current locale encoding.

Even if we did try to handle this error by setting failbit, chances of anybody
checking for it (especially on e.g. std::cout) were very low and the only
possible workaround in practice would have been attempting to output the
string in UTF-8 anyhow, so just do it ourselves.

See #17358.
2016-02-19 02:52:43 +01:00
Vadim Zeitlin
fa8a482593 Don't lose Unicode data in wxMessageOutputStderr
Ensure that we do output the string contents even if we have to encode it in
UTF-8 instead of the current locale encoding -- this is still better than not
outputting anything at all.

Closes #17358.
2016-02-19 02:52:43 +01:00
Vadim Zeitlin
3bb98963fa Update the link in README after the last commit
This should have been part of it.
2016-02-19 01:57:36 +01:00
Vadim Zeitlin
f4c136815a Rename directory with Github-specific files to the correct name
It must start with a leading dot (thanks Bryan).
2016-02-19 01:56:18 +01:00
Vadim Zeitlin
0ec70b51ce Make Stack Overflow a link in the README
And fix "wxwidgets" tag formatting to use Markdown instead of Doxygen.
2016-02-19 01:28:42 +01:00
Vadim Zeitlin
4b123cd638 Move CONTRIBUTING.md to Github-specific directory
Github now supports having its files in this directory, so create it and move
CONTRIBUTING.md there to reduce clutter in the repository root.
2016-02-19 01:27:41 +01:00
Vadim Zeitlin
d7e84827bc Try to avoid timeouts in AppVeyor Cygwin build
Disable more libraries and use --disable-optimize instead of --enable-debug
(also for MinGW) as we don't really need debug information in these builds and
not generating it might make things faster.
2016-02-19 01:23:11 +01:00
Vadim Zeitlin
704c177e74 Fix harmless unused parameter warning in wxTaskBarIcon
See https://github.com/wxWidgets/wxWidgets/pull/92
2016-02-18 23:28:16 +01:00
Vadim Zeitlin
51b70c895e Remove hard TABs from the sources
Some of them sneaked through, notably during wxNotificationMessage
refactoring.
2016-02-18 23:18:00 +01:00
Vadim Zeitlin
80d4993119 Merge wxNotificationMessage for OS X and MSW 8+
Closes https://github.com/wxWidgets/wxWidgets/pull/92
2016-02-18 23:09:05 +01:00
Vadim Zeitlin
5fdddc0b16 Fix wxMSW build with wxUSE_UXTHEME=0
Include wx/msw/uxtheme.h even when wxUSE_UXTHEME == 0 because
wxUxThemeEngine::GetIfActive() and MARGINS struct are still used even then in
anybutton.cpp and menuitem.cpp respectively.
2016-02-18 22:56:12 +01:00
Vadim Zeitlin
3351404c2c Don't use wxOVERRIDE in wxDECLARE_EVENT_TABLE to avoid clang warnings
If a class not using "override" for its other, not wx-related, virtual methods
included wxDECLARE_EVENT_TABLE() with wxOVERRIDE inside it, it resulted in a
clang -Winconsistent-missing-override warning per each virtual method without
it which was very annoying.

Avoid it by not using wxOVERRIDE in this macro and explicitly disabling the
-Winconsistent-missing-override for the methods inside it in case the rest of
the class does use "override".

Notice that this also required rearranging the order of the declarations in
this macro to ensure that a semicolon is still required after it.

Closes https://github.com/wxWidgets/wxWidgets/pull/217
2016-02-18 22:56:11 +01:00
Vadim Zeitlin
59def94f63 Merge wxListCtrl fixes for classic MSW there
Closes https://github.com/wxWidgets/wxWidgets/pull/216
2016-02-18 22:56:09 +01:00
Vadim Zeitlin
ed406caa71 Remove unused variables from wxAuiMSWToolBarArt code
No real changes, just remove the leftover variables to avoid warnings about
unused variables from gcc.

See https://github.com/wxWidgets/wxWidgets/pull/200
2016-02-18 22:56:07 +01:00
Artur Wieczorek
f6268599f1 Use "MultiProcessorCompilation" parameter instead of explicit /MP in the minimal sample project.
Use the user-visible option instead of the command line option which is hidden in the IDE.
2016-02-18 22:52:17 +01:00
Artur Wieczorek
27ea6aea5c Fix MSVC14 warnings about a shadowed variable in the widgets sample.
Just to suppress some harmless warnings.
2016-02-18 22:43:48 +01:00
Artur Wieczorek
51f7074caf Fix MSVC14 warnings about a shadowed variable in the propgrid sample.
Just to suppress some harmless warnings.
2016-02-18 18:46:45 +01:00
Artur Wieczorek
43fe885eb7 Fixed displaying text labels after assigning wxImageList to wxListCtrl.
For ComCtl32 prior to 6.0 all text labels in wxListCtrl need to be re-assigned when new wxImageList is set in order to position them correctly within the control.
2016-02-16 21:39:33 +01:00
Artur Wieczorek
53b6806b50 Fixed adding 32-bit icons with transparency to wxImageList.
ComCtl32 prior to 6.0 doesn't support images with alpha channel so if we have 32-bit icon with transparency we need to convert it to a wxBitmap and then add this bitmap to wxImageList. If required, bitmap with alpha channel will be converted to the mask in wxImageList::Add.
2016-02-16 21:39:33 +01:00
Vadim Zeitlin
a8b1894628 Add wx/osx/core/colour.h back to the list of installed headers
This file was accidentally removed by 602ea92143.

Closes #17374.
2016-02-15 01:28:45 +01:00
Vadim Zeitlin
64e14e850d Compilation fix for wxMSW without PCH
Add missing header inclusion to fix compilation after changes of
35f35ea407 (see #17360).
2016-02-15 01:21:39 +01:00
Vadim Zeitlin
8e3a317392 Remove useless #ifdef wxUSE_DEBUG_NEW_ALWAYS check
This symbol is tested using "#if", so it should be always defined and there is
no need for testing whether this is the case.

Moreover, doing this useless check triggers warning C4574 (which is disabled
by default, but it's useful enough to enable it explicitly) with VC14 about
using "#ifdef" with a symbol defined as 0.
2016-02-15 01:20:48 +01:00
Paul Cornett
75de19b21f avoid unused variable warning 2016-02-14 13:41:20 -08:00
Paul Cornett
8585f3215a add missing wxOVERRIDE 2016-02-14 13:40:45 -08:00
Paul Cornett
837c3a0df1 remove unused function 2016-02-14 13:40:07 -08:00
Paul Cornett
0ee7565e19 Fix restoring TLW size with wxPersistenceManager on wxGTK
...when window decoration sizes are not known. See #17228
2016-02-14 13:23:49 -08:00
Paul Cornett
f95fd11e08 Allow drawing HiDPI bitmaps with GTK3
1. Override wxWindow::GetContentScaleFactor() to use gdk_window_get_scale_factor()
   when available, and to use correct scale (1.0) otherwise, as wxDC::GetPPI()
   (used by overridden method) is not properly implemented for wxGTK
2. Record scale in wxBitmap(wxImage&) ctor and wxBitmap::CreateScaled()
3. Adjust cairo scale for drawing bitmap, and (inversely) for drawing on bitmap
2016-02-14 13:12:52 -08:00
Vadim Zeitlin
ed09b7b6c0 Remove symlinks time comparison tests from wxFileName test
These tests don't seem to be sound, it's possible for one second or more to
pass between the two calls to GetTimes() and it's apparently possible for the
access time on the symlink to not change (due to /tmp being mounted with
"noatime" option perhaps?), resulting in Travis CI build failures.
2016-02-13 18:55:53 +01:00
Vadim Zeitlin
54c874d488 Don't duplicate information in detailed test output
No need to output wxGetOsDescription() twice.
2016-02-13 18:34:47 +01:00