示例#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
 /**
  * Class Constructor
  * @param $title Window's title
  */
 public function __construct($title = '')
 {
     parent::__construct();
     parent::set_position(Gtk::WIN_POS_CENTER);
     parent::connect('key_press_event', array($this, 'onKeyTest'));
     parent::connect_simple('destroy', array($this, 'onClose'));
     parent::set_title($title);
 }
示例#3
0
 public function __construct()
 {
     parent::__construct();
     parent::set_title('Incluir');
     parent::connect_simple('destroy', array('Gtk', 'main_quit'));
     parent::set_default_size(400, 240);
     parent::set_border_width(10);
     parent::set_position(GTK::WIN_POS_CENTER);
     $vbox = new GtkVBox();
     $this->labels['id'] = new GtkLabel('Código:');
     $this->campos['id'] = new GtkEntry();
     $this->campos['id']->set_size_request(80, -1);
     $this->labels['nome'] = new GtkLabel('Nome: ');
     $this->campos['nome'] = new GtkEntry();
     $this->campos['nome']->set_size_request(240, -1);
     $this->labels['endereco'] = new GtkLabel('Endereço: ');
     $this->campos['endereco'] = new GtkEntry();
     $this->campos['endereco']->set_size_request(240, -1);
     $this->labels['telefone'] = new GtkLabel('Telefone: ');
     $this->campos['telefone'] = new GtkEntry();
     $this->campos['telefone']->set_size_request(140, -1);
     $this->labels['id_cidade'] = new GtkLabel('Cidade: ');
     $this->campos['id_cidade'] = GtkComboBox::new_text();
     $this->campos['id_cidade']->set_size_request(240, -1);
     $this->campos['id_cidade']->insert_text(0, 'Porto Alegre');
     $this->campos['id_cidade']->insert_text(1, 'São Paulo');
     $this->campos['id_cidade']->insert_text(2, 'Rio de Janeiro');
     $this->campos['id_cidade']->insert_text(3, 'Belo Horizonte');
     foreach ($this->campos as $chave => $objeto) {
         $hbox = new GtkHBox();
         $hbox->pack_start($this->labels[$chave], false, false);
         $hbox->pack_start($this->campos[$chave], false, false);
         $this->labels[$chave]->set_size_request(100, -1);
         $this->labels[$chave]->set_alignment(1, 0.5);
         // xAlign, yalign (0.5, 1)
         $vbox->pack_start($hbox, false, false);
     }
     $vbox->pack_start(new GtkHSeparator(), true, true);
     // cria uma caixa de botões
     $buttonbox = new GtkHButtonBox();
     $buttonbox->set_layout(Gtk::BUTTONBOX_START);
     // cria um botão de salvar
     $botao = GtkButton::new_from_stock(Gtk::STOCK_SAVE);
     // conecta o botão ao método onSaveClick()
     $botao->connect_simple('clicked', array($this, 'onSaveClick'));
     $buttonbox->pack_start($botao, false, false);
     // cria um botão de fechar a aplicação
     $botao = GtkButton::new_from_stock(Gtk::STOCK_CLOSE);
     $botao->connect_simple('clicked', array('Gtk', 'main_quit'));
     $buttonbox->pack_start($botao, false, false);
     $vbox->pack_start($buttonbox, false, false);
     parent::add($vbox);
     // exibe a janela
     parent::show_all();
 }
 /**
  * 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;
     set_error_handler(array('TCoreApplication', 'errorHandler'));
 }
示例#5
0
$chnapis3->modify_font(new PangoFontDescription($font . "  25"));
$chnapis3->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#800000"));
$v2box->pack_start($h2box = new GtkHBox(), 1, 1);
$h2box->pack_start($G["displejchyby"] = new GtkLabel("0"), 1);
$G["displejchyby"]->modify_font(new PangoFontDescription($font . "  85"));
$G["displejchyby"]->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#800000"));
$h2box->pack_start($G["displejodm"] = new GtkLabel('0'), 1);
$G["displejodm"]->modify_font(new PangoFontDescription($font . "  85"));
$G["displejodm"]->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#800000"));
$h2box->pack_start($G["displejtb"] = new GtkLabel('0.00'), 1);
$G["displejtb"]->modify_font(new PangoFontDescription($font . "  85"));
$G["displejtb"]->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#800000"));
$window = new GtkWindow();
$window->set_title($argv[0]);
$window->set_size_request(750, 550);
$window->connect_simple('destroy', array('Gtk', 'main_quit'));
$window->add($vbox = new GtkVBox());
$window->modify_bg(Gtk::STATE_NORMAL, GdkColor::parse("#ffffff"));
$window->connect_after('key-press-event', 'onKeyPress');
function onKeyPress($widget, $event)
{
    global $righthand, $lefthand;
    if (get_class($widget) == "GtkWindow") {
        echo "Pressed: " . $event->keyval;
    }
    return true;
}
$G["rezimdisplej"] = new GtkLabel('A->A');
$G["sensorstatus1"] = new GtkLabel('[ ]');
$G["sensorstatus2"] = new GtkLabel('[ ]');
setup_menu($vbox, $menu_definition);
示例#6
0
文件: test.php 项目: Harvie/Programs
#!/usr/bin/php -c/etc/php/php-gtk.ini
#GTK Hello world! by Harvie 2oo9

<?php 
if (!class_exists('gtk')) {
    die("Please load the php-gtk2 module in your php.ini\r\n");
}
$wnd = new GtkWindow();
$wnd->set_title('Hello world');
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));
$lblHello = new GtkLabel("Just wanted to say\r\n'Hello world!'");
$wnd->add($lblHello);
$wnd->show_all();
Gtk::main();