]>
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 | class wxContextHelp : public wxObject { | |
77 | public: | |
78 | wxContextHelp(wxWindow* window = NULL, bool doNow = TRUE); | |
79 | ~wxContextHelp(); | |
80 | ||
81 | bool BeginContextHelp(wxWindow* window = NULL); | |
82 | bool EndContextHelp(); | |
83 | }; | |
84 | ||
85 | ||
86 | //---------------------------------------------------------------------- | |
87 | ||
88 | class wxContextHelpButton : public wxBitmapButton { | |
89 | public: | |
90 | wxContextHelpButton(wxWindow* parent, wxWindowID id = wxID_CONTEXT_HELP, | |
91 | const wxPoint& pos = wxDefaultPosition, | |
92 | const wxSize& size = wxDefaultSize, | |
93 | long style = wxBU_AUTODRAW); | |
94 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
95 | }; | |
96 | ||
97 | ||
98 | //---------------------------------------------------------------------- | |
99 | ||
100 | class wxHelpProvider | |
101 | { | |
102 | public: | |
103 | static wxHelpProvider *Set(wxHelpProvider *helpProvider); | |
104 | static wxHelpProvider *Get(); | |
105 | ||
106 | // Virtuals... | |
107 | wxString GetHelp(const wxWindow *window); | |
108 | bool ShowHelp(wxWindow *window); | |
109 | void AddHelp(wxWindow *window, const wxString& text); | |
110 | %name(AddHelpById)void AddHelp(wxWindowID id, const wxString& text); | |
111 | ||
112 | %addmethods { void Destroy() { delete self; } } | |
113 | ||
114 | }; | |
115 | ||
116 | ||
117 | //---------------------------------------------------------------------- | |
118 | ||
119 | class wxSimpleHelpProvider : public wxHelpProvider | |
120 | { | |
121 | public: | |
122 | wxSimpleHelpProvider(); | |
123 | }; | |
124 | ||
125 | ||
126 | //---------------------------------------------------------------------- | |
127 | ||
128 | // TODO: Add this once the wxHelpController is in wxPython... | |
129 | ||
130 | // class WXDLLEXPORT wxHelpControllerHelpProvider : public wxSimpleHelpProvider | |
131 | // { | |
132 | // public: | |
133 | // wxHelpControllerHelpProvider(wxHelpController* hc = NULL); | |
134 | // void SetHelpController(wxHelpController* hc); | |
135 | // wxHelpController* GetHelpController(); | |
136 | // }; | |
137 | ||
138 | ||
139 | ||
140 | ||
141 | //---------------------------------------------------------------------- | |
142 | //---------------------------------------------------------------------- | |
143 | // This file gets appended to the shadow class file. | |
144 | //---------------------------------------------------------------------- | |
145 | ||
146 | %pragma(python) include="_helpextras.py"; | |
147 | ||
148 | //--------------------------------------------------------------------------- |