Пример #1
0
void
Init_vte_terminal(VALUE mVte)
{
    VALUE RG_TARGET_NAMESPACE;

    id_new = rb_intern("new");
    id_call = rb_intern("call");

    RG_TARGET_NAMESPACE = G_DEF_CLASS(VTE_TYPE_TERMINAL, "Terminal", mVte);

    G_DEF_CLASS(VTE_TYPE_TERMINAL_ERASE_BINDING, "EraseBinding", RG_TARGET_NAMESPACE);
    G_DEF_CLASS(VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE, "CursorBlinkMode", RG_TARGET_NAMESPACE);
    G_DEF_CLASS(VTE_TYPE_TERMINAL_CURSOR_SHAPE, "CursorShape", RG_TARGET_NAMESPACE);
    G_DEF_CLASS(VTE_TYPE_TERMINAL_WRITE_FLAGS, "WriteFlags", RG_TARGET_NAMESPACE);

    RG_DEF_METHOD(initialize, 0);

    RG_DEF_METHOD(fork_command, -1);

    RG_DEF_METHOD(feed, 1);
    RG_DEF_METHOD(feed_child, 1);
    RG_DEF_METHOD(feed_child_binary, 1);

    RG_DEF_METHOD(copy_clipboard, 0);
    RG_DEF_METHOD(paste_clipboard, 0);
    RG_DEF_METHOD(copy_primary, 0);
    RG_DEF_METHOD(paste_primary, 0);

    RG_DEF_METHOD(set_size, 2);

    RG_DEF_METHOD(set_audible_bell, 1);
    RG_DEF_METHOD_P(audible_bell, 0);
    RG_DEF_METHOD(set_visible_bell, 1);
    RG_DEF_METHOD_P(visible_bell, 0);

    RG_DEF_METHOD(set_scroll_background, 1);
    RG_DEF_METHOD(set_scroll_on_output, 1);
    RG_DEF_METHOD(set_scroll_on_keystroke, 1);

    RG_DEF_METHOD(set_color_dim, 1);
    RG_DEF_METHOD(set_color_bold, 1);
    RG_DEF_METHOD(set_color_foreground, 1);
    RG_DEF_METHOD(set_color_background, 1);
    RG_DEF_METHOD(set_color_cursor, 1);
    RG_DEF_METHOD(set_color_highlight, 1);
    RG_DEF_METHOD(set_colors, 3);
    RG_DEF_METHOD(set_default_colors, 0);
    RG_DEF_METHOD(set_background_image, 1);
    RG_DEF_METHOD(set_background_tint_color, 1);
    RG_DEF_METHOD(set_background_saturation, 1);
    RG_DEF_METHOD(set_background_transparent, 1);
    RG_DEF_METHOD(set_cursor_blinks, 1);
    RG_DEF_METHOD(set_cursor_blink_mode, 1);
    RG_DEF_METHOD(cursor_blink_mode, 0);
    RG_DEF_METHOD(set_cursor_shape, 1);
    RG_DEF_METHOD(cursor_shape, 0);
    RG_DEF_METHOD(child_exit_status, 0);
    RG_DEF_METHOD(set_scrollback_lines, 1);

    RG_DEF_METHOD(im_append_menuitems, 1);

    RG_DEF_METHOD(set_font, 1);
    RG_DEF_METHOD(font, 0);
    RG_DEF_METHOD(set_allow_bold, 1);
    RG_DEF_METHOD_P(allow_bold, 0);
    RG_DEF_METHOD_P(has_selection, 0);
    RG_DEF_ALIAS("have_selection?", "has_selection?");
    RG_DEF_METHOD(set_word_chars, 1);
    RG_DEF_METHOD_P(word_char, 1);
    RG_DEF_METHOD(set_backspace_binding, 1);
    RG_DEF_METHOD(set_delete_binding, 1);
    RG_DEF_METHOD_P(mouse_autohide, 0);
    RG_DEF_METHOD(set_mouse_autohide, 1);

    RG_DEF_METHOD(reset, 2);

    RG_DEF_METHOD(get_text, -1);
    RG_DEF_METHOD(get_text_range, -1);

    RG_DEF_METHOD(cursor_position, 0);

    RG_DEF_METHOD(match_clear_all, 0);
    RG_DEF_METHOD(match_add, 1);
    RG_DEF_METHOD(match_set_cursor, 2);
    RG_DEF_METHOD(match_remove, 1);
    RG_DEF_METHOD(match_check, 2);
    RG_DEF_METHOD(default_emulation, 0);
    RG_DEF_METHOD(status_line, 0);
    RG_DEF_METHOD(adjustment, 0);
    RG_DEF_METHOD(char_width, 0);
    RG_DEF_METHOD(char_height, 0);
    RG_DEF_METHOD(row_count, 0);
    RG_DEF_METHOD(column_count, 0);
    RG_DEF_METHOD(window_title, 0);
    RG_DEF_METHOD(icon_title, 0);
    RG_DEF_METHOD(pty_new, 1);
    RG_DEF_METHOD(search_find_next, 0);
    RG_DEF_METHOD(search_find_previous, 0);
    RG_DEF_METHOD_P(search_get_wrap_around, 0);
    RG_DEF_METHOD(search_set_wrap_around, 1);
    RG_DEF_ALIAS("search_wrap_around=", "search_set_wrap_around");
    RG_DEF_METHOD(select_all, 0);
    RG_DEF_METHOD(select_none, 0);
    RG_DEF_METHOD(set_opacity, 1);
    RG_DEF_METHOD(watch_child, 1);
    RG_DEF_METHOD(write_contents, -1);
}
Пример #2
0
void
Init_glib_io_channel(void)
{
    VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_IO_CHANNEL, "IOChannel", mGLib); 

    rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable);

    id_call = rb_intern("call");
    id_puts = rb_intern("puts");
    id_unpack = rb_intern("unpack");

    default_rs = rb_str_new_cstr("\n");
