xml-copy-editor-code/src/myipc.cpp

88 lines
1.7 KiB
C++
Raw Normal View History

2007-09-07 23:17:30 +02:00
#include "myipc.h"
#include "xmlcopyeditor.h"
MyServerConnection *server_connection = 0;
MyClientConnection *client_connection = 0;
2007-09-08 00:25:30 +02:00
wxConnectionBase *MyServer::OnAcceptConnection ( const wxString& topic )
2007-09-07 23:17:30 +02:00
{
if ( topic == IPC_TOPIC )
return new MyServerConnection();
// unknown topic
return NULL;
}
MyServerConnection::MyServerConnection() : wxConnection()
{
2007-09-08 00:25:30 +02:00
server_connection = this;
2007-09-07 23:17:30 +02:00
}
MyServerConnection::~MyServerConnection()
{
2007-09-08 00:25:30 +02:00
if ( server_connection )
{
server_connection = NULL;
}
2007-09-07 23:17:30 +02:00
}
2007-09-08 00:25:30 +02:00
bool MyServerConnection::OnPoke (
const wxString& WXUNUSED ( topic ),
const wxString& item,
wxChar *data,
int size,
wxIPCFormat WXUNUSED ( format ) )
2007-09-07 23:17:30 +02:00
{
2007-09-08 00:25:30 +02:00
if ( !wxTheApp )
return false;
MyFrame *frame;
frame = ( MyFrame * ) wxTheApp->GetTopWindow();
if ( !frame )
return false;
if ( item == ( wxString ) IPC_NO_FILE )
{
;
}
else if ( frame->isOpen ( item ) )
{
frame->activateTab ( item );
}
else
{
frame->openFile ( ( wxString& ) item );
}
frame->Raise();
return true;
2007-09-07 23:17:30 +02:00
}
2007-09-08 00:25:30 +02:00
bool MyServerConnection::OnStartAdvise ( const wxString& WXUNUSED ( topic ),
const wxString& WXUNUSED ( item ) )
2007-09-07 23:17:30 +02:00
{
return true;
}
MyClientConnection::MyClientConnection()
2007-09-08 00:25:30 +02:00
{}
2007-09-07 23:17:30 +02:00
wxConnectionBase *MyClient::OnMakeConnection()
{
return new MyClientConnection;
}
2007-09-08 00:25:30 +02:00
bool MyClientConnection::OnAdvise ( const wxString& WXUNUSED ( topic ), const wxString& WXUNUSED ( item ), wxChar *data, int WXUNUSED ( size ), wxIPCFormat WXUNUSED ( format ) )
2007-09-07 23:17:30 +02:00
{
2007-09-08 00:25:30 +02:00
return true;
2007-09-07 23:17:30 +02:00
}
bool MyClientConnection::OnDisconnect()
{
2007-09-08 00:25:30 +02:00
client_connection = NULL;
return wxConnection::OnDisconnect();
2007-09-07 23:17:30 +02:00
}
MyServer::MyServer()
{ }
MyClient::MyClient()
{ }