Class: MittensUi::Alert
- Inherits:
-
Object
- Object
- MittensUi::Alert
- Defined in:
- lib/mittens_ui/alert.rb
Instance Method Summary collapse
-
#initialize(message, options = {}) ⇒ Alert
constructor
A new instance of Alert.
- #render ⇒ Object
Constructor Details
#initialize(message, options = {}) ⇒ Alert
Returns a new instance of Alert.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mittens_ui/alert.rb', line 3 def initialize(, ={}) = { title: [:title] || "Alert", parent: $app_window, flags: [:modal, :destroy_with_parent], :buttons => [[Gtk::Stock::OK, :none]] }.freeze @alert_dialog = Gtk::Dialog.new() @alert_dialog.set_transient_for($app_window) @alert_dialog.set_default_width(420) @alert_dialog.set_default_height(200) @alert_dialog.set_modal(true) @alert_dialog.set_resizable(false) = Gtk::Label.new() .set_margin_top(36) dialog_box = @alert_dialog.content_area dialog_box.add() end |
Instance Method Details
#render ⇒ Object
25 26 27 28 29 |
# File 'lib/mittens_ui/alert.rb', line 25 def render @alert_dialog.show_all response = @alert_dialog.run response == :none ? @alert_dialog.destroy : @alert_dialog.destroy end |