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