2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: tipdlg.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxTipProvider
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxTipProvider
|
|
|
|
@wxheader{tipdlg.h}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
This is the class used together with wxShowTip() function.
|
2008-03-08 13:52:38 +00:00
|
|
|
It must implement wxTipProvider::GetTip function and return the
|
|
|
|
current tip from it (different tip each time it is called).
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
You will never use this class yourself, but you need it to show startup tips
|
|
|
|
with wxShowTip. Also, if you want to get the tips text from elsewhere than a
|
|
|
|
simple text file, you will want to derive a new class from wxTipProvider and
|
2008-03-10 15:24:38 +00:00
|
|
|
use it instead of the one returned by wxCreateFileTipProvider().
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxadv}
|
|
|
|
@category{FIXME}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
@see @ref overview_tipsoverview "Startup tips overview", ::wxShowTip
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
class wxTipProvider
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param currentTip
|
2008-03-09 12:33:59 +00:00
|
|
|
The starting tip index.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
wxTipProvider(size_t currentTip);
|
|
|
|
|
|
|
|
/**
|
2008-03-08 14:43:31 +00:00
|
|
|
Returns the index of the current tip (i.e. the one which would be returned by
|
2008-03-08 13:52:38 +00:00
|
|
|
GetTip).
|
2008-03-08 14:43:31 +00:00
|
|
|
The program usually remembers the value returned by this function after calling
|
2008-03-10 15:24:38 +00:00
|
|
|
wxShowTip(). Note that it is not the same as the value which
|
2008-03-08 13:52:38 +00:00
|
|
|
was passed to wxShowTip + 1 because the user might have pressed the "Next"
|
|
|
|
button in the tip dialog.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
size_t GetCurrentTip() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Return the text of the current tip and pass to the next one. This function is
|
|
|
|
pure virtual, it should be implemented in the derived classes.
|
|
|
|
*/
|
|
|
|
wxString GetTip();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a modified tip. This function will be called immediately after read,
|
2008-03-08 14:43:31 +00:00
|
|
|
and before being check whether it is a comment, an empty string or a string
|
2008-03-08 13:52:38 +00:00
|
|
|
to translate. You can optionally override this in your custom user-derived
|
2008-03-08 14:43:31 +00:00
|
|
|
class
|
|
|
|
to optionally to modify the tip as soon as it is read. You can return any
|
|
|
|
modification to the string. If you return wxEmptyString, then this tip is
|
2008-03-08 13:52:38 +00:00
|
|
|
skipped, and the next one is read.
|
|
|
|
*/
|
|
|
|
virtual wxString PreProcessTip(const wxString& tip);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
// ============================================================================
|
|
|
|
// Global functions/macros
|
|
|
|
// ============================================================================
|
|
|
|
|
2008-03-18 19:30:01 +00:00
|
|
|
/** @ingroup group_funcmacro_dialog */
|
|
|
|
//@{
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
2008-03-18 19:30:01 +00:00
|
|
|
This function creates a wxTipProvider which may be used with wxShowTip().
|
2008-03-08 14:43:31 +00:00
|
|
|
|
|
|
|
@param filename
|
2008-03-18 19:30:01 +00:00
|
|
|
The name of the file containing the tips, one per line.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param currentTip
|
2008-03-18 19:30:01 +00:00
|
|
|
The index of the first tip to show. Normally this index is remembered
|
|
|
|
between the 2 program runs.
|
|
|
|
|
|
|
|
@see @ref overview_tips
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-18 19:30:01 +00:00
|
|
|
@header{wx/tipdlg.h}
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
wxTipProvider* wxCreateFileTipProvider(const wxString& filename,
|
|
|
|
size_t currentTip);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2008-03-18 19:30:01 +00:00
|
|
|
/**
|
|
|
|
This function shows a "startup tip" to the user. The return value is the
|
|
|
|
state of the "Show tips at startup" checkbox.
|
|
|
|
|
|
|
|
@param parent
|
|
|
|
The parent window for the modal dialog.
|
|
|
|
@param tipProvider
|
|
|
|
An object which is used to get the text of the tips. It may be created
|
|
|
|
with the wxCreateFileTipProvider() function.
|
|
|
|
@param showAtStartup
|
|
|
|
Should be true if startup tips are shown, false otherwise. This is
|
|
|
|
used as the initial value for "Show tips at startup" checkbox which is
|
|
|
|
shown in the tips dialog.
|
|
|
|
|
|
|
|
@see @ref overview_tips
|
|
|
|
|
|
|
|
@header{wx/tipdlg.h}
|
|
|
|
*/
|
|
|
|
bool wxShowTip(wxWindow *parent,
|
|
|
|
wxTipProvider *tipProvider,
|
|
|
|
bool showAtStartup = true);
|
|
|
|
|
|
|
|
//@}
|
|
|
|
|