5 * Created by Toshi Nagata on 12/10/10.
6 * Copyright 2012 Toshi Nagata. All rights reserved.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation version 2 of the License.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
18 // For compilers that support precompilation, includes "wx/wx.h".
19 #include "wx/wxprec.h"
26 #if defined(__WXMSW__)
28 #include "MyIPCSupport.h"
31 wxString *gIPCServiceName = NULL;
34 MyClientConnection::OnDisconnect()
36 return wxGetApp().m_client->Disconnect();
41 m_clientConnection = NULL;
50 MyClient::Disconnect()
52 if (m_clientConnection != NULL) {
53 if (m_clientConnection->Disconnect()) {
54 m_clientConnection = NULL;
61 MyClient::OnMakeConnection()
63 if (m_clientConnection == NULL)
64 m_clientConnection = new MyClientConnection;
65 return m_clientConnection;
69 MyServerConnection::OnDisconnect()
71 return wxGetApp().m_server->Disconnect();
75 MyServerConnection::OnExecute(const wxString& topic, const void *data, size_t size, wxIPCFormat format)
77 if (topic == MOLBY_IPC_TOPIC) {
78 wxString files((wxChar *)data);
79 wxGetApp().RequestOpenFilesByEvent(files);
86 m_serverConnection = NULL;
95 MyServer::Disconnect()
97 if (m_serverConnection != NULL) {
98 if (m_serverConnection->Disconnect()) {
99 m_serverConnection = NULL;
106 MyServer::OnAcceptConnection(const wxString &topic)
108 if (topic == MOLBY_IPC_TOPIC) {
109 if (m_serverConnection == NULL)
110 m_serverConnection = new MyServerConnection();
111 return m_serverConnection;
116 #endif // defined(__WXMSW__)