]> git.saurik.com Git - wxWidgets.git/blob - src/gtk1/tooltip.cpp
Fix horizontal mouse wheel scrolling in wxGTK.
[wxWidgets.git] / src / gtk1 / tooltip.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk1/tooltip.cpp
3 // Purpose: wxToolTip implementation
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 // For compilers that support precompilation, includes "wx.h".
10 #include "wx/wxprec.h"
11
12 #if wxUSE_TOOLTIPS
13
14 #include "wx/tooltip.h"
15
16 #ifndef WX_PRECOMP
17 #include "wx/window.h"
18 #endif
19
20 #include "wx/gtk1/private.h"
21
22 //-----------------------------------------------------------------------------
23 // global data
24 //-----------------------------------------------------------------------------
25
26 static GtkTooltips *ss_tooltips = NULL;
27
28 //-----------------------------------------------------------------------------
29 // wxToolTip
30 //-----------------------------------------------------------------------------
31
32 IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject)
33
34 wxToolTip::wxToolTip( const wxString &tip )
35 {
36 m_text = tip;
37 m_window = NULL;
38 }
39
40 void wxToolTip::SetTip( const wxString &tip )
41 {
42 m_text = tip;
43 Apply( m_window );
44 }
45
46 void wxToolTip::Apply( wxWindow *win )
47 {
48 if (!win) return;
49
50 if (!ss_tooltips)
51 {
52 ss_tooltips = gtk_tooltips_new();
53 }
54
55 m_window = win;
56
57 if (m_text.empty())
58 m_window->ApplyToolTip( ss_tooltips, NULL );
59 else
60 m_window->ApplyToolTip( ss_tooltips, m_text );
61 }
62
63 void wxToolTip::Enable( bool flag )
64 {
65 if (!ss_tooltips) return;
66
67 if (flag)
68 gtk_tooltips_enable( ss_tooltips );
69 else
70 gtk_tooltips_disable( ss_tooltips );
71 }
72
73 void wxToolTip::SetDelay( long msecs )
74 {
75 if (!ss_tooltips)
76 return;
77
78 gtk_tooltips_set_delay( ss_tooltips, (int)msecs );
79 }
80
81 void wxToolTip::SetAutoPop( long WXUNUSED(msecs) )
82 {
83 }
84
85 void wxToolTip::SetReshow( long WXUNUSED(msecs) )
86 {
87 }
88
89 #endif