Sha256: a5fb7947bb0c699648ac8b458bc3c30fde33d1ea857a4e803f49fdde27ce66a2

Contents?: true

Size: 1.89 KB

Versions: 6

Compression:

Stored size: 1.89 KB

Contents

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

  rbgtktextmark.c -

  $Author: ggc $
  $Date: 2007/07/13 16:30:53 $

  Copyright (C) 2002,2003 Masahiro Sakai
************************************************/

#include "global.h"

#define _SELF(s) (GTK_TEXT_MARK(RVAL2GOBJ(s)))

#if GTK_CHECK_VERSION(2,12,0)
static VALUE
initialize(VALUE self, VALUE name, VALUE left_gravity)
{
    if (NIL_P(name))
        G_INITIALIZE(self, gtk_text_mark_new(NULL, RVAL2CBOOL(left_gravity)));
    else
        G_INITIALIZE(self, gtk_text_mark_new(RVAL2CSTR(name), RVAL2CBOOL(left_gravity)));
    return Qnil;
}
#endif

static VALUE
set_visible(VALUE self, VALUE setting)
{
    gtk_text_mark_set_visible(_SELF(self), RVAL2CBOOL(setting));
    return setting;
}

static VALUE
get_visible(VALUE self)
{
    return CBOOL2RVAL(gtk_text_mark_get_visible(_SELF(self)));
}

static VALUE
get_name(VALUE self)
{
    return CSTR2RVAL(gtk_text_mark_get_name(_SELF(self)));
}

static VALUE
get_deleted(VALUE self)
{
    return CBOOL2RVAL(gtk_text_mark_get_deleted(_SELF(self)));
}

static VALUE
get_buffer(VALUE self)
{
    return GOBJ2RVAL(gtk_text_mark_get_buffer(_SELF(self)));
}

static VALUE
get_left_gravity(VALUE self)
{
    return CBOOL2RVAL(gtk_text_mark_get_left_gravity(_SELF(self)));
}

void 
Init_gtk_textmark()
{
    VALUE gTextMark = G_DEF_CLASS(GTK_TYPE_TEXT_MARK, "TextMark", mGtk);
#if GTK_CHECK_VERSION(2,12,0)
    rb_define_method(gTextMark, "initialize", initialize, 2);
#endif
    rb_define_method(gTextMark, "set_visible", set_visible, 1);
    rb_define_method(gTextMark, "visible?", get_visible, 0);
    rb_define_method(gTextMark, "name", get_name, 0);
    rb_define_method(gTextMark, "deleted?", get_deleted, 0);
    rb_define_method(gTextMark, "buffer", get_buffer, 0);
    rb_define_method(gTextMark, "left_gravity?", get_left_gravity, 0);

    G_DEF_SETTERS(gTextMark);
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gtk2-1.0.0-x86-mingw32 ext/gtk2/rbgtktextmark.c
gtk2-1.0.0 ext/gtk2/rbgtktextmark.c
gtk2-0.90.9 ext/gtk2/rbgtktextmark.c
gtk2-0.90.9-x86-mingw32 ext/gtk2/rbgtktextmark.c
gtk2-0.90.8-x86-mingw32 ext/gtk2/rbgtktextmark.c
gtk2-0.90.8 ext/gtk2/rbgtktextmark.c