]>
Commit | Line | Data |
---|---|---|
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 | ||
d3b9f782 | 27 | static GtkTooltips *ss_tooltips = NULL; |
ff8bfdbb | 28 | |
90b1b133 | 29 | //----------------------------------------------------------------------------- |
b1170810 | 30 | // wxToolTip |
90b1b133 RR |
31 | //----------------------------------------------------------------------------- |
32 | ||
b342f8f0 RD |
33 | IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject) |
34 | ||
b1170810 RR |
35 | wxToolTip::wxToolTip( const wxString &tip ) |
36 | { | |
37 | m_text = tip; | |
d3b9f782 | 38 | m_window = NULL; |
b1170810 | 39 | } |
90b1b133 | 40 | |
301cd871 | 41 | void wxToolTip::SetTip( const wxString &tip ) |
b1170810 | 42 | { |
301cd871 RR |
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) | |
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()) |
d3b9f782 | 59 | m_window->ApplyToolTip( ss_tooltips, NULL ); |
301cd871 RR |
60 | else |
61 | m_window->ApplyToolTip( ss_tooltips, m_text ); | |
90b1b133 RR |
62 | } |
63 | ||
64 | void 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 | ||
74 | void 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 | |
becac1ef VZ |
82 | void wxToolTip::SetAutoPop( long WXUNUSED(msecs) ) |
83 | { | |
84 | } | |
85 | ||
86 | void wxToolTip::SetReshow( long WXUNUSED(msecs) ) | |
87 | { | |
88 | } | |
89 | ||
f7f1f70f | 90 | #endif |