class Alexandria::UI::AlertDialog
Attributes
dialog[R]
Public Class Methods
new(parent, title, stock_icon, buttons, message = nil)
click to toggle source
# File lib/alexandria/ui/alert_dialog.rb, line 12 def initialize(parent, title, stock_icon, buttons, message = nil) @dialog = Gtk::Dialog.new(title: "", parent: parent, flags: :destroy_with_parent, buttons: buttons) @dialog.border_width = 6 @dialog.resizable = false @dialog.child.spacing = 12 hbox = Gtk::Box.new(:horizontal, 12) hbox.homogeneous = false hbox.border_width = 6 image = Gtk::Image.new(stock: stock_icon, size: Gtk::IconSize::DIALOG) image.set_alignment(0.5, 0) hbox.pack_start(image) vbox = Gtk::Box.new(:vertical, 6) vbox.homogeneous = false vbox.pack_start make_label("<b><big>#{title}</big></b>") vbox.pack_start make_label CGI.escapeHTML(message.strip) if message hbox.pack_start(vbox) @dialog.child.pack_start(hbox) end
Public Instance Methods
default_response=(response)
click to toggle source
# File lib/alexandria/ui/alert_dialog.rb, line 51 def default_response=(response) dialog.default_response = response end
destroy()
click to toggle source
# File lib/alexandria/ui/alert_dialog.rb, line 47 def destroy dialog.destroy end
run()
click to toggle source
# File lib/alexandria/ui/alert_dialog.rb, line 43 def run dialog.run end
show_all()
click to toggle source
# File lib/alexandria/ui/alert_dialog.rb, line 39 def show_all dialog.show_all end
Private Instance Methods
make_label(markup)
click to toggle source
# File lib/alexandria/ui/alert_dialog.rb, line 57 def make_label(markup) label = Gtk::Label.new label.set_alignment(0, 0) label.wrap = label.selectable = true label.markup = markup label end