Sha256: 115fdb30a5f104da5b207b829e8757e2817893f222c877922e91134ddef7a327

Contents?: true

Size: 1.86 KB

Versions: 12

Compression:

Stored size: 1.86 KB

Contents

/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/************************************************

  rbgtktooltip.c -

  $Author: ktou $
  $Date: 2007/07/10 11:48:30 $

  Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
  Copyright (C) 1998-2000 Yukihiro Matsumoto,
                          Daisuke Kanda,
                          Hiroshi Igarashi
************************************************/

#include "global.h"

#if GTK_CHECK_VERSION(2,12,0)

/* GTK_TOOLTIP type-cast is private because it should be useless */
#define _SELF(self) (RVAL2GOBJ(self))

static VALUE
tooltip_set_markup(VALUE self, VALUE markup)
{
    gtk_tooltip_set_markup(_SELF(self), RVAL2CSTR(markup));
    return self;
}

static VALUE
tooltip_set_text(VALUE self, VALUE text)
{
    gtk_tooltip_set_text(_SELF(self), RVAL2CSTR(text));
    return self;
}

static VALUE
tooltip_set_icon(VALUE self, VALUE icon)
{
    gtk_tooltip_set_icon(_SELF(self), GDK_PIXBUF(RVAL2GOBJ(icon)));
    return self;
}

static VALUE
tooltip_set_icon_from_stock(VALUE self, VALUE stock_id, VALUE size)
{
    gtk_tooltip_set_icon_from_stock(_SELF(self), rb_id2name(SYM2ID(stock_id)), RVAL2GENUM(size, GTK_TYPE_ICON_SIZE));
    return self;
}

static VALUE
tooltip_set_custom(VALUE self, VALUE custom_widget)
{
    gtk_tooltip_set_custom(_SELF(self), GTK_WIDGET(RVAL2GOBJ(custom_widget)));
    return self;
}

#endif

void 
Init_gtk_tooltip()
{
#if GTK_CHECK_VERSION(2,12,0)
    VALUE gTooltip = G_DEF_CLASS(GTK_TYPE_TOOLTIP, "Tooltip", mGtk);
    rb_define_method(gTooltip, "set_markup", tooltip_set_markup, 1);
    rb_define_method(gTooltip, "set_text", tooltip_set_text, 1);
    rb_define_method(gTooltip, "set_icon", tooltip_set_icon, 1);
    rb_define_method(gTooltip, "set_icon_from_stock", tooltip_set_icon_from_stock, 2);
    rb_define_method(gTooltip, "set_custom", tooltip_set_custom, 1);
    G_DEF_SETTERS(gTooltip);
#endif
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
gtk2-1.0.3-x86-mingw32 ext/gtk2/rbgtktooltip.c
gtk2-1.0.3 ext/gtk2/rbgtktooltip.c
gtk2-1.0.2-x86-mingw32 ext/gtk2/rbgtktooltip.c
gtk2-1.0.2 ext/gtk2/rbgtktooltip.c
gtk2-1.0.1 ext/gtk2/rbgtktooltip.c
gtk2-1.0.1-x86-mingw32 ext/gtk2/rbgtktooltip.c
gtk2-1.0.0-x86-mingw32 ext/gtk2/rbgtktooltip.c
gtk2-1.0.0 ext/gtk2/rbgtktooltip.c
gtk2-0.90.9 ext/gtk2/rbgtktooltip.c
gtk2-0.90.9-x86-mingw32 ext/gtk2/rbgtktooltip.c
gtk2-0.90.8-x86-mingw32 ext/gtk2/rbgtktooltip.c
gtk2-0.90.8 ext/gtk2/rbgtktooltip.c