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