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 TextKillFocusHandler::TextKillFocusHandler(wxWindow* parent) : m_parent(parent), dirty(false)
33 {
34  Bind(wxEVT_KILL_FOCUS, &TextKillFocusHandler::OnKillFocus, this);
35  Bind(wxEVT_TEXT_ENTER, &TextKillFocusHandler::OnTextEnter, this);
36  Bind(wxEVT_TEXT, &TextKillFocusHandler::OnTextChange, this);
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 void TextKillFocusHandler::OnTextChange(wxCommandEvent & e)
74 {
75  DEBUG_TRACE("Control ID:" << e.GetId());
76  // check if it was an enter event.
77  DEBUG_DEBUG("event: int: " << e.GetInt() << " sel: " << e.GetSelection()
78  << " string: " << e.GetString().mb_str(wxConvLocal));
79  dirty = true;
80  e.Skip();
81 }
82 
#define DEBUG_TRACE(msg)
Definition: utils.h:67
TextKillFocusHandler(wxWindow *parent)
ctor.
include file for the hugin project
void OnTextEnter(wxCommandEvent &e)
void OnKillFocus(wxFocusEvent &e)
virtual ~TextKillFocusHandler()
dtor.
include file for the hugin project
#define DEBUG_DEBUG(msg)
Definition: utils.h:68
void OnTextChange(wxCommandEvent &e)