1 /* 2 FXiTe - The Free eXtensIble Text Editor 3 Copyright (c) 2009-2013 Jeffrey Pohlmeyer <yetanothergeek@gmail.com> 4 5 This program is free software; you can redistribute it and/or modify it 6 under the terms of the GNU General Public License version 3 as 7 published by the Free Software Foundation. 8 9 This software is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 #ifndef INTERPROC_H 20 #define INTERPROC_H 21 22 #ifdef WIN32 23 # include <windows.h> 24 #endif 25 26 class InterProc: public FXObject { 27 FXDECLARE(InterProc); InterProc()28 InterProc() {} 29 private: 30 FXApp*app; 31 FXSelector message; 32 FXObject *target; 33 long ExecuteClientRequest(FXString*s); 34 #ifdef WIN32 35 private: 36 const FXString *commands; 37 WPARAM LocalServerID; 38 WPARAM RemoteClientID; 39 WPARAM LocalClientID; 40 WPARAM RemoteServerID; 41 FXString DdePrefix; 42 FXString DdeTopic; 43 ATOM atomApplication; 44 ATOM atomTopic; 45 LPARAM atoms; 46 HGLOBAL hCommand; 47 bool found_server; 48 void MakeAtoms(); 49 void KillAtoms(); 50 void DoDispatch(FXID hwnd,unsigned int iMsg,unsigned int wParam,long lParam); 51 public: 52 static void dispatchEvent(FXID hwnd,unsigned int iMsg,unsigned int wParam,long lParam); 53 enum {ID_LAST}; 54 #else 55 private: 56 FXString sock_name; 57 FXHash *connlist; 58 int listen_fd; 59 public: 60 long onSocketRead(FXObject*o,FXSelector sel,void*p); 61 enum { 62 ID_SOCKET_ACCEPT, 63 ID_SOCKET_READ, 64 ID_LAST 65 }; 66 #endif 67 public: 68 bool ClientSend(FXTopWindow *win, const FXString &data); 69 void StartServer(FXTopWindow *win, FXObject*trg, FXSelector sel); 70 void StopServer(); 71 InterProc(FXApp*a, const FXString &connection, const FXString &topic=FXString::null); 72 }; 73 74 #endif 75