Commit Graph

426 Commits

Author SHA1 Message Date
orbitcowboy
8dfd799fd5 Use const for constant local variables in wxWidgets headers
This avoids warnings from MSVS 2017 static analyzer when C++ core rule
set is activated.

Closes https://github.com/wxWidgets/wxWidgets/pull/819
2018-07-21 16:16:32 +02:00
Vadim Zeitlin
bec3cf6387 Work around gcc 8 -Wcast-function-type in event table macros
Suppress the warnings about formally incorrect but working in practice
cast from an event handler taking an object of a class derived from
wxEvent to wxEventFunction, i.e. a handler taking just wxEvent itself.
2018-06-03 22:47:50 +02:00
Maarten Bent
3b9aeaeb2f More use of wxOVERRIDE 2018-03-06 23:31:01 +01:00
Robin Dunn
6cdf29760d Fix conflict in macro and class name 2018-02-10 13:00:19 -08:00
Vadim Zeitlin
bb2887930f Use wxPoint instead of (x,y) pair in wxPanGestureEvent
Using higher level objects makes the code generating and using this
event shorter and more clear.
2017-11-21 17:45:34 +01:00
prashantkn94
261b04b5a3 Merge multi-touch gestures event branch
This is a squashed commit of the SOC2017_GESTURES branch from
https://github.com/prashantkn94/wxWidgets.git

