1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#include "my_callback.h"
#include "MainFrame.h"
MyCallback::MyCallback(MainFrame* frame)
: m_frame(frame)
{
}
MyCallback::~MyCallback()
{
}
void MyCallback::OnProcessOutput(const wxString& str)
{
m_frame->AppendOutputText( str );
}
void MyCallback::OnProcessTerminated()
{
// if the process linked to this callback object is the same as the one in the main frame
// it means that this is the "sync" process - we need to delete it as well from the main
// frame
if ( m_frame->m_process == m_process ) {
wxDELETE(m_frame->m_process);
}
m_frame->SetCartAtEnd();
if ( m_frame->GetOptions().HasFlag( TerminalOptions::kExitWhenInfiriorTerminates ) ) {
m_frame->CallAfter( &MainFrame::Exit );
}
delete this;
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
void PtyCallback::OnProcessOutput(const wxString& str)
{
wxStyledTextCtrl *stc = m_frame->m_stc;
stc->AppendText( str );
m_frame->SetCartAtEnd();
}
void PtyCallback::OnProcessTerminated()
{
wxString message;
message << "[" << m_frame->m_process->GetPid() << "] Done\n";
wxStyledTextCtrl *stc = m_frame->m_stc;
stc->AppendText( message );
m_frame->SetCartAtEnd();
}
PtyCallback::PtyCallback(MainFrame* frame)
: m_frame(frame)
{
}
PtyCallback::~PtyCallback()
{
}
|