]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: helpview.h | |
3 | // Purpose: HelpView application class | |
4 | // Author: Vaclav Slavik, Julian Smart | |
5 | // Modified by: | |
6 | // Created: 2002-07-09 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2002 Vaclav Slavik, Julian Smart and others | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_HELPVIEW_H_ | |
13 | #define _WX_HELPVIEW_H_ | |
14 | ||
15 | #if defined(__GNUG__) && !defined(__APPLE__) | |
16 | #pragma interface "help.cpp" | |
17 | #endif | |
18 | ||
19 | #define hvVERSION 1.03 | |
20 | ||
21 | // If 1, start a server to allow this to be used | |
22 | // as an external help viewer. | |
23 | #if defined(__WXMAC__) && !defined(__UNIX__) | |
24 | #define hvUSE_IPC 0 | |
25 | #else | |
26 | #define hvUSE_IPC 1 | |
27 | #endif | |
28 | ||
29 | #if hvUSE_IPC | |
30 | #include <wx/ipc.h> | |
31 | ||
32 | class hvConnection; | |
33 | class hvServer; | |
34 | #endif | |
35 | ||
36 | /*! | |
37 | * The helpview application class. | |
38 | */ | |
39 | ||
40 | class hvApp : public wxApp | |
41 | { | |
42 | public: | |
43 | hvApp(); | |
44 | ||
45 | /// Initialise the application. | |
46 | virtual bool OnInit(); | |
47 | ||
48 | /// Clean up the application's data. | |
49 | virtual int OnExit(); | |
50 | ||
51 | #ifdef __WXMAC__ | |
52 | /// Respond to Apple Event for opening a document | |
53 | virtual void MacOpenFile(const wxString& filename); | |
54 | #endif | |
55 | ||
56 | /// Prompt the user for a book to open | |
57 | bool OpenBook(wxHtmlHelpController* controller); | |
58 | ||
59 | /// Returns the help controller. | |
60 | wxHtmlHelpController* GetHelpController() { return m_helpController; } | |
61 | ||
62 | #if hvUSE_IPC | |
63 | /// Returns the list of connections. | |
64 | wxList& GetConnections() { return m_connections; } | |
65 | #endif | |
66 | ||
67 | private: | |
68 | wxHtmlHelpController* m_helpController; | |
69 | ||
70 | #if hvUSE_IPC | |
71 | wxList m_connections; | |
72 | hvServer* m_server; | |
73 | #endif | |
74 | ||
75 | }; | |
76 | ||
77 | #if hvUSE_IPC | |
78 | class hvConnection : public wxConnection | |
79 | { | |
80 | public: | |
81 | hvConnection(); | |
82 | ~hvConnection(); | |
83 | ||
84 | bool OnExecute(const wxString& topic, wxChar*data, int size, wxIPCFormat format); | |
85 | wxChar *OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format); | |
86 | bool OnPoke(const wxString& topic, const wxString& item, wxChar *data, int size, wxIPCFormat format); | |
87 | bool OnStartAdvise(const wxString& topic, const wxString& item); | |
88 | ||
89 | private: | |
90 | }; | |
91 | ||
92 | class hvServer: public wxServer | |
93 | { | |
94 | public: | |
95 | wxConnectionBase *OnAcceptConnection(const wxString& topic); | |
96 | }; | |
97 | ||
98 | ||
99 | #endif | |
100 | ||
101 | #endif | |
102 | // _WX_HELPVIEW_H_ | |
103 |