1
/////////////////////////////////////////////////////////////////////////////
2
// Name: src/gtk/tooltip.cpp
3
// Purpose: wxToolTip implementation
4
// Author: Robert Roebling
5
// Copyright: (c) 1998 Robert Roebling
6
// Licence: wxWindows licence
7
/////////////////////////////////////////////////////////////////////////////
9
// For compilers that support precompilation, includes "wx.h".
10
#include "wx/wxprec.h"
14
#include "wx/tooltip.h"
17
#include "wx/window.h"
20
#include "wx/gtk/private.h"
22
//-----------------------------------------------------------------------------
24
//-----------------------------------------------------------------------------
26
#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
27
static GtkTooltips *gs_tooltips = NULL;
30
//-----------------------------------------------------------------------------
32
//-----------------------------------------------------------------------------
34
IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject)
36
wxToolTip::wxToolTip( const wxString &tip )
42
void wxToolTip::SetTip( const wxString &tip )
46
m_window->GTKApplyToolTip(wxGTK_CONV_SYS(m_text));
49
void wxToolTip::GTKSetWindow(wxWindow* win)
53
m_window->GTKApplyToolTip(wxGTK_CONV_SYS(m_text));
57
void wxToolTip::GTKApply(GtkWidget* widget, const char* tip)
59
#if GTK_CHECK_VERSION(2, 12, 0)
60
if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL)
61
gtk_widget_set_tooltip_text(widget, tip);
65
#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
67
gs_tooltips = gtk_tooltips_new();
69
gtk_tooltips_set_tip(gs_tooltips, widget, tip, NULL);
74
void wxToolTip::Enable( bool flag )
76
#if GTK_CHECK_VERSION(2, 12, 0)
77
if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL)
79
GtkSettings* settings = gtk_settings_get_default();
81
gtk_settings_set_long_property(settings, "gtk-enable-tooltips", flag, NULL);
86
#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
88
gs_tooltips = gtk_tooltips_new();
91
gtk_tooltips_enable( gs_tooltips );
93
gtk_tooltips_disable( gs_tooltips );
98
void wxToolTip::SetDelay( long msecs )
100
#if GTK_CHECK_VERSION(2, 12, 0)
101
if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL)
103
GtkSettings* settings = gtk_settings_get_default();
105
gtk_settings_set_long_property(settings, "gtk-tooltip-timeout", msecs, NULL);
110
#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
112
gs_tooltips = gtk_tooltips_new();
114
gtk_tooltips_set_delay( gs_tooltips, (int)msecs );
119
void wxToolTip::SetAutoPop( long WXUNUSED(msecs) )
123
void wxToolTip::SetReshow( long WXUNUSED(msecs) )
127
#endif // wxUSE_TOOLTIPS