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