Sha256: 0796238049271458efef6fbb1864235e76d9ee96d66c194499c2b2509b2f814e

Contents?: true

Size: 1.55 KB

Versions: 12

Compression:

Stored size: 1.55 KB

Contents

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

  rbatkvalue.c -

  $Author: mutoh $
  $Date: 2003/12/23 15:59:28 $

  Copyright (C) 2003 Masao Mutoh
************************************************/

#include "rbatk.h"

#define _SELF(s) (ATK_VALUE(RVAL2GOBJ(s)))

static VALUE
rbatk_value_get_current_value(VALUE self)
{
    GValue gval = {0,};
    atk_value_get_current_value(_SELF(self), &gval);

    return GVAL2RVAL(&gval);
}


static VALUE
rbatk_value_get_maximum_value(VALUE self)
{
    GValue gval = {0,};
    atk_value_get_maximum_value(_SELF(self), &gval);

    return GVAL2RVAL(&gval);
}

static VALUE
rbatk_value_get_minimum_value(VALUE self)
{
    GValue gval = {0,};
    atk_value_get_minimum_value(_SELF(self), &gval);

    return GVAL2RVAL(&gval);
}

static VALUE
rbatk_value_set_current_value(VALUE self, VALUE value)
{
    GValue gval = {0,};
    g_value_init(&gval, RVAL2GTYPE(value));

    rbgobj_rvalue_to_gvalue(value, &gval);

    if (! atk_value_set_current_value(_SELF(self), &gval)){
        rb_raise(rb_eRuntimeError, "Can't set the current value.");
    }

    return self;
}

void
Init_atk_value()
{
    VALUE mValue = G_DEF_INTERFACE(ATK_TYPE_VALUE, "Value", mAtk);

    rb_define_method(mValue, "current", rbatk_value_get_current_value, 0);
    rb_define_method(mValue, "max", rbatk_value_get_maximum_value, 0);
    rb_define_method(mValue, "min", rbatk_value_get_minimum_value, 0);
    rb_define_method(mValue, "set_current", rbatk_value_set_current_value, 1);

    G_DEF_SETTERS(mValue);
}

Version data entries

12 entries across 12 versions & 1 rubygems

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