Re: tooltip colors w/o theme



Jeff Shipman wrote:
> > Use gtk_widget_set_name() to name your tooltip widget "tooltip_widget",
> > and it'll pick up the colour and font. You can use
> > gtk_rc_add_default_file() to add the rc file for your app (so you don't
> > need to touch ~/.gtkrc).
> 
> I am having trouble doing this. Whenever I use gtk_widget_set_name()
> I get errors that my tooltip widget is not a GtkWidget. Sure enough,
> it's a GtkTooltips. So, then I tried doing casting, but that
> doesn't work. So I tried having my widget be a GtkWidget, but then
> I'm running into problems with gtk_tooltips_new() because it
> returns a GtkTooltips.

Hi Jeff, there's tooltips and tooltip :-) I do something like this:

-- 
void
set_tooltip( GtkWidget *wid, const char *fmt, ... )
{
        va_list ap;
        static GtkTooltips *our_tooltips = NULL;
        char *txt;

        va_start( ap, fmt );
        txt = g_strdup_vprintf( fmt, ap );
        va_end( ap );

        if( !our_tooltips ) {
                our_tooltips = gtk_tooltips_new();
                gtk_tooltips_force_window( our_tooltips );
                set_name( our_tooltips->tip_window, "tooltip_widget" );
        }

        gtk_tooltips_set_tip( our_tooltips, wid, txt, NULL );

        g_free( txt );
}
-- 

So you make one tooltips widget, then use it to set a popup for evry
widget you want a tip to appear above.

HTH, John




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]