]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/tooltip.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk/tooltip.cpp
3 // Purpose: wxToolTip implementation
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
15 #include "wx/tooltip.h"
18 #include "wx/window.h"
21 #include "wx/gtk/private.h"
23 //-----------------------------------------------------------------------------
25 //-----------------------------------------------------------------------------
27 static GtkTooltips
*gs_tooltips
= NULL
;
29 //-----------------------------------------------------------------------------
31 //-----------------------------------------------------------------------------
33 IMPLEMENT_ABSTRACT_CLASS(wxToolTip
, wxObject
)
35 wxToolTip::wxToolTip( const wxString
&tip
)
41 void wxToolTip::SetTip( const wxString
&tip
)
45 m_window
->GTKApplyToolTip(wxGTK_CONV_SYS(m_text
));
48 void wxToolTip::GTKSetWindow(wxWindow
* win
)
52 m_window
->GTKApplyToolTip(wxGTK_CONV_SYS(m_text
));
56 void wxToolTip::GTKApply(GtkWidget
* widget
, const char* tip
)
58 #if GTK_CHECK_VERSION(2, 12, 0)
59 if (!gtk_check_version(2, 12, 0))
60 gtk_widget_set_tooltip_text(widget
, tip
);
65 gs_tooltips
= gtk_tooltips_new();
67 gtk_tooltips_set_tip(gs_tooltips
, widget
, tip
, NULL
);
71 void wxToolTip::Enable( bool flag
)
73 #if GTK_CHECK_VERSION(2, 12, 0)
74 if (!gtk_check_version(2, 12, 0))
76 GtkSettings
* settings
= gtk_settings_get_default();
78 gtk_settings_set_long_property(settings
, "gtk-enable-tooltips", flag
, NULL
);
84 gs_tooltips
= gtk_tooltips_new();
87 gtk_tooltips_enable( gs_tooltips
);
89 gtk_tooltips_disable( gs_tooltips
);
93 void wxToolTip::SetDelay( long msecs
)
95 #if GTK_CHECK_VERSION(2, 12, 0)
96 if (!gtk_check_version(2, 12, 0))
98 GtkSettings
* settings
= gtk_settings_get_default();
100 gtk_settings_set_long_property(settings
, "gtk-tooltip-timeout", msecs
, NULL
);
106 gs_tooltips
= gtk_tooltips_new();
108 gtk_tooltips_set_delay( gs_tooltips
, (int)msecs
);
112 void wxToolTip::SetAutoPop( long WXUNUSED(msecs
) )
116 void wxToolTip::SetReshow( long WXUNUSED(msecs
) )
120 #endif // wxUSE_TOOLTIPS