]>
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$ | |
6 | // Licence: wxWindows license | |
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 FM |
21 | @library{wxadv} |
22 | @category{FIXME} | |
7c913512 | 23 | |
e54c96f1 | 24 | @see @ref overview_tipsoverview "Startup tips overview", ::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 | ||
37 | /** | |
7c913512 | 38 | Returns the index of the current tip (i.e. the one which would be returned by |
23324ae1 | 39 | GetTip). |
7c913512 | 40 | The program usually remembers the value returned by this function after calling |
e54c96f1 | 41 | wxShowTip(). Note that it is not the same as the value which |
23324ae1 FM |
42 | was passed to wxShowTip + 1 because the user might have pressed the "Next" |
43 | button in the tip dialog. | |
44 | */ | |
328f5751 | 45 | size_t GetCurrentTip() const; |
23324ae1 FM |
46 | |
47 | /** | |
48 | Return the text of the current tip and pass to the next one. This function is | |
49 | pure virtual, it should be implemented in the derived classes. | |
50 | */ | |
51 | wxString GetTip(); | |
52 | ||
53 | /** | |
54 | Returns a modified tip. This function will be called immediately after read, | |
7c913512 | 55 | and before being check whether it is a comment, an empty string or a string |
23324ae1 | 56 | to translate. You can optionally override this in your custom user-derived |
7c913512 FM |
57 | class |
58 | to optionally to modify the tip as soon as it is read. You can return any | |
59 | modification to the string. If you return wxEmptyString, then this tip is | |
23324ae1 FM |
60 | skipped, and the next one is read. |
61 | */ | |
62 | virtual wxString PreProcessTip(const wxString& tip); | |
63 | }; | |
64 | ||
65 | ||
e54c96f1 | 66 | |
23324ae1 FM |
67 | // ============================================================================ |
68 | // Global functions/macros | |
69 | // ============================================================================ | |
70 | ||
ba2874ff BP |
71 | /** @ingroup group_funcmacro_dialog */ |
72 | //@{ | |
73 | ||
23324ae1 | 74 | /** |
ba2874ff | 75 | This function creates a wxTipProvider which may be used with wxShowTip(). |
7c913512 FM |
76 | |
77 | @param filename | |
ba2874ff | 78 | The name of the file containing the tips, one per line. |
7c913512 | 79 | @param currentTip |
ba2874ff BP |
80 | The index of the first tip to show. Normally this index is remembered |
81 | between the 2 program runs. | |
82 | ||
83 | @see @ref overview_tips | |
7c913512 | 84 | |
ba2874ff | 85 | @header{wx/tipdlg.h} |
23324ae1 | 86 | */ |
4cc4bfaf FM |
87 | wxTipProvider* wxCreateFileTipProvider(const wxString& filename, |
88 | size_t currentTip); | |
23324ae1 | 89 | |
ba2874ff BP |
90 | /** |
91 | This function shows a "startup tip" to the user. The return value is the | |
92 | state of the "Show tips at startup" checkbox. | |
93 | ||
94 | @param parent | |
95 | The parent window for the modal dialog. | |
96 | @param tipProvider | |
97 | An object which is used to get the text of the tips. It may be created | |
98 | with the wxCreateFileTipProvider() function. | |
99 | @param showAtStartup | |
100 | Should be true if startup tips are shown, false otherwise. This is | |
101 | used as the initial value for "Show tips at startup" checkbox which is | |
102 | shown in the tips dialog. | |
103 | ||
104 | @see @ref overview_tips | |
105 | ||
106 | @header{wx/tipdlg.h} | |
107 | */ | |
108 | bool wxShowTip(wxWindow *parent, | |
109 | wxTipProvider *tipProvider, | |
110 | bool showAtStartup = true); | |
111 | ||
112 | //@} | |
113 |