]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/tooltip.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / msw / tooltip.h
CommitLineData
3a19e16d 1///////////////////////////////////////////////////////////////////////////////
623d5f80 2// Name: wx/msw/tooltip.h
3a19e16d
VZ
3// Purpose: wxToolTip class - tooltip control
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 31.01.99
3a19e16d 7// Copyright: (c) 1999 Robert Roebling, Vadim Zeitlin
65571936 8// Licence: wxWindows licence
3a19e16d
VZ
9///////////////////////////////////////////////////////////////////////////////
10
20ceebaa
MW
11#ifndef _WX_MSW_TOOLTIP_H_
12#define _WX_MSW_TOOLTIP_H_
13
4a6b1d28 14#include "wx/object.h"
e1bdb16a 15#include "wx/gdicmn.h"
4a6b1d28 16
b5dbe15d 17class WXDLLIMPEXP_FWD_CORE wxWindow;
0ce0f1e9 18class wxToolTipOtherWindows;
623d5f80 19
53a2db12 20class WXDLLIMPEXP_CORE wxToolTip : public wxObject
3a19e16d
VZ
21{
22public:
23 // ctor & dtor
24 wxToolTip(const wxString &tip);
25 virtual ~wxToolTip();
03647350 26
6418ad5e
FM
27 // ctor used by wxStatusBar to associate a tooltip to a portion of
28 // the status bar window:
03647350 29 wxToolTip(wxWindow* win, unsigned int id,
6418ad5e 30 const wxString &tip, const wxRect& rc);
3a19e16d
VZ
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
16f6dfd8 41 // controlling tooltip behaviour: globally change tooltip parameters
3a19e16d 42 // enable or disable the tooltips globally
16f6dfd8 43 static void Enable(bool flag);
3a19e16d 44 // set the delay after which the tooltip appears
16f6dfd8 45 static void SetDelay(long milliseconds);
be8b4385
VZ
46 // set the delay after which the tooltip disappears or how long the
47 // tooltip remains visible
becac1ef
VZ
48 static void SetAutoPop(long milliseconds);
49 // set the delay between subsequent tooltips to appear
50 static void SetReshow(long milliseconds);
be8b4385
VZ
51 // set maximum width for the new tooltips: -1 disables wrapping
52 // entirely, 0 restores the default behaviour
53 static void SetMaxWidth(int width);
3a19e16d 54
8614c467
VZ
55 // implementation only from now on
56 // -------------------------------
57
6418ad5e 58 // should be called in response to WM_MOUSEMOVE
4453b38d 59 static void RelayEvent(WXMSG *msg);
3a19e16d 60
1306e7d6 61 // add a window to the tooltip control
f7dd07f6 62 void AddOtherWindow(WXHWND hwnd);
1306e7d6 63
0c5405b7 64 // remove any tooltip from the window
6418ad5e
FM
65 static void Remove(WXHWND hwnd, unsigned int id, const wxRect& rc);
66
0ce0f1e9
VZ
67 // Set the rectangle we're associated with. This rectangle is only used for
68 // the main window, not any sub-windows added with Add() so in general it
69 // makes sense to use it for tooltips associated with a single window only.
6418ad5e 70 void SetRect(const wxRect& rc);
0c5405b7 71
3a19e16d 72private:
0ce0f1e9 73 // Adds a window other than our main m_window to this tooltip.
f7dd07f6 74 void DoAddHWND(WXHWND hWnd);
0ce0f1e9
VZ
75
76 // Perform the specified operation for the given window only.
77 void DoSetTip(WXHWND hWnd);
78 void DoRemove(WXHWND hWnd);
79
80 // Call the given function for all windows we're associated with.
81 void DoForAllWindows(void (wxToolTip::*func)(WXHWND));
82
83
8614c467
VZ
84 // the one and only one tooltip control we use - never access it directly
85 // but use GetToolTipCtrl() which will create it when needed
f048e32f
VZ
86 static WXHWND ms_hwndTT;
87
88 // create the tooltip ctrl if it doesn't exist yet and return its HWND
8614c467 89 static WXHWND GetToolTipCtrl();
3a19e16d 90
be8b4385
VZ
91 // new tooltip maximum width, defaults to min(display width, 400)
92 static int ms_maxWidth;
93
3a19e16d
VZ
94 // remove this tooltip from the tooltip control
95 void Remove();
96
97 wxString m_text; // tooltip text
0ce0f1e9
VZ
98 wxWindow* m_window; // main window we're associated with
99 wxToolTipOtherWindows *m_others; // other windows associated with it or NULL
6418ad5e
FM
100 wxRect m_rect; // the rect of the window for which this tooltip is shown
101 // (or a rect with width/height == 0 to show it for the entire window)
102 unsigned int m_id; // the id of this tooltip (ignored when m_rect width/height is 0)
b342f8f0
RD
103
104 DECLARE_ABSTRACT_CLASS(wxToolTip)
c0c133e1 105 wxDECLARE_NO_COPY_CLASS(wxToolTip);
3a19e16d 106};
d098a357 107
20ceebaa 108#endif // _WX_MSW_TOOLTIP_H_