Class: Alexandria::UI::AlertDialog
- Inherits:
-
Object
- Object
- Alexandria::UI::AlertDialog
- Defined in:
- lib/alexandria/ui/alert_dialog.rb
Direct Known Subclasses
ConfirmEraseDialog, ConflictWhileCopyingDialog, ErrorDialog, KeepBadISBNDialog, ReallyDeleteDialog, SkipEntryDialog
Instance Attribute Summary collapse
-
#dialog ⇒ Object
readonly
Returns the value of attribute dialog.
Instance Method Summary collapse
- #default_response=(response) ⇒ Object
- #destroy ⇒ Object
-
#initialize(parent, title, stock_icon, buttons, message = nil) ⇒ AlertDialog
constructor
A new instance of AlertDialog.
- #run ⇒ Object
- #show_all ⇒ Object
Constructor Details
#initialize(parent, title, stock_icon, buttons, message = nil) ⇒ AlertDialog
Returns a new instance of AlertDialog.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/alexandria/ui/alert_dialog.rb', line 12 def initialize(parent, title, stock_icon, , = nil) @dialog = Gtk::Dialog.new(title: "", parent: parent, flags: :destroy_with_parent, 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(.strip) if hbox.pack_start(vbox) @dialog.child.pack_start(hbox) end |
Instance Attribute Details
#dialog ⇒ Object (readonly)
Returns the value of attribute dialog.
37 38 39 |
# File 'lib/alexandria/ui/alert_dialog.rb', line 37 def dialog @dialog end |
Instance Method Details
#default_response=(response) ⇒ Object
51 52 53 |
# File 'lib/alexandria/ui/alert_dialog.rb', line 51 def default_response=(response) dialog.default_response = response end |
#destroy ⇒ Object
47 48 49 |
# File 'lib/alexandria/ui/alert_dialog.rb', line 47 def destroy dialog.destroy end |
#run ⇒ Object
43 44 45 |
# File 'lib/alexandria/ui/alert_dialog.rb', line 43 def run dialog.run end |
#show_all ⇒ Object
39 40 41 |
# File 'lib/alexandria/ui/alert_dialog.rb', line 39 def show_all dialog.show_all end |