protected function setUpMore() { $wnd = new GtkWindow(); $wnd->add($this->tv); $this->tv->realize(); $this->mod = new GtkListStore(Gtk::TYPE_STRING); $this->tv->set_model($this->mod); $this->col = new GtkTreeViewColumn('Title', new GtkCellRendererText(), 'text', 0); $this->tv->append_column($this->col); $this->mod->append(array('One')); $this->mod->append(array('Two')); }
/** * 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(); }
function __construct($parent = null) { parent::__construct(); if ($parent) { $this->set_screen($parent->get_screen()); } else { $this->connect_simple('destroy', array('gtk', 'main_quit')); } $this->set_title(__CLASS__); $this->set_position(Gtk::WIN_POS_CENTER); $this->set_default_size(-1, 500); $this->set_border_width(8); $hbox = new GtkHBox(false, 8); $this->add($hbox); $scrolled = new GtkScrolledWindow(); $scrolled->set_shadow_type(Gtk::SHADOW_ETCHED_IN); $scrolled->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); $hbox->pack_start($scrolled, false, false, 0); $model = $this->create_model(); $treeview = new GtkTreeView($model); $scrolled->add($treeview); $column = new GtkTreeViewColumn(); $column->set_title('Icon and Constant'); $cell_renderer = new GtkCellRendererPixbuf(); $column->pack_start($cell_renderer, false); $column->set_attributes($cell_renderer, 'stock-id', 1); $cell_renderer = new GtkCellRendererText(); $column->pack_start($cell_renderer, true); $column->set_cell_data_func($cell_renderer, 'constant_setter'); $treeview->append_column($column); $cell_renderer = new GtkCellRendererText(); $treeview->insert_column_with_data_func(-1, 'Label', $cell_renderer, 'label_setter'); $cell_renderer = new GtkCellRendererText(); $treeview->insert_column_with_data_func(-1, 'Accelerator', $cell_renderer, 'accel_setter'); $cell_renderer = new GtkCellRendererText(); $treeview->insert_column_with_data_func(-1, 'ID', $cell_renderer, 'id_setter'); $align = new GtkAlignment(0.5, 0, 0, 0); $hbox->pack_end($align, true, true, 0); $frame = new GtkFrame('Selection Info'); $align->add($frame); $vbox = new GtkVBox(false, 8); $vbox->set_border_width(4); $frame->add($vbox); $display = new StockItemDisplay(); $treeview->set_data('stock-display', $display); $display->type_label = new GtkLabel(); $display->constant_label = new GtkLabel(); $display->id_label = new GtkLabel(); $display->accel_label = new GtkLabel(); $display->icon_image = new GtkImage(); $vbox->pack_start($display->type_label, false, false, 0); $vbox->pack_start($display->icon_image, false, false, 0); $vbox->pack_start($display->accel_label, false, false, 0); $vbox->pack_start($display->constant_label, false, false, 0); $vbox->pack_start($display->id_label, false, false, 0); $selection = $treeview->get_selection(); $selection->set_mode(Gtk::SELECTION_SINGLE); $selection->connect('changed', array($this, 'on_selection_changed')); $this->show_all(); }
public function __construct() { parent::__construct(); $dbi = new DBInterface(); $this->strings = KioskClient::getStrings(); $this->set_position(Gtk::WIN_POS_CENTER); $this->set_default_size(300, 200); $this->set_resizable(false); $this->timeLabel = new GtkLabel($this->strings["timeLeftLabel_begin"] . '0' . $this->strings["timeLeftLabel_end"]); $this->set_title($this->strings["windowTitle_begin"] . '0' . $this->strings["windowTitle_end"]); $this->logoutButton = new GtkButton($this->strings['logoutButton']); $this->pauseButton = new GtkButton($this->strings['pauseButton']); $box = new GtkVBox(); $box->pack_start($this->timeLabel); if ($dbi->getSetting('max_pause_time')) { $box->pack_start($this->pauseButton); } $box->pack_start($this->logoutButton); # if ( DEBUG ) { # $this->quitButton = new GtkButton("Quit"); # $box->pack_start( $this->quitButton ); # } # $this->connect_simple( 'destroy', array('Gtk', 'main_quit') ); $this->add($box); }
function __construct() { parent::__construct(); require_once 'WidgetEditor.php'; $this->set_default_size(200, 200); $this->set_title('GtkWindow demo'); $this->connect_simple('destroy', array('gtk', 'main_quit')); $this->add($this->__create_box()); $this->show_all(); }
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(); }
function __construct($widget, $data) { parent::__construct(); $this->set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY); $this->set_title('WidgetEditor'); $this->table = new GtkTable(count($data), 2, false); foreach ($data as $nPos => $dat) { $this->addEditor($widget, $nPos, $dat); } $this->add($this->table); $this->show_all(); }
function __construct() { parent::__construct(); require_once 'WidgetEditor.php'; if (@$GLOBALS['framework']) { return; } $this->set_default_size(700, 300); $this->set_title('GtkIconView'); $this->connect_simple('destroy', array('gtk', 'main_quit')); $this->add($this->__create_box()); $this->show_all(); }
function __construct($parent = null) { parent::__construct(); if ($parent) { $this->set_screen($parent->get_screen()); } else { $this->connect_simple('destroy', array('gtk', 'main_quit')); } $this->set_title(__CLASS__); $this->set_position(Gtk::WIN_POS_CENTER); $this->set_default_size(-1, 500); $this->set_border_width(8); $hbox = new GtkHBox(false, 8); $this->add($hbox); $scrolled = new GtkScrolledWindow(); $scrolled->set_shadow_type(Gtk::SHADOW_ETCHED_IN); $scrolled->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); $hbox->pack_start($scrolled, false, false, 0); $this->list = new GtkListStore(Gtk::TYPE_STRING, GdkPixbuf::gtype, GdkPixbuf::gtype, Gtk::TYPE_LONG, Gtk::TYPE_LONG, Gtk::TYPE_STRING); $treeview = new GtkTreeView($this->list); $scrolled->add($treeview); $column = new GtkTreeViewColumn(); //$column->set_title('Name'); $cell_renderer = new GtkCellRendererText(); //$treeview->insert_column_with_data_func(-1, 'Name', $cell_renderer, 'smart_setter'); $treeview->append_column(new GtkTreeViewColumn('Name', $cell_renderer, 'text', 0)); $cell_renderer = new GtkCellRendererPixbuf(); $treeview->append_column(new GtkTreeViewColumn('Race', $cell_renderer, 'pixbuf', 1)); //$treeview->insert_column_with_data_func(-1, 'Race', $cell_renderer, 'smart_setter'); $cell_renderer = new GtkCellRendererPixbuf(); $treeview->append_column(new GtkTreeViewColumn('Class', $cell_renderer, 'pixbuf', 2)); //$treeview->insert_column_with_data_func(-1, 'Class', $cell_renderer, 'smart_setter'); $cell_renderer = new GtkCellRendererText(); //$treeview->insert_column_with_data_func(-1, 'Zone', $cell_renderer, 'smart_setter'); $cell_renderer = new GtkCellRendererText(); $treeview->append_column(new GtkTreeViewColumn('Level', $cell_renderer, 'text', 3)); //$treeview->insert_column_with_data_func(-1, 'LEVEL', $cell_renderer, 'smart_setter'); $cell_renderer = new GtkCellRendererText(); $treeview->append_column(new GtkTreeViewColumn('Ping', $cell_renderer, 'text', 4)); //$treeview->insert_column_with_data_func(-1, 'PING', $cell_renderer, 'smart_setter'); $treeview->append_column(new GtkTreeViewColumn('Zone', $cell_renderer, 'text', 5)); $align = new GtkAlignment(0.5, 0, 0, 0); $hbox->pack_end($align, true, true, 0); $selection = $treeview->get_selection(); $selection->set_mode(Gtk::SELECTION_SINGLE); //$selection->connect('changed', array($this, 'on_selection_changed')); $treeview->connect('key-press-event', array($this, 'on_selection_changed')); $treeview->connect('button-press-event', array($this, 'on_selection_changed')); $this->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')); }
function __construct($parent = null) { parent::__construct(); if (@$GLOBALS['framework']) { return; } if ($parent) { $this->set_screen($parent->get_screen()); } else { $this->connect_simple('destroy', array('gtk', 'main_quit')); } $this->set_title(__CLASS__); $this->set_position(Gtk::WIN_POS_CENTER); $this->set_border_width(8); $this->add($this->__create_box()); $this->show_all(); }
public function __construct($message) { parent::__construct(); $this->strings = KioskClient::getStrings(); $this->set_default_size(300, 200); $this->set_resizable(false); $this->set_keep_above(true); $this->set_title("Message: {$message}"); $this->messageLabel = new GtkLabel(); $this->messageLabel->set_use_markup(true); $this->messageLabel->set_markup($this->strings["message_begin"] . $message . $this->strings["message_end"]); $this->set_title($message); $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($this->messageLabel); $this->add($hbox); $this->show_all(); }
function __construct($titulo, $width, $height, $icone) { parent::__construct(); $this->set_transient_for($GLOBALS['XMONEY_JANELA_PRINCIPAL']); $this->set_modal(true); $this->set_title($titulo); $this->set_border_width(5); if ($width && $height) { $this->set_default_size($width, $height); } else { $this->set_resizable(false); } $this->set_position(Gtk::WIN_POS_CENTER); $this->set_icon_from_file(XMONEY_IMAGES . DIRECTORY_SEPARATOR . $icone); // accelgroup $this->add_accel_group($this->accel_group = new GtkAccelGroup()); // default_container $this->add($this->main_vbox = new GtkVBox()); $this->main_vbox->show(); }
function __construct() { parent::__construct(); $this->connect_simple('destroy', array('gtk', 'main_quit')); $this->set_title('PHP-Gtk2 Demos'); $this->set_default_size(800, 400); $hbox = new GtkHBox(false, 3); $this->add($hbox); $treeview = $this->__create_treeview(); $hbox->pack_start($treeview, false, false); $notebook = new GtkNotebook(); $hbox->pack_start($notebook, true); $notebook->append_page($this->__create_text(), new GtkLabel('Info')); $demobox = new GtkVBox(); $this->demobox = $demobox; $notebook->append_page($this->demobox, new GtkLabel('Demo')); list($text, $this->sourcebuffer) = $this->__create_source(); $notebook->append_page($text, new GtkLabel('Source')); $this->show_all(); }
function __construct($parent = null) { parent::__construct(); if ($parent) { $this->set_screen($parent->get_screen()); } else { $this->connect_simple('destroy', array('gtk', 'main_quit')); } $this->set_title("Pomm"); $this->set_position(Gtk::WIN_POS_CENTER); $this->set_default_size(850 + 100, 600 + 50); $this->set_border_width(0); $this->set_resizable(false); $pin = new GtkHPaned(); $pin->set_position(784); $vbox = new GtkVBox(false, 5); $this->add($vbox); $vbox->set_border_width(5); $pin->add1($this->__create_box()); $pin->add2($this->__create_dbox()); $vbox->pack_start($pin); $button = new GtkButton('Update'); $button->connect('clicked', array($this, '__update')); $button2 = new GtkButton('Filter'); $button2->connect('clicked', array($this, 'string_find')); $button3 = new GtkButton("LIST"); $button3->connect('clicked', array($this, 'set_mode_stat')); $bbox = new GtkHBox(false, 5); $bbox->pack_start($button); $bbox->pack_start($button2); $bbox->pack_start($button3); $this->sinfo = new GtkLabel(); $this->sinfo->set_markup('x:0 y:0 obj:0'); $paned = new GtkHPaned(); $paned->set_position(65 * 3); $paned->add1($bbox); $paned->add2($this->sinfo); $vbox->pack_end($paned, false, false, 0); //$this->set_icon_from_file("./img/4-1.gif"); $this->show_all(); }
function __construct($parent = null) { parent::__construct(); /** * Do I really need this? */ if ($parent) { $this->set_screen($parent->get_screen()); } else { $this->connect_simple('destroy', array('gtk', 'main_quit')); } $this->set_title(__CLASS__); $this->set_position(Gtk::WIN_POS_CENTER); $this->set_default_size(-1, 500); $this->set_border_width(8); $hpaned = new GtkHPaned(); $this->frame1 = new GtkFrame(null); $this->frame2 = new GtkFrame(null); $hpaned->add1($this->frame1); $hpaned->add2($this->frame2); $this->frame1->set_shadow_type(Gtk::SHADOW_IN); $this->frame2->set_shadow_type(Gtk::SHADOW_IN); $this->scrolled = new GtkScrolledWindow(null, null); $this->scrolled->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); $this->view = new GtkTreeView(); /* Allow multiple selections? $selection = $view->get_selection(); $selection->set_mode(Gtk::SELECTION_MULTIPLE); */ // Registar Events $veiw_selection = $this->view->get_selection(); $veiw_selection->connect('changed', array($this, 'changed')); $this->view->connect('row_expanded', array($this, 'click_section')); $this->connect('destroy', array($this, 'main_quit')); $this->setup_treeview($this->view); $this->scrolled->add_with_viewport($this->view); $this->frame1->add($this->scrolled); $this->add($hpaned); $this->show_all(); }
public function __construct($username) { parent::__construct(); $this->username = $username; $this->strings = KioskClient::getStrings(); # $this->set_default_size( 300, 200 ); $this->set_resizable(false); $this->set_modal(true); $this->set_keep_above(true); $this->set_title($this->strings['setPassword']); $this->messageLabel = new GtkLabel(); $this->messageLabel->set_use_markup(true); $this->messageLabel->set_markup($this->strings['setPassword']); $passwordLabel1 = new GtkLabel(); $passwordLabel1->set_use_markup(true); $passwordLabel1->set_label($this->strings['passwordLabel']); $this->passwordEntry1 = new GtkEntry(); $this->passwordEntry1->set_visibility(0); $passwordBox1 = new GtkHBox(); $passwordBox1->pack_start($passwordLabel1); $passwordBox1->pack_start($this->passwordEntry1); $passwordLabel2 = new GtkLabel(); $passwordLabel2->set_use_markup(true); $passwordLabel2->set_label($this->strings['passwordLabel']); $this->passwordEntry2 = new GtkEntry(); $this->passwordEntry2->set_visibility(0); $passwordBox2 = new GtkHBox(); $passwordBox2->pack_start($passwordLabel2); $passwordBox2->pack_start($this->passwordEntry2); $this->setPasswordButton = new GtkButton($this->strings['setPasswordButton']); $mainBox = new GtkVBox(); $mainBox->pack_start($this->messageLabel); $mainBox->pack_start($passwordBox1); $mainBox->pack_start($passwordBox2); $mainBox->pack_start($this->setPasswordButton); $this->add($mainBox); $this->connect('key-press-event', array(&$this, 'onKey'), $input); $this->setPasswordButton->connect_simple('clicked', array(&$this, 'onClick')); $this->show_all(); }
/** * 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; }
function __construct($parent = null) { parent::__construct(); $this->selected_file = ""; $this->hash_label_default = "Open a file (Ctrl+O) OR Type a sentence (Ctrl+T)"; $this->set_size_request(400, 60); $this->connect_simple('destroy', array('gtk', 'main_quit')); $this->set_title(__CLASS__); $this->set_position(Gtk::WIN_POS_CENTER); $this->add($vbox = new GtkVBox()); $accel_group = new GtkAccelGroup(); $this->add_accel_group($accel_group); $menu_definition = array('_File' => array('_Open|O', '_Type|T', '<hr>', 'E_xit'), '_Help' => array('_About|H')); // define menu definition $this->menu = new Menu($vbox, $menu_definition, $accel_group); // display title $button = new GtkButton('_Get Hash'); $button->connect('clicked', array($this, 'calculate')); $this->hash_label = new GtkLabel($this->hash_label_default); $vbox->pack_start($hbox = new GtkHBox()); $hbox->pack_start($this->hash_label); $hbox->pack_start($button, false, false, 0); $this->show_all(); }
<?php /* Create base window */ $window = new GtkWindow(); $window->set_title('Notebooks and Pages'); $window->connect_simple('destroy', array('gtk', 'main_quit')); $window->add($vbox = new GtkHBox()); $group = 'MyGroup'; $vbox->add($notebook1 = new GtkNoteBook()); $notebook1->append_page($label = new GtkLabel('This is the first page')); $notebook1->set_tab_detachable($label, true); $notebook1->append_page($label = new GtkLabel('This is the second page')); $notebook1->set_tab_detachable($label, true); $notebook1->append_page($label = new GtkLabel('This is the third page')); $notebook1->set_tab_detachable($label, true); $notebook1->set_group($group); var_dump($notebook1->get_group()); $vbox->add($notebook2 = new GtkNoteBook()); $notebook2->append_page($label = new GtkLabel('This is the first page')); $notebook2->set_tab_detachable($label, true); $notebook2->append_page($label = new GtkLabel('This is the second page')); $notebook2->set_tab_detachable($label, true); $notebook2->append_page($label = new GtkLabel('This is the third page')); $notebook2->set_tab_detachable($label, true); $notebook2->set_group($group); var_dump($notebook2->get_group()); unset($group); $vbox->add($notebook3 = new GtkNoteBook()); $notebook3->append_page($label = new GtkLabel('This is the first page')); $notebook3->set_tab_detachable($label, true); $notebook3->append_page($label = new GtkLabel('This is the second page'));
<?php $window = new GtkWindow(); $window->set_size_request(148, 240); $window->connect_simple('destroy', array('Gtk', 'main_quit')); $window->add($vbox = new GtkVBox()); // display title $title = new GtkLabel("Set up Volume Control\n" . "Part 1 - using GtkVScale"); $title->modify_font(new PangoFontDescription("Arial Narrow 8")); $title->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#0000ff")); $title->set_size_request(-1, 40); $title->set_justify(Gtk::JUSTIFY_CENTER); $alignment = new GtkAlignment(0.5, 0.5, 0, 0); $alignment->add($title); $vbox->pack_start($alignment, 0); $vol_adj = GtkVScale::new_with_range(-100, 80, 1); // note 1 $vbox->pack_start(new GtkLabel('Volume'), 0); $vbox->pack_start($vol_adj, 0); $vol_adj->set_size_request(10, 160); $vol_adj->set_inverted(1); // note 2 $vol_adj->connect('format-value', 'on_format_value'); // note 3 $window->show_all(); Gtk::main(); function on_format_value($scale, $value) { return $value . "dB"; // note 4 }
<?php $window = new GtkWindow(); $window->set_title($argv[0]); $window->set_size_request(400, 150); $window->connect_simple('destroy', array('Gtk', 'main_quit')); $window->add($vbox = new GtkVBox()); // define menu definition // define menu definition $menu_definition = array('_File' => array('_New', '_Open', '_Close', '<hr>', '_Save', 'Save _As', '<hr>', '_Quit'), '_Edit' => array('Cut', 'Copy', '_Paste', '<hr>', 'Select All', '<hr>', '_Undo', '_Redo')); setup_menu($vbox, $menu_definition); // display title $title = new GtkLabel("Set up Menu using GtkAction - Part 1"); $title->modify_font(new PangoFontDescription("Times New Roman Italic 10")); $title->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#0000ff")); $vbox->pack_start($title); $vbox->pack_start(new GtkLabel('')); $window->show_all(); Gtk::main(); function setup_menu($vbox, $menu_definition) { // note 1 $menubar = new GtkMenuBar(); // note 2 $vbox->pack_start($menubar, 0, 0); foreach ($menu_definition as $toplevel => $sublevels) { $menubar->append($top_menu = new GtkMenuItem($toplevel)); $menu = new GtkMenu(); $top_menu->set_submenu($menu); foreach ($sublevels as $item) { if ($item == '<hr>') {
return false; } function starttips($tipsquery, $tooltips) { if ($tooltips->enabled) { $tipsquery->start_query(); $tooltips->disable(); } else { // $tipsquery->stop_query(); - this is automatic when the caller button is clicked $tooltips->enable(); } } $window = new GtkWindow(); $window->set_title('Tooltip'); $window->connect_simple('destroy', array('gtk', 'main_quit')); $window->add($vbox = new GtkVBox()); $vbox->pack_start($button = new GtkButton('Button1')); $tooltips->set_tip($button, 'This is button 1', 'Here is some help for button 1'); $vbox->pack_start($button = new GtkButton('Button2')); $tooltips->set_tip($button, 'This is button 2. This is also a really long tooltip which probably won\'t fit on a single line and will therefore need to be wrapped. Hopefully the wrapping will work correctly.', 'Here is some Help for button 2'); $vbox->pack_start($button = new GtkButton('Override TipsQuery Label')); $tooltips->set_tip($button, 'Toggle TipsQuery view.', 'Help for Help?'); $popup = new GtkWindow(Gtk::WINDOW_POPUP); $popup->add($tipsquery = new GtkTipsQuery()); $tipsquery->set_labels('Click to get help', 'No help found'); $button->connect_simple('clicked', 'starttips', $tipsquery, $tooltips); $tipsquery->set_caller($button); $tipsquery->connect('widget-entered', 'showtips'); $window->show_all(); $popup->show_all(); Gtk::main();
<?php //Create our widgets $wnd = new GtkWindow(); $box = new GtkVBox(); $frame = new GtkFrame('Frame'); $btn = new GtkButton('Button'); //Pack them into each other $wnd->add($box); $box->add($frame); $frame->add($btn); //Give some a custom name $wnd->set_name('My window'); $btn->set_name('demo button'); //And now echo the class path of the button, // and the normal path echo 'class_path: "' . $btn->class_path() . "\"\n"; echo 'path: "' . $btn->path() . "\"\n"; /* Returns: class_path: "GtkWindow.GtkVBox.GtkFrame.GtkButton" path: "My window.GtkVBox.GtkFrame.demo button" */
$r = $radius + $radius / 3.0 * sin($f * 2.0 * pi()); $xpos = floor($xmid + $r * cos($ang) - $iw / 2.0 + 0.5); $ypos = floor($ymid + $r * sin($ang) - $ih / 2.0 + 0.5); $k = $i & 1 ? sin($f * 2.0 * pi()) : cos($f * 2.0 * pi()); $k = 2.0 * $k * $k; $k = max(0.25, $k); $r1 = new GdkRectangle($xpos, $ypos, $iw * $k, $ih * $k); $r2 = new GdkRectangle(0, 0, $back_width, $back_height); $dest = $r1->intersect($r2); $images[$i]->composite($frame, $dest->x, $dest->y, $dest->width, $dest->height, $xpos, $ypos, $k, $k, Gdk::INTERP_NEAREST, $i & 1 ? max(127, abs(255 * sin($f * 2.0 * pi()))) : max(127, abs(255 * cos($f * 2.0 * pi())))); } $da->queue_draw(); $frame_num++; return true; } $timeout_id = 0; //pixbuf_init (); if (!load_pixbufs()) { die("main(): Could not load all the pixbufs!"); } $frame = new GdkPixbuf(Gdk::COLORSPACE_RGB, false, 8, $back_width, $back_height); $window = new GtkWindow(Gtk::WINDOW_TOPLEVEL); $window->set_size_request($back_width, $back_height); $window->set_resizable(false); $window->connect_simple('destroy', array('gtk', 'main_quit')); $da = new GtkDrawingArea(); $da->connect('expose_event', 'expose_cb'); $window->add($da); Gtk::timeout_add(FRAME_DELAY, 'timeout'); $window->show_all(); Gtk::main();
<?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();
Gtk::main_quit(); } /* * Called when button is clicked. Print the message and destroy the window. */ function hello() { global $window; print "Hello World!\n"; $window->destroy(); } /* * Create a new top-level window and connect the signals to the appropriate * functions. Note that all constructors must be assigned by reference. */ $window = new GtkWindow(); $window->connect('destroy', 'destroy'); $window->connect('delete-event', 'delete_event'); $window->set_border_width(10); /* * Create a button, connect its clicked signal to hello() function and add * the button to the window. */ $button = new GtkButton('Hello World!'); $button->connect('clicked', 'hello'); /* * Create a new tooltips object and use it to set a tooltip for the button. */ $tt = new GtkTooltips(); $tt->set_delay(200); $tt->set_tip($button, 'Prints "Hello World!"', '');
public function __construct() { parent::__construct(); $this->window(); }
$chnapis->modify_font(new PangoFontDescription($font . " 25")); $chnapis->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#800000")); $h3box->pack_start($chnapis3 = new GtkLabel("TB"), 1); $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');
<?php $window = new GtkWindow(); $window->set_default_size(120, 120); $vbox = new GtkVBox(); // new Button $button = new GtkButton(); $button->set_label('Icon Test'); $p = GdkPixbuf::new_from_file('images/publica.png'); $a = new GtkImage(); $a->set_from_pixbuf($p); $button->set_image($a); $vbox->pack_start($button, false, false); $window->add($vbox); $window->show_all(); Gtk::main();