]>
Commit | Line | Data |
---|---|---|
232fdc63 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: testableframe.h | |
3 | // Purpose: An improved wxFrame for unit-testing | |
4 | // Author: Steven Lamerton | |
4ceca854 | 5 | // RCS-ID: $Id$ |
232fdc63 | 6 | // Copyright: (c) 2010 Steven Lamerton |
3fdcd5d5 | 7 | // Licence: wxWindows licence |
232fdc63 VZ |
8 | /////////////////////////////////////////////////////////////////////////////// |
9 | ||
10 | #include "wx/frame.h" | |
11 | #include "wx/hashmap.h" | |
12 | #include "wx/event.h" | |
13 | ||
14 | class wxTestableFrame : public wxFrame | |
15 | { | |
16 | public: | |
17 | wxTestableFrame(); | |
18 | ||
19 | void OnEvent(wxEvent& evt); | |
20 | ||
21 | //wxEVT_ANY get the count for all events or a type can be specified | |
22 | int GetEventCount(wxEventType type = wxEVT_ANY); | |
23 | ||
4ceca854 SL |
24 | //Used to clear an event count, after disconnecting a counter for example |
25 | void ClearEventCount(wxEventType type); | |
26 | ||
232fdc63 VZ |
27 | private: |
28 | wxLongToLongHashMap m_count; | |
29 | }; | |
30 | ||
31 | class EventCounter | |
32 | { | |
33 | public: | |
34 | EventCounter(wxWindow* win, wxEventType type); | |
35 | ~EventCounter(); | |
36 | ||
37 | private: | |
38 | wxEventType m_type; | |
39 | wxTestableFrame* m_frame; | |
40 | wxWindow* m_win; | |
41 | }; |