]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/gtk1/tooltip.cpp
Loads of updates/fixes. Everything is now zero-based (positions, columns,
[wxWidgets.git] / src / gtk1 / tooltip.cpp
... / ...
CommitLineData
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// wxToolTip
21//-----------------------------------------------------------------------------
22
23wxToolTip::wxToolTip( const wxString &tip )
24{
25 m_text = tip;
26
27 m_tooltips = (GtkTooltips*) NULL;
28
29 m_fg = new GdkColor;
30 m_fg->red = 0;
31 m_fg->green = 0;
32 m_fg->blue = 0;
33
34 m_bg = new GdkColor;
35 m_bg->red = 65535;
36 m_bg->green = 65535;
37 m_bg->blue = 50000;
38}
39
40wxToolTip::~wxToolTip()
41{
42 gtk_object_unref( GTK_OBJECT(m_tooltips) );
43
44 delete m_fg;
45 delete m_bg;
46}
47
48bool wxToolTip::Ok()
49{
50 return (m_tooltips);
51}
52
53void wxToolTip::Create( GtkWidget *tool )
54{
55 if (!m_tooltips)
56 {
57 m_tooltips = gtk_tooltips_new();
58
59 gdk_color_alloc( gtk_widget_get_colormap( tool ), m_fg );
60 gdk_color_alloc( gtk_widget_get_colormap( tool ), m_bg );
61
62 gtk_tooltips_set_colors( m_tooltips, m_bg, m_fg );
63 }
64
65 gtk_tooltips_set_tip( m_tooltips, tool, m_text, (gchar*) NULL );
66}
67
68void wxToolTip::Enable( bool flag )
69{
70 if (!Ok()) return;
71
72 if (flag)
73 gtk_tooltips_enable( m_tooltips );
74 else
75 gtk_tooltips_disable( m_tooltips );
76}
77
78void wxToolTip::SetDelay( long msecs )
79{
80 if (!Ok()) return;
81
82 gtk_tooltips_set_delay( m_tooltips, msecs );
83}
84