PHP-GTK
Sunday, December 21, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkIconView
GtkIconView::get_column_spacingnext

Last updated: Sun, 12 May 2013
view this page in English

GtkIconView Constructor

Creates a new GtkIconView instance. To make it actually display something, you need to add a data model (e.g. a GtkListStore) and some scroll bars.

Example 74. GtkIconView filled with stock icons

<?php
//GtkIconView example
$wnd = new GtkWindow();
$wnd->set_title('GtkIconView');
$wnd->set_default_size(400, 400);
$wnd->connect_simple('destroy', array('Gtk', 'main_quit'));
 
$iv = new GtkIconView();
 
$model = new GtkListStore(GdkPixbuf::gtype, Gtk::TYPE_STRING);
$iv->set_model($model);
 
//fill the model with some nice icons
$ids = Gtk::stock_list_ids();
sort($ids);
foreach ($ids as $id) {
    $pixbuf = $iv->render_icon($id, Gtk::ICON_SIZE_DIALOG);
    $model->set($model->append(), 0, $pixbuf, 1, $id);
}
 
$iv->set_pixbuf_column(0);
$iv->set_text_column(1);
 
//number of columns in view, not model
$iv->set_columns(0);
$iv->set_item_width(100);
 
//make it scrollable
$scrollwin = new GtkScrolledWindow();
$scrollwin->set_policy(
    Gtk::POLICY_AUTOMATIC,
    Gtk::POLICY_AUTOMATIC
);
$scrollwin->add($iv);
 
$wnd->add($scrollwin);
$wnd->show_all();
Gtk::main();
?>

User Contributed Notes
gtk.gtkiconview.constructor.php
add a note about notes
There are no user contributed notes for this page.


previousGtkIconView
GtkIconView::get_column_spacingnext

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:50:57 2013 CEST