예제 #1
0
 /**
  * Constructor Method
  */
 function __construct()
 {
     parent::__construct();
     parent::set_size_request(840, 640);
     parent::set_position(GTK::WIN_POS_CENTER);
     parent::connect_simple('delete-event', array($this, 'onClose'));
     parent::connect_simple('destroy', array('Gtk', 'main_quit'));
     parent::set_title(self::APP_TITLE);
     parent::set_icon(GdkPixbuf::new_from_file('favicon.png'));
     $gtk = GtkSettings::get_default();
     $gtk->set_long_property("gtk-button-images", TRUE, 0);
     $gtk->set_long_property("gtk-menu-images", TRUE, 0);
     self::$inst = $this;
     $ini = parse_ini_file('application.ini');
     $lang = $ini['language'];
     TAdiantiCoreTranslator::setLanguage($lang);
     TApplicationTranslator::setLanguage($lang);
     date_default_timezone_set($ini['timezone']);
     $this->content = new GtkFixed();
     $vbox = new GtkVBox();
     parent::add($vbox);
     $vbox->pack_start(GtkImage::new_from_file('app/images/pageheader-gtk.png'), false, false);
     $MenuBar = TMenuBar::newFromXML('menu.xml');
     $vbox->pack_start($MenuBar, false, false);
     $vbox->pack_start($this->content, true, true);
     parent::show_all();
 }
예제 #2
0
 /**
  * Define the icon of the button
  * @param  $image  image path
  */
 public function setImage($image)
 {
     if (file_exists('lib/adianti/images/' . $image)) {
         $imagem = GtkImage::new_from_file('lib/adianti/images/' . $image);
     } else {
         $imagem = GtkImage::new_from_file('app/images/' . $image);
     }
     parent::set_image($imagem);
 }
예제 #3
0
 /**
  * Define the icon of the button
  * @param  $image  image path
  */
 public function setImage($image)
 {
     if (file_exists('lib/adianti/images/' . $image)) {
         $imagem = GtkImage::new_from_file('lib/adianti/images/' . $image);
     } else {
         $imagem = GtkImage::new_from_file('app/images/' . $image);
     }
     $this->widget->set_image($imagem);
 }
예제 #4
0
 /**
  * Class Constructor
  * @param $name Name of the widget
  */
 public function __construct($name)
 {
     parent::__construct($name);
     $this->widget = new GtkHBox();
     parent::add($this->widget);
     $this->mask = 'yyyy-mm-dd';
     // creates the entry field
     $this->entry = new TEntry($name);
     $this->entry->setSize(200);
     $this->setMask($this->mask);
     $this->widget->add($this->entry);
     // creates a button with a calendar image
     $button = new GtkButton();
     $button->set_relief(GTK::RELIEF_NONE);
     $imagem = GtkImage::new_from_file('lib/adianti/images/tdate-gtk.png');
     $button->set_image($imagem);
     $this->actionButton = $button;
     // define the button's callback
     $button->connect_simple('clicked', array($this, 'onCalendar'));
     $this->widget->add($button);
     // creates the calendar window
     $this->popWindow = new GtkWindow(Gtk::WINDOW_POPUP);
     // creates the calendar
     $this->calendar = new GtkCalendar();
     // define the action when the user selects a date
     $this->calendar->connect_simple('day-selected-double-click', array($this, 'onSelectDate'));
     $this->month = new TCombo('tdate-month');
     $this->month->addItems(array(TAdiantiCoreTranslator::translate('January'), TAdiantiCoreTranslator::translate('February'), TAdiantiCoreTranslator::translate('March'), TAdiantiCoreTranslator::translate('April'), TAdiantiCoreTranslator::translate('May'), TAdiantiCoreTranslator::translate('June'), TAdiantiCoreTranslator::translate('July'), TAdiantiCoreTranslator::translate('August'), TAdiantiCoreTranslator::translate('September'), TAdiantiCoreTranslator::translate('October'), TAdiantiCoreTranslator::translate('November'), TAdiantiCoreTranslator::translate('December')));
     $this->month->setCallback(array($this, 'onChangeMonth'));
     $this->month->setSize(70);
     for ($n = date('Y') - 10; $n <= date('Y') + 10; $n++) {
         $years[$n] = $n;
     }
     $this->year = new TCombo('tdate-year');
     $this->year->addItems($years);
     $this->year->setCallback(array($this, 'onChangeMonth'));
     $this->year->setSize(70);
     $hbox = new GtkHBox();
     $hbox->pack_start($this->month);
     $hbox->pack_start($this->year);
     $bt_today = new GtkButton(TAdiantiCoreTranslator::translate('Today'));
     $bt_close = new GtkButton(TAdiantiCoreTranslator::translate('Close'));
     $bt_today->connect_simple('clicked', array($this, 'selectToday'));
     $inst = $this->popWindow;
     $bt_close->connect_simple('clicked', array($inst, 'hide'));
     $hbox2 = new GtkHBox();
     $hbox2->pack_start($bt_today);
     $hbox2->pack_start($bt_close);
     $vbox = new GtkVBox();
     $vbox->pack_start($hbox, FALSE, FALSE);
     $vbox->pack_start($this->calendar);
     $vbox->pack_start($hbox2, FALSE, FALSE);
     // shows the window
     $this->popWindow->add($vbox);
 }
