Added wxToolTip

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1472 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-01-25 13:57:06 +00:00
parent d2f621342b
commit 90b1b133da
7 changed files with 248 additions and 0 deletions

69
src/gtk1/tooltip.cpp Normal file
View File

@@ -0,0 +1,69 @@
/////////////////////////////////////////////////////////////////////////////
// Name: tooltip.cpp
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "tooltip.h"
#endif
#include "wx/tooltip.h"
#include "gtk/gtk.h"
#include "gdk/gdk.h"
//-----------------------------------------------------------------------------
// global data
//-----------------------------------------------------------------------------
GtkTooltips *gs_tooltips = (GtkTooltips*) NULL;
GdkColor gs_tooltip_bg;
GdkColor gs_tooltip_fg;
//-----------------------------------------------------------------------------
// wxToolTip
//-----------------------------------------------------------------------------
void wxToolTip::Add( wxWindow *tool, const wxString &tip )
{
if (!gs_tooltips)
{
gs_tooltips = gtk_tooltips_new();
gs_tooltip_fg.red = 0;
gs_tooltip_fg.green = 0;
gs_tooltip_fg.blue = 0;
gdk_color_alloc( gtk_widget_get_colormap( tool->GetConnectWidget() ), &gs_tooltip_fg );
gs_tooltip_bg.red = 65535;
gs_tooltip_bg.green = 65535;
gs_tooltip_bg.blue = 50000;
gdk_color_alloc( gtk_widget_get_colormap( tool->GetConnectWidget() ), &gs_tooltip_bg );
gtk_tooltips_set_colors( gs_tooltips, &gs_tooltip_bg, &gs_tooltip_fg );
}
gtk_tooltips_set_tip( gs_tooltips, tool->GetConnectWidget(), tip, (gchar*) NULL );
}
void wxToolTip::Enable( bool flag )
{
if (!gs_tooltips) gs_tooltips = gtk_tooltips_new();
if (flag)
gtk_tooltips_enable( gs_tooltips );
else
gtk_tooltips_disable( gs_tooltips );
}
void wxToolTip::SetDelay( long msecs )
{
if (!gs_tooltips) gs_tooltips = gtk_tooltips_new();
gtk_tooltips_set_delay( gs_tooltips, msecs );
}