1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/richtooltip.h
3 // Purpose: Declaration of wxRichToolTip class.
4 // Author: Vadim Zeitlin
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 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_RICHTOOLTIP_H_
12 #define _WX_RICHTOOLTIP_H_
16 class WXDLLIMPEXP_FWD_CORE wxColour
;
17 class WXDLLIMPEXP_FWD_CORE wxFont
;
18 class WXDLLIMPEXP_FWD_CORE wxIcon
;
19 class WXDLLIMPEXP_FWD_CORE wxWindow
;
21 class wxRichToolTipImpl
;
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).
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.
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.
43 wxTipKind_BottomRight
,
47 // ----------------------------------------------------------------------------
48 // wxRichToolTip: a customizable but not necessarily native tooltip.
49 // ----------------------------------------------------------------------------
51 // Notice that this class does not inherit from wxWindow.
52 class WXDLLIMPEXP_ADV wxRichToolTip
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
);
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
62 void SetBackgroundColour(const wxColour
& col
,
63 const wxColour
& colEnd
= wxColour());
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)
68 void SetIcon(int icon
= wxICON_INFORMATION
);
69 void SetIcon(const wxIcon
& icon
);
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
);
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
);
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
);
86 // Show the tooltip for the given window.
87 void ShowFor(wxWindow
* win
);
89 // Non-virtual dtor as this class is not supposed to be derived from.
93 wxRichToolTipImpl
* const m_impl
;
95 wxDECLARE_NO_COPY_CLASS(wxRichToolTip
);
98 #endif // wxUSE_RICHTOOLTIP
100 #endif // _WX_RICHTOOLTIP_H_