예제 #5
0
 function append($icon, $label, $index, $callback = null)
 {
     $button = new GtkToolButton(GtkImage::new_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . $icon), $label);
     $this->add($button);
     $button->set_visible_horizontal(true);
     $button->set_visible_vertical(true);
     if ($callback) {
         $button->connect('clicked', $callback);
     }
     return $button;
 }
예제 #6
0
 function __construct()
 {
     parent::__construct();
     parent::set_title('Adianti Framework :: Samples');
     $this->content = new GtkFixed();
     $vbox = new GtkVBox();
     $vbox->pack_start(GtkImage::new_from_file('app/images/pageheader-gtk.png'), false, false);
     $MenuBar = TMenuBar::newFromXML('menu.xml');
     $vbox->pack_start($MenuBar, false, false);
     $vbox->pack_start($this->content, true, true);
     parent::add($vbox);
     parent::show_all();
 }
예제 #7
0
 function __construct()
 {
     parent::__construct();
     parent::set_title('Adianti Framework :: Samples');
     $this->content = new GtkFixed();
     $vbox = new GtkVBox();
     $scroll = new GtkScrolledWindow();
     $scroll->set_policy(GTK::POLICY_AUTOMATIC, GTK::POLICY_ALWAYS);
     $scroll->set_size_request(200, -1);
     $vbox->pack_start(GtkImage::new_from_file('app/images/pageheader.png'), false, false);
     $MenuBar = TMenuBar::newFromXML('menu.xml');
     $vbox->pack_start($MenuBar, false, false);
     $vbox->pack_start($this->content, true, true);
     parent::add($vbox);
     parent::show_all();
 }
예제 #8
0
 /**
  * Class Constructor
  * @param $label  The menu label
  * @param $action The menu action
  * @param $image  The menu image
  */
 public function __construct($label, $action, $image = NULL)
 {
     parent::__construct(utf8_decode($label));
     // converts into ISO
     parent::set_image(null);
     if (OS == 'WIN') {
         parent::set_border_width(3);
     }
     $this->label = $label;
     $this->action = $action;
     $this->image = $image;
     if (file_exists($image)) {
         parent::set_image(GtkImage::new_from_file($image));
     }
     $inst = TApplication::getInstance();
     if ($inst instanceof TApplication) {
         parent::connect_simple('activate', array($inst, 'run'), $action);
     }
 }
예제 #9
0
 function __construct()
 {
     parent::__construct();
     parent::set_title('Adianti Framework :: Library');
     $this->content = new GtkFixed();
     $vbox = new GtkVBox();
     $vbox->pack_start(GtkImage::new_from_file('app/images/pageheader-gtk.png'), false, false);
     $hbox = new GtkHBox();
     $vbox->pack_start($hbox, true, true);
     $frame = new GtkFrame();
     $frame->add($this->content);
     $this->scroll = new GtkScrolledWindow();
     $this->scroll->set_policy(GTK::POLICY_AUTOMATIC, GTK::POLICY_ALWAYS);
     $this->scroll->set_size_request(200, -1);
     $hbox->pack_start($this->scroll, false, false);
     $hbox->pack_start($frame, true, true);
     parent::add($vbox);
     parent::show_all();
     $this->run('LoginForm');
 }
