2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: tipdlg.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxTipProvider
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxTipProvider
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
This is the class used together with wxShowTip() function.
|
2008-03-08 08:52:38 -05:00
|
|
|
It must implement wxTipProvider::GetTip function and return the
|
|
|
|
current tip from it (different tip each time it is called).
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05: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 11:24:38 -04:00
|
|
|
use it instead of the one returned by wxCreateFileTipProvider().
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxadv}
|
2008-10-04 07:55:28 -04:00
|
|
|
@category{misc}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-04 07:55:28 -04:00
|
|
|
@see @ref overview_tips, ::wxShowTip
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxTipProvider
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param currentTip
|
2008-03-09 08:33:59 -04:00
|
|
|
The starting tip index.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxTipProvider(size_t currentTip);
|
|
|
|
|
|
|
|
/**
|
2008-10-04 07:55:28 -04:00
|
|
|
Returns the index of the current tip (i.e. the one which would be returned by GetTip()).
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
The program usually remembers the value returned by this function after calling
|
2008-10-04 07:55:28 -04:00
|
|
|
wxShowTip(). Note that it is not the same as the value which was passed to
|
|
|
|
wxShowTip + 1 because the user might have pressed the "Next" button in
|
|
|
|
the tip dialog.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
size_t GetCurrentTip() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-04 07:55:28 -04: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.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
virtual wxString GetTip() = 0;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-04 07:55:28 -04:00
|
|
|
Returns a modified tip.
|
|
|
|
|
|
|
|
This function will be called immediately after read, and before being check
|
|
|
|
whether it is a comment, an empty string or a string to translate.
|
|
|
|
You can optionally override this in your custom user-derived class
|
2008-03-08 09:43:31 -05:00
|
|
|
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 08:52:38 -05:00
|
|
|
skipped, and the next one is read.
|
|
|
|
*/
|
|
|
|
virtual wxString PreProcessTip(const wxString& tip);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
// ============================================================================
|
|
|
|
// Global functions/macros
|
|
|
|
// ============================================================================
|
|
|
|
|
2009-01-05 15:48:06 -05:00
|
|
|
/** @addtogroup group_funcmacro_dialog */
|
2008-03-18 15:30:01 -04:00
|
|
|
//@{
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-03-18 15:30:01 -04:00
|
|
|
This function creates a wxTipProvider which may be used with wxShowTip().
|
2008-03-08 09:43:31 -05:00
|
|
|
|
|
|
|
@param filename
|
2008-03-18 15:30:01 -04:00
|
|
|
The name of the file containing the tips, one per line.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param currentTip
|
2008-03-18 15:30:01 -04: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 09:43:31 -05:00
|
|
|
|
2008-03-18 15:30:01 -04:00
|
|
|
@header{wx/tipdlg.h}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxTipProvider* wxCreateFileTipProvider(const wxString& filename,
|
|
|
|
size_t currentTip);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-18 15:30:01 -04: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);
|
|
|
|
|
|
|
|
//@}
|
|
|
|
|