]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: _cshelp.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 | // not a %module | |
14 | ||
15 | //--------------------------------------------------------------------------- | |
16 | %newgroup | |
17 | ||
18 | %{ | |
19 | %} | |
20 | ||
21 | //---------------------------------------------------------------------- | |
22 | ||
23 | enum { | |
24 | wxFRAME_EX_CONTEXTHELP, | |
25 | wxDIALOG_EX_CONTEXTHELP, | |
26 | }; | |
27 | %constant wxEventType wxEVT_HELP; | |
28 | %constant wxEventType wxEVT_DETAILED_HELP; | |
29 | ||
30 | ||
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 | } | |
37 | ||
38 | //---------------------------------------------------------------------- | |
39 | ||
40 | // A help event is sent when the user clicks on a window in context-help mode. | |
41 | ||
42 | class wxHelpEvent : public wxCommandEvent | |
43 | { | |
44 | public: | |
45 | wxHelpEvent(wxEventType type = wxEVT_NULL, | |
46 | wxWindowID winid = 0, | |
47 | const wxPoint& pt = wxDefaultPosition); | |
48 | ||
49 | // Position of event (in screen coordinates) | |
50 | const wxPoint& GetPosition() const; | |
51 | void SetPosition(const wxPoint& pos); | |
52 | ||
53 | // Optional link to further help | |
54 | const wxString& GetLink() const; | |
55 | void SetLink(const wxString& link); | |
56 | ||
57 | // Optional target to display help in. E.g. a window specification | |
58 | const wxString& GetTarget() const; | |
59 | void SetTarget(const wxString& target); | |
60 | }; | |
61 | ||
62 | //--------------------------------------------------------------------------- | |
63 | ||
64 | class wxContextHelp : public wxObject { | |
65 | public: | |
66 | wxContextHelp(wxWindow* window = NULL, bool doNow = True); | |
67 | ~wxContextHelp(); | |
68 | ||
69 | bool BeginContextHelp(wxWindow* window = NULL); | |
70 | bool EndContextHelp(); | |
71 | }; | |
72 | ||
73 | ||
74 | //---------------------------------------------------------------------- | |
75 | ||
76 | class wxContextHelpButton : public wxBitmapButton { | |
77 | public: | |
78 | %addtofunc wxContextHelpButton "self._setOORInfo(self)" | |
79 | ||
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 | ||
89 | class wxHelpProvider | |
90 | { | |
91 | public: | |
92 | static wxHelpProvider *Set(wxHelpProvider *helpProvider); | |
93 | static wxHelpProvider *Get(); | |
94 | ||
95 | // Virtuals... | |
96 | wxString GetHelp(const wxWindow *window); | |
97 | bool ShowHelp(wxWindow *window); | |
98 | void AddHelp(wxWindow *window, const wxString& text); | |
99 | %name(AddHelpById)void AddHelp(wxWindowID id, const wxString& text); | |
100 | ||
101 | %extend { void Destroy() { delete self; } } | |
102 | ||
103 | }; | |
104 | ||
105 | ||
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 | //---------------------------------------------------------------------- | |
131 | //--------------------------------------------------------------------------- |