]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/tooltip.cpp
Get/SetTitle only for wxTopLevelWindow (wxMotif part).
[wxWidgets.git] / src / gtk / tooltip.cpp
CommitLineData
90b1b133
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: 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
a9d6a93c 13#include "wx/setup.h"
cad880f5
RR
14
15#if wxUSE_TOOLTIPS
f7f1f70f 16
90b1b133 17#include "wx/tooltip.h"
e1bf3ad3 18#include "wx/window.h"
90b1b133 19
9e691f46 20#include "wx/gtk/private.h"
90b1b133 21
301cd871
RR
22//-----------------------------------------------------------------------------
23// global data
24//-----------------------------------------------------------------------------
25
26static GtkTooltips *ss_tooltips = (GtkTooltips*) NULL;
ff8bfdbb 27
90b1b133 28//-----------------------------------------------------------------------------
b1170810 29// wxToolTip
90b1b133
RR
30//-----------------------------------------------------------------------------
31
b342f8f0
RD
32IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject)
33
b1170810
RR
34wxToolTip::wxToolTip( const wxString &tip )
35{
36 m_text = tip;
301cd871 37 m_window = (wxWindow*) NULL;
b1170810 38}
90b1b133 39
301cd871 40void wxToolTip::SetTip( const wxString &tip )
b1170810 41{
301cd871
RR
42 m_text = tip;
43 Apply( m_window );
44}
45
46void wxToolTip::Apply( wxWindow *win )
47{
48 if (!win) return;
49
50 if (!ss_tooltips)
90b1b133 51 {
301cd871 52 ss_tooltips = gtk_tooltips_new();
90b1b133 53 }
ff8bfdbb 54
301cd871 55 m_window = win;
ff8bfdbb 56
301cd871 57 if (m_text.IsEmpty())
05939a81 58 m_window->ApplyToolTip( ss_tooltips, (wxChar*) NULL );
301cd871
RR
59 else
60 m_window->ApplyToolTip( ss_tooltips, m_text );
90b1b133
RR
61}
62
63void wxToolTip::Enable( bool flag )
64{
301cd871 65 if (!ss_tooltips) return;
ff8bfdbb 66
90b1b133 67 if (flag)
301cd871 68 gtk_tooltips_enable( ss_tooltips );
90b1b133 69 else
301cd871 70 gtk_tooltips_disable( ss_tooltips );
90b1b133
RR
71}
72
73void wxToolTip::SetDelay( long msecs )
74{
b02da6b1
VZ
75 if (!ss_tooltips)
76 return;
ff8bfdbb 77
b02da6b1 78 gtk_tooltips_set_delay( ss_tooltips, (int)msecs );
90b1b133 79}
dcf924a3 80
f7f1f70f 81#endif
90b1b133 82