]> git.saurik.com Git - wxWidgets.git/blame - include/wx/tipdlg.h
Applied #15226 wxRichTextCtrl: Implement setting properties with undo for objects...
[wxWidgets.git] / include / wx / tipdlg.h
CommitLineData
c89165a8 1///////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/tipdlg.h
c89165a8
VZ
3// Purpose: declaration of wxTipDialog
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 28.06.99
c89165a8 7// Copyright: (c) Vadim Zeitlin
65571936 8// Licence: wxWindows licence
c89165a8
VZ
9///////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_TIPDLG_H_
12#define _WX_TIPDLG_H_
13
c89165a8
VZ
14// ----------------------------------------------------------------------------
15// headers which we must include here
16// ----------------------------------------------------------------------------
17
18#include "wx/defs.h"
19
20#if wxUSE_STARTUP_TIPS
21
22#include "wx/textfile.h"
23
24// ----------------------------------------------------------------------------
25// wxTipProvider - a class which is used by wxTipDialog to get the text of the
26// tips
27// ----------------------------------------------------------------------------
28
29// the abstract base class: it provides the tips, i.e. implements the GetTip()
30// function which returns the new tip each time it's called. To support this,
31// wxTipProvider evidently needs some internal state which is the tip "index"
32// and which should be saved/restored by the program to not always show one and
33// the same tip (of course, you may use random starting position as well...)
12f190b0 34class WXDLLIMPEXP_ADV wxTipProvider
c89165a8
VZ
35{
36public:
37 wxTipProvider(size_t currentTip) { m_currentTip = currentTip; }
38
39 // get the current tip and update the internal state to return the next tip
40 // when called for the next time
cb719f2e 41 virtual wxString GetTip() = 0;
c89165a8
VZ
42
43 // get the current tip "index" (or whatever allows the tip provider to know
44 // from where to start the next time)
45 size_t GetCurrentTip() const { return m_currentTip; }
46
cb719f2e
WS
47 // Allows any user-derived class to optionally override this function to
48 // modify the tip as soon as it is read. If return wxEmptyString, then
70373b5a
JS
49 // the tip is skipped, and the next one is read.
50 virtual wxString PreprocessTip(const wxString& tip) { return tip; }
51
c89165a8
VZ
52 // virtual dtor for the base class
53 virtual ~wxTipProvider() { }
54
55protected:
56 size_t m_currentTip;
57};
58
59// a function which returns an implementation of wxTipProvider using the
60// specified text file as the source of tips (each line is a tip).
61//
62// NB: the caller is responsible for deleting the pointer!
6502dc68 63#if wxUSE_TEXTFILE
12f190b0
VS
64WXDLLIMPEXP_ADV wxTipProvider *wxCreateFileTipProvider(const wxString& filename,
65 size_t currentTip);
6502dc68 66#endif // wxUSE_TEXTFILE
c89165a8
VZ
67
68// ----------------------------------------------------------------------------
69// wxTipDialog
70// ----------------------------------------------------------------------------
71
72// A dialog which shows a "tip" - a short and helpful messages describing to
73// the user some program characteristic. Many programs show the tips at
74// startup, so the dialog has "Show tips on startup" checkbox which allows to
75// the user to disable this (however, it's the program which should show, or
76// not, the dialog on startup depending on its value, not this class).
77//
cb719f2e 78// The function returns true if this checkbox is checked, false otherwise.
12f190b0
VS
79WXDLLIMPEXP_ADV bool wxShowTip(wxWindow *parent,
80 wxTipProvider *tipProvider,
cb719f2e 81 bool showAtStartup = true);
c89165a8
VZ
82
83#endif // wxUSE_STARTUP_TIPS
84
85#endif // _WX_TIPDLG_H_