/** * @name __construct() * @return Demo */ public function __construct() { // Cria a janela $this->widgets['frmDemo'] = new GtkWindow(); $this->widgets['frmDemo']->set_size_request(600, 300); $this->widgets['frmDemo']->set_position(Gtk::WIN_POS_CENTER_ALWAYS); $this->widgets['frmDemo']->connect("destroy", array($this, "frmDemo_unload")); $box = new GtkVBox(); // Adiciona o textview do resultado $this->widgets['txtResult'] = Fabula::GtkTextView(); $box->pack_start(Fabula::GtkViewPort($this->widgets['txtResult']), TRUE, TRUE); // Adiciona o textview dos comandos $this->widgets['txtCommands'] = Fabula::GtkEntry(); $box->pack_start($this->widgets['txtCommands'], FALSE, FALSE); $this->widgets['txtCommands']->grab_focus(); // Connecta o entry de comandos para capturar o botão enter $this->widgets['txtCommands']->connect("key-press-event", array($this, "txtCommands_onkeypress")); // Inicia o pipe $this->pipe = Fabula::PipeIO("/bin/sh", array()); $this->pipe->set_callback("stdout", array($this, "on_pipe_io_stdout")); $this->pipe->run(); // Inicia a aplicação $this->widgets['frmDemo']->add($box); $this->frmDemo_onload(); }
/** * @name __construct() * @return Demo */ public function __construct() { // Cria a janela $this->widgets['frmDemo'] = new GtkWindow(); $this->widgets['frmDemo']->set_size_request(280, 280); $this->widgets['frmDemo']->set_position(Gtk::WIN_POS_CENTER_ALWAYS); $this->widgets['frmDemo']->connect("destroy", array($this, "frmDemo_unload")); $box = new GtkVBox(); // Toolbar $this->widgets['tlbDemo'] = Fabula::GtkToolbar(); $box->pack_start($this->widgets['tlbDemo'], FALSE, FALSE); // Adiciona o evento click $this->widgets['tlbDemo']->connect("clicked", array($this, "tlbDemo_onclick")); // Menu $menu = Fabula::GtkMenu(); $menu->append_item("Link 1"); $menu->append_item("Link 2"); $menu->append_item("Link 3"); $btnMySQL = $this->widgets['tlbDemo']->append_menu_from_stock($menu, Gtk::STOCK_ADD, NULL, "Novo"); // Botão do stock $this->widgets['tlbDemo']->append_button_from_stock(Gtk::STOCK_OPEN, NULL, "Abrir"); // Botão da imagem $this->widgets['tlbDemo']->append_button_from_image("GtkToolbar.png", "MySQL", "MySQL"); // Toggle $this->widgets['tlbDemo']->append_toggle_from_stock(Gtk::STOCK_CONNECT, NULL, "Conectar"); // Container $scale = new GtkVScale(); $scale->set_range(0, 100); $scale->set_draw_value(FALSE); $scale->set_size_request(28, 150); $btnContainer = $this->widgets['tlbDemo']->append_container_from_stock($scale, "button-release-event", Gtk::STOCK_ABOUT, NULL, "Container"); // Inicia a aplicação $box->pack_start(Fabula::GtkTextView()); $this->widgets['frmDemo']->add($box); $this->frmDemo_onload(); }