Location: PHPKode > scripts > GTK Popup Menu App > xzydialogs.php
<?php //1011051107
//1101311029 marcado pango en mensaje
//1011090017 simplificacion de codigo
//1011082303 correccion de titulo
//alert, confirm, prompt 1011061827
//todo: integrar en xzyapp ? 1011061829
//http://gtk.php.net/manual/en/gtk.gtkmessagedialog.php
//http://gtk.php.net/manual/en/gtk.enum.messagetype.php
//http://gtk.php.net/manual/en/gtk.enum.buttonstype.php
//falta poner la codificacion a utf-8 y no iso8859-1
//buscando conformidad con phplasses 1102061521 v.0.1.1
class xzyDialog extends GtkMessageDialog { //1011082339
	function __construct($type,$buttons,$message,$title) { //1011082345
		parent::__construct(null,0,$type,$buttons,$message);
		$this->set_title($title);
		$this->set_markup($message);
	}
	
	function run() { //1011082344
		$this->show_all();
		return parent::run(); //1011090014
	}
}

class xzyDialogs { 
	static function Alert($message,$title = 'Mensaje') { 
		$dialog = new xzyDialog(Gtk::MESSAGE_INFO,Gtk::BUTTONS_OK,$message,$title);	//1011082329
		$answer = $dialog->run();
		$dialog->destroy();
	}
	
	static function Confirm($message,$title = 'Pregunta') { 
		$dialog = new xzyDialog(Gtk::MESSAGE_QUESTION,Gtk::BUTTONS_YES_NO,$message,$title);
		$answer = ($dialog->run() ==  Gtk::RESPONSE_YES)? true: false;
		$dialog->destroy();
		return $answer;
	}
	
	static function Prompt($message,$title = 'Pregunta',$valor='') {
		$dialog = new xzyDialog(Gtk::MESSAGE_QUESTION,Gtk::BUTTONS_OK_CANCEL,$message,$title);
		$dialog->vbox->add($texto = new Gtkentry($valor));
		$result = ($dialog->run() == Gtk::RESPONSE_CANCEL)? false: $texto->get_text();
		$dialog->destroy();
		return $result;
	}
	
	
}


?>
Return current item: GTK Popup Menu App