Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TextKillFocusHandler.cpp
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
2 
27 #include "hugin_config.h"
28 #include "panoinc_WX.h"
29 #include "panoinc.h"
31 
32 BEGIN_EVENT_TABLE(TextKillFocusHandler, wxEvtHandler)
33  EVT_KILL_FOCUS(TextKillFocusHandler::OnKillFocus)
34  EVT_TEXT_ENTER(-1, TextKillFocusHandler::OnTextEnter)
35  EVT_TEXT(-1, TextKillFocusHandler::OnTextChange)
37 
38 
40 {
41 
42 }
43 
44 void TextKillFocusHandler::OnKillFocus(wxFocusEvent & e)
45 {
46  DEBUG_TRACE("Control ID:" << e.GetId());
47  // create a text changed event
48  // need to get id of the eve
49  if (dirty) {
50  DEBUG_DEBUG("forwarding focus change");
51  wxCommandEvent cmdEvt(wxEVT_COMMAND_TEXT_ENTER, e.GetId());
52  cmdEvt.SetEventObject(e.GetEventObject());
53  m_parent->GetEventHandler()->ProcessEvent(cmdEvt);
54  dirty = false;
55  }
56  e.Skip();
57 }
58 
59 void TextKillFocusHandler::OnTextEnter(wxCommandEvent & e)
60 {
61  DEBUG_TRACE("Control ID:" << e.GetId());
62  // create a text changed event
63  // need to get id of the event
64  if (dirty) {
65  // let the event through
66  dirty = false;
67  e.Skip();
68  } else {
69  // do not skip the event -> block
70  }
71 }
72 
73 
74 void TextKillFocusHandler::OnTextChange(wxCommandEvent & e)
75 {
76  DEBUG_TRACE("Control ID:" << e.GetId());
77  // check if it was an enter event.
78  DEBUG_DEBUG("event: int: " << e.GetInt() << " sel: " << e.GetSelection()
79  << " string: " << e.GetString().mb_str(wxConvLocal));
80  dirty = true;
81  e.Skip();
82 }
83 
84 
#define DEBUG_TRACE(msg)
Definition: utils.h:67
END_EVENT_TABLE()
include file for the hugin project
void OnTextEnter(wxCommandEvent &e)
void OnKillFocus(wxFocusEvent &e)
include file for the hugin project
Handle EVT_KILL_FOCUS and convert it to a EVT_TEXT_ENTER event.
#define DEBUG_DEBUG(msg)
Definition: utils.h:68
void OnTextChange(wxCommandEvent &e)