本文整理汇总了PHP中TAction::getAction方法的典型用法代码示例。如果您正苦于以下问题:PHP TAction::getAction方法的具体用法?PHP TAction::getAction怎么用?PHP TAction::getAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TAction
的用法示例。
在下文中一共展示了TAction::getAction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Class Constructor
* @param $message A string containint the question
* @param $action_yes Action taken for YES response
* @param $action_no Action taken for NO response
*/
public function __construct($message, TAction $action_yes, TAction $action_no = NULL)
{
$buttons = array(Gtk::STOCK_YES, Gtk::RESPONSE_YES);
if ($action_no instanceof TAction) {
$buttons[] = Gtk::STOCK_NO;
$buttons[] = Gtk::RESPONSE_NO;
}
$buttons[] = Gtk::STOCK_CANCEL;
$buttons[] = Gtk::RESPONSE_CANCEL;
parent::__construct('', NULL, Gtk::DIALOG_MODAL, $buttons);
parent::set_position(Gtk::WIN_POS_CENTER);
parent::set_size_request(500, 300);
$textview = new GtkTextView();
$textview->set_wrap_mode(Gtk::WRAP_WORD);
$textview->set_border_width(12);
$textbuffer = $textview->get_buffer();
$tagtable = $textbuffer->get_tag_table();
$customTag = new GtkTextTag();
$tagtable->add($customTag);
$customTag->set_property('foreground', '#525252');
$tagBegin = $textbuffer->create_mark('tagBegin', $textbuffer->get_end_iter(), true);
$textbuffer->insert_at_cursor("\n " . $message);
$tagEnd = $textbuffer->create_mark('tagEnd', $textbuffer->get_end_iter(), true);
$start = $textbuffer->get_iter_at_mark($tagBegin);
$end = $textbuffer->get_iter_at_mark($tagEnd);
$textbuffer->apply_tag($customTag, $start, $end);
$textview->set_editable(FALSE);
$textview->set_cursor_visible(FALSE);
$pango = new PangoFontDescription('Sans 14');
$textview->modify_font($pango);
$image = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_QUESTION, Gtk::ICON_SIZE_DIALOG);
$scroll = new GtkScrolledWindow();
$scroll->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS);
$scroll->add($textview);
$hbox = new GtkHBox();
$this->vbox->pack_start($hbox);
$hbox->pack_start($image, FALSE, FALSE);
$hbox->pack_start($scroll, TRUE, TRUE);
$this->show_all();
$result = parent::run();
if ($result == Gtk::RESPONSE_YES) {
parent::destroy();
call_user_func_array($action_yes->getAction(), array($action_yes->getParameters()));
} else {
if ($result == Gtk::RESPONSE_NO) {
parent::destroy();
call_user_func_array($action_no->getAction(), array($action_no->getParameters()));
} else {
parent::destroy();
}
}
}
示例2: __construct
/**
* Class Constructor
* @param $type Type of the message (info, error)
* @param $message Message to be shown
* @param $action Action to be processed when closing the dialog
*/
public function __construct($type, $message, TAction $action = NULL)
{
parent::__construct('', NULL, Gtk::DIALOG_MODAL, array(Gtk::STOCK_OK, Gtk::RESPONSE_OK));
parent::set_position(Gtk::WIN_POS_CENTER);
parent::set_size_request(500, 300);
$textview = new GtkTextView();
$textview->set_wrap_mode(Gtk::WRAP_WORD);
$textview->set_border_width(12);
$textbuffer = $textview->get_buffer();
$tagtable = $textbuffer->get_tag_table();
$customTag = new GtkTextTag();
$tagtable->add($customTag);
$customTag->set_property('foreground', '#525252');
$message = "\n " . str_replace('<br>', "\n ", $message);
$tagBegin = $textbuffer->create_mark('tagBegin', $textbuffer->get_end_iter(), true);
$textbuffer->insert_at_cursor(strip_tags($message));
$tagEnd = $textbuffer->create_mark('tagEnd', $textbuffer->get_end_iter(), true);
$start = $textbuffer->get_iter_at_mark($tagBegin);
$end = $textbuffer->get_iter_at_mark($tagEnd);
$textbuffer->apply_tag($customTag, $start, $end);
$textview->set_editable(FALSE);
$textview->set_cursor_visible(FALSE);
$pango = new PangoFontDescription('Sans 14');
$textview->modify_font($pango);
$image = $type == 'info' ? GtkImage::new_from_stock(Gtk::STOCK_DIALOG_INFO, Gtk::ICON_SIZE_DIALOG) : GtkImage::new_from_stock(Gtk::STOCK_DIALOG_ERROR, Gtk::ICON_SIZE_DIALOG);
$scroll = new GtkScrolledWindow();
$scroll->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS);
$scroll->add($textview);
$hbox = new GtkHBox();
$this->vbox->pack_start($hbox);
$hbox->pack_start($image, FALSE, FALSE);
$hbox->pack_start($scroll, TRUE, TRUE);
$this->show_all();
parent::connect('key_press_event', array($this, 'onClose'));
$result = parent::run();
if ($result == Gtk::RESPONSE_OK) {
if ($action) {
$parameters = $action->getParameters();
call_user_func_array($action->getAction(), array($parameters));
}
}
parent::destroy();
}
示例3: setAction
/**
* Define the action for the SeekButton
* @param $action Action taken when the user clicks over the Seek Button (A TAction object)
*/
public function setAction(TAction $action)
{
$callback = $action->getAction();
$this->btn->setAction($action, '');
$param = array();
if (is_array($callback)) {
$classname = get_class($callback[0]);
if ($classname == 'TStandardSeek') {
$param['key'] = 3;
$param['parent'] = $action->getParameter('parent');
$param['database'] = $action->getParameter('database');
$param['model'] = $action->getParameter('model');
$param['display_field'] = $action->getParameter('display_field');
$param['receive_key'] = $action->getParameter('receive_key');
$param['receive_field'] = $action->getParameter('receive_field');
}
}
if ($this->useOutEvent) {
// get_text aqui não é on-the-fly, tem que chamar um método na hora do evento
$this->entry->connect_simple('focus-out-event', array($this, 'onBlur'), $callback, $param);
}
}
示例4: setAction
/**
* Define the action to be executed when
* the user clicks over the column header
* @param $action A TAction object
*/
public function setAction(TAction $action)
{
$this->set_clickable(TRUE);
$this->connect_simple('clicked', array($this, 'onExecuteAction'), $action->getAction(), $action->getParameters());
}