]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/msw/tooltip.h | |
3 | // Purpose: wxToolTip class - tooltip control | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 31.01.99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1999 Robert Roebling, Vadim Zeitlin | |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_MSW_TOOLTIP_H_ | |
13 | #define _WX_MSW_TOOLTIP_H_ | |
14 | ||
15 | #include "wx/object.h" | |
16 | ||
17 | class WXDLLIMPEXP_FWD_CORE wxWindow; | |
18 | ||
19 | class WXDLLIMPEXP_CORE wxToolTip : public wxObject | |
20 | { | |
21 | public: | |
22 | // ctor & dtor | |
23 | wxToolTip(const wxString &tip); | |
24 | virtual ~wxToolTip(); | |
25 | ||
26 | // accessors | |
27 | // tip text | |
28 | void SetTip(const wxString& tip); | |
29 | const wxString& GetTip() const { return m_text; } | |
30 | ||
31 | // the window we're associated with | |
32 | void SetWindow(wxWindow *win); | |
33 | wxWindow *GetWindow() const { return m_window; } | |
34 | ||
35 | // controlling tooltip behaviour: globally change tooltip parameters | |
36 | // enable or disable the tooltips globally | |
37 | static void Enable(bool flag); | |
38 | // set the delay after which the tooltip appears | |
39 | static void SetDelay(long milliseconds); | |
40 | // set the delay after which the tooltip disappears or how long the | |
41 | // tooltip remains visible | |
42 | static void SetAutoPop(long milliseconds); | |
43 | // set the delay between subsequent tooltips to appear | |
44 | static void SetReshow(long milliseconds); | |
45 | // set maximum width for the new tooltips: -1 disables wrapping | |
46 | // entirely, 0 restores the default behaviour | |
47 | static void SetMaxWidth(int width); | |
48 | ||
49 | // implementation only from now on | |
50 | // ------------------------------- | |
51 | ||
52 | // should be called in responde to WM_MOUSEMOVE | |
53 | static void RelayEvent(WXMSG *msg); | |
54 | ||
55 | // add a window to the tooltip control | |
56 | void Add(WXHWND hwnd); | |
57 | ||
58 | // remove any tooltip from the window | |
59 | static void Remove(WXHWND hwnd); | |
60 | ||
61 | private: | |
62 | // the one and only one tooltip control we use - never access it directly | |
63 | // but use GetToolTipCtrl() which will create it when needed | |
64 | static WXHWND ms_hwndTT; | |
65 | ||
66 | // create the tooltip ctrl if it doesn't exist yet and return its HWND | |
67 | static WXHWND GetToolTipCtrl(); | |
68 | ||
69 | // new tooltip maximum width, defaults to min(display width, 400) | |
70 | static int ms_maxWidth; | |
71 | ||
72 | // remove this tooltip from the tooltip control | |
73 | void Remove(); | |
74 | ||
75 | wxString m_text; // tooltip text | |
76 | wxWindow *m_window; // window we're associated with | |
77 | ||
78 | DECLARE_ABSTRACT_CLASS(wxToolTip) | |
79 | wxDECLARE_NO_COPY_CLASS(wxToolTip); | |
80 | }; | |
81 | ||
82 | #endif // _WX_MSW_TOOLTIP_H_ |