]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/helpbase.h
wxMenuItem code cleanup, removing duplicate and unneccessary code
[wxWidgets.git] / include / wx / helpbase.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: helpbase.h
3// Purpose: Help system base classes
4// Author: Julian Smart
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_HELPBASEH__
13#define _WX_HELPBASEH__
14
15#include "wx/defs.h"
16
17#if wxUSE_HELP
18
19#include "wx/object.h"
20#include "wx/string.h"
21#include "wx/gdicmn.h"
22#include "wx/frame.h"
23
24// Flags for SetViewer
25#define wxHELP_NETSCAPE 1
26
27// Search modes:
28enum wxHelpSearchMode
29{
30 wxHELP_SEARCH_INDEX,
31 wxHELP_SEARCH_ALL
32};
33
34// Defines the API for help controllers
35class WXDLLIMPEXP_CORE wxHelpControllerBase: public wxObject
36{
37public:
38 inline wxHelpControllerBase(wxWindow* parentWindow = NULL) { m_parentWindow = parentWindow; }
39 inline ~wxHelpControllerBase() {}
40
41 // Must call this to set the filename and server name.
42 // server is only required when implementing TCP/IP-based
43 // help controllers.
44 virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return false; }
45 virtual bool Initialize(const wxString& WXUNUSED(file)) { return false; }
46
47 // Set viewer: only relevant to some kinds of controller
48 virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
49
50 // If file is "", reloads file given in Initialize
51 virtual bool LoadFile(const wxString& file = wxEmptyString) = 0;
52
53 // Displays the contents
54 virtual bool DisplayContents(void) = 0;
55
56 // Display the given section
57 virtual bool DisplaySection(int sectionNo) = 0;
58
59 // Display the section using a context id
60 virtual bool DisplayContextPopup(int WXUNUSED(contextId)) { return false; }
61
62 // Display the text in a popup, if possible
63 virtual bool DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos)) { return false; }
64
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)
76 {
77 // does nothing by default
78 }
79 /// Obtains the latest settings used by the help frame and the help
80 /// frame.
81 virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
82 wxPoint *WXUNUSED(pos) = NULL,
83 bool *WXUNUSED(newFrameEachTime) = NULL)
84 {
85 return (wxFrame*) NULL; // does nothing by default
86 }
87
88 virtual bool Quit() = 0;
89 virtual void OnQuit() {}
90
91 /// Set the window that can optionally be used for the help window's parent.
92 virtual void SetParentWindow(wxWindow* win) { m_parentWindow = win; }
93
94 /// Get the window that can optionally be used for the help window's parent.
95 virtual wxWindow* GetParentWindow() const { return m_parentWindow; }
96
97protected:
98 wxWindow* m_parentWindow;
99private:
100 DECLARE_CLASS(wxHelpControllerBase)
101};
102
103#endif // wxUSE_HELP
104
105#endif
106// _WX_HELPBASEH__