Commit Graph

328 Commits

Author SHA1 Message Date
Vadim Zeitlin
c0c133e13b add wx-prefixed and semicolon-requiring versions of DECLARE_NO_{COPY,ASSIGN}_CLASS macros
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58757 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-08 11:45:59 +00:00
Vadim Zeitlin
9b11752c4f require semicolon after wxDECLARE/DEFINE_EVENT() (closes #10456)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58718 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-07 18:59:25 +00:00
Vadim Zeitlin
579e055907 fix typo in last commit
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58714 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-07 15:29:52 +00:00
Vadim Zeitlin
1afe8c8307 rename wxDECLARE_LOCAL_EVENT to just wxDECLARE_EVENT
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58713 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-07 15:29:29 +00:00
Vadim Zeitlin
a01ada0599 allow handling events in a function taking the base class of the event class corresponding to the event type and not exactly the event class itself: this is more flexible (while still being safe) and incidentally fixes compatibility issues with existing code using explicit casts to wxObjectEventFunction (see #10477)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58690 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-06 18:33:01 +00:00
Francesco Montorsi
74d60f66ee add a wxEventType argument to wxThreadEvent for coherency with other event classes; rewrite its Clone() function
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58661 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-04 19:44:55 +00:00
Francesco Montorsi
1e247d6992 use WXDLLIMPEXP_CORE, not WXDLLIMPEXP_BASE for wxThreadEvent
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-04 19:25:09 +00:00
Francesco Montorsi
f6a3e0bad5 fix the new wxThreadEvent class adopting the new type-safe conventions for event classes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58655 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-04 17:49:22 +00:00
Francesco Montorsi
d48b06bd90 check in the 'selective yield' patch (see ticket #10320):
- implements YieldFor() with event filtering for wxMSW and wxGTK,
  adds TODO markers in other ports;
- replaces wxYield() in GTK's clipboard code with a wxTheApp->YieldFor() call, thus fixing possible reentrancies 
(and modifies clipboard sample to test synchronous IsSupported calls)
- replaces wxYieldIfNeeded() calls in wxProgressDialog with wxTheApp->YieldFor() calls, so that it processes only 
UI/user-input events, thus fixing the race condition visible in the "thread" sample
- documents the new functions


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58654 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-04 17:42:28 +00:00
Vadim Zeitlin
abb7d8a351 work around VC6 ICE in DLL build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58629 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-02 21:44:36 +00:00
Vadim Zeitlin
361ba943f9 use explicit this-> with non-dependent names (compilation fix for standard-conforming compilers such as g++ 4)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58627 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-02 21:09:08 +00:00
Vadim Zeitlin
f3ff831f3b Changes to template Connect() to make it compile with MSVC7 and possible other
not quite up-to-date compilers, to reduce repetitions and to allow using
methods of non-wxEvtHandler-derived classes as event callbacks:

1. Don't rely on compiler ability to deduce template parameter from the type
   of a parameter of a function used as another template parameter, at least
   MSVC7 can't do this and it's probably not the only one.
2. Do rely on compiler support for partial specialization to make
   wxEventFunctorMethod compile for non-wxEvtHandler-derived handlers while
   still keeping the old functionality for the wxEvtHandler-derived ones.
3. Don't make any difference between functions and functors, both are callable
   objects so use them as such, this allows to fold code for both cases.
4. Avoid the use of dynamic_cast<>.
5. Several naming changes:
 a) wxTypedEventType -> wxEventTypeTag (because this is what it is)
 b) Subscribe/Unsubscribe -> DoConnect/Disconnect (to follow the usual
    convention of public Foo calling private DoFoo and to avoid using up
    another name)
 c) Derived -> ObjClass (because it's not clear what does Derived mean)
6. Extend the unit test to cover more cases.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58625 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-02 20:38:56 +00:00
Vadim Zeitlin
f57254320e don't always disable new events code; leave it enabled for MSVC8+
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58620 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-02 11:39:48 +00:00
Vadim Zeitlin
412fcdc105 remove WXDLLIMPEXP_BASE from template classes to fix linking of code using new events in DLL build using MSVC9
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58613 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-01 23:05:55 +00:00
Vadim Zeitlin
111d41b2fa no real changes, just add some comments
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58610 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-01 22:10:52 +00:00
Vadim Zeitlin
dca9410337 fix wxEVT_SPIN_XXX definitions in a nicer (compatible with new events) way
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58313 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-23 00:30:41 +00:00
Francesco Montorsi
7f853dd046 fix wxWindow::PushEventHandler and related wxWindow functions for the stack management; currently they don't work well when passing event handlers which are part of an event handler chain (see wx-dev thread 'wxWindow event handler stack'); implement wxEvtHandler Unlink() and IsUnlinked() functions and document them; revise docs of all involved functions of both wxEvtHandler and wxWindow, adding images for better explanations
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58291 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-22 11:53:09 +00:00
Julian Smart
48def411aa Applied Peter Most's EVT_SPIN crash fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58200 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-18 19:30:23 +00:00
Vadim Zeitlin
29de6f400c ensure that ProcessEvent() is called for all the event handlers, not just the first one in event handlers list
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58144 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-16 16:07:16 +00:00
Vadim Zeitlin
cf516c2bb2 disable new event code unconditionally for now
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58089 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-14 08:47:23 +00:00
Vadim Zeitlin
4b42c189d5 fix wxDEFINE_EVENT_REFERENCE in wxEVENTS_COMPATIBILITY_2_8 case
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58052 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-12 17:10:23 +00:00
Vadim Zeitlin
898a466aef restored the default value of wxObjectEventFunctor wxNewEventFunctor and explain why is it needed
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58050 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-12 16:53:07 +00:00
Vadim Zeitlin
03f3617bf3 fix VC6 ICE; don't call the function which doesn't compare the objects operator==() (see #10000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58049 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-12 16:51:14 +00:00
Vadim Zeitlin
0b632977d7 don't use wxDELETE unnecessarily
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58040 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-12 14:33:43 +00:00
Vadim Zeitlin
3c77890141 add more flexible and safer template Connect() overloads (#10000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58039 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-12 14:26:13 +00:00
Francesco Montorsi
079f4130b8 no real change: rename wxPendingEvents to wxHandlersWithPendingEvents since its current name is misleading; that's not a list of events but a list of event handlers
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57623 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-12-28 19:30:43 +00:00
Francesco Montorsi
c9c1faa490 use wxEventType coherently with the docs
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-09 16:44:56 +00:00
Vadim Zeitlin
5c33522fca replace wx_{const,static,reinterpret}_cast with their standard C++ equivalents
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56644 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-02 02:39:52 +00:00
Vadim Zeitlin
3232da9d90 work around Borland compilation errors
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56461 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-10-20 09:00:19 +00:00
Vadim Zeitlin
7ce2fb7139 reverted r55167, see #9854
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55832 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-24 13:38:53 +00:00
Vadim Zeitlin
25250d335f extracted the part of ProcessEvent() which is repeated multiple times during the handling of a single event in the new ProcessEventHere() method; this ensures that wxApp::FilterEvent() is not called multiple times for the same event unnecessarily
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55784 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-22 00:08:28 +00:00
Vadim Zeitlin
0e0977894a make wxKeyEvent and wxMouseEvent derive from the same wxKeyboardState object (indirectly via wxMouseState in the case of the latter) to make Get/HasModifiers() available in wxMouseEvent as well while avoiding code duplication
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55745 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-19 18:41:41 +00:00
Robert Roebling
de2fcf0332 #9854 (AddPendingEvent - protect during wxEvtHandler destruction)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55167 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-08-22 09:18:30 +00:00
Vadim Zeitlin
831b64f32f fix the wrong #ifdef WXWIN_COMPATIBILITY_2_8 checks, #if should be used (#9644)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54372 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-06-26 11:16:40 +00:00
Vadim Zeitlin
d317fdebc3 add wxShowEvent::IsShown() and wxIconizeEvent::IsIconized() instead of (now deprecated) GetShow() and Iconized() respectively (#978)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54320 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-06-21 16:17:13 +00:00
Vadim Zeitlin
d1a64f69cb use more general pointer-to-member representation for wxEvtHandler methods to make it possible to use as event handlers methods of classes multiply inheriting from it and some other class (#9556)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54100 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-06-11 14:22:21 +00:00
Robert Roebling
ae8eee38f4 Disable disabling wxWeakRef<T>
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-06-02 18:07:06 +00:00
Vadim Zeitlin
c3f941621e added wxQueueEvent() avoiding the bug of wxPostEvent() with the events having wxString fields
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53405 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-04-28 18:49:42 +00:00
Robert Roebling
c96cc30a5d Let wxCommandEvent's copy constr copy its string via .c_str() as otherwise ::Clone() isn't thread-safe
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53313 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-04-22 13:14:00 +00:00
Vadim Zeitlin
8cd6a9ad50 added wxSpinCtrlDouble (slightly modified patch 1835864)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52612 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-03-18 14:04:19 +00:00
Vadim Zeitlin
4732e2dca9 add wxUSE_WEAKREF (modified partially applied patch 1870445)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51614 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-02-09 14:40:26 +00:00
Vadim Zeitlin
85ee624151 make wxIdleEventHandler available in console applications too (patch 1878258)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51521 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-02-03 14:08:01 +00:00
Vadim Zeitlin
c058cafa56 don't use DECLARE_EVENT_TYPE() to avoid confusing people about its unused value parameter, declare the event type constants directly
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51405 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-27 13:21:39 +00:00
Vadim Zeitlin
cc6ceca789 improvements to wxWeakRef and related classes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51187 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-13 01:12:13 +00:00
Paul Cornett
162e998c2f check for self-assignment in operator=
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51123 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-09 04:08:33 +00:00
Robert Roebling
2ef989c972 Last part from weak ref patch for event sink disconnection
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51111 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-08 17:57:27 +00:00
Vadim Zeitlin
8ebec7dcd8 clean up wxEvtHandler::m_eventsLocker weirdness: there is no need to allocate it dynamically (as it's always done anyhow), this removes the need for ClearEventLocker() and OS/2 #ifdefs
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51027 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-05 19:07:52 +00:00
Vadim Zeitlin
19c4d91638 process one event at once in wxEvtHandler::ProcessPendingEvents() to prevent crashes when a (pending) event handler destroys the event handler object itself; only add the event handler to wxPendingEvents list if it's not already there (and explicitly mention that an object can be present in this list only once in the comment) (replaces patch 1837719)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51021 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-05 17:29:20 +00:00
Robert Roebling
ad684023c5 Remove old event type compatibility
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50857 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-12-20 11:24:44 +00:00
Paul Cornett
204abcd474 remove unneccessary header dependencies on wx/thread.h
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50443 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-12-03 02:55:14 +00:00