コード例 #1
0
 function __construct($toba_instalador)
 {
     $this->toba_instalador = $toba_instalador;
     $archivo = dirname(__FILE__) . '/toba.glade';
     $glade = new GladeXML($archivo, 'dlg_crear_instancia');
     foreach (self::$comp_req as $comp) {
         $this->comp[$comp] = $glade->get_widget($comp);
     }
     $glade->signal_autoconnect_instance($this);
     //---Bases disponibles
     $store = new GtkListStore(Gtk::TYPE_STRING);
     $instalacion = $this->toba_instalador->get_instalacion();
     foreach ($instalacion->get_lista_bases() as $db) {
         $param = $instalacion->get_parametros_base($db);
         $store->append(array($db));
     }
     $this->comp['combo_base']->set_model($store);
     $cellRenderer = new GtkCellRendererText();
     $this->comp['combo_base']->pack_start($cellRenderer);
     $this->comp['combo_base']->set_active(0);
     //--- Pone los proyectos
     $proyectos = toba_modelo_proyecto::get_lista();
     foreach ($proyectos as $path => $id) {
         $label = $path == $id ? $id : "{$id} (Directorio {$path})";
         $check = new GtkCheckButton($label);
         $check->set_use_underline(false);
         $this->check_proyectos[] = array($id, $path, $check);
         $check->show();
         $this->comp['box_proyectos']->pack_start($check);
     }
 }
コード例 #2
0
 function evt__cambio_directorio()
 {
     $modelo = new GtkListStore(Gtk::TYPE_STRING);
     $path = $this->comp['edit_toba']->get_text() . '/instalacion';
     $instancia = $this->toba_instalador->get_instancia($this->param_comando[1]);
     foreach ($instancia->get_lista($path) as $id_instancia) {
         $iter = $modelo->append(array($id_instancia));
     }
     $this->comp['combo_instancia']->set_model($modelo);
     if (isset($iter)) {
         $this->comp['combo_instancia']->set_active_iter($iter);
     }
 }
コード例 #3
0
 function __create_box()
 {
     $box = new GtkVBox();
     $box->pack_start(new GtkLabel('Double click with the mouse on a file, or select by key and press return'), false);
     $paned = new GtkHPaned();
     $paned->set_position(200);
     //filename, markup-filename, fullpath, is_dir, preview image
     $mFile = new GtkListStore(GObject::TYPE_STRING, GObject::TYPE_STRING, GObject::TYPE_STRING, GObject::TYPE_BOOLEAN, GdkPixbuf::gtype);
     $mFile->set_sort_column_id(0, Gtk::SORT_ASCENDING);
     $vFile = new GtkTreeView($mFile);
     $col = new GtkTreeViewColumn('Image', new GtkCellRendererPixbuf(), 'pixbuf', 4);
     $text = new GtkCellRendererText();
     $col->pack_start($text);
     $col->add_attribute($text, 'markup', 1);
     $vFile->append_column($col);
     $vFile->set_headers_visible(false);
     $vFile->connect('key-press-event', array($this, 'onPressFile'));
     $vFile->connect('button-press-event', array($this, 'onPressFile'));
     /*
         GtkIconView has some problems with text that are too long
           and missing icons
             $vFile = new GtkIconView();
             $vFile->set_model($mFile);
             $vFile->set_columns(1);
             $vFile->set_pixbuf_column(3);
             $vFile->set_text_column(0);
             $vFile->set_item_width(100);
     */
     $this->loadFiles($mFile, getcwd());
     $scrwndFiles = new GtkScrolledWindow();
     $scrwndFiles->add($vFile);
     $scrwndFiles->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
     $vboxFile = new GtkVBox();
     $vboxFile->pack_start($scrwndFiles);
     $chkImg = new GtkCheckbutton('Load preview images');
     $chkImg->set_active(true);
     $chkImg->connect('toggled', array($this, 'onCheckPreview'));
     $vboxFile->pack_start($chkImg, false);
     $paned->add1($vboxFile);
     $this->img = new GtkImage();
     $scrwndImg = new GtkScrolledWindow();
     $scrwndImg->add_with_viewport($this->img);
     $scrwndImg->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
     $paned->add2($scrwndImg);
     $box->pack_end($paned);
     return $box;
 }
