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-3.4.3 sample/misc/dndtreeview.rb
gtk2-3.4.2 sample/misc/dndtreeview.rb
gtk2-3.4.1 sample/misc/dndtreeview.rb
gtk2-3.4.0 sample/misc/dndtreeview.rb
gtk2-3.3.9 sample/misc/dndtreeview.rb
gtk2-3.3.8 sample/misc/dndtreeview.rb
gtk2-3.3.7 sample/misc/dndtreeview.rb
gtk2-3.3.6 sample/misc/dndtreeview.rb
gtk2-3.3.5 sample/misc/dndtreeview.rb
gtk2-3.3.4 sample/misc/dndtreeview.rb
gtk2-3.3.3 sample/misc/dndtreeview.rb
gtk2-3.3.2 sample/misc/dndtreeview.rb
gtk2-3.3.1 sample/misc/dndtreeview.rb
gtk2-3.3.0 sample/misc/dndtreeview.rb
gtk2-3.2.9-x64-mingw32 sample/misc/dndtreeview.rb
gtk2-3.2.9-x86-mingw32 sample/misc/dndtreeview.rb
gtk2-3.2.9 sample/misc/dndtreeview.rb
gtk2-3.2.8-x64-mingw32 sample/misc/dndtreeview.rb
gtk2-3.2.8-x86-mingw32 sample/misc/dndtreeview.rb
gtk2-3.2.8 sample/misc/dndtreeview.rb