]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/tooltip.cpp
d6577bfb93608eab330d30726d21259a8c80511b
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"
18 #include "wx/window.h"
19 #include "wx/tooltip.h"
21 #include "wx/gtk/private.h"
23 extern GdkFont
*GtkGetDefaultGuiFont();
25 //-----------------------------------------------------------------------------
27 //-----------------------------------------------------------------------------
29 static GtkTooltips
*ss_tooltips
= (GtkTooltips
*) NULL
;
30 static GdkColor ss_bg
;
31 static GdkColor ss_fg
;
33 //-----------------------------------------------------------------------------
35 //-----------------------------------------------------------------------------
37 IMPLEMENT_ABSTRACT_CLASS(wxToolTip
, wxObject
)
39 wxToolTip::wxToolTip( const wxString
&tip
)
42 m_window
= (wxWindow
*) NULL
;
45 void wxToolTip::SetTip( const wxString
&tip
)
51 void wxToolTip::Apply( wxWindow
*win
)
57 ss_tooltips
= gtk_tooltips_new();
62 gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_fg
);
67 gdk_color_alloc( gtk_widget_get_default_colormap(), &ss_bg
);
69 #if GTK_CHECK_VERSION(1, 2, 0)
70 gtk_tooltips_force_window( ss_tooltips
);
74 gtk_widget_get_style( ss_tooltips
->tip_window
) );
76 g_style
->fg
[GTK_STATE_NORMAL
] = ss_fg
;
77 g_style
->bg
[GTK_STATE_NORMAL
] = ss_bg
;
79 SET_STYLE_FONT( g_style
, GtkGetDefaultGuiFont() );
81 gtk_widget_set_style( ss_tooltips
->tip_window
, g_style
);
83 gtk_tooltips_set_colors( ss_tooltips
, &ss_bg
, &ss_fg
);
90 m_window
->ApplyToolTip( ss_tooltips
, (wxChar
*) NULL
);
92 m_window
->ApplyToolTip( ss_tooltips
, m_text
);
95 void wxToolTip::Enable( bool flag
)
97 if (!ss_tooltips
) return;
100 gtk_tooltips_enable( ss_tooltips
);
102 gtk_tooltips_disable( ss_tooltips
);
105 void wxToolTip::SetDelay( long msecs
)
110 gtk_tooltips_set_delay( ss_tooltips
, (int)msecs
);