예제 #10
0
 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();
 }
예제 #11
0
 /**
  * Add the home icon
  */
 public function addHome()
 {
     $image = GtkImage::new_from_file('lib/adianti/include/tbreadcrumb/home.png');
     $this->container->pack_start($image, FALSE, FALSE);
 }
예제 #12
0
 /**
  * Cria um botão por uma imagem
  *
  * @name newButtonFromImage($image, $label=NULL)
  * @param $image (string): String com caminho do arquivo de imagem
  * @param $label (string): String com o nome do botão
  * @return $button (GtkButton): Retorna o botão criado
  * @deprecated
  */
 public function newButtonFromImage($image, $label = NULL)
 {
     // Criação do botão
     $button = new GtkButton();
     // Cria o container interno do botão
     $button_hbox = new GtkVBox();
     $button->add($button_hbox);
     // Carrega a imagem
     $img = GtkImage::new_from_file($image);
     $button_hbox->pack_start($img, 0, 0);
     // Verifica se possui label
     if ($label != NULL) {
         $button_hbox->pack_start(new GtkLabel($label), 0, 0);
     }
     // Retorna o botão
     return $button;
 }
예제 #13
0
 function preenche_itens()
 {
     $db = new Database($this, true);
     if (!$db->link) {
         return;
     }
     /*
      * Itens disponiveis
      */
     if (!$db->multi_query('SELECT * FROM Vw_Itens')) {
         return;
     }
     while ($line = $db->line()) {
         $id = $line['id'];
         $descricao = $line['Descricao'];
         $cod_menu = $line['CodMenu'];
         $menu = $line['Menu'];
         $imagem = $line['Imagem'];
         $cod_secao = $line['CodSecao'];
         $secao = latin1($line['Secao']);
         // Secao
         if ($this->secoes[$cod_secao] == null) {
             $this->lista->pack_start($ptr_secao = $this->secoes[$cod_secao] = new GtkExpander(' ' . $secao . ' '), false);
             $ptr_secao->add(new GtkHBox());
         }
         // Menu
         if ($this->menus[$cod_menu] == null) {
             $ptr = $this->menus[$cod_menu] = new GtkFrame(' ' . $menu . ' ');
             $ptr->set_border_width(5);
             $ptr->add($children = new GtkVBox());
             $children->pack_start(GtkImage::new_from_file('/usr/share/xmoney/images' . DIRECTORY_SEPARATOR . $imagem));
             $this->secoes[$cod_secao]->child->pack_start($ptr, false);
         }
         // Item
         if ($this->itens[$id] == null) {
             $ptr = $this->itens[$id] = new GtkCheckButton(' ' . $descricao . ' ');
             $this->menus[$cod_menu]->child->pack_start($ptr);
         }
     }
     $this->lista->show_all();
     $this->expandir->set_active(true);
     return true;
 }
예제 #14
0
 private function chamarClick($linha, $coluna)
 {
     //Marca a casa onde a IA vai jogar
     $img = GtkImage::new_from_file("imagens/decepticon.png");
     $this->telaCampo->matrizBotao[$linha][$coluna]->set_image($img);
     $this->linhaEscolhida = $linha;
     $this->colunaEscolhida = $coluna;
     $this->telaCampo->ativarClick = false;
     //Desativa a tela para o usuário não click junto com a IA
     $this->iniciarAtraso();
     //Atrasa a jogada da IA para que o usuário possa ver onde ela vai jogar
 }
