Commit | Line | Data |
---|---|---|
4f3449b4 | 1 | ///////////////////////////////////////////////////////////////////////////// |
d14a1e28 | 2 | // Name: _cshelp.i |
4f3449b4 RD |
3 | // Purpose: Context sensitive help classes, and etc. |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 28-July-2001 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2001 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
d14a1e28 RD |
13 | // not a %module |
14 | ||
15 | //--------------------------------------------------------------------------- | |
16 | %newgroup | |
4f3449b4 RD |
17 | |
18 | %{ | |
4f3449b4 RD |
19 | %} |
20 | ||
4f3449b4 RD |
21 | //---------------------------------------------------------------------- |
22 | ||
23 | enum { | |
24 | wxFRAME_EX_CONTEXTHELP, | |
25 | wxDIALOG_EX_CONTEXTHELP, | |
4f3449b4 | 26 | }; |
d14a1e28 RD |
27 | %constant wxEventType wxEVT_HELP; |
28 | %constant wxEventType wxEVT_DETAILED_HELP; | |
4f3449b4 RD |
29 | |
30 | ||
d14a1e28 RD |
31 | %pythoncode { |
32 | EVT_HELP = wx.PyEventBinder( wxEVT_HELP, 1) | |
33 | EVT_HELP_RANGE = wx.PyEventBinder( wxEVT_HELP, 2) | |
34 | EVT_DETAILED_HELP = wx.PyEventBinder( wxEVT_DETAILED_HELP, 1) | |
35 | EVT_DETAILED_HELP_RANGE = wx.PyEventBinder( wxEVT_DETAILED_HELP, 2) | |
36 | } | |
4f3449b4 RD |
37 | |
38 | //---------------------------------------------------------------------- | |
39 | ||
d14a1e28 RD |
40 | // A help event is sent when the user clicks on a window in context-help mode. |
41 | ||
4f3449b4 RD |
42 | class wxHelpEvent : public wxCommandEvent |
43 | { | |
44 | public: | |
45 | wxHelpEvent(wxEventType type = wxEVT_NULL, | |
d14a1e28 | 46 | wxWindowID winid = 0, |
4f3449b4 | 47 | const wxPoint& pt = wxDefaultPosition); |
d14a1e28 RD |
48 | |
49 | // Position of event (in screen coordinates) | |
50 | const wxPoint& GetPosition() const; | |
4f3449b4 | 51 | void SetPosition(const wxPoint& pos); |
d14a1e28 RD |
52 | |
53 | // Optional link to further help | |
54 | const wxString& GetLink() const; | |
4f3449b4 | 55 | void SetLink(const wxString& link); |
d14a1e28 RD |
56 | |
57 | // Optional target to display help in. E.g. a window specification | |
58 | const wxString& GetTarget() const; | |
4f3449b4 RD |
59 | void SetTarget(const wxString& target); |
60 | }; | |
61 | ||
62 | //--------------------------------------------------------------------------- | |
63 | ||
4f3449b4 RD |
64 | class wxContextHelp : public wxObject { |
65 | public: | |
dd9f7fea | 66 | wxContextHelp(wxWindow* window = NULL, bool doNow = True); |
4f3449b4 RD |
67 | ~wxContextHelp(); |
68 | ||
69 | bool BeginContextHelp(wxWindow* window = NULL); | |
70 | bool EndContextHelp(); | |
71 | }; | |
72 | ||
73 | ||
74 | //---------------------------------------------------------------------- | |
75 | ||
76 | class wxContextHelpButton : public wxBitmapButton { | |
77 | public: | |
d14a1e28 RD |
78 | %addtofunc wxContextHelpButton "self._setOORInfo(self)" |
79 | ||
4f3449b4 RD |
80 | wxContextHelpButton(wxWindow* parent, wxWindowID id = wxID_CONTEXT_HELP, |
81 | const wxPoint& pos = wxDefaultPosition, | |
82 | const wxSize& size = wxDefaultSize, | |
83 | long style = wxBU_AUTODRAW); | |
84 | }; | |
85 | ||
86 | ||
87 | //---------------------------------------------------------------------- | |
88 | ||
d14a1e28 | 89 | class wxHelpProvider |
4f3449b4 RD |
90 | { |
91 | public: | |
92 | static wxHelpProvider *Set(wxHelpProvider *helpProvider); | |
93 | static wxHelpProvider *Get(); | |
94 | ||
95 | // Virtuals... | |
96 | wxString GetHelp(const wxWindow *window); | |
1fded56b RD |
97 | bool ShowHelp(wxWindow *window); |
98 | void AddHelp(wxWindow *window, const wxString& text); | |
4f3449b4 RD |
99 | %name(AddHelpById)void AddHelp(wxWindowID id, const wxString& text); |
100 | ||
d14a1e28 | 101 | %extend { void Destroy() { delete self; } } |
4f3449b4 RD |
102 | |
103 | }; | |
104 | ||
d14a1e28 | 105 | |
4f3449b4 RD |
106 | //---------------------------------------------------------------------- |
107 | ||
108 | class wxSimpleHelpProvider : public wxHelpProvider | |
109 | { | |
110 | public: | |
111 | wxSimpleHelpProvider(); | |
112 | }; | |
113 | ||
114 | ||
115 | //---------------------------------------------------------------------- | |
116 | ||
117 | // TODO: Add this once the wxHelpController is in wxPython... | |
118 | ||
119 | // class WXDLLEXPORT wxHelpControllerHelpProvider : public wxSimpleHelpProvider | |
120 | // { | |
121 | // public: | |
122 | // wxHelpControllerHelpProvider(wxHelpController* hc = NULL); | |
123 | // void SetHelpController(wxHelpController* hc); | |
124 | // wxHelpController* GetHelpController(); | |
125 | // }; | |
126 | ||
127 | ||
128 | ||
129 | ||
130 | //---------------------------------------------------------------------- | |
4f3449b4 | 131 | //--------------------------------------------------------------------------- |