]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: help.i | |
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 | ||
13 | %module help | |
14 | ||
15 | %{ | |
16 | #include "wxPython.h" | |
17 | #include <wx/cshelp.h> | |
18 | %} | |
19 | ||
20 | //---------------------------------------------------------------------- | |
21 | ||
22 | %include typemaps.i | |
23 | %include my_typemaps.i | |
24 | ||
25 | // Import some definitions of other classes, etc. | |
26 | %import _defs.i | |
27 | %import windows.i | |
28 | %import misc.i | |
29 | %import controls.i | |
30 | ||
31 | ||
32 | //---------------------------------------------------------------------- | |
33 | ||
34 | enum { | |
35 | wxFRAME_EX_CONTEXTHELP, | |
36 | wxDIALOG_EX_CONTEXTHELP, | |
37 | wxID_CONTEXT_HELP, | |
38 | wxEVT_HELP, | |
39 | wxEVT_DETAILED_HELP, | |
40 | }; | |
41 | ||
42 | ||
43 | %pragma(python) code = " | |
44 | # Help events | |
45 | def EVT_HELP(win, id, func): | |
46 | win.Connect(id, -1, wxEVT_HELP, func) | |
47 | ||
48 | def EVT_HELP_RANGE(win, id, id2, func): | |
49 | win.Connect(id, id2, wxEVT_HELP, func) | |
50 | ||
51 | def EVT_DETAILED_HELP(win, id, func): | |
52 | win.Connect(id, -1, wxEVT_DETAILED_HELP, func) | |
53 | ||
54 | def EVT_DETAILED_HELP_RANGE(win, id, id2, func): | |
55 | win.Connect(id, id2, wxEVT_DETAILED_HELP, func) | |
56 | " | |
57 | ||
58 | //---------------------------------------------------------------------- | |
59 | ||
60 | class wxHelpEvent : public wxCommandEvent | |
61 | { | |
62 | public: | |
63 | wxHelpEvent(wxEventType type = wxEVT_NULL, | |
64 | wxWindowID id = 0, | |
65 | const wxPoint& pt = wxDefaultPosition); | |
66 | const wxPoint& GetPosition(); | |
67 | void SetPosition(const wxPoint& pos); | |
68 | const wxString& GetLink(); | |
69 | void SetLink(const wxString& link); | |
70 | const wxString& GetTarget(); | |
71 | void SetTarget(const wxString& target); | |
72 | }; | |
73 | ||
74 | //--------------------------------------------------------------------------- | |
75 | ||
76 | ||
77 | class wxContextMenuEvent : public wxCommandEvent | |
78 | { | |
79 | public: | |
80 | wxContextMenuEvent(wxEventType type = wxEVT_NULL, | |
81 | wxWindowID id = 0, | |
82 | const wxPoint& pt = wxDefaultPosition); | |
83 | const wxPoint& GetPosition(); | |
84 | void SetPosition(const wxPoint& pos); | |
85 | }; | |
86 | ||
87 | ||
88 | ||
89 | //---------------------------------------------------------------------- | |
90 | ||
91 | class wxContextHelp : public wxObject { | |
92 | public: | |
93 | wxContextHelp(wxWindow* window = NULL, bool doNow = TRUE); | |
94 | ~wxContextHelp(); | |
95 | ||
96 | bool BeginContextHelp(wxWindow* window = NULL); | |
97 | bool EndContextHelp(); | |
98 | }; | |
99 | ||
100 | ||
101 | //---------------------------------------------------------------------- | |
102 | ||
103 | class wxContextHelpButton : public wxBitmapButton { | |
104 | public: | |
105 | wxContextHelpButton(wxWindow* parent, wxWindowID id = wxID_CONTEXT_HELP, | |
106 | const wxPoint& pos = wxDefaultPosition, | |
107 | const wxSize& size = wxDefaultSize, | |
108 | long style = wxBU_AUTODRAW); | |
109 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
110 | }; | |
111 | ||
112 | ||
113 | //---------------------------------------------------------------------- | |
114 | ||
115 | class wxHelpProvider | |
116 | { | |
117 | public: | |
118 | static wxHelpProvider *Set(wxHelpProvider *helpProvider); | |
119 | static wxHelpProvider *Get(); | |
120 | ||
121 | // Virtuals... | |
122 | wxString GetHelp(const wxWindow *window); | |
123 | bool ShowHelp(wxWindowBase *window); | |
124 | void AddHelp(wxWindowBase *window, const wxString& text); | |
125 | %name(AddHelpById)void AddHelp(wxWindowID id, const wxString& text); | |
126 | ||
127 | %addmethods { void Destroy() { delete self; } } | |
128 | ||
129 | }; | |
130 | ||
131 | ||
132 | //---------------------------------------------------------------------- | |
133 | ||
134 | class wxSimpleHelpProvider : public wxHelpProvider | |
135 | { | |
136 | public: | |
137 | wxSimpleHelpProvider(); | |
138 | }; | |
139 | ||
140 | ||
141 | //---------------------------------------------------------------------- | |
142 | ||
143 | // TODO: Add this once the wxHelpController is in wxPython... | |
144 | ||
145 | // class WXDLLEXPORT wxHelpControllerHelpProvider : public wxSimpleHelpProvider | |
146 | // { | |
147 | // public: | |
148 | // wxHelpControllerHelpProvider(wxHelpController* hc = NULL); | |
149 | // void SetHelpController(wxHelpController* hc); | |
150 | // wxHelpController* GetHelpController(); | |
151 | // }; | |
152 | ||
153 | ||
154 | ||
155 | ||
156 | //---------------------------------------------------------------------- | |
157 | //---------------------------------------------------------------------- | |
158 | // This file gets appended to the shadow class file. | |
159 | //---------------------------------------------------------------------- | |
160 | ||
161 | %pragma(python) include="_helpextras.py"; | |
162 | ||
163 | //--------------------------------------------------------------------------- |