GtkDialog コンストラクタ
GtkDialog ([string title = null [, GtkWidget parent_window = null [, GtkDialogFlags dialog_flags = 0 [, array (GtkButton,
GtkResponseType)]]]]);
Use the constructor to generate a dialog box in accordance with the parameters provided. Alternatively, you may not pass any parameters and construct all elements of the dialog manually.
例 48. An reconstruction of the GtkMessageDialog using GtkDialog.
<?php
/* Creating and initialising the dialog box */
$dialogBox = new GtkDialog(
"This is a Dialog",
NULL,
Gtk::DIALOG_MODAL,
array(
Gtk::STOCK_NO, Gtk::RESPONSE_NO,
Gtk::STOCK_YES, Gtk::RESPONSE_YES
)
);
/* Creating and adding a question to the dialog */
$dialogQues = new GtkLabel("Do you like PHP-Gtk2?");
$topArea = $dialogBox->vbox;
$topArea->add($dialogQues);
/* Showing all widgets added */
$dialogBox->show_all();
/* Running the dialog box */
$result = $dialogBox->run();
/* Accessing the result and performing
appropriate action */
switch($result) {
case (Gtk::RESPONSE_YES):
echo "Thanks!\n";
break;
case (Gtk::RESPONSE_NO):
echo "Why Not?!\n";
break;
}
/* Destroying the dialog box */
$dialogBox->destroy();
?>
|