/** * Busca o titulo do item selecionado * * @name get_selected_title() */ public function get_selected_title() { // Busca os paths $path = parent::get_selected_items(); // Verifica se existe algum selecionado if (sizeof($path) <= 0) { return FALSE; } // Busca o iter $iter = $this->model[$path[0][0]]->iter; // Retorna o titulo return $this->model->get_value($iter, 1); }
function __create_box() { $iv = new GtkIconView(); $model = new GtkListStore(GdkPixbuf::gtype, GObject::TYPE_STRING); $iv->set_model($model); $iv->set_columns(1); $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); //multi select incl. zooming up an rectangle to select icons $iv->set_selection_mode(Gtk::SELECTION_MULTIPLE); //labels at the right side $iv->set_orientation(Gtk::ORIENTATION_HORIZONTAL); //enough place for the text so that it doesn't wrap $iv->set_item_width(200); //spacing between icon and label $iv->set_spacing(0); //spacing between single rows $iv->set_row_spacing(0); //spacing between cols //margin from the edges of the view widget -> like the CSS margin property $iv->set_margin(5); //in how many columns the view will be split //Icon order (for 3 columns): // 1 2 3 // 4 5 6 //FIXME: is there a way to arrange it horizontally so that it's arranged that way: // 1 4 7 // 2 5 8 // 3 6 9 ? //0 is auto-fit $iv->set_columns(0); $editor = new WidgetEditor($iv, array(array('selection_mode', GtkComboBox::gtype, 'Gtk::SELECTION_'), array('orientation', GtkComboBox::gtype, 'Gtk::ORIENTATION_'), array('item_width', GtkScale::gtype, 0, 500), array('spacing', GtkScale::gtype, -100, 100), array('row_spacing', GtkScale::gtype, -100, 100), array('column_spacing', GtkScale::gtype, -100, 100), array('margin', GtkScale::gtype, -100, 200), array('columns', GtkScale::gtype, 0, 20))); $scrollwin = new GtkScrolledWindow(); $scrollwin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); $scrollwin->add($iv); return $scrollwin; }
{ $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 $widget->set_tooltip_cell($tooltip, $path, null); // you can pass a specific cell renderer as the third arg here return true; //show tip } /* New tooltip iconview stuff */ $iconview = new GtkIconView($store); $iconview->set_pixbuf_column(2); $iconview->set_text_column(0); $vbox->add($iconview); // simple tooltips for an iconview var_dump($iconview->get_tooltip_column()); // notice this is -1 for disabled //$iconview->set_tooltip_column(1); // this is the "shortcut" way to set tips, see below // fancy tooltip querying $iconview->set_has_tooltip(true); $iconview->connect('query-tooltip', 'checkcontext'); /* New tooltip treeview stuff */ $treeview = new GtkTreeView($store); $treeview->append_column(new GtkTreeViewColumn('stuff', new GtkCellRendererText(), 'text', 0)); $vbox->add($treeview); // simple text only tooltips can be automatic on treeviews - use -1 to turn it off