Sha256: ca06e4742b97961861f97571e66fbd8e41ce311696a464d6e45bb9af3db2eec5

Contents?: true

Size: 1.44 KB

Versions: 116

Compression:

Stored size: 1.44 KB

Contents

=begin
  dndtreeview.rb - Drag and Drop sample script.

  Copyright (C) 2003-2015 Masao Mutoh
  Copyright (c) 2003-2015 Ruby-GNOME2 Project Team
  This program is licenced under the same licence as Ruby-GNOME2.
=end

require "gtk3"

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::ModifierType::BUTTON1_MASK,
                                  TARGET_TABLE,
                                  Gdk::DragAction::COPY | Gdk::DragAction::MOVE)
    view.enable_model_drag_dest(TARGET_TABLE,
                                 Gdk::DragAction::COPY | Gdk::DragAction::MOVE)

    add(view)
  end
end

win = TestWindow.new
win.show_all

Gtk.main

Version data entries

116 entries across 108 versions & 2 rubygems

Version Path
gtk3-3.4.1 sample/misc/dndtreeview.rb
gtk3-3.4.0 sample/misc/dndtreeview.rb
gtk3-3.3.9 sample/misc/dndtreeview.rb
gtk3-3.3.8 sample/misc/dndtreeview.rb
gtk3-3.3.7 sample/misc/dndtreeview.rb
gtk3-3.3.6 sample/misc/dndtreeview.rb
gtk3-3.3.5 sample/misc/dndtreeview.rb
gtk3-3.3.4 sample/misc/dndtreeview.rb
gtk3-3.3.3 sample/misc/dndtreeview.rb
gtk3-3.3.2 sample/misc/dndtreeview.rb
gtk3-3.3.1 sample/misc/dndtreeview.rb
gtk3-3.3.0 sample/misc/dndtreeview.rb
gtk3-3.2.9-x64-mingw32 sample/misc/dndtreeview.rb
gtk3-3.2.9-x86-mingw32 sample/misc/dndtreeview.rb
gtk3-3.2.9 sample/misc/dndtreeview.rb
gtk3-3.2.8-x64-mingw32 sample/misc/dndtreeview.rb
gtk3-3.2.8-x86-mingw32 sample/misc/dndtreeview.rb
gtk3-3.2.8 sample/misc/dndtreeview.rb
gtk3-3.2.7-x86-mingw32 sample/misc/dndtreeview.rb
gtk3-3.2.7-x64-mingw32 sample/misc/dndtreeview.rb