]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/tooltip.h
Don't pop explicitly changed status messages.
[wxWidgets.git] / include / wx / msw / tooltip.h
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 #include "wx/gdicmn.h"
17
18 class WXDLLIMPEXP_FWD_CORE wxWindow;
19
20 class WXDLLIMPEXP_CORE wxToolTip : public wxObject
21 {
22 public:
23 // ctor & dtor
24 wxToolTip(const wxString &tip);
25 virtual ~wxToolTip();
26
27 // ctor used by wxStatusBar to associate a tooltip to a portion of
28 // the status bar window:
29 wxToolTip(wxWindow* win, unsigned int id,
30 const wxString &tip, const wxRect& rc);
31
32 // accessors
33 // tip text
34 void SetTip(const wxString& tip);
35 const wxString& GetTip() const { return m_text; }
36
37 // the window we're associated with
38 void SetWindow(wxWindow *win);
39 wxWindow *GetWindow() const { return m_window; }
40
41 // controlling tooltip behaviour: globally change tooltip parameters
42 // enable or disable the tooltips globally
43 static void Enable(bool flag);
44 // set the delay after which the tooltip appears
45 static void SetDelay(long milliseconds);
46 // set the delay after which the tooltip disappears or how long the
47 // tooltip remains visible
48 static void SetAutoPop(long milliseconds);
49 // set the delay between subsequent tooltips to appear
50 static void SetReshow(long milliseconds);
51 // set maximum width for the new tooltips: -1 disables wrapping
52 // entirely, 0 restores the default behaviour
53 static void SetMaxWidth(int width);
54
55 // implementation only from now on
56 // -------------------------------
57
58 // should be called in response to WM_MOUSEMOVE
59 static void RelayEvent(WXMSG *msg);
60
61 // add a window to the tooltip control
62 void Add(WXHWND hwnd);
63
64 // remove any tooltip from the window
65 static void Remove(WXHWND hwnd, unsigned int id, const wxRect& rc);
66
67 // the rect we're associated with
68 void SetRect(const wxRect& rc);
69 const wxRect& GetRect() const { return m_rect; }
70
71 private:
72 // the one and only one tooltip control we use - never access it directly
73 // but use GetToolTipCtrl() which will create it when needed
74 static WXHWND ms_hwndTT;
75
76 // create the tooltip ctrl if it doesn't exist yet and return its HWND
77 static WXHWND GetToolTipCtrl();
78
79 // new tooltip maximum width, defaults to min(display width, 400)
80 static int ms_maxWidth;
81
82 // remove this tooltip from the tooltip control
83 void Remove();
84
85 wxString m_text; // tooltip text
86 wxWindow* m_window; // window we're associated with
87 wxRect m_rect; // the rect of the window for which this tooltip is shown
88 // (or a rect with width/height == 0 to show it for the entire window)
89 unsigned int m_id; // the id of this tooltip (ignored when m_rect width/height is 0)
90
91 DECLARE_ABSTRACT_CLASS(wxToolTip)
92 wxDECLARE_NO_COPY_CLASS(wxToolTip);
93 };
94
95 #endif // _WX_MSW_TOOLTIP_H_