]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/tooltip.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxToolTip implementation
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation "tooltip.h"
14 #include "wx/window.h"
15 #include "wx/tooltip.h"
20 //-----------------------------------------------------------------------------
22 //-----------------------------------------------------------------------------
24 static GtkTooltips
*ss_tooltips
= (GtkTooltips
*) NULL
;
25 static GdkColor ss_bg
;
26 static GdkColor ss_fg
;
28 //-----------------------------------------------------------------------------
30 //-----------------------------------------------------------------------------
32 wxToolTip::wxToolTip( const wxString
&tip
)
35 m_window
= (wxWindow
*) NULL
;
38 void wxToolTip::SetTip( const wxString
&tip
)
44 void wxToolTip::Apply( wxWindow
*win
)
50 ss_tooltips
= gtk_tooltips_new();
55 gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_fg
);
60 gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_bg
);
62 gtk_tooltips_set_colors( ss_tooltips
, &ss_bg
, &ss_fg
);
68 m_window
->ApplyToolTip( ss_tooltips
, (char*) NULL
);
70 m_window
->ApplyToolTip( ss_tooltips
, m_text
);
73 void wxToolTip::Enable( bool flag
)
75 if (!ss_tooltips
) return;
78 gtk_tooltips_enable( ss_tooltips
);
80 gtk_tooltips_disable( ss_tooltips
);
83 void wxToolTip::SetDelay( long msecs
)
85 if (!ss_tooltips
) return;
87 gtk_tooltips_set_delay( ss_tooltips
, msecs
);