1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Help system base classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_HELPBASEH__
13 #define _WX_HELPBASEH__
19 #include "wx/object.h"
20 #include "wx/string.h"
21 #include "wx/gdicmn.h"
24 // Flags for SetViewer
25 #define wxHELP_NETSCAPE 1
34 // Defines the API for help controllers
35 class WXDLLIMPEXP_CORE wxHelpControllerBase
: public wxObject
38 inline wxHelpControllerBase(wxWindow
* parentWindow
= NULL
) { m_parentWindow
= parentWindow
; }
39 inline ~wxHelpControllerBase() {}
41 // Must call this to set the filename and server name.
42 // server is only required when implementing TCP/IP-based
44 virtual bool Initialize(const wxString
& WXUNUSED(file
), int WXUNUSED(server
) ) { return false; }
45 virtual bool Initialize(const wxString
& WXUNUSED(file
)) { return false; }
47 // Set viewer: only relevant to some kinds of controller
48 virtual void SetViewer(const wxString
& WXUNUSED(viewer
), long WXUNUSED(flags
) = 0) {}
50 // If file is "", reloads file given in Initialize
51 virtual bool LoadFile(const wxString
& file
= wxEmptyString
) = 0;
53 // Displays the contents
54 virtual bool DisplayContents(void) = 0;
56 // Display the given section
57 virtual bool DisplaySection(int sectionNo
) = 0;
59 // Display the section using a context id
60 virtual bool DisplayContextPopup(int WXUNUSED(contextId
)) { return false; }
62 // Display the text in a popup, if possible
63 virtual bool DisplayTextPopup(const wxString
& WXUNUSED(text
), const wxPoint
& WXUNUSED(pos
)) { return false; }
65 // By default, uses KeywordSection to display a topic. Implementations
66 // may override this for more specific behaviour.
67 virtual bool DisplaySection(const wxString
& section
) { return KeywordSearch(section
); }
68 virtual bool DisplayBlock(long blockNo
) = 0;
69 virtual bool KeywordSearch(const wxString
& k
,
70 wxHelpSearchMode mode
= wxHELP_SEARCH_ALL
) = 0;
71 /// Allows one to override the default settings for the help frame.
72 virtual void SetFrameParameters(const wxString
& WXUNUSED(title
),
73 const wxSize
& WXUNUSED(size
),
74 const wxPoint
& WXUNUSED(pos
) = wxDefaultPosition
,
75 bool WXUNUSED(newFrameEachTime
) = false)
77 // does nothing by default
79 /// Obtains the latest settings used by the help frame and the help
81 virtual wxFrame
*GetFrameParameters(wxSize
*WXUNUSED(size
) = NULL
,
82 wxPoint
*WXUNUSED(pos
) = NULL
,
83 bool *WXUNUSED(newFrameEachTime
) = NULL
)
85 return NULL
; // does nothing by default
88 virtual bool Quit() = 0;
89 virtual void OnQuit() {}
91 /// Set the window that can optionally be used for the help window's parent.
92 virtual void SetParentWindow(wxWindow
* win
) { m_parentWindow
= win
; }
94 /// Get the window that can optionally be used for the help window's parent.
95 virtual wxWindow
* GetParentWindow() const { return m_parentWindow
; }
98 wxWindow
* m_parentWindow
;
100 DECLARE_CLASS(wxHelpControllerBase
)