Ejemplo n.º 1
0
void NaviHier::SetDesEnv(MEnv* aDesEnv)
{
    assert(aDesEnv == NULL || aDesEnv != NULL && iDesEnv == NULL);
    if (aDesEnv != iDesEnv) {
	unset_model();
	remove_all_columns();
	/* No need to delete model explicitly, it is deleted at unset_model
	Glib::RefPtr<TreeModel> curmdl = get_model();
	TreeModel* curmdlp = curmdl.operator ->();
	curmdl.reset();
	delete curmdlp;
	*/
	iDesEnv = aDesEnv;
	if (iDesEnv != NULL) {
	    Glib::RefPtr<HierTreeMdl> mdl = HierTreeMdl::create(iDesEnv);
	    HierTreeMdl* hmdl = mdl.operator ->();
	    GtkTreeModel* model = mdl->Gtk::TreeModel::gobj();
	    bool isds = GTK_IS_TREE_DRAG_SOURCE(model);
	    set_model(mdl);
	    append_column( "one", mdl->ColRec().name);
	    enable_model_drag_source();
	    drag_source_set (Gtk::ArrayHandle_TargetEntry(sNaviHierDnDTarg, 1, Glib::OWNERSHIP_NONE), Gdk::MODIFIER_MASK, Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
	    iDesObs->SignalCompDeleted().connect(sigc::mem_fun(*hmdl, &HierTreeMdl::on_comp_deleting));
	    iDesObs->SignalCompAdded().connect(sigc::mem_fun(*hmdl, &HierTreeMdl::on_comp_adding));
	    iDesObs->SignalCompChanged().connect(sigc::mem_fun(*hmdl, &HierTreeMdl::on_comp_changed));
	}
    }
}
Ejemplo n.º 2
0
void NaviNatN::SetDesEnv(MEnv* aDesEnv)
{
    if (aDesEnv != iDesEnv) {
	unset_model();
	remove_all_columns();
	Glib::RefPtr<TreeModel> curmdl = get_model();
	curmdl.reset();
	iDesEnv = aDesEnv;
	if (iDesEnv != NULL) {
	    Glib::RefPtr<NatnTreeMdl> mdl = NatnTreeMdl::create(iDesEnv->Provider());
	    GtkTreeModel* model = mdl->Gtk::TreeModel::gobj();
	    bool isds = GTK_IS_TREE_DRAG_SOURCE(model);
	    set_model(mdl);
	    append_column( "one", mdl->ColRec().name);
	    enable_model_drag_source();
	    drag_source_set (Gtk::ArrayHandle_TargetEntry(targetentries));
	}
    }
}