Hugintrunk
0.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
hugin1
hugin
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
"
30
#include "
hugin/TextKillFocusHandler.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
39
TextKillFocusHandler::~TextKillFocusHandler
()
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
DEBUG_TRACE
#define DEBUG_TRACE(msg)
Definition:
utils.h:67
TextKillFocusHandler::TextKillFocusHandler
TextKillFocusHandler(wxWindow *parent)
ctor.
Definition:
TextKillFocusHandler.cpp:32
panoinc.h
include file for the hugin project
TextKillFocusHandler::m_parent
wxWindow * m_parent
Definition:
TextKillFocusHandler.h:53
TextKillFocusHandler::OnTextEnter
void OnTextEnter(wxCommandEvent &e)
Definition:
TextKillFocusHandler.cpp:59
TextKillFocusHandler.h
TextKillFocusHandler::OnKillFocus
void OnKillFocus(wxFocusEvent &e)
Definition:
TextKillFocusHandler.cpp:44
TextKillFocusHandler::~TextKillFocusHandler
virtual ~TextKillFocusHandler()
dtor.
Definition:
TextKillFocusHandler.cpp:39
panoinc_WX.h
include file for the hugin project
TextKillFocusHandler::dirty
bool dirty
Definition:
TextKillFocusHandler.h:55
DEBUG_DEBUG
#define DEBUG_DEBUG(msg)
Definition:
utils.h:68
TextKillFocusHandler::OnTextChange
void OnTextChange(wxCommandEvent &e)
Definition:
TextKillFocusHandler.cpp:73
Generated on Sun Nov 17 2024 01:25:37 for Hugintrunk by
1.8.5