#ifdef HAVE_RB_GC_REGISTER_MARK_OBJECT
    rb_gc_register_mark_object(default_rs);
#else
    rb_global_variable(&default_rs);
#endif

    RG_DEF_METHOD(initialize, -1);
    RG_DEF_SMETHOD(open, -1);
    RG_DEF_METHOD(fileno, 0);
    RG_DEF_ALIAS("to_i", "fileno");
    RG_DEF_METHOD(read, -1);
    RG_DEF_METHOD(readchar, 0);
    RG_DEF_METHOD(getc, 0);
    RG_DEF_METHOD(readline, -1);
    RG_DEF_METHOD(gets, -1);
    RG_DEF_METHOD(each, -1);
    RG_DEF_ALIAS("each_line", "each");
    RG_DEF_METHOD(each_char, 0);
    RG_DEF_METHOD(write, 1);
    RG_DEF_METHOD(printf, -1);
    RG_DEF_METHOD(print, -1);
    RG_DEF_METHOD(puts, -1);
    RG_DEF_METHOD(putc, 1);
    RG_DEF_METHOD(flush, 0);
    RG_DEF_METHOD(seek, -1);
    RG_DEF_METHOD(set_pos, 1);
    RG_DEF_METHOD(close, -1);
    RG_DEF_METHOD(create_watch, 1);
    RG_DEF_METHOD(add_watch, 1);
    RG_DEF_METHOD(buffer_size, 0);
    RG_DEF_METHOD(set_buffer_size, 1);
    RG_DEF_METHOD(buffer_condition, 0);
    RG_DEF_METHOD(flags, 0);
    RG_DEF_METHOD(set_flags, 1);
    RG_DEF_METHOD(buffered, 0);
    RG_DEF_METHOD(set_buffered, 1);
    RG_DEF_METHOD(encoding, 0);
    RG_DEF_METHOD(set_encoding, 1);

    /* GSeekType */
    rb_define_const(RG_TARGET_NAMESPACE, "SEEK_CUR", INT2NUM(G_SEEK_CUR));
    rb_define_const(RG_TARGET_NAMESPACE, "SEEK_SET", INT2NUM(G_SEEK_SET));
    rb_define_const(RG_TARGET_NAMESPACE, "SEEK_END", INT2NUM(G_SEEK_END));

    /* GIOStatus */
    rb_define_const(RG_TARGET_NAMESPACE, "STATUS_ERROR", INT2NUM(G_IO_STATUS_ERROR));
    rb_define_const(RG_TARGET_NAMESPACE, "STATUS_NORMAL", INT2NUM(G_IO_STATUS_NORMAL));
    rb_define_const(RG_TARGET_NAMESPACE, "STATUS_EOF", INT2NUM(G_IO_STATUS_EOF));
    rb_define_const(RG_TARGET_NAMESPACE, "STATUS_AGAIN", INT2NUM(G_IO_STATUS_AGAIN));

    /* GIOCondition */
    /* Deprecated. Just for bacakward compatibility. Use
     * GLib::IOCondition::* instead. */
    G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_IO_CONDITION, "G_IO_");

    /* GIOFlags */
    rb_define_const(RG_TARGET_NAMESPACE, "FLAG_APPEND", INT2NUM(G_IO_FLAG_APPEND));
    rb_define_const(RG_TARGET_NAMESPACE, "FLAG_NONBLOCK", INT2NUM(G_IO_FLAG_NONBLOCK));
    rb_define_const(RG_TARGET_NAMESPACE, "FLAG_READABLE", INT2NUM(G_IO_FLAG_IS_READABLE));
    rb_define_const(RG_TARGET_NAMESPACE, "FLAG_WRITEABLE", INT2NUM(G_IO_FLAG_IS_WRITEABLE));
    rb_define_const(RG_TARGET_NAMESPACE, "FLAG_IS_SEEKABLE", INT2NUM(G_IO_FLAG_IS_SEEKABLE));
    rb_define_const(RG_TARGET_NAMESPACE, "FLAG_MASK", INT2NUM(G_IO_FLAG_MASK));
    rb_define_const(RG_TARGET_NAMESPACE, "FLAG_GET_MASK", INT2NUM(G_IO_FLAG_GET_MASK));
    rb_define_const(RG_TARGET_NAMESPACE, "FLAG_SET_MASK", INT2NUM(G_IO_FLAG_SET_MASK));
}
Пример #3
0
void 
Init_gtk_gdk_display(VALUE mGdk)
{
#if GTK_CHECK_VERSION(2,2,0)
    VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DISPLAY, "Display", mGdk);

    RG_DEF_SMETHOD(open, 1);
    RG_DEF_SMETHOD(default, 0);
    RG_DEF_METHOD(name, 0);
    RG_DEF_METHOD(n_screens, 0);
    RG_DEF_METHOD(get_screen, 1);
    RG_DEF_ALIAS("[]", "get_screen");
    RG_DEF_METHOD(default_screen, 0);

    RG_DEF_METHOD(pointer_ungrab, 1);
    RG_DEF_METHOD(keyboard_ungrab, 1);
    RG_DEF_METHOD_P(pointer_grabbed, 0);

    RG_DEF_METHOD(beep, 0);
    RG_DEF_METHOD(sync, 0);