예제 #15
0
 function __create_dbox()
 {
     $vbox = new GtkVBox(false, 5);
     $vbox->set_spacing(2);
     $this->m_ssdata = array();
     for ($i = 0; $i <= 14; $i++) {
         $this->m_ssdata[$i] = array();
         $this->m_ssdata[$i]['Img1'] = GtkImage::new_from_file("./img/11-1.gif");
         $this->m_ssdata[$i]['Img2'] = GtkImage::new_from_file("./img/9.gif");
         $this->m_ssdata[$i]['paned'] = new GtkTable(1, 2, false);
         $this->m_ssdata[$i]['paned']->attach($this->m_ssdata[$i]['Img1'], 0, 1, 1, 2);
         $this->m_ssdata[$i]['paned']->attach($this->m_ssdata[$i]['Img2'], 1, 2, 1, 2);
         $this->m_ssdata[$i]['paned']->set_col_spacings(1);
         $this->m_ssdata[$i]['paned']->set_row_spacings(1);
         //$this->m_ssdata[$i]['paned'] = new GtkHPaned();
         //$this->m_ssdata[$i]['paned']->add1($this->m_ssdata[$i]['Img1']);
         //$this->m_ssdata[$i]['paned']->add2($this->m_ssdata[$i]['Img2']);
         //$this->m_ssdata[$i]['paned']->set_position(45);
         $vbox->pack_start($this->m_ssdata[$i]['paned'], false, false, 0);
         $this->m_ssdata[$i]['name'] = new GtkLabel();
         $this->m_ssdata[$i]['name']->set_markup("Name: \nZacki");
         $vbox->pack_start($this->m_ssdata[$i]['name']);
         $this->m_ssdata[$i]['level'] = new GtkLabel();
         $this->m_ssdata[$i]['level']->set_markup("Level: 70");
         $vbox->pack_start($this->m_ssdata[$i]['level']);
         $this->m_ssdata[$i]['ping'] = new GtkLabel();
         $this->m_ssdata[$i]['ping']->set_markup("Ping: 70");
         $vbox->pack_start($this->m_ssdata[$i]['ping']);
         $this->m_ssdata[$i]['map'] = new GtkLabel();
         $this->m_ssdata[$i]['map']->set_markup("Zone: \nXZ");
         $vbox->pack_start($this->m_ssdata[$i]['map']);
         $this->m_ssdata[$i]['end'] = new GtkLabel();
         $this->m_ssdata[$i]['end']->set_markup("-----");
         $vbox->pack_start($this->m_ssdata[$i]['end']);
     }
     $scrolled = new GtkScrolledWindow();
     $scrolled->add_with_viewport($vbox);
     $scrolled->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
     $this->m_ssdata_clear();
     return $scrolled;
 }
 /**
  * Adiciona um botão toggle menu no final do toolbar apartir de um arquivo de imagem
  * 
  * @name append_toggle_from_image($imageFile, $label="", $tip=NULL)
  * @param string $imageFile Caminho do arquivo da imagem
  * @param string $label Label do botão caso for usar um
  * @param string $tip String para mostrar como tooltip
  * @return GtkToggleToolButton
  */
 public function append_toggle_from_image($imageFile, $label = "", $tip = NULL)
 {
     // Cria o botão
     $toolbutton = new GtkToggleToolButton();
     // Cria a imagem
     $imagebutton = GtkImage::new_from_file($imageFile);
     // Troca o icone pela imagem
     $iconWidget = $toolbutton->set_icon_widget($imagebutton);
     // Verifica se existe label
     if ($label != NULL) {
         $toolbutton->set_label($label);
     }
     // Verifica se existe tooltip
     if ($tip != NULL) {
         // Adiciona o tooltip
         $toolbutton->set_tooltip_text($tip);
     }
     // Adiciona o callback do click
     $toolbutton->connect_simple("clicked", array($this, "__onclick"), ++$this->__counter);
     // Armazena o botão
     $this->__buttons[$this->__counter] = $toolbutton;
     // Adiciona o botão ao toolbar
     parent::insert($toolbutton, -1);
     // Retorna o botão
     return $toolbutton;
 }
