]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/tooltip.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxToolTip implementation
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
11 #pragma implementation "tooltip.h"
14 // For compilers that support precompilation, includes "wx.h".
15 #include "wx/wxprec.h"
21 #include "wx/window.h"
22 #include "wx/tooltip.h"
24 #include "wx/gtk/private.h"
26 extern GdkFont
*GtkGetDefaultGuiFont();
28 //-----------------------------------------------------------------------------
30 //-----------------------------------------------------------------------------
32 static GtkTooltips
*ss_tooltips
= (GtkTooltips
*) NULL
;
33 static GdkColor ss_bg
;
34 static GdkColor ss_fg
;
36 //-----------------------------------------------------------------------------
38 //-----------------------------------------------------------------------------
40 IMPLEMENT_ABSTRACT_CLASS(wxToolTip
, wxObject
)
42 wxToolTip::wxToolTip( const wxString
&tip
)
45 m_window
= (wxWindow
*) NULL
;
48 void wxToolTip::SetTip( const wxString
&tip
)
54 void wxToolTip::Apply( wxWindow
*win
)
60 ss_tooltips
= gtk_tooltips_new();
65 gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_fg
);
70 gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_bg
);
72 gtk_tooltips_force_window( ss_tooltips
);
76 gtk_widget_get_style( ss_tooltips
->tip_window
) );
78 g_style
->fg
[GTK_STATE_NORMAL
] = ss_fg
;
79 g_style
->bg
[GTK_STATE_NORMAL
] = ss_bg
;
81 gtk_widget_set_style( ss_tooltips
->tip_window
, g_style
);
87 m_window
->ApplyToolTip( ss_tooltips
, (wxChar
*) NULL
);
89 m_window
->ApplyToolTip( ss_tooltips
, m_text
);
92 void wxToolTip::Enable( bool flag
)
94 if (!ss_tooltips
) return;
97 gtk_tooltips_enable( ss_tooltips
);
99 gtk_tooltips_disable( ss_tooltips
);
102 void wxToolTip::SetDelay( long msecs
)
107 gtk_tooltips_set_delay( ss_tooltips
, (int)msecs
);