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