Applied patch [ 600500 ] Tip-of-day: comments, translatable
By Robert O'Connor This is a patch to wxTip Provider classes used by the "Tip of the day" dialog. See wx-dev archives August 2002 for discussion of the functionality design. It does 5 things: -Support for comments inside the tips file. The pound character (#) is used, as recommended by Vadim. -Allows optional easy translation support to tips, by marking them as translatable for gettext, by enclosing them in a _(""). Program will translate these tips at runtime from the active catalog. -Blank lines or lines with just spaces are automatically skipped (I had to put this in, I keep wondering why I get blank tips sometimes and it is because the text file had a empty blank line at the end of the text file). -There is a pluggable virtual function to preprocess to modify the tip in a derived class, in case something specialized is desired, such as variable expansion, etc, as recommended by Julian and Vadim. -Now resets the tip counter if the previous tip is past the end of the file (ie you removed some tips, or changed tip files), as discussed on wx-dev. This patch updates: -The classes. -The class documentation and the Tip-of-the-day topic overview documentation. -The dialogs example, placing some new strings for the tips.txt file which demonstrate how to use the Tip-of-the-day features for in practice. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16887 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -43,12 +43,17 @@ public:
|
||||
|
||||
// get the current tip and update the internal state to return the next tip
|
||||
// when called for the next time
|
||||
virtual wxString GetTip() = 0;
|
||||
virtual wxString GetTip() = 0;
|
||||
|
||||
// get the current tip "index" (or whatever allows the tip provider to know
|
||||
// from where to start the next time)
|
||||
size_t GetCurrentTip() const { return m_currentTip; }
|
||||
|
||||
// Allows any user-derived class to optionally override this function to
|
||||
// modify the tip as soon as it is read. If return wxEmptyString, then
|
||||
// the tip is skipped, and the next one is read.
|
||||
virtual wxString PreprocessTip(const wxString& tip) { return tip; }
|
||||
|
||||
// virtual dtor for the base class
|
||||
virtual ~wxTipProvider() { }
|
||||
|
||||
|
Reference in New Issue
Block a user