コード例 #4
0
 function __construct($toba_instalador, $param_comando)
 {
     $this->param_comando = $param_comando;
     $this->toba_instalador = $toba_instalador;
     $archivo = dirname(__FILE__) . '/toba.glade';
     $glade = new GladeXML($archivo, 'dlg_cargar_proyecto');
     foreach (self::$comp_req as $comp) {
         $this->comp[$comp] = $glade->get_widget($comp);
     }
     $glade->signal_autoconnect_instance($this);
     $modelo = new GtkListStore(Gtk::TYPE_STRING, Gtk::TYPE_STRING);
     $opciones = toba_modelo_proyecto::get_lista();
     print_r($opciones);
     $iter = $modelo->append(array($this->label_otro, null));
     foreach ($opciones as $path => $id) {
         $label = $id == $path ? $id : "{$id} ({$path})";
         $modelo->append(array($label, $id));
     }
     $this->comp['combo_proyecto']->set_model($modelo);
     $this->comp['combo_proyecto']->set_active_iter($iter);
     $this->evt__cambio_proyecto();
 }
コード例 #5
0
 function __create_treeview()
 {
     $this->load_demos();
     $model = new GtkListStore(GObject::TYPE_PHP_VALUE, GObject::TYPE_STRING);
     //		$model->append(array("asd", "aswdasd"));//???????
     foreach ($this->demos as $demo) {
         $iter = $model->append();
         $model->set($iter, 0, $demo);
     }
     $treeview = new GtkTreeView($model);
     $cell_renderer = new GtkCellRendererText();
     $treeview->insert_column_with_data_func(-1, 'Demos', $cell_renderer, array(&$this, 'label_setter'));
     $selection = $treeview->get_selection();
     $selection->set_mode(Gtk::SELECTION_SINGLE);
     $selection->connect('changed', array($this, 'demo_selected'));
     //crashes as gboxed can't be instantiated
     //		$treeview->connect('row-activated', array($this, 'demo_activate'));
     //		$column = new GtkTreeViewColumn();
     //		$column->set_title('Demos');
     //		$treeview->append_column($column);
     return $treeview;
 }
コード例 #6
0
ファイル: GtkListStore.php プロジェクト: amitjoy/php-gtk
function display_table($vbox, $data)
{
    // Set up a scroll window
    $scrolled_win = new GtkScrolledWindow();
    $scrolled_win->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    $vbox->pack_start($scrolled_win);
    // Creates the list store
    if (defined("GObject::TYPE_STRING")) {
        $model = new GtkListStore(GObject::TYPE_STRING, GObject::TYPE_STRING, GObject::TYPE_LONG, GObject::TYPE_DOUBLE);
        // note 2
    } else {
        $model = new GtkListStore(Gtk::TYPE_STRING, Gtk::TYPE_STRING, Gtk::TYPE_LONG, Gtk::TYPE_DOUBLE);
        // note 2
    }
    $field_header = array('Row #', 'Description', 'Qty', 'Price');
    // note 3
    // Creates the view to display the list store
    $view = new GtkTreeView($model);
    // note 4
    $scrolled_win->add($view);
    // note 5
    // Creates columns
    for ($col = 0; $col < count($field_header); ++$col) {
        $cell_renderer = new GtkCellRendererText();
        $column = new GtkTreeViewColumn($field_header[$col], $cell_renderer, 'text', $col);
        $view->append_column($column);
    }
    // pupulates the data
    for ($row = 0; $row < count($data); ++$row) {
        $values = array();
        for ($col = 0; $col < count($data[$row]); ++$col) {
            $values[] = $data[$row][$col];
        }
        $model->append($values);
        // note 6
    }
}
コード例 #7
0
ファイル: TEntry.class.php プロジェクト: enieber/adianti
 /**
  * Define options for completion
  * @param $options array of options for completion
  */
 function setCompletion($options)
 {
     $store = new GtkListStore(GObject::TYPE_STRING);
     if (is_array($options)) {
         foreach ($options as $option) {
             $store->append(array($option));
         }
     }
     $completion = new GtkEntryCompletion();
     $completion->set_model($store);
     $completion->set_text_column(0);
     parent::set_completion($completion);
 }
コード例 #8
0
 function __create_completion_model()
 {
     $this->inputHTTP = $store = new GtkListStore(Gtk::TYPE_STRING);
     $iter = $store->append();
     $store->set($iter, 0, 'GNOME');
     return $store;
 }
コード例 #9
0
ファイル: insert.php プロジェクト: phpsource/doc-gtk
<?php

