Source for file InfoBox.php
Documentation is available at InfoBox.php
* Information box with icon and the exception message.
* @package Gtk2_ExceptionDump
* @author Christian Weiske <cweiske@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @link http://pear.php.net/package/Gtk2_ExceptionDump
* Creates a new InfoBox and sets the exception.
* @param mixed $exception Exception or PEAR_Error
if ($exception !== null ) {
}//public function __construct($exception = null)
* Sets up the child widgets.
protected function build()
$stockalign = new GtkAlignment (0 , 0 , 0 , 0 );
GtkImage ::new_from_stock (
Gtk ::STOCK_DIALOG_ERROR , Gtk ::ICON_SIZE_DIALOG
$this->pack_start ($stockalign, false , true );
$this->expander = new GtkExpander ('');
$this->message = new GtkLabel ();
$this->expander->set_label_widget ($this->message);
$this->message->set_selectable (true );
$this->message->set_line_wrap (true );
$this->userinfo = new GtkLabel ();
$this->userinfo->set_selectable (true );
$this->userinfo->set_line_wrap (true );
//FIXME: add scrolled window
$this->expander->add ($this->userinfo);
$this->pack_start ($this->expander);
}//protected function build()
* Sets and displays the exception.
* @param mixed $exception Exception or PEAR_Error
//works on PEAR_Error and Exception
$code = $exception->getCode ();
$code = ' (Code #' . $code . ')';
$this->message->set_label ($exception->getMessage () . $code);
if ($exception instanceof PEAR_Error ) {
$this->userinfo->set_label ($exception->getUserInfo ());
$this->userinfo->set_label ('');
}//public function setException($exception)
* Explicitely sets a message to display, not an exception.
* Can be used to tell the user that no exception occured,
* but a normal variable has been passed.
* @param string $message The message to display
* @param string $userinfo User information text that is display
* when expanding the label.
public function setMessage($message, $userinfo = '')
$this->message->set_label ($message);
$this->userinfo->set_label ($userinfo);
}//public function setMessage($message, $userinfo = '')
}//class Gtk2_ExceptionDump_InfoBox extends GtkHBox
Documentation generated on Mon, 11 Mar 2019 15:55:05 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|