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