/** * 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(); }
/** * 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); }
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')); }
/** * Cria a janela no modo splash * * @name set_splash_image($image) * @param string $image Caminho para a imagem do splash * @return GtkFixed */ public function set_splash_image($image) { // Carrega a imagem $pixbuf = GdkPixbuf::new_from_file($image); // Modifica as propriedades da janela parent::set_type_hint(Gdk::WINDOW_TYPE_HINT_SPLASHSCREEN); parent::set_size_request($pixbuf->get_width(), $pixbuf->get_height()); parent::set_position(GTK::WIN_POS_CENTER); parent::realize(); // Adiciona a imagem no fundo do GtkWindow list($pixmap, $mask) = $pixbuf->render_pixmap_and_mask(255); $style = parent::get_style(); $style = $style->copy(); $style->bg_pixmap[Gtk::STATE_NORMAL] = $pixmap; parent::set_style($style); // Adiciona um fixed para futuros widgets $fixed = new GtkFixed(); parent::add($fixed); // Mostra o splash parent::show_all(); // Retorna o fixed para adição de widgets return $fixed; }
<?php $window = new GtkWindow(); $window->set_size_request(400, 240); $window->connect_simple('destroy', array('Gtk', 'main_quit')); $window->set_position(Gtk::WIN_POS_CENTER_ALWAYS); $window->add($vbox = new GtkVBox()); // display title $title = new GtkLabel("Search for text in GtkTextView - Part 1\n"); $title->modify_font(new PangoFontDescription("Times New Roman Italic 10")); $title->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#0000ff")); $title->set_size_request(-1, 60); $title->set_justify(Gtk::JUSTIFY_CENTER); $alignment = new GtkAlignment(0.5, 0, 0, 0); $alignment->add($title); $vbox->pack_start($alignment, 0, 0); $vbox->pack_start(new GtkLabel(), 0, 0); $hbox = new GtkHBox(); $hbox->pack_start(new GtkLabel("Search string: "), 0); $hbox->pack_start($entry = new GtkEntry(), 0); $hbox->pack_start($button_search = new GtkButton('Search'), 0); $vbox->pack_start($hbox, 0); $button_search->connect('clicked', 'on_search_button', $entry); // note 1 // Create a new buffer and a new view to show the buffer. $buffer = new GtkTextBuffer(); $view = new GtkTextView(); $view->set_buffer($buffer); $view->modify_font(new PangoFontDescription("Verdana italic 14")); $view->set_wrap_mode(Gtk::WRAP_WORD); $scrolled_win = new GtkScrolledWindow();
$state = $event->state; } if ($state & GDK_BUTTON1_MASK && $pixmap) { draw_brush($widget, $x, $y); } return true; } function draw_brush($widget, $x, $y) { global $pixmap; gdk::draw_arc($pixmap, $widget->style->black_gc, true, $x - 4, $y - 4, 8, 8, 0, 64 * 360); $widget->draw(new GdkRectangle($x - 4, $y - 4, 8, 8)); } $window = new GtkWindow(); $window->set_name('Test Input'); $window->set_position(GTK_WIN_POS_CENTER); $window->connect_object('destroy', array('gtk', 'main_quit')); $vbox = new GtkVBox(); $window->add($vbox); $vbox->show(); $drawing_area = new GtkDrawingArea(); $drawing_area->size(300, 300); $vbox->pack_start($drawing_area); $drawing_area->show(); $drawing_area->connect('expose_event', 'expose_event'); $drawing_area->connect('configure_event', 'configure_event'); $drawing_area->connect('motion_notify_event', 'motion_notify_event'); $drawing_area->connect('button_press_event', 'button_press_event'); $drawing_area->set_events(GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); $button = new GtkButton('Quit'); $vbox->pack_start($button, false, false);