예제 #17
0
 function preenche_lista()
 {
     $db = new Database($this->Owner, true);
     if (!$db->link) {
         return;
     }
     // Secoes
     $sql = 'SELECT * FROM Tb_Secoes';
     if (!$db->multi_query($sql)) {
         return;
     }
     while ($line = $db->line()) {
         $CodSecao = $line['Cod_S_Secao'];
         $Imagem = $line['Imagem'];
         $Nome = $line['Nome'];
         $this->lista->pack_start($ptr = $this->secoes[$CodSecao] = new GtkExpander(''), false);
         $ptr->add(new GtkVBox());
         $ptr->set_label_widget($hbox = new GtkHBox());
         $hbox->pack_start(GtkImage::new_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . $Imagem), false);
         $hbox->pack_start($label = new GtkLabel());
         $label->set_markup('<b>' . $Nome . '</b>');
         $ptr->show_all();
     }
     // Menus
     $sql = 'SELECT * FROM Tb_Menus';
     if (!$db->multi_query($sql)) {
         return;
     }
     while ($line = $db->line()) {
         $CodMenu = $line['Cod_S_Menu'];
         $CodSecao = $line['Cod_S_Secao'];
         $Imagem = $line['Imagem'];
         $Nome = $line['Nome'];
         $Permissao = $line['Permissao'];
         $Classe = $line['Classe'];
         $this->secoes[$CodSecao]->child->pack_start($button = new GtkButton());
         $button->set_relief(Gtk::RELIEF_NONE);
         $button->add($hbox = new GtkHBox());
         $hbox->pack_start(GtkImage::new_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . $Imagem), false);
         $hbox->pack_start(new GtkLabel(' ' . $Nome . ' '));
         $button->show_all();
         $button->connect('clicked', array($this, 'button_clicked'), array($Permissao, $Classe));
     }
     // Ajuda
     $this->lista->pack_start($ptr = new GtkExpander(''), false);
     $ptr->set_label_widget($hbox = new GtkHBox());
     $hbox->pack_start(GtkImage::new_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . 'ajuda.png'), false);
     $hbox->pack_start($label = new GtkLabel());
     $label->set_markup('<b>Ajuda</b>');
     $ptr->show_all();
     // Sobre
     $ptr->add($button = new GtkButton());
     $button->set_relief(Gtk::RELIEF_NONE);
     $button->add($hbox = new GtkHBox());
     $hbox->pack_start(GtkImage::new_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . 'sobre.png'), false);
     $hbox->pack_start(new GtkLabel('Sobre'));
     $ptr->show_all();
     $button->connect('clicked', array($this, 'sobre_clicked'));
     return true;
 }
예제 #18
0
 /**
  * Add an Action to the DataGrid
  * @param $object A TDataGridAction object
  */
 public function addAction(TDataGridAction $action)
 {
     $this->actions[] = $action;
     $button = new GtkButton($action->getLabel());
     if (file_exists('lib/adianti/images/' . $action->getImage())) {
         $button->set_image(GtkImage::new_from_file('lib/adianti/images/' . $action->getImage()));
     } else {
         $button->set_image(GtkImage::new_from_file('app/images/' . $action->getImage()));
     }
     $button->connect_simple('clicked', array($this, 'onExecute'), $action);
     $this->action_area->pack_start($button);
 }
