]>
Commit | Line | Data |
---|---|---|
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); | |
46 | }; | |
47 | ||
48 | ||
49 | // The C++ version of wxPyTipProvider | |
50 | %{ | |
51 | class wxPyTipProvider : public wxTipProvider { | |
52 | public: | |
53 | wxPyTipProvider(size_t currentTip) | |
54 | : wxTipProvider(currentTip) {} | |
55 | ||
56 | DEC_PYCALLBACK_STRING__pure(GetTip); | |
57 | DEC_PYCALLBACK_STRING_STRING(PreprocessTip); | |
58 | PYPRIVATE; | |
59 | }; | |
60 | ||
61 | IMP_PYCALLBACK_STRING__pure( wxPyTipProvider, wxTipProvider, GetTip); | |
62 | IMP_PYCALLBACK_STRING_STRING(wxPyTipProvider, wxTipProvider, PreprocessTip); | |
63 | %} | |
64 | ||
65 | ||
66 | // Now let SWIG know about it | |
67 | class wxPyTipProvider : public wxTipProvider { | |
68 | public: | |
69 | wxPyTipProvider(size_t currentTip); | |
70 | ||
71 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
72 | %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyTipProvider)" | |
73 | }; | |
74 | ||
75 | ||
76 | ||
77 | // A dialog which shows a "tip" - a short and helpful messages describing to | |
78 | // the user some program characteristic. Many programs show the tips at | |
79 | // startup, so the dialog has "Show tips on startup" checkbox which allows to | |
80 | // the user to disable this (however, it's the program which should show, or | |
81 | // not, the dialog on startup depending on its value, not this class). | |
82 | // | |
83 | // The function returns True if this checkbox is checked, False otherwise. | |
84 | bool wxShowTip(wxWindow *parent, wxTipProvider *tipProvider, bool showAtStartup = True); | |
85 | ||
86 | // a function which returns an implementation of wxTipProvider using the | |
87 | // specified text file as the source of tips (each line is a tip). | |
88 | %newobject wxCreateFileTipProvider; | |
89 | wxTipProvider* wxCreateFileTipProvider(const wxString& filename, size_t currentTip); | |
90 | ||
91 | ||
92 | ||
93 | ||
94 | //--------------------------------------------------------------------------- | |
95 | //--------------------------------------------------------------------------- |