]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _tipdlg.i | |
3 | // Purpose: SWIG defs for wxTip classes and such | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 18-June-1999 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2003 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // Not a %module | |
14 | ||
15 | ||
16 | //--------------------------------------------------------------------------- | |
17 | %newgroup | |
18 | ||
19 | %{ | |
20 | #include <wx/tipdlg.h> | |
21 | %} | |
22 | ||
23 | //--------------------------------------------------------------------------- | |
24 | ||
25 | ||
26 | // wxTipProvider - a class which is used by wxTipDialog to get the text of the | |
27 | // tips | |
28 | class wxTipProvider | |
29 | { | |
30 | public: | |
31 | // wxTipProvider(size_t currentTip); **** Abstract base class | |
32 | ~wxTipProvider(); | |
33 | ||
34 | // get the current tip and update the internal state to return the next tip | |
35 | // when called for the next time | |
36 | virtual wxString GetTip(); | |
37 | ||
38 | // get the current tip "index" (or whatever allows the tip provider to know | |
39 | // from where to start the next time) | |
40 | size_t GetCurrentTip(); | |
41 | ||
42 | // Allows any user-derived class to optionally override this function to | |
43 | // modify the tip as soon as it is read. If return wxEmptyString, then | |
44 | // the tip is skipped, and the next one is read. | |
45 | virtual wxString PreprocessTip(const wxString& tip); | |
994453b8 RD |
46 | |
47 | %property(CurrentTip, GetCurrentTip, doc="See `GetCurrentTip`"); | |
48 | %property(Tip, GetTip, doc="See `GetTip`"); | |
d14a1e28 RD |
49 | }; |
50 | ||
51 | ||
52 | // The C++ version of wxPyTipProvider | |
53 | %{ | |
54 | class wxPyTipProvider : public wxTipProvider { | |
55 | public: | |
56 | wxPyTipProvider(size_t currentTip) | |
57 | : wxTipProvider(currentTip) {} | |
58 | ||
59 | DEC_PYCALLBACK_STRING__pure(GetTip); | |
60 | DEC_PYCALLBACK_STRING_STRING(PreprocessTip); | |
61 | PYPRIVATE; | |
62 | }; | |
63 | ||
64 | IMP_PYCALLBACK_STRING__pure( wxPyTipProvider, wxTipProvider, GetTip); | |
65 | IMP_PYCALLBACK_STRING_STRING(wxPyTipProvider, wxTipProvider, PreprocessTip); | |
66 | %} | |
67 | ||
68 | ||
69 | // Now let SWIG know about it | |
70 | class wxPyTipProvider : public wxTipProvider { | |
71 | public: | |
03a2f00c | 72 | %pythonAppend wxPyTipProvider "self._setCallbackInfo(self, PyTipProvider)" |
d14a1e28 RD |
73 | wxPyTipProvider(size_t currentTip); |
74 | ||
75 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
d14a1e28 RD |
76 | }; |
77 | ||
78 | ||
79 | ||
80 | // A dialog which shows a "tip" - a short and helpful messages describing to | |
81 | // the user some program characteristic. Many programs show the tips at | |
82 | // startup, so the dialog has "Show tips on startup" checkbox which allows to | |
83 | // the user to disable this (however, it's the program which should show, or | |
84 | // not, the dialog on startup depending on its value, not this class). | |
85 | // | |
dd9f7fea | 86 | // The function returns True if this checkbox is checked, False otherwise. |
ab1f7d2a | 87 | MustHaveApp(wxShowTip); |
a72f4631 | 88 | bool wxShowTip(wxWindow *parent, wxTipProvider *tipProvider, bool showAtStartup = true); |
d14a1e28 RD |
89 | |
90 | // a function which returns an implementation of wxTipProvider using the | |
91 | // specified text file as the source of tips (each line is a tip). | |
92 | %newobject wxCreateFileTipProvider; | |
ab1f7d2a | 93 | MustHaveApp(wxCreateFileTipProvider); |
d14a1e28 RD |
94 | wxTipProvider* wxCreateFileTipProvider(const wxString& filename, size_t currentTip); |
95 | ||
96 | ||
97 | ||
98 | ||
99 | //--------------------------------------------------------------------------- | |
100 | //--------------------------------------------------------------------------- |