]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/tooltip.cpp
Some compile warnings removed; file selector prototypes put in each filedlg.h;
[wxWidgets.git] / src / gtk / tooltip.cpp
CommitLineData
90b1b133
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: tooltip.cpp
3// Purpose:
4// Author: Robert Roebling
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10#ifdef __GNUG__
11#pragma implementation "tooltip.h"
12#endif
13
14#include "wx/tooltip.h"
15
16#include "gtk/gtk.h"
17#include "gdk/gdk.h"
18
19//-----------------------------------------------------------------------------
20// global data
21//-----------------------------------------------------------------------------
22
23GtkTooltips *gs_tooltips = (GtkTooltips*) NULL;
24GdkColor gs_tooltip_bg;
25GdkColor gs_tooltip_fg;
26
27//-----------------------------------------------------------------------------
28// wxToolTip
29//-----------------------------------------------------------------------------
30
31void wxToolTip::Add( wxWindow *tool, const wxString &tip )
32{
33 if (!gs_tooltips)
34 {
35 gs_tooltips = gtk_tooltips_new();
36
37 gs_tooltip_fg.red = 0;
38 gs_tooltip_fg.green = 0;
39 gs_tooltip_fg.blue = 0;
40 gdk_color_alloc( gtk_widget_get_colormap( tool->GetConnectWidget() ), &gs_tooltip_fg );
41
42 gs_tooltip_bg.red = 65535;
43 gs_tooltip_bg.green = 65535;
44 gs_tooltip_bg.blue = 50000;
45 gdk_color_alloc( gtk_widget_get_colormap( tool->GetConnectWidget() ), &gs_tooltip_bg );
46
47 gtk_tooltips_set_colors( gs_tooltips, &gs_tooltip_bg, &gs_tooltip_fg );
48 }
49
50 gtk_tooltips_set_tip( gs_tooltips, tool->GetConnectWidget(), tip, (gchar*) NULL );
51}
52
53void wxToolTip::Enable( bool flag )
54{
55 if (!gs_tooltips) gs_tooltips = gtk_tooltips_new();
56
57 if (flag)
58 gtk_tooltips_enable( gs_tooltips );
59 else
60 gtk_tooltips_disable( gs_tooltips );
61}
62
63void wxToolTip::SetDelay( long msecs )
64{
65 if (!gs_tooltips) gs_tooltips = gtk_tooltips_new();
66
67 gtk_tooltips_set_delay( gs_tooltips, msecs );
68}
69