Sha256: e73ac5dd2193898db34c180a7e6208893d8267ae5158ba7481d0e724aa542b5b

Contents?: true

Size: 1.66 KB

Versions: 12

Compression:

Stored size: 1.66 KB

Contents

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

  rbatkhypertext.c -

  $Author: mutoh $
  $Date: 2004/03/05 15:33:47 $

  Copyright (C) 2004 Masao Mutoh
************************************************/
#include "rbatk.h"

#define _SELF(s) (ATK_IMAGE(RVAL2GOBJ(s)))

static VALUE
rbatkimage_get_image_position(VALUE self, VALUE coord_type)
{
    gint x, y;
    atk_image_get_image_position(_SELF(self), &x, &y, 
                                 RVAL2GENUM(coord_type, ATK_TYPE_COORD_TYPE));
    return rb_assoc_new(INT2NUM(x), INT2NUM(y));
}

static VALUE
rbatkimage_get_image_description(VALUE self)
{
    return CSTR2RVAL(atk_image_get_image_description(_SELF(self)));
}

static VALUE
rbatkimage_set_image_description(VALUE self, VALUE description)
{
    gboolean ret = atk_image_set_image_description(_SELF(self),
                                                   RVAL2CSTR(description));
    if (! ret) rb_raise(rb_eRuntimeError, "Can't set image description");
    return self;
}

static VALUE
rbatkimage_get_image_size(VALUE self)
{
    gint width, height;
    atk_image_get_image_size(_SELF(self), &width, &height);
    return rb_assoc_new(INT2NUM(width), INT2NUM(height));
}

void
Init_atk_image()
{
    VALUE image = G_DEF_INTERFACE(ATK_TYPE_IMAGE, "Image", mAtk);

    rb_define_method(image, "image_position", rbatkimage_get_image_position, 1);
    rb_define_method(image, "image_description", rbatkimage_get_image_description, 0);
    rb_define_method(image, "set_image_description", rbatkimage_set_image_description, 1);
    rb_define_method(image, "image_size", rbatkimage_get_image_size, 0);

    G_DEF_SETTERS(image);
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
atk-1.0.3-x86-mingw32 ext/atk/rbatkimage.c
atk-1.0.3 ext/atk/rbatkimage.c
atk-1.0.2-x86-mingw32 ext/atk/rbatkimage.c
atk-1.0.2 ext/atk/rbatkimage.c
atk-1.0.1 ext/atk/rbatkimage.c
atk-1.0.1-x86-mingw32 ext/atk/rbatkimage.c
atk-1.0.0-x86-mingw32 ext/atk/rbatkimage.c
atk-1.0.0 ext/atk/rbatkimage.c
atk-0.90.9 ext/atk/rbatkimage.c
atk-0.90.9-x86-mingw32 ext/atk/rbatkimage.c
atk-0.90.8-x86-mingw32 ext/atk/rbatkimage.c
atk-0.90.8 ext/atk/rbatkimage.c