]>
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 #if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
28 static GtkTooltips
*gs_tooltips
= NULL
;
31 //-----------------------------------------------------------------------------
33 //-----------------------------------------------------------------------------
35 IMPLEMENT_ABSTRACT_CLASS(wxToolTip
, wxObject
)
37 wxToolTip::wxToolTip( const wxString
&tip
)
43 void wxToolTip::SetTip( const wxString
&tip
)
47 m_window
->GTKApplyToolTip(wxGTK_CONV_SYS(m_text
));
50 void wxToolTip::GTKSetWindow(wxWindow
* win
)
54 m_window
->GTKApplyToolTip(wxGTK_CONV_SYS(m_text
));
58 void wxToolTip::GTKApply(GtkWidget
* widget
, const char* tip
)
60 #if GTK_CHECK_VERSION(2, 12, 0)
61 if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL
)
62 gtk_widget_set_tooltip_text(widget
, tip
);
66 #if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
68 gs_tooltips
= gtk_tooltips_new();
70 gtk_tooltips_set_tip(gs_tooltips
, widget
, tip
, NULL
);
75 void wxToolTip::Enable( bool flag
)
77 #if GTK_CHECK_VERSION(2, 12, 0)
78 if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL
)
80 GtkSettings
* settings
= gtk_settings_get_default();
82 gtk_settings_set_long_property(settings
, "gtk-enable-tooltips", flag
, NULL
);
87 #if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
89 gs_tooltips
= gtk_tooltips_new();
92 gtk_tooltips_enable( gs_tooltips
);
94 gtk_tooltips_disable( gs_tooltips
);
99 void wxToolTip::SetDelay( long msecs
)
101 #if GTK_CHECK_VERSION(2, 12, 0)
102 if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL
)
104 GtkSettings
* settings
= gtk_settings_get_default();
106 gtk_settings_set_long_property(settings
, "gtk-tooltip-timeout", msecs
, NULL
);
111 #if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
113 gs_tooltips
= gtk_tooltips_new();
115 gtk_tooltips_set_delay( gs_tooltips
, (int)msecs
);
120 void wxToolTip::SetAutoPop( long WXUNUSED(msecs
) )
124 void wxToolTip::SetReshow( long WXUNUSED(msecs
) )
128 #endif // wxUSE_TOOLTIPS