public function __construct($window) { parent::__construct(Gtk::WINDOW_TOPLEVEL, $window, Gtk::DIALOG_NO_SEPARATOR); parent::set_decorated(FALSE); parent::set_size_request(150, 250); parent::set_skip_taskbar_hint(TRUE); parent::connect("delete-event", array($this, "autocomplete_window_destroy")); }
/** * 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(); } } }
public function __construct() { parent::__construct(); $this->strings = KioskClient::getStrings(); $this->set_default_size(200, 100); $this->set_resizable(false); $this->set_modal(true); $label = new GtkLabel($this->strings["logoutWarningLabel"]); $this->vbox->pack_start($label); $this->vbox->show_all(); $this->add_button(Gtk::STOCK_NO, Gtk::RESPONSE_NO); $this->add_button(GtK::STOCK_YES, Gtk::RESPONSE_YES); }
/** * 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(); }
public function __construct($message) { parent::__construct(); $this->strings = KioskClient::getStrings(); $this->set_position(GtK::WIN_POS_CENTER_ALWAYS); $this->set_default_size(200, 100); $this->set_resizable(false); $this->set_modal(false); $alertMessage = new GtkLabel(); $alertMessage->set_use_markup(true); $alertMessage->set_markup($message); $this->vbox->pack_start($hbox = new GtkHBox()); $stock = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG); $hbox->pack_start($stock, 0, 0); $hbox->pack_start($alertMessage); $this->add_button(Gtk::STOCK_OK, Gtk::RESPONSE_OK); $this->action_area->set_layout(Gtk::BUTTONBOX_SPREAD); $this->set_has_separator(false); $this->show_all(); $this->run(); $this->destroy(); }
function __construct() { parent::__construct(); $this->set_border_width(10); $this->set_title('X-Money - Login'); $this->set_icon_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . 'logo.png'); $this->vbox->pack_start($hbox = new GtkHBox()); $hbox->pack_start(GtkImage::new_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . 'logo.png')); $hbox->pack_start($vbox = new GtkVBox()); $vbox->pack_start($frame = new GtkFrame(latin1(' Digite suas informações para acessar o sistema: '))); $frame->set_border_width(10); $frame->add($table = new GtkTable()); $table->attach(new GtkLabel('Usuario:'), 0, 1, 0, 1); $table->attach($this->username = new GtkEntry(), 1, 2, 0, 1); $table->attach(new GtkLabel('Senha:'), 0, 1, 1, 2); $table->attach($this->password = new GtkEntry(), 1, 2, 1, 2); $this->password->set_visibility(false); $this->ok = $this->add_button('_Ok', Gtk::RESPONSE_OK); $this->add_button('_Cancelar', Gtk::RESPONSE_CANCEL); EntrySetNextFocus($this->username, $this->password); EntrySetNextFocus($this->password, $this->ok); $this->vbox->show_all(); }