]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/tooltip.cpp
Blind fix for Tinderbox build error.
[wxWidgets.git] / src / gtk1 / tooltip.cpp
CommitLineData
90b1b133 1/////////////////////////////////////////////////////////////////////////////
9b5f1895 2// Name: src/gtk1/tooltip.cpp
ff8bfdbb 3// Purpose: wxToolTip implementation
90b1b133
RR
4// Author: Robert Roebling
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
65571936 7// Licence: wxWindows licence
90b1b133
RR
8/////////////////////////////////////////////////////////////////////////////
9
14f355c2
VS
10// For compilers that support precompilation, includes "wx.h".
11#include "wx/wxprec.h"
12
cad880f5 13#if wxUSE_TOOLTIPS
f7f1f70f 14
90b1b133 15#include "wx/tooltip.h"
cdccdfab
WS
16
17#ifndef WX_PRECOMP
18 #include "wx/window.h"
19#endif
90b1b133 20
3cbab641 21#include "wx/gtk1/private.h"
90b1b133 22
301cd871
RR
23//-----------------------------------------------------------------------------
24// global data
25//-----------------------------------------------------------------------------
26
27static GtkTooltips *ss_tooltips = (GtkTooltips*) NULL;
ff8bfdbb 28
90b1b133 29//-----------------------------------------------------------------------------
b1170810 30// wxToolTip
90b1b133
RR
31//-----------------------------------------------------------------------------
32
b342f8f0
RD
33IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject)
34
b1170810
RR
35wxToolTip::wxToolTip( const wxString &tip )
36{
37 m_text = tip;
301cd871 38 m_window = (wxWindow*) NULL;
b1170810 39}
90b1b133 40
301cd871 41void wxToolTip::SetTip( const wxString &tip )
b1170810 42{
301cd871
RR
43 m_text = tip;
44 Apply( m_window );
45}
46
47void wxToolTip::Apply( wxWindow *win )
48{
49 if (!win) return;
50
51 if (!ss_tooltips)
90b1b133 52 {
301cd871 53 ss_tooltips = gtk_tooltips_new();
90b1b133 54 }
ff8bfdbb 55
301cd871 56 m_window = win;
ff8bfdbb 57
cdccdfab 58 if (m_text.empty())
05939a81 59 m_window->ApplyToolTip( ss_tooltips, (wxChar*) NULL );
301cd871
RR
60 else
61 m_window->ApplyToolTip( ss_tooltips, m_text );
90b1b133
RR
62}
63
64void wxToolTip::Enable( bool flag )
65{
301cd871 66 if (!ss_tooltips) return;
ff8bfdbb 67
90b1b133 68 if (flag)
301cd871 69 gtk_tooltips_enable( ss_tooltips );
90b1b133 70 else
301cd871 71 gtk_tooltips_disable( ss_tooltips );
90b1b133
RR
72}
73
74void wxToolTip::SetDelay( long msecs )
75{
b02da6b1
VZ
76 if (!ss_tooltips)
77 return;
ff8bfdbb 78
b02da6b1 79 gtk_tooltips_set_delay( ss_tooltips, (int)msecs );
90b1b133 80}
dcf924a3 81
f7f1f70f 82#endif