2010-08-22 18:16:05 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: testableframe.h
|
|
|
|
// Purpose: An improved wxFrame for unit-testing
|
|
|
|
// Author: Steven Lamerton
|
2010-09-23 12:55:29 -04:00
|
|
|
// RCS-ID: $Id$
|
2010-08-22 18:16:05 -04:00
|
|
|
// Copyright: (c) 2010 Steven Lamerton
|
2011-04-04 05:21:52 -04:00
|
|
|
// Licence: wxWindows licence
|
2010-08-22 18:16:05 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "wx/frame.h"
|
|
|
|
#include "wx/hashmap.h"
|
|
|
|
#include "wx/event.h"
|
|
|
|
|
|
|
|
class wxTestableFrame : public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxTestableFrame();
|
|
|
|
|
|
|
|
void OnEvent(wxEvent& evt);
|
|
|
|
|
|
|
|
//wxEVT_ANY get the count for all events or a type can be specified
|
|
|
|
int GetEventCount(wxEventType type = wxEVT_ANY);
|
|
|
|
|
2010-09-23 12:55:29 -04:00
|
|
|
//Used to clear an event count, after disconnecting a counter for example
|
|
|
|
void ClearEventCount(wxEventType type);
|
|
|
|
|
2010-08-22 18:16:05 -04:00
|
|
|
private:
|
|
|
|
wxLongToLongHashMap m_count;
|
|
|
|
};
|
|
|
|
|
|
|
|
class EventCounter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EventCounter(wxWindow* win, wxEventType type);
|
|
|
|
~EventCounter();
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxEventType m_type;
|
|
|
|
wxTestableFrame* m_frame;
|
|
|
|
wxWindow* m_win;
|
|
|
|
};
|