static VALUE rg_m_current_event_state(G_GNUC_UNUSED VALUE self) { GdkModifierType state; gboolean ret = gtk_get_current_event_state(&state); return ret ? GFLAGS2RVAL(state, GDK_TYPE_MODIFIER_TYPE) : Qnil; }
static VALUE gdkwin_get_decorations(VALUE self) { GdkWMDecoration decorations; gboolean ret = gdk_window_get_decorations(_SELF(self), &decorations); return ret ? GFLAGS2RVAL(decorations, GDK_TYPE_WM_DECORATION) : Qnil; }
/* * Method: data * * Gets the internal data stored in the entry. The data depends of the type * of the entry: * * Gst::IndexEntry::ID: the description of the ID, as a String. * * Gst::IndexEntry::ASSOCIATION: an Array that contains the number of associations, a Gst::Format, the value of the format and the association flags (see Gst::Index::AssocFlags). * * Gst::IndexEntry::FORMAT: an Array that contains a Gst::Format and its value. * * Gst::IndexEntry::OBJECt: not yet implemented. * * Returns: the internal data of the entry. */ static VALUE rg_data (VALUE self) { GstIndexEntry *entry; VALUE data; entry = RGST_INDEX_ENTRY (self); switch (entry->type) { case GST_INDEX_ENTRY_ID: data = CSTR2RVAL (entry->data.id.description); break; case GST_INDEX_ENTRY_ASSOCIATION: data = rb_ary_new (); rb_ary_push (data, INT2FIX (entry->data.assoc.nassocs)); rb_ary_push (data, RGST_FORMAT_NEW (entry->data.assoc.assocs->format)); rb_ary_push (data, ULL2NUM (entry->data.assoc.assocs->value)); rb_ary_push (data, GFLAGS2RVAL (entry->data.assoc.flags, GST_TYPE_ASSOC_FLAGS)); break; case GST_INDEX_ENTRY_FORMAT: data = rb_ary_new (); rb_ary_push (data, RGST_FORMAT_NEW (entry->data.format.format)); rb_ary_push (data, CSTR2RVAL (entry->data.format.key)); break; case GST_INDEX_ENTRY_OBJECT: /* TODO */ default: data = Qnil; } return data; }
static VALUE gdkwin_get_pointer(VALUE self) { gint x, y; GdkModifierType state; GdkWindow* ret = gdk_window_get_pointer(_SELF(self), &x, &y, &state); return rb_ary_new3(4, GOBJ2RVAL(ret), INT2NUM(x), INT2NUM(y), GFLAGS2RVAL(state, GDK_TYPE_MODIFIER_TYPE)); }
/* Should return true/false */ static gboolean filter_func(const GtkFileFilterInfo *info, gpointer func) { return CBOOL2RVAL(rb_funcall((VALUE)func, 5, GFLAGS2RVAL(info->contains, GTK_TYPE_FILE_FILTER_FLAGS), CSTR2RVAL(info->filename), CSTR2RVAL(info->uri), CSTR2RVAL(info->display_name), CSTR2RVAL(info->mime_type))); }
static VALUE seek_parse(VALUE self) { gdouble rate; GstFormat format; GstSeekFlags flags; GstSeekType start_type, stop_type; gint64 start, stop; gst_event_parse_seek(RGST_EVENT(self), &rate, &format, &flags, &start_type, &start, &stop_type, &stop); return rb_ary_new3(6, DBL2NUM(rate), GST_FORMAT2RVAL(format), GFLAGS2RVAL(start_type, GST_TYPE_SEEK_FLAGS), LL2NUM(start), GFLAGS2RVAL(stop_type, GST_TYPE_SEEK_FLAGS), LL2NUM(stop)); }
static VALUE device_get_state(VALUE self, VALUE window) { gdouble axes[2]; GdkModifierType mask; gdk_device_get_state(_SELF(self), GDK_WINDOW(RVAL2GOBJ(window)), axes, &mask); return rb_ary_new3(3, rb_float_new(axes[0]), rb_float_new(axes[1]), GFLAGS2RVAL(mask, GDK_TYPE_MODIFIER_TYPE)); }
static VALUE device_keys(VALUE self) { gint i; VALUE ary = rb_ary_new(); GdkDeviceKey* keys = _SELF(self)->keys; for (i = 0; i < _SELF(self)->num_keys; i++){ rb_ary_push(ary, rb_ary_new3(2, UINT2NUM(keys[i].keyval), GFLAGS2RVAL(keys[i].modifiers, GDK_TYPE_MODIFIER_TYPE))); } return ary; }
static VALUE rg_display_options(int argc, VALUE *argv, VALUE self) { VALUE flags; rb_scan_args(argc, argv, "01", &flags); if NIL_P(flags){ #if GTK_CHECK_VERSION(2,4,0) return GFLAGS2RVAL(gtk_calendar_get_display_options(_SELF(self)), GTK_TYPE_CALENDAR_DISPLAY_OPTIONS); #else rb_warn("Gtk::Calendar#display_options has supported since GTK+-2.4."); #endif } else {
static VALUE rg_display_options(int argc, VALUE *argv, VALUE self) { VALUE flags; rb_scan_args(argc, argv, "01", &flags); if (NIL_P(flags)){ return GFLAGS2RVAL(gtk_calendar_get_display_options(_SELF(self)), GTK_TYPE_CALENDAR_DISPLAY_OPTIONS); } else { /* This is for backward compatibility. */ rb_warning("Gtk::Calendar#display_options(flags) has been deprecated. Use Gtk::Calendar#set_display_options(flags)."); gtk_calendar_display_options(_SELF(self), RVAL2GFLAGS(flags, GTK_TYPE_CALENDAR_DISPLAY_OPTIONS)); } return self; }
static VALUE rg_translate_keyboard_state(VALUE self, VALUE hardware_keycode, VALUE state, VALUE group) { guint keyval; gint effective_group, level; GdkModifierType consumed_modifiers; gboolean ret; ret = gdk_keymap_translate_keyboard_state(_SELF(self), NUM2UINT(hardware_keycode), RVAL2GFLAGS(state, GDK_TYPE_MODIFIER_TYPE), NUM2INT(group), &keyval, &effective_group, &level, &consumed_modifiers); return ret ? rb_ary_new3(4, UINT2NUM(keyval), INT2NUM(effective_group), INT2NUM(level), GFLAGS2RVAL(consumed_modifiers, GDK_TYPE_MODIFIER_TYPE)) : Qnil; }
static void exec_input(gpointer data, G_GNUC_UNUSED gint source, GdkInputCondition condition) { rb_funcall((VALUE)data, id_call, 1, GFLAGS2RVAL(condition, GDK_TYPE_INPUT_CONDITION)); }
static VALUE rg_flags(VALUE self) { return GFLAGS2RVAL(GTK_WIDGET_FLAGS(_SELF(self)), GTK_TYPE_WIDGET_FLAGS); }
/* * Class method: get_flag(tag) * tag: the name of the tag. * * Gets the flag of the given tag. * * Returns: the flag of this tag (see Gst::Tag::Flag). */ static VALUE rb_gst_tag_get_flag (VALUE self, VALUE tag) { return GFLAGS2RVAL (gst_tag_get_flag (RVAL2CSTR (tag)), GST_TYPE_TAG_FLAG); }
static VALUE gdkwin_get_events(VALUE self) { return GFLAGS2RVAL(gdk_window_get_events(_SELF(self)), GDK_TYPE_EVENT_MASK); }
static VALUE accel_key_get_mods(VALUE self) { return GFLAGS2RVAL(_SELF(self)->accel_mods, GDK_TYPE_MODIFIER_TYPE); }
static VALUE rg_needed(VALUE self) { return GFLAGS2RVAL(gtk_recent_filter_get_needed(_SELF(self)), GTK_TYPE_RECENT_FILTER_FLAGS); }
static VALUE rg_flags(VALUE self) { return GFLAGS2RVAL(gtk_tree_model_get_flags(_SELF(self)), GTK_TYPE_TREE_MODEL_FLAGS); }
static VALUE ffil_get_needed(VALUE self) { return GFLAGS2RVAL(gtk_file_filter_get_needed(_SELF(self)), GTK_TYPE_FILE_FILTER_FLAGS); }
/* * Class method: get_flag(tag) * tag: the name of the tag. * * Gets the flag of the given tag. * * Returns: the flag of this tag (see Gst::Tag::Flag). */ static VALUE rg_s_get_flag (G_GNUC_UNUSED VALUE self, VALUE tag) { return GFLAGS2RVAL (gst_tag_get_flag (RVAL2CSTR (tag)), GST_TYPE_TAG_FLAG); }
static VALUE interface_to_ruby(GIArgument *argument, GITypeInfo *type_info) { VALUE rb_interface; GIBaseInfo *interface_info; GIInfoType interface_type; GType gtype; interface_info = g_type_info_get_interface(type_info); interface_type = g_base_info_get_type(interface_info); gtype = g_registered_type_info_get_g_type(interface_info); switch (interface_type) { case GI_INFO_TYPE_INVALID: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[invalid] -> Ruby"); break; case GI_INFO_TYPE_FUNCTION: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[function] -> Ruby"); break; case GI_INFO_TYPE_CALLBACK: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[callback] -> Ruby"); break; case GI_INFO_TYPE_STRUCT: rb_interface = BOXED2RVAL(argument->v_pointer, gtype); break; case GI_INFO_TYPE_BOXED: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[boxed] -> Ruby"); break; case GI_INFO_TYPE_ENUM: if (gtype == G_TYPE_NONE) { rb_interface = INT2NUM(argument->v_int32); } else { rb_interface = GENUM2RVAL(argument->v_int32, gtype); } break; case GI_INFO_TYPE_FLAGS: if (gtype == G_TYPE_NONE) { rb_interface = INT2NUM(argument->v_int32); } else { rb_interface = GFLAGS2RVAL(argument->v_int32, gtype); } break; case GI_INFO_TYPE_OBJECT: rb_interface = GOBJ2RVAL(argument->v_pointer); break; case GI_INFO_TYPE_INTERFACE: rb_interface = GOBJ2RVAL(argument->v_pointer); break; case GI_INFO_TYPE_CONSTANT: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[constant] -> Ruby"); break; case GI_INFO_TYPE_INVALID_0: g_assert_not_reached(); break; case GI_INFO_TYPE_UNION: rb_interface = BOXED2RVAL(argument->v_pointer, gtype); break; case GI_INFO_TYPE_VALUE: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[value] -> Ruby"); break; case GI_INFO_TYPE_SIGNAL: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[signal] -> Ruby"); break; case GI_INFO_TYPE_VFUNC: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[vfunc] -> Ruby"); break; case GI_INFO_TYPE_PROPERTY: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[property] -> Ruby"); break; case GI_INFO_TYPE_FIELD: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[field] -> Ruby"); break; case GI_INFO_TYPE_ARG: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[arg] -> Ruby"); break; case GI_INFO_TYPE_TYPE: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[type] -> Ruby"); break; case GI_INFO_TYPE_UNRESOLVED: rb_raise(rb_eNotImpError, "TODO: GIArgument(interface)[unresolved] -> Ruby"); break; default: g_assert_not_reached(); break; } g_base_info_unref(interface_info); return rb_interface; }
static VALUE rg_action(VALUE self) { return GFLAGS2RVAL(_SELF(self)->action, GDK_TYPE_DRAG_ACTION); }