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; }
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(); }