Sha256: 14f984dd77f36393b99fff61cb0426e9253980da87914d168eabe6ffdc55ed99

Contents?: true

Size: 1.78 KB

Versions: 6

Compression:

Stored size: 1.78 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)));
}

/* Defined as Properties:
const gchar *       gtk_text_mark_get_name              (GtkTextMark *mark);
*/

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)));
}

/* Defined as Properties:
gboolean            gtk_text_mark_get_left_gravity      (GtkTextMark *mark);
*/

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);
    G_DEF_SETTER(gTextMark, "visible");
    rb_define_method(gTextMark, "visible?", get_visible, 0);
    rb_define_method(gTextMark, "deleted?", get_deleted, 0);
    rb_define_method(gTextMark, "buffer", get_buffer, 0);
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gtk2-1.0.3-x86-mingw32 ext/gtk2/rbgtktextmark.c
gtk2-1.0.3 ext/gtk2/rbgtktextmark.c
gtk2-1.0.2-x86-mingw32 ext/gtk2/rbgtktextmark.c
gtk2-1.0.2 ext/gtk2/rbgtktextmark.c
gtk2-1.0.1 ext/gtk2/rbgtktextmark.c
gtk2-1.0.1-x86-mingw32 ext/gtk2/rbgtktextmark.c