示例#1
0
void HierTreeMdl::get_value_vfunc(const TreeModel::iterator& iter, int column, Glib::ValueBase& value) const
{
    if (IsIterValid(iter)) {
	if (column < iColRec.size()) {
	    GType coltype = get_column_type_vfunc(column);
	    if (column == HierTreeClrec::KCol_Name) {
		Glib::Value<Glib::ustring> sval;
		sval.init(coltype);
		Elem* node = (Elem*) iter.gobj()->user_data;
		//string data = node->EType() + ":" + node->Name();
		string data = node->Name();
		sval.set(data.c_str());
		value.init(coltype);
		value = sval;
	    }
	    else if (column == HierTreeClrec::KCol_Elem) {
		Glib::Value<Elem*> sval;
		sval.init(coltype);
		Elem* data = (Elem*) iter.gobj()->user_data;
		sval.set(data);
		value.init(coltype);
		value = sval;
	    }
	}
    }
}
示例#2
0
void NatnTreeMdl::get_value_vfunc(const TreeModel::iterator& iter, int column, Glib::ValueBase& value) const
{
    if (IsIterValid(iter)) {
	if (column < iColRec.size()) {
	    GType coltype = get_column_type_vfunc(column);
	    Glib::Value<Glib::ustring> sval;
	    sval.init(coltype);
	    string data = iNodesInfo.at(GetRowIndex(iter));
	    sval.set(data.c_str());
	    value.init(coltype);
	    value = sval;
	}
    }
}
//------------------------------------------------------------------------------
void ListModelWrapper::get_icon_value(const iterator& iter, int column, const bec::NodeId& node,
                                      Glib::ValueBase& value) const {
  if (!*_tm)
    return;

  static ImageCache* pixbufs = ImageCache::get_instance();
  static Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default();
  bec::IconId icon_id = (*_tm)->get_field_icon(node, column, get_icon_size());
  value.init(Glib::Value<Glib::RefPtr<Gdk::Pixbuf>>::value_type());
  if (icon_id != 0 && icon_id != -1) {
    Glib::RefPtr<Gdk::Pixbuf> pixbuf = pixbufs->image(icon_id);
    if (pixbuf) {
      Glib::Value<Glib::RefPtr<Gdk::Pixbuf>> pixbufValue;
      pixbufValue.init(Glib::Value<Glib::RefPtr<Gdk::Pixbuf>>::value_type());
      pixbufValue.set(pixbuf);
      value = pixbufValue;
    }
  }
}