]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: tipdlg.h | |
e54c96f1 | 3 | // Purpose: interface of wxTipProvider |
23324ae1 | 4 | // Author: wxWidgets team |
526954c5 | 5 | // Licence: wxWindows licence |
23324ae1 FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
8 | /** | |
9 | @class wxTipProvider | |
7c913512 | 10 | |
e54c96f1 | 11 | This is the class used together with wxShowTip() function. |
23324ae1 FM |
12 | It must implement wxTipProvider::GetTip function and return the |
13 | current tip from it (different tip each time it is called). | |
7c913512 | 14 | |
23324ae1 FM |
15 | You will never use this class yourself, but you need it to show startup tips |
16 | with wxShowTip. Also, if you want to get the tips text from elsewhere than a | |
17 | simple text file, you will want to derive a new class from wxTipProvider and | |
e54c96f1 | 18 | use it instead of the one returned by wxCreateFileTipProvider(). |
7c913512 | 19 | |
23324ae1 | 20 | @library{wxadv} |
78e87bf7 | 21 | @category{misc} |
7c913512 | 22 | |
78e87bf7 | 23 | @see @ref overview_tips, ::wxShowTip |
23324ae1 | 24 | */ |
7c913512 | 25 | class wxTipProvider |
23324ae1 FM |
26 | { |
27 | public: | |
28 | /** | |
29 | Constructor. | |
3c4f71cc | 30 | |
7c913512 | 31 | @param currentTip |
4cc4bfaf | 32 | The starting tip index. |
23324ae1 FM |
33 | */ |
34 | wxTipProvider(size_t currentTip); | |
35 | ||
34a9a352 RD |
36 | virtual ~wxTipProvider(); |
37 | ||
23324ae1 | 38 | /** |
0824e369 | 39 | Returns the index of the current tip (i.e.\ the one which would be returned by GetTip()). |
78e87bf7 | 40 | |
7c913512 | 41 | The program usually remembers the value returned by this function after calling |
78e87bf7 FM |
42 | wxShowTip(). Note that it is not the same as the value which was passed to |
43 | wxShowTip + 1 because the user might have pressed the "Next" button in | |
44 | the tip dialog. | |
23324ae1 | 45 | */ |
328f5751 | 46 | size_t GetCurrentTip() const; |
23324ae1 FM |
47 | |
48 | /** | |
78e87bf7 FM |
49 | Return the text of the current tip and pass to the next one. |
50 | This function is pure virtual, it should be implemented in the derived classes. | |
23324ae1 | 51 | */ |
da1ed74c | 52 | virtual wxString GetTip() = 0; |
23324ae1 FM |
53 | |
54 | /** | |
78e87bf7 FM |
55 | Returns a modified tip. |
56 | ||
57 | This function will be called immediately after read, and before being check | |
58 | whether it is a comment, an empty string or a string to translate. | |
59 | You can optionally override this in your custom user-derived class | |
7c913512 FM |
60 | to optionally to modify the tip as soon as it is read. You can return any |
61 | modification to the string. If you return wxEmptyString, then this tip is | |
23324ae1 FM |
62 | skipped, and the next one is read. |
63 | */ | |
34a9a352 | 64 | virtual wxString PreprocessTip(const wxString& tip); |
23324ae1 FM |
65 | }; |
66 | ||
67 | ||
e54c96f1 | 68 | |
23324ae1 FM |
69 | // ============================================================================ |
70 | // Global functions/macros | |
71 | // ============================================================================ | |
72 | ||
b21126db | 73 | /** @addtogroup group_funcmacro_dialog */ |
ba2874ff BP |
74 | //@{ |
75 | ||
23324ae1 | 76 | /** |
ba2874ff | 77 | This function creates a wxTipProvider which may be used with wxShowTip(). |
7c913512 FM |
78 | |
79 | @param filename | |
ba2874ff | 80 | The name of the file containing the tips, one per line. |
7c913512 | 81 | @param currentTip |
ba2874ff BP |
82 | The index of the first tip to show. Normally this index is remembered |
83 | between the 2 program runs. | |
84 | ||
85 | @see @ref overview_tips | |
7c913512 | 86 | |
ba2874ff | 87 | @header{wx/tipdlg.h} |
23324ae1 | 88 | */ |
4cc4bfaf FM |
89 | wxTipProvider* wxCreateFileTipProvider(const wxString& filename, |
90 | size_t currentTip); | |
23324ae1 | 91 | |
ba2874ff BP |
92 | /** |
93 | This function shows a "startup tip" to the user. The return value is the | |
94 | state of the "Show tips at startup" checkbox. | |
95 | ||
96 | @param parent | |
97 | The parent window for the modal dialog. | |
98 | @param tipProvider | |
99 | An object which is used to get the text of the tips. It may be created | |
100 | with the wxCreateFileTipProvider() function. | |
101 | @param showAtStartup | |
102 | Should be true if startup tips are shown, false otherwise. This is | |
103 | used as the initial value for "Show tips at startup" checkbox which is | |
104 | shown in the tips dialog. | |
105 | ||
106 | @see @ref overview_tips | |
107 | ||
108 | @header{wx/tipdlg.h} | |
109 | */ | |
110 | bool wxShowTip(wxWindow *parent, | |
111 | wxTipProvider *tipProvider, | |
112 | bool showAtStartup = true); | |
113 | ||
114 | //@} | |
115 |