#if GTK_CHECK_VERSION(2,4,0)
    RG_DEF_METHOD(flush, 0);
#endif
    RG_DEF_METHOD(close, 0);

    RG_DEF_METHOD(devices, 0);
    RG_DEF_METHOD(event, 0);
    RG_DEF_METHOD(peek_event, 0);
    RG_DEF_METHOD(put_event, 1);
    RG_DEF_METHOD(set_double_click_time, 1);
    RG_DEF_METHOD(double_click_time, 0);
    RG_DEF_METHOD(button_click_time, 0);
    RG_DEF_METHOD(button_window, 0);
    RG_DEF_METHOD(button_number, 0);
    RG_DEF_METHOD_P(closed, 0);
#if GTK_CHECK_VERSION(2,4,0)
    RG_DEF_METHOD(button_x, 0);
    RG_DEF_METHOD(button_y, 0);
    RG_DEF_METHOD(set_double_click_distance, 1);
    RG_DEF_METHOD(double_click_distance, 0);
#endif
    RG_DEF_METHOD(pointer, 0);
    RG_DEF_METHOD(window_at_pointer, 0);
#if GTK_CHECK_VERSION(2,4,0)
    RG_DEF_METHOD_P(supports_cursor_color, 0);
    RG_DEF_METHOD_P(supports_cursor_alpha, 0);
    RG_DEF_METHOD(default_cursor_size, 0);
    RG_DEF_METHOD(maximal_cursor_size, 0);
    RG_DEF_METHOD(default_group, 0);
#endif
#if GTK_CHECK_VERSION(2,6,0)
    RG_DEF_METHOD_P(supports_selection_notification, 0);
    RG_DEF_METHOD_P(request_selection_notification, 1);
    RG_DEF_METHOD_P(supports_clipboard_persistence, 0);
    RG_DEF_METHOD(store_clipboard, 3);
#endif
    RG_DEF_METHOD(core_pointer, 0);
#if GTK_CHECK_VERSION(2,8,0)
    RG_DEF_METHOD(warp_pointer, 3);
#endif

    G_DEF_SETTERS(RG_TARGET_NAMESPACE);
#ifdef GDK_WINDOWING_X11
    RG_DEF_METHOD(grab, 0);
    RG_DEF_METHOD(ungrab, 0);
#if GTK_CHECK_VERSION(2,4,0)
    RG_DEF_METHOD(register_standard_event_type, 2);
#endif
#if GTK_CHECK_VERSION(2,8,0)
    RG_DEF_METHOD(user_time, 0);
    RG_DEF_METHOD(set_cursor_theme, 2);
#endif
#  if GTK_CHECK_VERSION(2, 12, 0)
/*
    RG_DEF_METHOD(broadcast_startup_message, -1);
*/
    RG_DEF_METHOD(startup_notification_id, 0);
#  endif
    G_DEF_CLASS3("GdkDisplayX11", "DisplayX11", mGdk);
#endif
#endif

#if GTK_CHECK_VERSION(2,10,0)
    RG_DEF_METHOD_P(supports_shapes, 0);
    RG_DEF_METHOD_P(supports_input_shapes, 0);
