RubyLit - Ruby.del.litoral!
Dialogo Acerca De


#
#http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3AAboutDialog
#
require 'gtk2'

# inicio gtk, es comun olvidarse de esta linea.
Gtk.init

# Creo la ventana
window = Gtk::Window.new( Gtk::Window::TOPLEVEL )
# Seteo ancho y alto
window.set_size_request( 300, 75 )
# Le pongo Titulo
window.set_title( "Un Mensaje" )
# creo el evento que cierra la ventana al hacer clic en la X
window.signal_connect( "delete_event" ) { Gtk.main_quit }

# Creo una Caja Vertical
vbox = Gtk::VBox.new( false, 0 )
# Agrego la caja a la ventana
window.add( vbox )

# Creo un boton
button = Gtk::Button.new( "Click" )
# Agrego el boton a la caja
vbox.pack_start( button, false, false, 0)

# Creo el evento que responde al click
button.signal_connect( "button_press_event", Gdk::Event::BUTTON_PRESS  ) { 
   |widget, event, y|

#http://ruby-gnome2.sourceforge.jp/hiki.cgi?Icons
#http://ruby-gnome2.sourceforge.jp/hiki.cgi?c=plugin;plugin=attach_download;p=Icons;file_name=logo-joshua.png
    ilogo = Gdk::Pixbuf.new("logo-joshua.png",40,40)

    #creo el dialogo.
    dialog = Gtk::AboutDialog.new()
    dialog.name = "Ejemplos para el wiki de RubyLit" 
    dialog.website = "http://www.rubylit.com.ar" 
    dialog.authors = ["Rafael Bidegain", "Rafa", "PingDonga"]
    dialog.license = "GPL V3 o superior" 
    dialog.version = "1.0" 
    dialog.logo = ilogo
    dialog.translator_credits = "Gracias a: \
 \nPingDonga por la traducción de Porteño a Entrerriano. \
 \nRafa por la traducción de Castellano a Porteño." 

    # Ejecuto el dialogo
    x = dialog.run do |response|
        # Capturo la respuesta
        case response
        when Gtk::Dialog::RESPONSE_NONE
            print "RESPONSE_NONE" 
        when Gtk::Dialog::RESPONSE_REJECT
            print "RESPONSE_REJECT" 
        when Gtk::Dialog::RESPONSE_ACCEPT
            print "RESPONSE_ACCEPT" 
        when Gtk::Dialog::RESPONSE_DELETE_EVENT
            print "RESPONSE_DELETE_EVENT" 
        when Gtk::Dialog::RESPONSE_OK
            print "RESPONSE_OK" 
        when Gtk::Dialog::RESPONSE_CANCEL
            print "RESPONSE_CANCEL" 
        when Gtk::Dialog::RESPONSE_CLOSE
            print "RESPONSE_CLOSE" 
        when Gtk::Dialog::RESPONSE_YES
            print "RESPONSE_YES" 
        when Gtk::Dialog::RESPONSE_NO
            print "RESPONSE_NO" 
        when Gtk::Dialog::RESPONSE_APPLY
            print "RESPONSE_APPLY" 
        when Gtk::Dialog::RESPONSE_HELP
            print "RESPONSE_HELP" 
        end
    end
    print "\n***\n#{x}\n***\n" 
}

#muestro todo lo que puse en la ventana
window.show_all

#run!
Gtk.main


cavite housing