]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/tooltip.cpp
Fix for #15520: wxRichTextCtrl: Drawing the selection doesn't respect its container...
[wxWidgets.git] / src / gtk1 / tooltip.cpp
CommitLineData
90b1b133 1/////////////////////////////////////////////////////////////////////////////
9b5f1895 2// Name: src/gtk1/tooltip.cpp
ff8bfdbb 3// Purpose: wxToolTip implementation
90b1b133 4// Author: Robert Roebling
90b1b133 5// Copyright: (c) 1998 Robert Roebling
65571936 6// Licence: wxWindows licence
90b1b133
RR
7/////////////////////////////////////////////////////////////////////////////
8
14f355c2
VS
9// For compilers that support precompilation, includes "wx.h".
10#include "wx/wxprec.h"
11
cad880f5 12#if wxUSE_TOOLTIPS
f7f1f70f 13
90b1b133 14#include "wx/tooltip.h"
cdccdfab
WS
15
16#ifndef WX_PRECOMP
17 #include "wx/window.h"
18#endif
90b1b133 19
3cbab641 20#include "wx/gtk1/private.h"
90b1b133 21
301cd871
RR
22//-----------------------------------------------------------------------------
23// global data
24//-----------------------------------------------------------------------------
25
d3b9f782 26static GtkTooltips *ss_tooltips = 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;
d3b9f782 37 m_window = 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
cdccdfab 57 if (m_text.empty())
d3b9f782 58 m_window->ApplyToolTip( ss_tooltips, 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
becac1ef
VZ
81void wxToolTip::SetAutoPop( long WXUNUSED(msecs) )
82{
83}
84
85void wxToolTip::SetReshow( long WXUNUSED(msecs) )
86{
87}
88
f7f1f70f 89#endif