Class: Interphase::MessageDialog

Inherits:
Dialog show all
Defined in:
lib/interphase/widgets/dialog.rb

Overview

A message dialog which displays text and some buttons.

Instance Attribute Summary

Attributes inherited from Widget

#gtk_instance, #name, #parent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Dialog

#action_to_integer, #add_button, #run

Methods inherited from Widget

#destroy, #method_missing, #on, #respond_to_missing?, #show, #size

Constructor Details

#initialize(message, **options, &block) ⇒ MessageDialog

Create a new message dialog.

message

The message which the dialog displays.


55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/interphase/widgets/dialog.rb', line 55

def initialize(message, **options, &block)
  super(
    Gtk::MessageDialog.new(
      nil,
      0,
      Gtk::MessageDialog::OTHER,
      Gtk::MessageDialog::BUTTONS_NONE,
      message
    ),
    options, &block
  )
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Interphase::Widget

Class Method Details

.show(message) ⇒ Object

A helper method which creates a new MessageDialog, adds an OK button, displays it, blocks until 'OK' is clicked, then destroys it.

message

The message which the dialog displays.


71
72
73
74
75
76
# File 'lib/interphase/widgets/dialog.rb', line 71

def self.show(message)
  dialog = MessageDialog.new(message)
  dialog.add_button('OK', :ok)
  dialog.run
  dialog.destroy
end