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