TextKillFocusHandler.cpp

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00002 
00027 #include <config.h>
00028 #include "panoinc_WX.h"
00029 #include "panoinc.h"
00030 #include "hugin/TextKillFocusHandler.h"
00031 
00032 BEGIN_EVENT_TABLE(TextKillFocusHandler, wxEvtHandler)
00033     EVT_KILL_FOCUS(TextKillFocusHandler::OnKillFocus)
00034     EVT_TEXT_ENTER(-1, TextKillFocusHandler::OnTextEnter)
00035     EVT_TEXT(-1, TextKillFocusHandler::OnTextChange)
00036 END_EVENT_TABLE()
00037 
00038 
00039 TextKillFocusHandler::~TextKillFocusHandler()
00040 {
00041 
00042 }
00043 
00044 void TextKillFocusHandler::OnKillFocus(wxFocusEvent & e)
00045 {
00046     DEBUG_TRACE("Control ID:" << e.GetId());
00047     // create a text changed event
00048     // need to get id of the eve
00049     if (dirty) {
00050         DEBUG_DEBUG("forwarding focus change");
00051         wxCommandEvent cmdEvt(wxEVT_COMMAND_TEXT_ENTER, e.GetId());
00052         cmdEvt.SetEventObject(e.GetEventObject());
00053         m_parent->GetEventHandler()->ProcessEvent(cmdEvt);
00054         dirty = false;
00055     }
00056     e.Skip();
00057 }
00058 
00059 void TextKillFocusHandler::OnTextEnter(wxCommandEvent & e)
00060 {
00061     DEBUG_TRACE("Control ID:" << e.GetId());
00062     // create a text changed event
00063     // need to get id of the event
00064     if (dirty) {
00065         // let the event through
00066         dirty = false;
00067         e.Skip();
00068     } else {
00069         // do not skip the event -> block
00070     }
00071 }
00072 
00073 
00074 void TextKillFocusHandler::OnTextChange(wxCommandEvent & e)
00075 {
00076     DEBUG_TRACE("Control ID:" << e.GetId());
00077     // check if it was an enter event.
00078     DEBUG_DEBUG("event: int: " << e.GetInt() << "  sel: " << e.GetSelection()
00079                 << "  string: " << e.GetString().mb_str(wxConvLocal));
00080     dirty = true;
00081     e.Skip();
00082 }
00083 
00084 

Generated on Fri Apr 18 01:25:37 2014 for Hugintrunk by  doxygen 1.3.9.1