//Create new store with two columns
$store = new GtkListStore(Gobject::TYPE_STRING, Gobject::TYPE_LONG);
//insert the rows at different positions
$store->insert(1, array('Tokio', 34100000));
$store->insert(0, array('Mexico city', 22650000));
//use the iterator to set the data after insertion
$iter = $store->insert(1);
$store->set($iter, 0, 'Seoul', 1, 22250000);
コード例 #10
0
 function evt__cambiar_proyecto()
 {
     $combo = $this->comp['combo_instancia'];
     $iter = $combo->get_active_iter();
     $modelo = new GtkListStore(Gtk::TYPE_STRING);
     if (isset($iter)) {
         $instancia = $combo->get_model()->get_value($iter, 0);
     }
     $combo = $this->comp['combo_proyecto'];
     $iter = $combo->get_active_iter();
     $modelo = new GtkListStore(Gtk::TYPE_STRING);
     if (isset($iter) && isset($instancia)) {
         $id_proyecto = $combo->get_model()->get_value($iter, 0);
         foreach ($this->toba_instalador->get_instancia($instancia)->get_proyecto($id_proyecto)->get_indice_fuentes() as $fuente) {
             $iter = $modelo->append(array($fuente));
         }
     }
     $this->comp['combo_fuente']->set_model($modelo);
     $this->evt__cambiar_fuente();
 }
コード例 #11
0
ファイル: foreach.php プロジェクト: phpsource/doc-gtk
<?php

$store = new GtkListStore(Gobject::TYPE_STRING, Gobject::TYPE_LONG);
$store->append(array('Tokio', 34100000));
$store->append(array('Mexico city', 22650000));
$store->append(array('New York', 21850000));
$store->append(array('São Paulo', 20200000));
/*
* And now show what we've got in the store
*/
function echoRow($store, $path, $iter)
{
    $city = $store->get_value($iter, 0);
    $number = $store->get_value($iter, 1);
    echo $city . ' has ' . $number . " inhabitants.\r\n";
}
$store->foreach('echoRow');
コード例 #12
0
ファイル: swap.php プロジェクト: phpsource/doc-gtk
<?php

