Sha256: 271cd27a1dc7f009de398f868b63b723f6730989b9c3085f65a6983aca4a0dfe

Contents?: true

Size: 1.92 KB

Versions: 15

Compression:

Stored size: 1.92 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(self, markup)
    VALUE self, markup;
{
    gtk_tooltip_set_markup(_SELF(self), RVAL2CSTR(markup));
    return self;
}

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

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

static VALUE
tooltip_set_icon_from_stock(self, stock_id, size)
    VALUE self, stock_id, 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(self, custom_widget)
    VALUE self, 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

15 entries across 15 versions & 1 rubygems

Version Path
gtk2-0.90.7-x86-mingw32 ext/gtk2/rbgtktooltip.c
gtk2-0.90.7 ext/gtk2/rbgtktooltip.c
gtk2-0.90.6 ext/gtk2/rbgtktooltip.c
gtk2-0.90.6-x86-mingw32 ext/gtk2/rbgtktooltip.c
gtk2-0.90.5 ext/gtk2/rbgtktooltip.c
gtk2-0.90.5-x86-mingw32 ext/gtk2/rbgtktooltip.c
gtk2-0.90.4 ext/gtk2/rbgtktooltip.c
gtk2-0.90.4-x86-mingw32 ext/gtk2/rbgtktooltip.c
gtk2-0.90.3 ext/gtk2/rbgtktooltip.c
gtk2-0.90.3-x86-mingw32 ext/gtk2/rbgtktooltip.c
gtk2-0.90.2 ext/gtk2/rbgtktooltip.c
gtk2-0.90.2-x86-mingw32 ext/gtk2/rbgtktooltip.c
gtk2-0.20.1 src/rbgtktooltip.c
gtk2-0.20.0.1 src/rbgtktooltip.c
gtk2-0.20.0 src/rbgtktooltip.c