Class: Gtk::Dialog

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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Dialog

Returns a new instance of Dialog.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/gtk4/dialog.rb', line 20

def initialize(options={})
  initialize_raw

  title   = options[:title]
  parent  = options[:parent]
  flags   = options[:flags]
  buttons = options[:buttons]

  set_title(title) if title
  set_transient_for(parent) if parent
  if flags
    unless flags.is_a?(DialogFlags)
      flags = DialogFlags.new(flags)
    end
    set_modal(true) if flags.modal?
    set_destroy_with_parent(true) if flags.destroy_with_parent?
  end

  add_buttons(*buttons) if buttons
end

Instance Method Details

#add_button(text, response_id) ⇒ Object



48
49
50
# File 'lib/gtk4/dialog.rb', line 48

def add_button(text, response_id)
  add_button_raw(text, ResponseType.resolve(response_id))
end

#add_button_rawObject



47
# File 'lib/gtk4/dialog.rb', line 47

alias_method :add_button_raw, :add_button

#add_buttons(*buttons) ⇒ Object



41
42
43
44
45
# File 'lib/gtk4/dialog.rb', line 41

def add_buttons(*buttons)
  buttons.each do |text, response_id|
    add_button(text, response_id)
  end
end

#get_widget_for_response(response_id) ⇒ Object



53
54
55
# File 'lib/gtk4/dialog.rb', line 53

def get_widget_for_response(response_id)
  get_widget_for_response_raw(ResponseType.resolve(response_id))
end

#get_widget_for_response_rawObject



52
# File 'lib/gtk4/dialog.rb', line 52

alias_method :get_widget_for_response_raw, :get_widget_for_response

#initialize_rawObject



19
# File 'lib/gtk4/dialog.rb', line 19

alias_method :initialize_raw, :initialize

#set_default_response(response_id) ⇒ Object Also known as: default_response=



58
59
60
# File 'lib/gtk4/dialog.rb', line 58

def set_default_response(response_id)
  set_default_response_raw(ResponseType.resolve(response_id))
end

#set_default_response_rawObject



57
# File 'lib/gtk4/dialog.rb', line 57

alias_method :set_default_response_raw, :set_default_response

#use_header_bar?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/gtk4/dialog.rb', line 67

def use_header_bar?
  use_header_bar_raw != 0
end