Closes https://github.com/wxWidgets/wxWidgets/pull/551
2017-11-17 18:06:06 +01:00
Vadim Zeitlin
d15bbcacd2 Merge branch 'rmv_symbols_3' of https://github.com/catalinr/wxWidgets
Remove obsolete mentions of Windows 9x, Windows CE and OS/2.
2017-02-20 17:46:45 +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
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
Maarten
977a826639 use more wxOVERRIDE (#329) 2016-09-25 13:21:28 -07:00
Catalin
cd4942bf8a Removed obsolete symbols from comments. 2016-02-21 20:12:10 +02: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
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
Tim Kosse
dc48f595b3 Need to include wx/vector.h, otherwise wxVector is undeclared if configured with --disable-precom-headers --disable-any. 2016-02-05 10:07:09 +01:00
Vadim Zeitlin
5dd5d68e67 Revert "Fix fields initialization in wxCommandEvent copy ctor."
This reverts commit 62763ad541 which seems to
have been completely unnecessary as the fields had been already initialized
and this commit actually broke initialization of the propagation level of the
copied wxCommandEvent objects.

Add a unit test proving that things do work.

Closes #16739.
2016-01-30 05:02:54 +01:00
Vadim Zeitlin
99d9a81e28 Fix crash when unbinding event handlers from other handlers
Calling Unbind() on another handler from the currently executing handler which
had been bound after (and hence executed before) the handler being unbound
resulted in a crash previously as the iterators used in the loop over all
dynamic event handlers became invalid.

Fix this by storing the dynamic event table entries in a vector instead of a
list (which is also more memory and speed efficient anyhow) and null the
deleted entries instead of removing them to avoid invalidating the iterators
and only really remove them once we finish iterating.

Closes #17229.
2015-12-08 03:02:37 +01:00
Tobias Taschner
8282c1be0f Remove Windows CE support
Windows CE doesn't seem to be supported by Microsoft any longer. Last CE
release was in early 2013 and the PocketPC and Smartphone targets supported by
wxWidgets are long gone.

The build files where already removed in an earlier cleanup this commit
removes all files, every #ifdef and all documentation regarding the Windows CE
support.

Closes https://github.com/wxWidgets/wxWidgets/pull/81
2015-09-23 00:52:30 +02:00
Dimitri Schoolwerth
31145b8e3a Fix some typos, no code changes (besides strings) 2015-06-05 02:54:46 +04:00
Dimitri Schoolwerth
8f8d58d193 Use wx-prefixed macros throughout the repository.
Change {DECLARE,IMPLEMENT}_*CLASS and {DECLARE,BEGIN,END}_EVENT_TABLE
occurrences to use the wx-prefixed version of the macros.
2015-04-23 22:00:35 +04:00
Vadim Zeitlin
ea47af08cb Add wxEVT_MAGNIFY mouse event.
Currently this is implemented for wxOSX only.

Closes #14322.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78274 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-12-16 13:59:26 +00:00
Vadim Zeitlin
62763ad541 Fix fields initialization in wxCommandEvent copy ctor.
Neither m_isCommandEvent nor, worse, m_propagationLevel was set correctly for
wxCommandEvent objects constructed using copy ctor -- and hence Clone(). This
means that such events were not propagated upwards the window hierarchy, quite
possibly resulting in mysterious bugs.

Fix this now by initializing these fields in both the normal and copy ctors.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78229 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-12-05 22:17:52 +00:00
Vadim Zeitlin
01f9accd19 Remove wxPM, wxWidgets port to OS/2.
This port is not used and is not being worked on, so remove it to reduce the
amount of the code which needs to be updated for every global change.

Also remove tests for VisualAge compiler which isn't used since ages.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76533 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-05-15 23:56:58 +00:00
Vadim Zeitlin
f4b80e5337 Remove MSVC6 support.
Don't support this compiler any more, this allows to get rid of tons of
MSVC6-specific workarounds, in particular we can now use Bind() and natural
template functions calls in the library code.

Also remove MSVC6 project and solution files and don't generate them when
bakefile_gen is ran any more (removing the remaining occurrences of msvc6prj
from the bakefiles results in weird bake-time errors, so it's simpler to just
leave them there).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76532 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-05-15 22:32:17 +00:00
Paul Cornett
8b4ae731d3 use wxOVERRIDE
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76220 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-03-30 00:02:23 +00:00
Paul Cornett
967a94c91a remove WXWIN_COMPATIBILITY_2_6, add WXWIN_COMPATIBILITY_3_0
closes #15792

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75532 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-01-04 20:07:33 +00:00
Vadim Zeitlin
4521f6c88c Add wxActivateEvent::GetActivationReason().
This method is implemented for wxMSW-only currently and allows to check
whether the window is being activated by a mouse click or in some other way
there.

Closes #15516.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74915 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-10-02 16:25:04 +00:00
Vadim Zeitlin
3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00
Václav Slavík
cbc8576a9b Add functor-taking overload of CallAfter().
This is a generalization of the existing method-calling overloads.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74574 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-21 10:05:03 +00:00
Vadim Zeitlin
5ac5e40e41 Prevent duplicate menu event processing in MDI windows.
Record the object propagating the given event upwards in the event object
itself and use it in wxMDIParentFrame to determine whether the event being
handled is already coming from wxMDIChildFrame and avoid sending it back for
processing it there again in this case.

This is ugly and makes wx event processing even more complex but this is the
only way I could find to ensure that

(a) Both the child and the parent frames get the events from the toolbar
    (even though the toolbar parent is the parent frame and hence normally
    the child wouldn't get notified about them at all and so the forwarding
    at wxMDIParentFrame level is required to make this work).

(b) The child gets the event only once, whether it comes from a toolbar (and
    hence indirectly via the parent frame) or from the child menu (and hence
    directly to the child, at least in wxMSW).

This commit fixes the event propagation unit test case, at least under MSW and
GTK.

See #14314.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74357 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-03 22:18:42 +00:00
Vadim Zeitlin
5833988cb7 Add wxMouseEvent::GetColumnsPerAction().
This is similar to the existing GetLinesPerAction() but is for, surprise,
columns.

Also change the documentation to say that the value returned by both of these
methods is 3 under "most platforms" as some wxOSX currently uses 1 and not 3.

Closes #15239.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74156 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-06-10 15:53:29 +00:00
Vadim Zeitlin
3bad8c3926 Fix menu event handlers calling order.
Pass the menu event to the window associated with the menu first, before
falling back on wxApp.

This required adding yet another flag to keep state in wxEvent but it seems to
be unavoidable as wxMenuBase::SendEvent() calls ProcessEvent() twice and we
must have some way to distinguish the first call from the second one.

Added a test case verifying that the menu events are indeed processed in the
expected order.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73921 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-05-04 23:59:29 +00:00
Vadim Zeitlin
ce7fe42e84 Provide shorter synonyms for wxEVT_XXX constants.
Use the same short names as are used by the event table macros for the event
type constants themselves. This makes them much more comfortable to use, e.g.
Bind(wxEVT_BUTTON) compared to Bind(wxEVT_COMMAND_BUTTON_CLICKED).

The old long names are still kept for backwards compatibility and shouldn't be
removed as it doesn't really cost anything to continue providing them, but all
new event types should only use the short versions.

Closes #10661.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73850 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-25 10:11:03 +00:00
Vadim Zeitlin
4cf8e24bc1 Fix typo in definitions of BEGIN_EVENT_TABLE_TEMPLATEn() macros with n>=2.
They were all defined as wxBEGIN_EVENT_TABLE_TEMPLATE1() instead of the
correct wxBEGIN_EVENT_TABLE_TEMPLATEn().

Closes #15050.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73566 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-02-24 13:48:42 +00:00
Vadim Zeitlin
e0e6f3dc80 Fix wxKeyEvent::GetPosition() after the changes of r72207.
Now that the position of wxKeyEvent is initialized on demand, don't use m_x
and m_y fields directly but always use GetX() and GetY().

Also improve GetPosition() documentation slightly and mention only the new
version, taking wxCoord, in it as the old one, taking long, is provided for
compatiblity only.

Closes #14987.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73411 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-01-20 12:45:52 +00:00
Vadim Zeitlin
f0facad09d Disable CallAfter() for MSVC 7 too, it can't compile this code.
It was already disabled for VC6 but VC7 doesn't compile this code neither, so
disable it for this compiler as well.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73025 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-26 15:51:04 +00:00
Vadim Zeitlin
8f6bb2602b Disable wxEvtHandler::CallAfter() for VC6, it's too broken for it.
There is no clear way to implement wxRemoveRef() for VC6 so just disable it,
and CallAfter() as it relies on it, for this compiler.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72743 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-24 00:17:15 +00:00
Paul Cornett
856cad9ac7 Minor changes to some comments
remove ambiguous "only"
procession --> processing


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72736 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-23 17:28:43 +00:00
Vadim Zeitlin
cf2227623a Add wxEvtHandler::CallAfter() for asynchronous method calls.
Add wxAsyncMethodCallEvent that is handled simply by calling the method this
event was created for and add default handler for this event to wxEvtHandler.

Implement CallAfter() overloads for up to 2 parameters only for now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72722 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-23 12:02:24 +00:00
Vadim Zeitlin
685d0d734b Add wxEvent::GetEventUserData() and improve user data documentation.
Provide a public and documented accessor for wxEvent::m_callbackUserData.

Also document better the user data semantics and how it can be used.

Closes #14748.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-16 22:28:43 +00:00
Vadim Zeitlin
34af6cfc8d Copy wxCommandEvent string explicitly in its copy ctor.
Due to the optimization used in wxCommandEvent::GetString(), which returns the
string from the text control that generated the event only if it's really
needed, wxCommandEvent::m_cmdString field may be empty even when it does have
an associated string. As we lose the possibility to retrieve the value on
demand from wxTextCtrl when we make a copy (because it can be associated with
a different object), we need to explicitly copy the string to avoid losing
this data entirely.

This fixes GetString() value for the text events generated by generic
wxSearchCtrl.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72647 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-09 21:01:53 +00:00
Vadim Zeitlin
105b2ca747 No changes, just fix some typos in the comments in the headers.
Closes #14665.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-17 11:07:30 +00:00
Vadim Zeitlin
2f7baaeccf Don't eagerly set wxKeyEvent position fields.
This results in a noticeable delay when using wxGTK via a remote X11
connection for every key event as a round trip to server is needed to get the
mouse pointer position every time a key is pressed or released.

Only provide the position on demand. And explain that it's actually not very
useful as it's simply the same as the current mouse position.

Closes #14361.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72207 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-24 20:45:52 +00:00
Vadim Zeitlin
9bd5c5fcda Use wxString::Clone() instead of c_str() in wxThreadEvent copy ctor.
Creating a new wxString from c_str() of the old one resulted in dropping all
string data after the first embedded NUL. Fix this by using Clone() method
that exists specifically for this purpose. It also makes the code more clear.

Closes #14380.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71701 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-06-08 18:44:14 +00:00
Vadim Zeitlin
41469c9e5e Use enum for wxMouseEvent::m_wheelAxis instead of int.
This variable can take only 2 values, use symbolic names for them instead of
difficult to understand 0 and 1.

See ##14105.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70961 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-22 00:26:59 +00:00
Vadim Zeitlin
1b4bff8262 Add minimal support for building non-GUI parts of wxWidgets for Android.
Recognize __ANDROID__ in wx/platform.h and include the appropriate headers
from wx/android.

Also fix a couple of compilation errors (in filename.cpp) and warnings (in
event.h) which only appear when building for Android.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70703 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-26 20:24:25 +00:00
Vadim Zeitlin
f179a616c7 Remove references to defunct event types in comments.
No real changes, just complete the changes of r58039 by removing the
references to non-existent (any more) event types from the comments too.

Closes #13801.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70104 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-12-24 15:42:57 +00:00
Paul Cornett
7bc57fd972 fix tests for WXWIN_COMPATIBILITY_2_8, closes #13800
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70098 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-12-23 05:59:59 +00:00
Vadim Zeitlin
4cf1a9bf4a Ensure that Enter key presses are never stolen from wxButton in wxMSW.
This commit fixes the following bug: when an in-place editor control containing
an embedded button was used in wxDataViewCtrl, pressing Enter on the button
would close the editor, accepting changes, instead as (generic) wxDataViewCtrl
intercepts WXK_RETURN in its EVT_CHAR_HOOK handler. To prevent this from
happening, wxButton now handles EVT_CHAR_HOOK itself and never lets the parent
window intercept it if it's for WXK_RETURN. To ensure that normal
wxEVT_KEY_DOWN and wxEVT_CHAR are still generated in this case, wxButton
handler calls the new wxKeyEvent::DoAllowNextEvent() method that was added to
allow suppressing EVT_CHAR_HOOK only, without affecting the subsequent events.
DoAllowNextEvent() is currently only used in wxMSW but support for it was also
added to wxGTK and (both) wxOSX ports.

See #9102.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69984 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-12-11 17:03:56 +00:00
Vadim Zeitlin
3a95f73c00 Make wxEVT_CHAR_HOOK propagate upwards and send it to the window itself.
Send wxEVT_CHAR_HOOK events to the focused window itself but make them
propagatable to ensure that the parent windows (including the top level
parent) still get it. This still allows the TLW parent to intercept keyboard
handling in its child but allows the child (or an intermediate parent window)
to have some say in the matter.

See #9102.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-12-02 00:50:25 +00:00
Vadim Zeitlin
e45d90901d Added wxKeyEvent ctor for creating event of the different type for same key.
This is useful for implementation code in a couple of ports so provide a
higher level ctor doing this instead of having to use a copy ctor and then
manually changing the event type.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69891 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-12-02 00:50:19 +00:00