]> git.saurik.com Git - wxWidgets.git/blob - include/wx/richtooltip.h
83ea72dee2179f0bbcbfc21be289c31e5d8c4681
[wxWidgets.git] / include / wx / richtooltip.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/richtooltip.h
3 // Purpose: Declaration of wxRichToolTip class.
4 // Author: Vadim Zeitlin
5 // Created: 2011-10-07
6 // RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $
7 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_RICHTOOLTIP_H_
12 #define _WX_RICHTOOLTIP_H_
13
14 #if wxUSE_RICHTOOLTIP
15
16 class WXDLLIMPEXP_FWD_CORE wxColour;
17 class WXDLLIMPEXP_FWD_CORE wxFont;
18 class WXDLLIMPEXP_FWD_CORE wxIcon;
19
20 class wxRichToolTipImpl;
21
22 // This enum describes the kind of the tip shown which combines both the tip
23 // position and appearance because the two are related (when the tip is
24 // positioned asymmetrically, a right handed triangle is used but an
25 // equilateral one when it's in the middle of a side).
26 //
27 // Automatic selects the tip appearance best suited for the current platform
28 // and the position best suited for the window the tooltip is shown for, i.e.
29 // chosen in such a way that the tooltip is always fully on screen.
30 //
31 // Other values describe the position of the tooltip itself, not the window it
32 // relates to. E.g. wxTipKind_Top places the tip on the top of the tooltip and
33 // so the tooltip itself is located beneath its associated window.
34 enum wxTipKind
35 {
36 wxTipKind_None,
37 wxTipKind_TopLeft,
38 wxTipKind_Top,
39 wxTipKind_TopRight,
40 wxTipKind_BottomLeft,
41 wxTipKind_Bottom,
42 wxTipKind_BottomRight,
43 wxTipKind_Auto
44 };
45
46 // ----------------------------------------------------------------------------
47 // wxRichToolTip: a customizable but not necessarily native tooltip.
48 // ----------------------------------------------------------------------------
49
50 // Notice that this class does not inherit from wxWindow.
51 class WXDLLIMPEXP_ADV wxRichToolTip
52 {
53 public:
54 // Ctor must specify the tooltip title and main message, additional
55 // attributes can be set later.
56 wxRichToolTip(const wxString& title, const wxString& message);
57
58 // Set the background colour: if two colours are specified, the background
59 // is drawn using a gradient from top to bottom, otherwise a single solid
60 // colour is used.
61 void SetBackgroundColour(const wxColour& col,
62 const wxColour& colEnd = wxColour());
63
64 // Set the small icon to show: either one of the standard information/
65 // warning/error ones (the question icon doesn't make sense for a tooltip)
66 // or a custom icon.
67 void SetIcon(int icon = wxICON_INFORMATION);
68 void SetIcon(const wxIcon& icon);
69
70 // Set timeout after which the tooltip should disappear, in milliseconds.
71 // By default the tooltip is hidden after system-dependent interval of time
72 // elapses but this method can be used to change this or also disable
73 // hiding the tooltip automatically entirely by passing 0 in this parameter
74 // (but doing this can result in native version not being used).
75 void SetTimeout(unsigned milliseconds);
76
77 // Choose the tip kind, possibly none. By default the tip is positioned
78 // automatically, as if wxTipKind_Auto was used.
79 void SetTipKind(wxTipKind tipKind);
80
81 // Set the title text font. By default it's emphasized using the font style
82 // or colour appropriate for the current platform.
83 void SetTitleFont(const wxFont& font);
84
85 // Show the tooltip for the given window.
86 void ShowFor(wxWindow* win);
87
88 // Non-virtual dtor as this class is not supposed to be derived from.
89 ~wxRichToolTip();
90
91 private:
92 wxRichToolTipImpl* const m_impl;
93
94 wxDECLARE_NO_COPY_CLASS(wxRichToolTip);
95 };
96
97 #endif // wxUSE_RICHTOOLTIP
98
99 #endif // _WX_RICHTOOLTIP_H_