]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/gtk1/tooltip.cpp
add Create to wxDocParentFrame
[wxWidgets.git] / src / gtk1 / tooltip.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/gtk1/tooltip.cpp
3// Purpose: wxToolTip implementation
4// Author: Robert Roebling
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10// For compilers that support precompilation, includes "wx.h".
11#include "wx/wxprec.h"
12
13#if wxUSE_TOOLTIPS
14
15#include "wx/tooltip.h"
16
17#ifndef WX_PRECOMP
18 #include "wx/window.h"
19#endif
20
21#include "wx/gtk1/private.h"
22
23//-----------------------------------------------------------------------------
24// global data
25//-----------------------------------------------------------------------------
26
27static GtkTooltips *ss_tooltips = (GtkTooltips*) NULL;
28
29//-----------------------------------------------------------------------------
30// wxToolTip
31//-----------------------------------------------------------------------------
32
33IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject)
34
35wxToolTip::wxToolTip( const wxString &tip )
36{
37 m_text = tip;
38 m_window = (wxWindow*) NULL;
39}
40
41void wxToolTip::SetTip( const wxString &tip )
42{
43 m_text = tip;
44 Apply( m_window );
45}
46
47void wxToolTip::Apply( wxWindow *win )
48{
49 if (!win) return;
50
51 if (!ss_tooltips)
52 {
53 ss_tooltips = gtk_tooltips_new();
54 }
55
56 m_window = win;
57
58 if (m_text.empty())
59 m_window->ApplyToolTip( ss_tooltips, (wxChar*) NULL );
60 else
61 m_window->ApplyToolTip( ss_tooltips, m_text );
62}
63
64void wxToolTip::Enable( bool flag )
65{
66 if (!ss_tooltips) return;
67
68 if (flag)
69 gtk_tooltips_enable( ss_tooltips );
70 else
71 gtk_tooltips_disable( ss_tooltips );
72}
73
74void wxToolTip::SetDelay( long msecs )
75{
76 if (!ss_tooltips)
77 return;
78
79 gtk_tooltips_set_delay( ss_tooltips, (int)msecs );
80}
81
82#endif