Added IPC server capability to helpview, if you compile

with hvUSE_IPC
Added client demo using raw IPC classes (not yet using
a kind of help controller, as we eventually should)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17483 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2002-10-08 15:27:13 +00:00
parent aa4497caf2
commit bd5dd71130
5 changed files with 638 additions and 23 deletions

View File

@@ -16,27 +16,77 @@
#pragma interface "help.cpp"
#endif
// Define a new application type, each program should derive a class from wxApp
// If 1, start a server to allow this to be used
// as an external help viewer.
#define hvUSE_IPC 1
#if hvUSE_IPC
#include <wx/ipc.h>
class hvConnection;
class hvServer;
#endif
/*!
* The helpview application class.
*/
class hvApp : public wxApp
{
public:
// override base class virtuals
// ----------------------------
public:
hvApp();
// this one is called on application startup and is a good place for the app
// initialization (doing it here and not in the ctor allows to have an error
// return: if OnInit() returns false, the application terminates)
/// Initialise the application.
virtual bool OnInit();
virtual bool OnInit();
virtual int OnExit();
/// Clean up the application's data.
virtual int OnExit();
/// Prompt the user for a book to open
bool OpenBook(wxHtmlHelpController* controller);
// Prompt the user for a book to open
bool OpenBook(wxHtmlHelpController* controller);
/// Returns the help controller.
wxHtmlHelpController* GetHelpController() { return m_helpController; }
private:
wxHtmlHelpController *help;
#if hvUSE_IPC
/// Returns the list of connections.
wxList& GetConnections() { return m_connections; }
#endif
private:
wxHtmlHelpController* m_helpController;
#if hvUSE_IPC
wxList m_connections;
hvServer* m_server;
#endif
};
#if hvUSE_IPC
class hvConnection : public wxConnection
{
public:
hvConnection();
~hvConnection();
bool OnExecute(const wxString& topic, wxChar*data, int size, wxIPCFormat format);
wxChar *OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format);
bool OnPoke(const wxString& topic, const wxString& item, wxChar *data, int size, wxIPCFormat format);
bool OnStartAdvise(const wxString& topic, const wxString& item);
private:
};
class hvServer: public wxServer
{
public:
wxConnectionBase *OnAcceptConnection(const wxString& topic);
};
#endif
#endif
// _WX_HELPVIEW_H_