Class: Gtk::MessageDialog

Inherits:
Object
  • Object
show all
Extended by:
GLib::Deprecatable
Defined in:
lib/gtk4/deprecated.rb,
lib/gtk4/message-dialog.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ MessageDialog

Returns a new instance of MessageDialog.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/gtk4/message-dialog.rb', line 19

def initialize(options={})
  parent  = options[:parent]
  flags   = options[:flags] || 0
  type    = options[:type] || :info
  buttons = options[:buttons] || options[:buttons_type] || :ok
  message = options[:message]

  initialize_general = GLib::Object.instance_method(:initialize).bind(self)
  initialize_general.call(:message_type => type,
                          :buttons => buttons)
  Loader.reference_gobject(self, :sink => true)

  if message
    self.use_markup = false
    self.text = message
  end

  if parent
    self.transient_for = parent
  end

  if flags
    unless flags.is_a?(DialogFlags)
      flags = DialogFlags.new(flags)
    end
    self.modal = true if flags.modal?
    self.destroy_with_parent = true if flags.destroy_with_parent?
  end
end