00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00012
00013 #ifdef __GNUG__
00014 #pragma implementation "CREventCaptureManager.h"
00015 #endif
00016
00017 #include <wxGuiTest/CREventCaptureManager.h>
00018
00019 #include <fstream>
00020
00021 #include <wx/xrc/xmlres.h>
00022 #include <wx/notebook.h>
00023 #include <wx/listbase.h>
00024 #include <wx/splitter.h>
00025 #include <wx/treebase.h>
00026 #include <wx/tglbtn.h>
00027
00028 #include <wxGuiTest/CRLogInterface.h>
00029 #include "CapturedEvents/CRCapturedEvent.h"
00030 #include "CREventFactory.h"
00031 #include <wxGuiTest/CRCppEmitter.h>
00032
00033 using namespace wxTst;
00034
00035
00036
00037 CREventCaptureManager *CREventCaptureManager::ms_instance = NULL;
00038
00039
00040 CREventCaptureManager::CREventCaptureManager ()
00041 {
00042 m_ignoreWdw = NULL;
00043 m_isOn = false;
00044 m_event = NULL;
00045 m_log = NULL;
00046 m_logStream = new std::ofstream ();
00047 m_logStream->open ("CREventCaptureManager.log");
00048
00049 m_pendingEvent = NULL;
00050 }
00051
00052
00053 CREventCaptureManager::~CREventCaptureManager ()
00054 {
00055 if (m_logStream != NULL) {
00056
00057 m_logStream->close ();
00058 m_logStream = NULL;
00059 }
00060
00061
00062 this->EmitPendingEvent();
00063
00064
00065
00066
00067
00068
00069
00070
00071 ms_instance = NULL;
00072 }
00073
00074
00075 CREventCaptureManager * CREventCaptureManager::GetInstance ()
00076 {
00077 if (ms_instance == NULL) {
00078
00079 ms_instance = new CREventCaptureManager ();
00080 }
00081 return ms_instance;
00082 }
00083
00084
00085 void CREventCaptureManager::Destroy ()
00086 {
00087 if (ms_instance != NULL) {
00088
00089 delete ms_instance;
00090 ms_instance = NULL;
00091 }
00092 }
00093
00094
00095 void CREventCaptureManager::IgnoreWindow (wxWindow *wdw)
00096 {
00097 m_ignoreWdw = wdw;
00098 }
00099
00100
00101 void CREventCaptureManager::On ()
00102 {
00103 m_isOn = true;
00104 }
00105
00106
00107 void CREventCaptureManager::Off ()
00108 {
00109 m_isOn = false;
00110 }
00111
00112
00113 bool CREventCaptureManager::IsOn () const
00114 {
00115 return m_isOn;
00116 }
00117
00118
00119 void CREventCaptureManager::SetLogger (CRLogInterface *log)
00120 {
00121 m_log = log;
00122 }
00123
00124
00125 void CREventCaptureManager::FilterEvent (wxEvent &event)
00126 {
00127 if (this->IsOn ()) {
00128
00129
00130 if (this->CanIgnore (event)) {
00131
00132 return;
00133 }
00134
00135 if ((m_event != NULL) && (&event == m_event)) {
00136
00137 return;
00138 }
00139
00140
00141
00142
00143
00144
00145
00146 m_event = &event;
00147
00148
00149
00150
00151
00152
00153 CRCapturedEvent *captureEvt = CREventFactory::GetInstance ()->
00154 CreateEvent (event);
00155 if (captureEvt) {
00156
00157
00158
00159
00160
00161 captureEvt->Process (&m_pendingEvent);
00162
00163 this->EmitPendingEvent();
00164
00165 if (captureEvt->IsIrrelevant ()) {
00166
00167 delete captureEvt;
00168
00169 } else if (captureEvt->IsPending ()) {
00170
00171 m_pendingEvent = captureEvt;
00172
00173 } else {
00174
00175 captureEvt->EmitCpp ();
00176 delete captureEvt;
00177 }
00178
00179 } else {
00180
00181 wxString evtDesc = this->GetDescForUnsupportedEvent (event);
00182 if (!evtDesc.IsEmpty ()) {
00183
00184 CRCppEmitter::GetInstance ()->AddComment (
00185 wxString::Format (_T("Unsupported event %s %s\n"),
00186 evtDesc.c_str (), this->GetEventDetails (event).c_str ()));
00187 this->LogEventDetails (event, wxString::Format (
00188 _T("Unsupported event %s"), evtDesc.c_str ()));
00189 }
00190 }
00191
00192 wxString evtDesc = this->GetEventDesc (event);
00193 if (!evtDesc.IsEmpty ()) {
00194
00195 (*m_logStream) << evtDesc.c_str () << _T(": ") <<
00196 this->GetEventDetails (event).c_str () << std::endl;
00197 }
00198 }
00199 }
00200
00201
00202 bool CREventCaptureManager::CanIgnore (wxEvent &event)
00203 {
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216 wxWindow *wdw = wxDynamicCast (event.GetEventObject (), wxWindow);
00217 if (wdw != NULL) {
00218
00219 if (wdw == m_ignoreWdw) {
00220
00221
00222 return true;
00223 }
00224 wxWindow *parent = wdw->GetParent ();
00225 if (parent) {
00226
00227 if (parent == m_ignoreWdw) {
00228
00229
00230 return true;
00231 }
00232
00233 wxWindow *grandParent = wdw->GetGrandParent ();
00234 if (grandParent && grandParent == m_ignoreWdw) {
00235
00236
00237 return true;
00238 }
00239 }
00240 }
00241
00242 return false;
00243 }
00244
00245
00246 void CREventCaptureManager::EmitPendingEvent ()
00247 {
00248 if (m_pendingEvent != NULL) {
00249
00250 m_pendingEvent->EmitCpp ();
00251 delete m_pendingEvent;
00252 m_pendingEvent = NULL;
00253 }
00254 }
00255
00256
00257 wxString CREventCaptureManager::GetDescForUnsupportedEvent (
00258 wxEvent &event) const
00259 {
00260 #define UNSUPPORTED_EVENT_DESC(eventtype) \
00261 if (et == eventtype) \
00262 return _T(#eventtype);
00263
00264 int et = event.GetEventType ();
00265
00266 UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LISTBOX_SELECTED)
00267 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED)
00268 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED)
00269 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_RADIOBUTTON_SELECTED)
00270 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_SCROLLBAR_UPDATED)
00271 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_VLBOX_SELECTED)
00272 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_COMBOBOX_SELECTED)
00273 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TOOL_RCLICKED)
00274 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TOOL_ENTER)
00275 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED)
00276 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED)
00277 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_SPLITTER_UNSPLIT)
00278 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED)
00279 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_BEGIN_DRAG)
00280 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_BEGIN_RDRAG)
00281 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT)
00282 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_END_LABEL_EDIT)
00283 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_DELETE_ITEM)
00284 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS)
00285
00286
00287 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_ITEM_SELECTED)
00288 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_ITEM_DESELECTED)
00289 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_KEY_DOWN)
00290 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_INSERT_ITEM)
00291 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_COL_CLICK)
00292 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK)
00293 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK)
00294 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_ITEM_ACTIVATED)
00295 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_CACHE_HINT)
00296 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_COL_RIGHT_CLICK)
00297 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG)
00298 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_COL_DRAGGING)
00299 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_COL_END_DRAG)
00300 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_LIST_ITEM_FOCUSED)
00301 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TREE_BEGIN_DRAG)
00302 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TREE_BEGIN_RDRAG)
00303 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT)
00304 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TREE_END_LABEL_EDIT)
00305
00306
00307
00308
00309
00310 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TREE_ITEM_COLLAPSED)
00311 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TREE_ITEM_COLLAPSING)
00312 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TREE_SEL_CHANGED)
00313 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TREE_KEY_DOWN)
00314 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TREE_ITEM_ACTIVATED)
00315 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK)
00316 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TREE_END_DRAG)
00317 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK)
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353 #if wxUSE_HOTKEY
00354 else UNSUPPORTED_EVENT_DESC(wxEVT_HOTKEY)
00355 #endif
00356
00357
00358 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLL_TOP)
00359 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLL_BOTTOM)
00360 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLL_LINEUP)
00361 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLL_LINEDOWN)
00362 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLL_PAGEUP)
00363 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLL_PAGEDOWN)
00364 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLL_THUMBTRACK)
00365 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLL_THUMBRELEASE)
00366 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLL_CHANGED)
00367 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLLWIN_TOP)
00368 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLLWIN_BOTTOM)
00369 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLLWIN_LINEUP)
00370 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLLWIN_LINEDOWN)
00371 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLLWIN_PAGEUP)
00372 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLLWIN_PAGEDOWN)
00373 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLLWIN_THUMBTRACK)
00374 else UNSUPPORTED_EVENT_DESC(wxEVT_SCROLLWIN_THUMBRELEASE)
00375
00376
00377
00378
00379
00380
00381
00382
00383 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_ENTER)
00384 else UNSUPPORTED_EVENT_DESC(wxEVT_HELP)
00385 else UNSUPPORTED_EVENT_DESC(wxEVT_DETAILED_HELP)
00386 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TEXT_ENTER)
00387 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TEXT_URL)
00388 else UNSUPPORTED_EVENT_DESC(wxEVT_COMMAND_TEXT_MAXLEN)
00389 else
00390 return _T("");
00391 }
00392
00393
00394 wxString CREventCaptureManager::GetEventDesc (wxEvent &event) const
00395 {
00396 #define EVENT_DESC(eventtype) \
00397 if (et == eventtype) \
00398 desc = _T(#eventtype);
00399
00400 int et = event.GetEventType ();
00401 wxString desc;
00402
00403 EVENT_DESC(wxEVT_COMMAND_BUTTON_CLICKED)
00404 else EVENT_DESC(wxEVT_COMMAND_MENU_SELECTED)
00405 else EVENT_DESC(wxEVT_COMMAND_TEXT_UPDATED)
00406 else EVENT_DESC(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
00407 else EVENT_DESC(wxEVT_COMMAND_CHOICE_SELECTED)
00408 else EVENT_DESC(wxEVT_COMMAND_RADIOBOX_SELECTED)
00409 else EVENT_DESC(wxEVT_COMMAND_CHECKBOX_CLICKED)
00410 else EVENT_DESC(wxEVT_COMMAND_SLIDER_UPDATED)
00411 else EVENT_DESC(wxEVT_COMMAND_SPINCTRL_UPDATED)
00412 else EVENT_DESC(wxEVT_COMMAND_TREE_SEL_CHANGING)
00413 else EVENT_DESC(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK)
00414 else EVENT_DESC(wxEVT_COMMAND_LISTBOX_SELECTED)
00415 else EVENT_DESC(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED)
00416 else EVENT_DESC(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED)
00417 else EVENT_DESC(wxEVT_COMMAND_RADIOBUTTON_SELECTED)
00418 else EVENT_DESC(wxEVT_COMMAND_SCROLLBAR_UPDATED)
00419 else EVENT_DESC(wxEVT_COMMAND_VLBOX_SELECTED)
00420 else EVENT_DESC(wxEVT_COMMAND_COMBOBOX_SELECTED)
00421 else EVENT_DESC(wxEVT_COMMAND_TOOL_RCLICKED)
00422 else EVENT_DESC(wxEVT_COMMAND_TOOL_ENTER)
00423 else EVENT_DESC(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED)
00424 else EVENT_DESC(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED)
00425 else EVENT_DESC(wxEVT_COMMAND_SPLITTER_UNSPLIT)
00426 else EVENT_DESC(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED)
00427 else EVENT_DESC(wxEVT_COMMAND_LIST_BEGIN_DRAG)
00428 else EVENT_DESC(wxEVT_COMMAND_LIST_BEGIN_RDRAG)
00429 else EVENT_DESC(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT)
00430 else EVENT_DESC(wxEVT_COMMAND_LIST_END_LABEL_EDIT)
00431 else EVENT_DESC(wxEVT_COMMAND_LIST_DELETE_ITEM)
00432 else EVENT_DESC(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS)
00433
00434
00435 else EVENT_DESC(wxEVT_COMMAND_LIST_ITEM_SELECTED)
00436 else EVENT_DESC(wxEVT_COMMAND_LIST_ITEM_DESELECTED)
00437 else EVENT_DESC(wxEVT_COMMAND_LIST_KEY_DOWN)
00438 else EVENT_DESC(wxEVT_COMMAND_LIST_INSERT_ITEM)
00439 else EVENT_DESC(wxEVT_COMMAND_LIST_COL_CLICK)
00440 else EVENT_DESC(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK)
00441 else EVENT_DESC(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK)
00442 else EVENT_DESC(wxEVT_COMMAND_LIST_ITEM_ACTIVATED)
00443 else EVENT_DESC(wxEVT_COMMAND_LIST_CACHE_HINT)
00444 else EVENT_DESC(wxEVT_COMMAND_LIST_COL_RIGHT_CLICK)
00445 else EVENT_DESC(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG)
00446 else EVENT_DESC(wxEVT_COMMAND_LIST_COL_DRAGGING)
00447 else EVENT_DESC(wxEVT_COMMAND_LIST_COL_END_DRAG)
00448 else EVENT_DESC(wxEVT_COMMAND_LIST_ITEM_FOCUSED)
00449 else EVENT_DESC(wxEVT_COMMAND_TREE_BEGIN_DRAG)
00450 else EVENT_DESC(wxEVT_COMMAND_TREE_BEGIN_RDRAG)
00451 else EVENT_DESC(wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT)
00452 else EVENT_DESC(wxEVT_COMMAND_TREE_END_LABEL_EDIT)
00453
00454
00455
00456
00457
00458 else EVENT_DESC(wxEVT_COMMAND_TREE_ITEM_COLLAPSED)
00459 else EVENT_DESC(wxEVT_COMMAND_TREE_ITEM_COLLAPSING)
00460 else EVENT_DESC(wxEVT_COMMAND_TREE_SEL_CHANGED)
00461 else EVENT_DESC(wxEVT_COMMAND_TREE_KEY_DOWN)
00462 else EVENT_DESC(wxEVT_COMMAND_TREE_ITEM_ACTIVATED)
00463 else EVENT_DESC(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK)
00464 else EVENT_DESC(wxEVT_COMMAND_TREE_END_DRAG)
00465 else EVENT_DESC(wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK)
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501 #if wxUSE_HOTKEY
00502 else EVENT_DESC(wxEVT_HOTKEY)
00503 #endif
00504
00505
00506 else EVENT_DESC(wxEVT_SCROLL_TOP)
00507 else EVENT_DESC(wxEVT_SCROLL_BOTTOM)
00508 else EVENT_DESC(wxEVT_SCROLL_LINEUP)
00509 else EVENT_DESC(wxEVT_SCROLL_LINEDOWN)
00510 else EVENT_DESC(wxEVT_SCROLL_PAGEUP)
00511 else EVENT_DESC(wxEVT_SCROLL_PAGEDOWN)
00512 else EVENT_DESC(wxEVT_SCROLL_THUMBTRACK)
00513 else EVENT_DESC(wxEVT_SCROLL_THUMBRELEASE)
00514 else EVENT_DESC(wxEVT_SCROLL_CHANGED)
00515 else EVENT_DESC(wxEVT_SCROLLWIN_TOP)
00516 else EVENT_DESC(wxEVT_SCROLLWIN_BOTTOM)
00517 else EVENT_DESC(wxEVT_SCROLLWIN_LINEUP)
00518 else EVENT_DESC(wxEVT_SCROLLWIN_LINEDOWN)
00519 else EVENT_DESC(wxEVT_SCROLLWIN_PAGEUP)
00520 else EVENT_DESC(wxEVT_SCROLLWIN_PAGEDOWN)
00521 else EVENT_DESC(wxEVT_SCROLLWIN_THUMBTRACK)
00522 else EVENT_DESC(wxEVT_SCROLLWIN_THUMBRELEASE)
00523
00524
00525
00526
00527
00528
00529
00530
00531 else EVENT_DESC(wxEVT_COMMAND_ENTER)
00532 else EVENT_DESC(wxEVT_HELP)
00533 else EVENT_DESC(wxEVT_DETAILED_HELP)
00534 else EVENT_DESC(wxEVT_COMMAND_TEXT_ENTER)
00535 else EVENT_DESC(wxEVT_COMMAND_TEXT_URL)
00536 else EVENT_DESC(wxEVT_COMMAND_TEXT_MAXLEN)
00537
00538 #undef EVENT_DESC
00539
00540 return desc;
00541 }
00542
00543
00544 wxString CREventCaptureManager::GetEventDetails (wxEvent& event) const
00545 {
00546 wxString evtObjName, evtObjHierarchy;
00547
00548 wxObject *obj = event.GetEventObject ();
00549 if ((event.GetEventType () == wxEVT_COMMAND_MENU_SELECTED) ||
00550 (event.GetEventType () == wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)) {
00551
00552 wxWindow *wdw = wxDynamicCast (obj, wxWindow);
00553 if (wdw != NULL) {
00554
00555 evtObjName = wdw->GetName ();
00556
00557
00558
00559 wxWindow *parent = wdw->GetParent ();
00560 if (parent) {
00561
00562 evtObjHierarchy += _T("-> ") + parent->GetName ();
00563 }
00564 parent = wdw->GetGrandParent ();
00565 if (parent) {
00566
00567 evtObjHierarchy += _T(" -> ") + parent->GetName ();
00568 }
00569
00570 } else {
00571
00572
00573 wxMenu *menu = wxDynamicCast (obj, wxMenu);
00574 if (menu != NULL) {
00575
00576 evtObjName = menu->GetTitle ();
00577 }
00578 }
00579
00580 } else if (obj != NULL) {
00581
00582 wxWindow *wdw = wxDynamicCast (obj, wxWindow);
00583 if (wdw != NULL) {
00584
00585 evtObjName = wdw->GetName ();
00586
00587
00588
00589
00590 if (event.IsCommandEvent ()) {
00591
00592
00593 wxWindow *child = wxWindow::FindWindowById (event.GetId ());
00594 wxASSERT ((event.GetId () == wxXmlResource::GetXRCID (evtObjName))
00595 || (child != NULL));
00596
00597 } else {
00598
00599 wxASSERT (event.GetId () == wxXmlResource::GetXRCID (evtObjName));
00600 }
00601
00602 wxWindow *parent = wdw->GetParent ();
00603 if (parent) {
00604
00605 evtObjHierarchy += _T("-> ") + parent->GetName ();
00606 }
00607 parent = wdw->GetGrandParent ();
00608 if (parent) {
00609
00610 evtObjHierarchy += _T(" -> ") + parent->GetName ();
00611 }
00612 } else {
00613
00614
00615 wxMenu *menu = wxDynamicCast (obj, wxMenu);
00616 if (menu != NULL) {
00617
00618 evtObjName = menu->GetTitle ();
00619 }
00620 }
00621 }
00622
00623
00624
00625
00626 wxString evtInfo = wxString::Format (_T("id %d, EvtObj '%s' %s"),
00627
00628 event.GetId (),
00629
00630 evtObjName.c_str (),
00631 evtObjHierarchy.c_str ());
00632
00633 return evtInfo;
00634 }
00635
00636
00637 void CREventCaptureManager::LogEventDetails (wxEvent& event,
00638 const wxString &prefix)
00639 {
00640
00641
00642 if (m_log) {
00643
00644 m_log->Log (prefix + _T(" ") + this->GetEventDetails (event) + _T("\n"));
00645 }
00646 }
00647
00648
00649