Sha256: 778892551c1d1f35257853d0edaca3646cc19ddc8c4b40c5d5827b7d267b55fc
Contents?: true
Size: 1.48 KB
Versions: 184
Compression:
Stored size: 1.48 KB
Contents
=begin dndtreeview.rb - Drag and Drop sample script. Copyright (C) 2003-2006 Masao Mutoh This program is licenced under the same licence as Ruby-GNOME2. $Date: 2006/06/17 13:18:12 $ $Id: dndtreeview.rb,v 1.3 2006/06/17 13:18:12 mutoh Exp $ =end require 'gtk2' class TestWindow < Gtk::Window attr_reader :list TARGET_TABLE = [["GTK_TREE_MODEL_ROW", 0, 0]] def initialize() super("Drag and Drop Gtk::TreeView") set_default_size(300,128) signal_connect("destroy") { Gtk.main_quit } data = [["Hello", "KON-NI-CHIWA"], ["Goodbye", "SAYO-NARA"], ["Good morning", "OHA-YO-GOZAI-MASU"], ["Good evening", "KON-BAN-WA"]] model = Gtk::ListStore.new(String, String) view = Gtk::TreeView.new(model) renderer = Gtk::CellRendererText.new col1 = Gtk::TreeViewColumn.new("Data", renderer, {:text => 0}) col2 = Gtk::TreeViewColumn.new("Data", renderer, {:text => 1}) view.append_column(col1) view.append_column(col2) data.each do |v1, v2| iter = model.append iter.set_value(0, v1) iter.set_value(1, v2) end view.enable_model_drag_source(Gdk::Window::BUTTON1_MASK, TARGET_TABLE, Gdk::DragContext::ACTION_COPY|Gdk::DragContext::ACTION_MOVE) view.enable_model_drag_dest(TARGET_TABLE, Gdk::DragContext::ACTION_COPY|Gdk::DragContext::ACTION_MOVE) add(view) end end win = TestWindow.new.show_all Gtk.main
Version data entries
184 entries across 184 versions & 1 rubygems
Version | Path |
---|---|
gtk2-0.90.3 | sample/misc/dndtreeview.rb |
gtk2-0.90.3-x86-mingw32 | sample/misc/dndtreeview.rb |
gtk2-0.90.2 | sample/misc/dndtreeview.rb |
gtk2-0.90.2-x86-mingw32 | sample/misc/dndtreeview.rb |