#endif
#if GTK_CHECK_VERSION(2, 12, 0)
    RG_DEF_METHOD_P(supports_composite, 0);
    RG_DEF_METHOD(trigger_tooltip_query, 0);
#endif
}
Пример #4
0
void 
Init_gtk_treeview(VALUE mGtk)
{
    VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TREE_VIEW, "TreeView", mGtk);

    id_selection = rb_intern("selection");
    id_model = rb_intern("model");

    RG_DEF_METHOD(initialize, -1);
    RG_DEF_METHOD(selection, 0);
    RG_DEF_METHOD(columns_autosize, 0);
    RG_DEF_METHOD(append_column, 1);
    RG_DEF_METHOD(remove_column, 1);
    RG_DEF_METHOD(insert_column, -1);
    RG_DEF_METHOD(get_column, 1);
    RG_DEF_METHOD(columns, 0);
    RG_DEF_METHOD(move_column_after, 2);
    RG_DEF_METHOD(set_column_drag_function, 0);
    RG_DEF_METHOD(scroll_to_point, 2);
    RG_DEF_METHOD(scroll_to_cell, 5);
    RG_DEF_METHOD(set_cursor, 3);
    RG_DEF_METHOD(cursor, 0);
    RG_DEF_METHOD(expand_all, 0);
    RG_DEF_METHOD(collapse_all, 0);
    RG_DEF_METHOD(expand_row, 2);
    RG_DEF_METHOD(collapse_row, 1);
    RG_DEF_METHOD(expand_to_path, 1);
    RG_DEF_METHOD(map_expanded_rows, 0);
    RG_DEF_METHOD_P(row_expanded, 1);
    RG_DEF_METHOD(get_path_at_pos, 2);
    RG_DEF_ALIAS("get_path", "get_path_at_pos");
    RG_DEF_METHOD(get_cell_area, 2);
    RG_DEF_METHOD(get_background_area, 2);
    RG_DEF_METHOD(visible_rect, 0);
    RG_DEF_METHOD(visible_range, 0);
    RG_DEF_METHOD(bin_window, 0);
    RG_DEF_METHOD(widget_to_tree_coords, 2);
    RG_DEF_METHOD(tree_to_widget_coords, 2);
#if GTK_CHECK_VERSION(2,12,0)
    RG_DEF_METHOD(convert_bin_window_to_tree_coords, 2);
    RG_DEF_METHOD(convert_bin_window_to_widget_coords, 2);
    RG_DEF_METHOD(convert_tree_to_bin_window_coords, 2);
    RG_DEF_METHOD(convert_tree_to_widget_coords, 2);
    RG_DEF_METHOD(convert_widget_to_bin_window_coords, 2);
    RG_DEF_METHOD(convert_widget_to_tree_coords, 2);
#endif
    RG_DEF_METHOD(enable_model_drag_dest, 2);
    RG_DEF_METHOD(enable_model_drag_source, 3);
    RG_DEF_METHOD(unset_rows_drag_source, 0);
    RG_DEF_METHOD(unset_rows_drag_dest, 0);
    RG_DEF_METHOD(set_drag_dest_row, 2);
    RG_DEF_METHOD(drag_dest_row, 0);
    RG_DEF_METHOD(get_dest_row_at_pos, 2);
    RG_DEF_ALIAS("get_dest_row", "get_dest_row_at_pos");
    RG_DEF_METHOD(create_row_drag_icon, 1);
    RG_DEF_METHOD(set_search_equal_func, 0);
    RG_DEF_METHOD(set_cursor_on_cell, 4);

    RG_DEF_METHOD(set_row_separator_func, 0);
    RG_DEF_METHOD(search_entry, 0);
    RG_DEF_METHOD(set_search_entry, 1);
    RG_DEF_METHOD(set_search_position_func, 0);

    /* Constants */
    G_DEF_CLASS(GTK_TYPE_TREE_VIEW_DROP_POSITION, "DropPosition", RG_TARGET_NAMESPACE);
    G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_TREE_VIEW_DROP_POSITION, "GTK_TREE_VIEW_");

    /* GtkTreeViewGridLines */
    G_DEF_CLASS(GTK_TYPE_TREE_VIEW_GRID_LINES, "GridLines", RG_TARGET_NAMESPACE);
    G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_TREE_VIEW_GRID_LINES, "GTK_TREE_VIEW_");

    /* Option Signals */
    G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "row-collapsed", (GValToRValSignalFunc)treeview_signal_func);
    G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "row-expanded", (GValToRValSignalFunc)treeview_signal_func);
    G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "test-collapse-row", (GValToRValSignalFunc)treeview_signal_func);
    G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "test-expand-row", (GValToRValSignalFunc)treeview_signal_func);
}