Method: Gtk::SelectionData#set

Defined in:
lib/gtk4/selection-data.rb

#set(type, data, options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/gtk4/selection-data.rb', line 20

def set(type, data, options={})
  format ||= options[:format]
  if format.nil?
    case type
    when Gdk::Selection::TYPE_INTEGER
      format = 32
    when Gdk::Selection::TYPE_STRING
      format = 8
    else
      message = "specify :format as the number of bits of each data"
      raise ArgumentError, message
    end
  end
  set_raw(type, format, data)
end