$store = new GtkListStore(Gobject::TYPE_STRING, Gobject::TYPE_LONG);
//insert the rows at different positions
$tokio = $store->insert(0, array('Tokio', 34100000));
$mexico = $store->insert(1, array('Mexico city', 22650000));
//we swap so that mexico is first
$store->swap($tokio, $mexico);
//show the list
function echoRow($store, $path, $iter)
{
    echo $store->get_value($iter, 0) . "\r\n";
}
$store->foreach('echoRow');
コード例 #13
0
$tipswindow->add($content);
$content->show();
$text->set_tooltip_window($tipswindow);
$text->connect('query-tooltip', 'redboxtip');
// trigger tooltip query for the display on button press
$vbox->add($button = new GtkButton('Trigger Tooltip passing Display'));
$button->connect_simple('clicked', array('GtkTooltip', 'trigger_tooltip_query'), GdkDisplay::get_default());
$button->set_has_tooltip(true);
$button->connect('query-tooltip', 'texttip');
// trigger tooltip query for a display where the widget is on button press
$vbox->add($button = new GtkButton('Trigger Tooltip passing Widget'));
$button->connect_simple('clicked', array($label, 'trigger_tooltip_query'));
$button->set_has_tooltip(true);
$button->connect('query-tooltip', 'texttip');
/* Generic liststore for the next tests */
$store = new GtkListStore(Gobject::TYPE_STRING, Gobject::TYPE_STRING, GdkPixbuf::gtype);
$store->append(array('foo', 'tip1', $window->render_icon(Gtk::STOCK_OPEN, Gtk::ICON_SIZE_DIALOG)));
$store->append(array('bar', 'tip2', $window->render_icon(Gtk::STOCK_CLOSE, Gtk::ICON_SIZE_DIALOG)));
$store->append(array('baz', 'tip3', $window->render_icon(Gtk::STOCK_SAVE, Gtk::ICON_SIZE_DIALOG)));
$store->append(array('kitty', 'tip4', $window->render_icon(Gtk::STOCK_OK, Gtk::ICON_SIZE_DIALOG)));
// callback that tells us if we have an item at the spot
function checkcontext($widget, $x, $y, $keyboard_mode, $tooltip)
{
    $list = $widget->get_tooltip_context($x, $y, $keyboard_mode);
    if (!$list) {
        return false;
    }
    list($model, $path, $iter) = $list;
    $tooltip->set_text($model->get_value($iter, 1));
    $widget->set_tooltip_item($tooltip, $path);
    // use set_tooltip_row for textview
コード例 #14
0
<?php

/**
*   FIXED by Andrei on 2005-10-19 22:38
*   php-gtk/ext/gtk+/gtktreeview.overrides:1.20
*   Problem reason: Wrong alloc used
*/
// Create a list store.
$listStore = new GtkListStore(Gtk::TYPE_STRING, Gtk::TYPE_LONG, Gtk::TYPE_DOUBLE);
// Add some product data.
$iter = $listStore->append(array('Crisscott T-Shirts', 10, 19.95));
$iter = $listStore->prepend(array('PHP-GTK Bumper Stickers', 37, 1.99));
$iter = $listStore->prepend(array('Pro PHP-GTK', 23, 44.95));
/**
 * Weird issue 1:
 * When the array is initialized to another array first
 * there is not problem, but if the array is created inside
 * the call to insert, it fails with the following message:

(listing9-3.php:1918): GLib-GObject-WARNING **: gvalue.c:89: cannot initialize GValue with type `gdouble', the value has already been initialized as `(null)'
PHP Warning:  PHP-GTK internal error: unsupported type (null) in /home/scott/authoring/Apress/chapter9/listing9-3.php on line 23
PHP Warning:  Cannot set row: type of element 2 does not match the model in /home/scott/authoring/Apress/chapter9/listing9-3.php on line 23

(listing9-3.php:1918): GLib-GObject-CRITICAL **: g_value_unset: assertion `G_IS_VALUE (value)' failed
*/
$iter = $listStore->insert(2, array('Crisscott Pencils', 18, 0.99));
// Comment the above line and uncomment these two to test.
//$tmp = array('Crisscott Pencils', 18, .99);
//$iter = $listStore->insert(2, $tmp);
/**
 * Weird issue 2:
コード例 #15
0
ファイル: move_before.php プロジェクト: phpsource/doc-gtk
<?php

$store = new GtkListStore(Gobject::TYPE_STRING, Gobject::TYPE_LONG);
$tokio = $store->insert(0, array('Tokio', 34100000));
$mexico = $store->insert(1, array('Mexico city', 22650000));
$seoul = $store->insert(2, array('Seoul', 22250000));
//move Seoul before Mexico
$store->move_before($seoul, $mexico);
//show the list
function echoRow($store, $path, $iter)
{
    echo $store->get_value($iter, 0) . "\r\n";
}
$store->foreach('echoRow');
コード例 #16
0
ファイル: append.php プロジェクト: phpsource/doc-gtk
<?php

//Create new store with two columns
$store = new GtkListStore(Gobject::TYPE_STRING, Gobject::TYPE_LONG);
//append one row
$store->append(array('Tokio', 34100000));
//append another row
$store->append(array('Mexico city', 22650000));
コード例 #17
0
 function __create_completion_model()
 {
     $store = new GtkListStore(GObject::TYPE_STRING);
     $iter = $store->append();
     $store->set($iter, 0, 'GNOME');
     $iter = $store->append();
     $store->set($iter, 0, 'total');
     $iter = $store->append();
     $store->set($iter, 0, 'totally');
     $iter = $store->append();
     $store->set($iter, 0, 'PHP');
     $iter = $store->append();
     $store->set($iter, 0, 'PHP-Gtk2');
     return $store;
 }
コード例 #18
0
 private function create_model()
 {
     $store = new GtkListStore(GObject::TYPE_PHP_VALUE, GObject::TYPE_STRING);
     $ids = Gtk::stock_list_ids();
     sort($ids);
     foreach ($ids as $id) {
         $info = new StockItemInfo($id);
         $stock_item = Gtk::stock_lookup($id);
         if ($stock_item) {
             $info->stock_item = $stock_item;
         } else {
             $info->stock_item = array('', '', 0, 0, '');
         }
         $icon_set = GtkIconFactory::lookup_default($id);
         if ($icon_set) {
             $sizes = $icon_set->get_sizes();
             $size = $sizes[0];
             for ($i = 0; $i < count($sizes); $i++) {
                 if ($sizes[$i] == Gtk::ICON_SIZE_MENU) {
                     $size = Gtk::ICON_SIZE_MENU;
                     break;
                 }
             }
             $info->small_icon = $this->render_icon($info->stock_id, $size);
             if ($size != Gtk::ICON_SIZE_MENU) {
                 list($width, $height) = Gtk::icon_size_lookup(Gtk::ICON_SIZE_MENU);
                 $info->small_icon = $info->small_icon->scale_simple($width, $height, 'bilinear');
             }
         } else {
             $info->small_icon = null;
         }
         if ($info->stock_item[3] == 0) {
             $info->accel_str = '';
         } else {
             $info->accel_str = '<' . Gtk::accelerator_get_label($info->stock_item[3], $info->stock_item[2]) . '>';
         }
         $iter = $store->append();
         $store->set($iter, 0, $info, 1, $id);
     }
     return $store;
 }
コード例 #19
0
ファイル: constructor.php プロジェクト: phpsource/doc-gtk
<?php

/*  GtkListStore example
 Here we create a list of the largest cities.
 For that we need a list store with two columns:
 The name and the number of inhabitants.
 The "name" is of type "string", and the number
 of inhabitants is of type long (big integer).
*/
$store = new GtkListStore(Gobject::TYPE_STRING, Gobject::TYPE_LONG);
/*
* Using the "set" method
*/
//at first, get an iterator for a new row
$iterator = $store->append();
//now use that to set the name at that row (column 0)
$store->set($iterator, 0, 'Tokio');
//same row: set the inhabitants into column 1
$store->set($iterator, 1, 34100000);
//You can set a whole row at once:
$iterator = $store->append();
//we add the data "Mexico city" at column 0 and
// "22 million" at column 1 at the row $iterator
$store->set($iterator, 0, 'Mexico city', 1, 22650000);
//Or, even faster: don't even create an iterator variable
$store->set($store->append(), 0, 'Seoul', 1, 22250000);
/*
* Using "append" to add a row without an iterator
*/
$store->append(array('New York', 21850000));
$store->append(array('São Paulo', 20200000));
コード例 #20
0
function uprav_behy()
{
    global $G, $model, $view;
    #debug_log('úprava behov');
    $dialog = new GtkDialog();
    // note 1
    $viewport1 = new GtkViewPort();
    $dialog->set_title('Behy');
    $dialog->set_position(GTK::WIN_POS_CENTER);
    $dialog->set_default_size(960, 420);
    $model = new GtkListStore(Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING, Gobject::TYPE_STRING);
    #datum
    #nazov
    #druh (OA, OJ, A1, A2, A3, J1, J2, J3)
    #rozhodca
    #$rozhodcovia=explode(",",$G["config"]->__get("rozhodca"));
    $view = new GtkTreeView($model);
    #	$view->set_grid_lines(Gtk::TREE_VIEW_GRID_LINES_BOTH);
    $column1 = new GtkTreeViewColumn('Kód');
    $column2 = new GtkTreeViewColumn('Názov');
    $column3 = new GtkTreeViewColumn('Filter');
    $column4 = new GtkTreeViewColumn('Dátum');
    $column5 = new GtkTreeViewColumn('Rozhodca');
    $column6 = new GtkTreeViewColumn('Dĺžka');
    $column7 = new GtkTreeViewColumn('Prekážky');
    $column8 = new GtkTreeViewColumn('Štd.č');
    $column9 = new GtkTreeViewColumn('Max.č');
    $view->append_column($column1);
    $view->append_column($column2);
    $view->append_column($column3);
    $view->append_column($column4);
    $view->append_column($column5);
    $view->append_column($column6);
    $view->append_column($column7);
    $view->append_column($column8);
    $view->append_column($column9);
    $cell_renderer1 = new GtkCellRendererText();
    $cell_renderer2 = new GtkCellRendererText();
    $cell_renderer3 = new GtkCellRendererText();
    $cell_renderer4 = new GtkCellRendererText();
    $cell_renderer5 = new GtkCellRendererText();
    $cell_renderer6 = new GtkCellRendererText();
    $cell_renderer7 = new GtkCellRendererText();
    $cell_renderer8 = new GtkCellRendererText();
    $cell_renderer9 = new GtkCellRendererText();
    $cell_renderer1->set_property('width', 60);
    $cell_renderer1->set_property('editable', true);
    $cell_renderer2->set_property('width', 220);
    $cell_renderer2->set_property('editable', true);
    $cell_renderer3->set_property('width', 50);
    $cell_renderer3->set_property('editable', true);
    $cell_renderer4->set_property('width', 80);
    $cell_renderer4->set_property('editable', true);
    $cell_renderer5->set_property('width', 180);
    $cell_renderer5->set_property('editable', true);
    $cell_renderer6->set_property('width', 50);
    $cell_renderer6->set_property('editable', true);
    $cell_renderer7->set_property('width', 50);
    $cell_renderer7->set_property('editable', true);
    $cell_renderer8->set_property('width', 50);
    $cell_renderer8->set_property('editable', true);
    $cell_renderer9->set_property('width', 50);
    $cell_renderer9->set_property('editable', true);
    $cell_renderer1->connect('edited', 'callback_start1');
    $cell_renderer2->connect('edited', 'callback_start2');
    $cell_renderer3->connect('edited', 'callback_start3');
    $cell_renderer4->connect('edited', 'callback_start4');
    $cell_renderer5->connect('edited', 'callback_start5');
    $cell_renderer6->connect('edited', 'callback_start6');
    $cell_renderer7->connect('edited', 'callback_start7');
    $cell_renderer8->connect('edited', 'callback_start8');
    $cell_renderer9->connect('edited', 'callback_start9');
    #$cell_renderer3->set_property('width', -1);
    $column1->pack_start($cell_renderer1, true);
    $column2->pack_start($cell_renderer2, true);
    $column3->pack_start($cell_renderer3, true);
    $column4->pack_start($cell_renderer4, true);
    $column5->pack_start($cell_renderer5, true);
    $column6->pack_start($cell_renderer6, true);
    $column7->pack_start($cell_renderer7, true);
    $column8->pack_start($cell_renderer8, true);
    $column9->pack_start($cell_renderer9, true);
    $column1->set_attributes($cell_renderer1, 'text', 0);
    $column2->set_attributes($cell_renderer2, 'text', 1);
    $column3->set_attributes($cell_renderer3, 'text', 2);
    $column4->set_attributes($cell_renderer4, 'text', 3);
    $column5->set_attributes($cell_renderer5, 'text', 4);
    $column6->set_attributes($cell_renderer6, 'text', 5);
    $column7->set_attributes($cell_renderer7, 'text', 6);
    $column8->set_attributes($cell_renderer8, 'text', 7);
    $column9->set_attributes($cell_renderer9, 'text', 8);
    #print_r($G["behy"]);exit;
    foreach ($G["behy"] as $b) {
        $model->append($b);
    }
    $toolbar = new GtkHButtonBox();
    $addbutton = GtkButton::new_from_stock(Gtk::STOCK_ADD);
    $deletebutton = GtkButton::new_from_stock(Gtk::STOCK_DELETE);
    #$loadbutton=GtkButton::new_from_stock(Gtk::STOCK_REFRESH);
    $savebutton = GtkButton::new_from_stock(Gtk::STOCK_SAVE);
    $savebutton->connect("pressed", "uloz_behy");
    $addbutton->connect("pressed", "pridaj_beh");
    $deletebutton->connect("pressed", "vymaz_beh");
    $toolbar->add($addbutton);
    $toolbar->add($deletebutton);
    #$toolbar->add($loadbutton);
    $toolbar->add($savebutton);
    $toolbar->set_size_request(0, 40);
    $sw = new GtkScrolledWindow();
    $sw->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    $sw->add($view);
    $sw->set_size_request(-1, 560);
    $vbox = new GtkVBox();
    $vbox->add($toolbar);
    $vbox->add($sw);
    $dialog->vbox->pack_start($vbox);
    // note 3
    $dialog->show_all();
    // note 4
    $dialog->run();
    // note 5
    $dialog->destroy();
    // note 6
}
コード例 #21
0
ファイル: set.php プロジェクト: phpsource/doc-gtk
<?php

//Create new list store with string and number columns
$store = new GtkListStore(Gobject::TYPE_STRING, Gobject::TYPE_LONG);
//at first, get an iterator for a new row
$iterator = $store->append();
//now use that to set the name at that row (column 0)
$store->set($iterator, 0, 'Tokio');
//same row: set the inhabitants into column 1
$store->set($iterator, 1, 34100000);
//You can set a whole row at once:
$iterator = $store->append();
//we add the data "Mexico city" at column 0 and
// "22 million" at column 1 at the row $iterator
$store->set($iterator, 0, 'Mexico city', 1, 22650000);
//Even faster: don't even create an iterator variable
$store->set($store->append(), 0, 'Seoul', 1, 22250000);