class DestWindow

Public Class Methods

new() click to toggle source
Calls superclass method
# File gtk2/sample/misc/dnd.rb, line 33
def initialize
  super("Dest Window")

  @label = Gtk::Label.new("Drop here!")
  add(@label)
  set_default_size(100, 100)
  Gtk::Drag.dest_set(self, Gtk::Drag::DEST_DEFAULT_MOTION | 
                     Gtk::Drag::DEST_DEFAULT_HIGHLIGHT,
                     [["test", Gtk::Drag::TARGET_SAME_APP, 12345]], 
                     Gdk::DragContext::ACTION_COPY|Gdk::DragContext::ACTION_MOVE)
  
  signal_connect("drag-data-received") do |w, dc, x, y, selectiondata, info, time|
    dc.targets.each do |target|
      if target.name == "test" ||
          selectiondata.type == Gdk::Selection::TYPE_STRING
        puts selectiondata.data
      end
    end
  end
  signal_connect("drag-drop") do |w, dc, x, y, time|
    Gtk::Drag.get_data(w, dc, dc.targets[0], time)
  end
end