Sha256: 933c91763028a1674b623f12290482889c2a74054f6c6ec2d7f5a55e6ffc6e28

Contents?: true

Size: 1.86 KB

Versions: 15

Compression:

Stored size: 1.86 KB

Contents

/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/************************************************
 
  rbgtktoggleaction.c -
 
  $Author: ggc $
  $Date: 2007/07/13 16:07:32 $
 
  Copyright (C) 2004,2005 Masao Mutoh
************************************************/
 
#include "global.h"

#if GTK_CHECK_VERSION(2,4,0)

#define _SELF(self) (GTK_TOGGLE_ACTION(RVAL2GOBJ(self)))

static VALUE
taction_initialize(self, name, label, tooltip, stock_id)
    VALUE self, name, label, tooltip, stock_id;
{
    const gchar *gstockid = NULL;

    if (TYPE(stock_id) == T_SYMBOL){
        gstockid = rb_id2name(SYM2ID(stock_id));
    } else if (TYPE(stock_id) == T_STRING){
        gstockid = RVAL2CSTR(stock_id);
    }

    G_INITIALIZE(self, gtk_toggle_action_new(RVAL2CSTR(name),
                                             RVAL2CSTR(label),
                                             NIL_P(tooltip) ? NULL : RVAL2CSTR(tooltip),
                                             gstockid));
    return Qnil;
}

static VALUE
taction_toggled(self)
    VALUE self;
{
    gtk_toggle_action_toggled(_SELF(self));
    return self;
}

static VALUE
taction_set_active(self, is_active)
    VALUE self, is_active;
{
    gtk_toggle_action_set_active(_SELF(self), RVAL2CBOOL(is_active));
    return self;
}

static VALUE
taction_get_active(self)
    VALUE self;
{
    return CBOOL2RVAL(gtk_toggle_action_get_active(_SELF(self)));
}
#endif

void 
Init_gtk_toggle_action()
{
#if GTK_CHECK_VERSION(2,4,0)

    VALUE gToggleAction = G_DEF_CLASS(GTK_TYPE_TOGGLE_ACTION, "ToggleAction", mGtk);

    rb_define_method(gToggleAction, "initialize", taction_initialize, 4);
    rb_define_method(gToggleAction, "toggled", taction_toggled, 0);
    rb_define_method(gToggleAction, "set_active", taction_set_active, 1);
    rb_define_method(gToggleAction, "active?", taction_get_active, 0);

    G_DEF_SETTERS(gToggleAction);
#endif
}

Version data entries

15 entries across 15 versions & 1 rubygems

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