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