예제 #19
0
 public function __construct($status = null)
 {
     if (DEBUG) {
         echo "LoginWindow::__construct( \$status = {$status} )\n";
     }
     parent::__construct();
     $this->strings = KioskClient::getStrings();
     $this->status = $status;
     $screen = GdkScreen::get_default();
     $screenWidth = $screen->get_width();
     $screenHeight = $screen->get_height();
     $this->set_decorated(1);
     $this->set_default_size(800, 600);
     ##Temporary Changed for testing  ($screenWidth, $screenHeight)
     #$this->fullscreen();
     $this->set_keep_above(0);
     $this->set_modal(1);
     $messageBox = new GtkHBox();
     $this->loginBox = new GtkVBox();
     $this->errorBox = new GtkVBox();
     $usernameBox = new GtkHBox();
     $passwordBox = new GtkHBox();
     ## Build the login box
     $this->messageLabel = new GtkLabel();
     $this->messageLabel->set_use_markup(true);
     $this->messageLabel->set_label($this->strings['promptLabel']);
     $usernameLabel = new GtkLabel();
     $usernameLabel->set_use_markup(true);
     $usernameLabel->set_label($this->strings['usernameLabel']);
     $this->usernameEntry = new GtkEntry();
     $passwordLabel = new GtkLabel();
     $passwordLabel->set_use_markup(true);
     $passwordLabel->set_label($this->strings['passwordLabel']);
     $this->passwordEntry = new GtkEntry();
     $this->passwordEntry->set_visibility(0);
     $this->loginButton = new GtkButton($this->strings['loginButton']);
     $messageBox->pack_start($this->messageLabel);
     $usernameBox->pack_start($usernameLabel);
     $usernameBox->pack_start($this->usernameEntry);
     $passwordBox->pack_start($passwordLabel);
     $passwordBox->pack_start($this->passwordEntry);
     $this->loginBox->pack_start($messageBox);
     $this->loginBox->pack_start($usernameBox);
     $this->loginBox->pack_start($passwordBox);
     $this->loginBox->pack_start($this->loginButton);
     ## Build the error message box
     $this->errorLabel = new GtkLabel();
     $this->errorLabel->set_use_markup(true);
     $this->errorLabel->set_label('Error : Username and Password Do Not Match');
     $errorLabelBox = new GtkHBox();
     $errorLabelBox->pack_start($this->errorLabel);
     $this->errorButton = new GtkButton('OK');
     $errorButtonBox = new GtkHBox();
     $errorButtonBox->pack_start($this->errorButton);
     $this->errorBox->pack_start($errorLabelBox);
     $this->errorBox->pack_start($errorButtonBox);
     if (DEBUG) {
         $this->quitButton = new GtkButton("Quit");
         $this->loginBox->pack_start($this->quitButton);
     }
     $this->connect_simple('destroy', array('Gtk', 'main_quit'));
     $centerHBox = new GtkHBox();
     $centerVBox = new GtkVBox();
     $leftBox = new GtkHBox();
     $rightBox = new GtkHBox();
     $topBox = new GtkHBox();
     $bottomBox = new GtkHBox();
     $insideTopBox = new GtkVBox();
     $this->topLabel = new GtkLabel();
     $this->topLabel->set_use_markup(true);
     $this->topLabel->set_label($this->strings['topLabel']);
     $insideTopBox->pack_start($this->topLabel);
     if (file_exists('/etc/libki/logo.png')) {
         $logo = GtkImage::new_from_file('/etc/libki/logo.png');
         $insideTopBox->pack_start($logo);
     } elseif (file_exists('logo.png')) {
         $logo = GtkImage::new_from_file('logo.png');
         $insideTopBox->pack_start($logo);
     }
     $topBox->pack_start($insideTopBox);
     $centerHBox->pack_start($leftBox, true);
     $centerHBox->pack_start($this->loginBox, false);
     $centerHBox->pack_start($this->errorBox, false);
     $centerHBox->pack_start($rightBox, true);
     $centerVBox->pack_start($topBox, true);
     $centerVBox->pack_start($centerHBox, false);
     $centerVBox->pack_start($bottomBox, true);
     $this->add($centerVBox);
 }
