]>
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
)
47 void wxToolTip::GTKApply( wxWindow
*win
)
53 gs_tooltips
= gtk_tooltips_new();
58 m_window
->GTKApplyToolTip( gs_tooltips
, NULL
);
60 m_window
->GTKApplyToolTip( gs_tooltips
, wxGTK_CONV_SYS(m_text
) );
64 void wxToolTip::GTKApply(GtkWidget
*w
, const gchar
*tip
)
66 #if GTK_CHECK_VERSION(2, 12, 0)
67 if (!gtk_check_version(2, 12, 0))
69 gtk_widget_set_tooltip_text(w
, tip
);
75 gs_tooltips
= gtk_tooltips_new();
77 gtk_tooltips_set_tip(gs_tooltips
, w
, tip
, NULL
);
81 void wxToolTip::Enable( bool flag
)
83 #if GTK_CHECK_VERSION(2, 12, 0)
84 if (!gtk_check_version(2, 12, 0))
86 GtkSettings
* settings
= gtk_settings_get_default();
89 gtk_settings_set_long_property(settings
, "gtk-enable-tooltips", flag
?TRUE
:FALSE
, NULL
);
98 gtk_tooltips_enable( gs_tooltips
);
100 gtk_tooltips_disable( gs_tooltips
);
105 void gtk_tooltips_set_delay (GtkTooltips
*tooltips
,
109 void wxToolTip::SetDelay( long msecs
)
111 #if GTK_CHECK_VERSION(2, 12, 0)
112 if (!gtk_check_version(2, 12, 0))
114 GtkSettings
* settings
= gtk_settings_get_default();
117 gtk_settings_set_long_property(settings
, "gtk-tooltip-timeout", msecs
, NULL
);
125 // FIXME: This is a deprecated function and might not even have an effect.
126 // Try to not use it, after which remove the prototype above.
127 gtk_tooltips_set_delay( gs_tooltips
, (int)msecs
);
131 void wxToolTip::SetAutoPop( long WXUNUSED(msecs
) )
135 void wxToolTip::SetReshow( long WXUNUSED(msecs
) )
139 #endif // wxUSE_TOOLTIPS