예제 #20
0
 public function onClickButton($linha, $coluna, $matrizBotao, $jogo)
 {
     if ($this->ativarClick) {
         //Desativa a tela para o usuário não click junto com a IA
         $buttonImg = $this->matrizBotao[$linha][$coluna]->get_image();
         if ($this->ehBandeira($buttonImg)) {
             //caso o usuário click em uma casa com bandeira
             $this->jogo->numeroBandeiras++;
             //essa bandeira não será perdida
             $this->campoXML->get_widget("labelBandeira")->set_label($this->jogo->numeroBandeiras);
         }
         //vai reniciar a contagem do tempo toda vez que um botão
         //for clicado
         $this->tempo->zerarTempo();
         $this->matrizBotao[$linha][$coluna]->set_sensitive(false);
         //desativa o botão clicado
         $campo = $jogo->campo;
         if ($campo->matriz[$linha][$coluna] > 0) {
             //Coloca o número no botão
             $matrizBotao[$linha][$coluna]->set_label($campo->matriz[$linha][$coluna]);
             //Caso o usuário click em uma bomba.
         } else {
             if ($campo->matriz[$linha][$coluna] == -1) {
                 $this->acharBombas();
                 $buttonImg = $this->matrizBotao[$linha][$coluna]->get_image();
                 //Marca as bombas que o usuário achou
                 if ($buttonImg != null && $buttonImg->get_name() == "bandeira") {
                     $img = GtkImage::new_from_file("imagens/bomb2.png");
                 } else {
                     $img = GtkImage::new_from_file("imagens/bomb.png");
                 }
                 //Coloca a imagem na casa onde tem bomba.
                 $matrizBotao[$linha][$coluna]->set_image($img);
                 if ($this->controle == 0) {
                     if (!$this->jogo->turno) {
                         $this->vencer();
                     } else {
                         $this->perder();
                     }
                 }
             } else {
                 if ($campo->matriz[$linha][$coluna] == 0) {
                     //Caso clique em uma casa com 0
                     $matrizBotao[$linha][$coluna]->set_label("");
                     foreach (range($linha - 1, $linha + 1) as $i) {
                         foreach (range($coluna - 1, $coluna + 1) as $j) {
                             if ($campo->verificarIndice($i, $j)) {
                                 if (!$matrizBotao[$i][$j]->get_active()) {
                                     $matrizBotao[$i][$j]->clicked();
                                     //chamada de recurso para todos os botões adjacentes.
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
예제 #21
0
 /**
  * Add an Action to the DataGrid
  * @param $object A TDataGridAction object
  */
 public function addAction(TDataGridAction $action)
 {
     if ($this->modelCreated) {
         throw new Exception(TAdiantiCoreTranslator::translate('You must call ^1 before ^2', __METHOD__, 'createModel'));
     } else {
         $this->actions[] = $action;
         $button = new GtkButton($action->getLabel());
         if (file_exists('lib/adianti/images/' . $action->getImage())) {
             $button->set_image(GtkImage::new_from_file('lib/adianti/images/' . $action->getImage()));
         } else {
             $button->set_image(GtkImage::new_from_file('app/images/' . $action->getImage()));
         }
         $button->connect_simple('clicked', array($this, 'onExecute'), $action);
         $this->action_area->pack_start($button);
     }
 }
예제 #22
0
 function evt__mostrar_opciones()
 {
     $objeto_cmd = $this->get_objeto_comando($this->seleccion);
     $this->opciones = $objeto_cmd->inspeccionar_opciones();
     $this->comp['label_info']->set_markup($objeto_cmd->get_info_extra());
     //------ Cambia algunas cosas de lugar
     if ($objeto_cmd instanceof comando_base) {
         $opciones_a_sacar = array('listar', 'registrar');
         $hay_que_sacar = $objeto_cmd->tiene_definido_base();
         foreach (array_keys($this->opciones) as $id) {
             $existe = in_array($id, $opciones_a_sacar);
             if ($existe && $hay_que_sacar) {
                 unset($this->opciones[$id]);
             }
             if (!$existe && !$hay_que_sacar) {
                 unset($this->opciones[$id]);
             }
         }
     }
     //-----------------------------------
     $i = 0;
     foreach ($this->opciones as $opcion => $atributos) {
         if (!isset($atributos['tags']['gtk_no_mostrar'])) {
             $nombre = ucwords(str_replace('_', ' ', $opcion));
             $boton = new GtkToolButton();
             $boton->set_label($nombre);
             if (isset($atributos['tags']['gtk_icono'])) {
                 $archivo = $atributos['tags']['gtk_icono'];
                 $img = GtkImage::new_from_file(toba_dir() . '/www/img/' . $archivo);
                 $boton->set_property('icon-widget', $img);
             }
             $boton->set_tooltip($this->tooltips, $atributos['ayuda']);
             $boton->connect('clicked', array($this, 'evt__ejecutar'), $opcion, $atributos);
             $this->comp['caja_opciones']->insert($boton, $i);
             //--- Desactivar algunos
             if ($objeto_cmd instanceof comando_instalacion && ($opcion == 'instalar' || $opcion == 'crear') && toba_modelo_instalacion::existe_info_basica()) {
                 $boton->set_sensitive(false);
             }
             //----
             $i++;
         }
         if (isset($atributos['tags']['gtk_separador'])) {
             $boton = new GtkSeparatorToolItem();
             $this->comp['caja_opciones']->insert($boton, $i);
             $i++;
         }
     }
     $this->comp['caja_opciones']->show_all();
 }
예제 #23
0
 function append_background()
 {
     if (!$this->get_n_pages()) {
         $this->background = true;
         $this->append($page = new TNotebookPage('X-Money', null));
         $page->pack_start($image = GtkImage::new_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . 'fundo.png'));
         $image->show();
     }
 }