std::list<openfluid::core::Unit*> DomainUnitRelationAddDialog::show()
{
  mp_TreeView->get_selection()->unselect_all();

  std::list<openfluid::core::Unit*> SelectedUnits;

  if (mp_Dialog->run() == Gtk::RESPONSE_OK)
  {
    Gtk::TreeSelection::ListHandle_Path Selecteds =
        mp_TreeView->get_selection()->get_selected_rows();

    for (Gtk::TreeSelection::ListHandle_Path::iterator it = Selecteds.begin(); it
        != Selecteds.end(); ++it)
    {
      std::string Class = mref_TreeModel->get_iter(*it)->get_value(
          m_Columns.m_Class);
      int Id = mref_TreeModel->get_iter(*it)->get_value(m_Columns.m_Id);

      if (Id)
        SelectedUnits.push_back(mp_CoreRepos->getUnit(Class, Id));
    }
  }

  mp_Dialog->hide();

  return SelectedUnits;
}
Пример #2
0
std::set<std::string> MapViewAddLayersDialog::show(
    const std::set<std::string>& AlreadyDisplayedLayersIds)
{
  update(AlreadyDisplayedLayersIds);

  std::set<std::string> SelectedLayersIds;

  if (mp_Dialog->run() == Gtk::RESPONSE_OK)
  {
    Gtk::TreeSelection::ListHandle_Path Selecteds =
        mp_TreeView->get_selection()->get_selected_rows();

    for (Gtk::TreeSelection::ListHandle_Path::iterator it = Selecteds.begin(); it
        != Selecteds.end(); ++it)
    {
      SelectedLayersIds.insert(mref_TreeModel->get_iter(*it)->get_value(
          m_Columns.m_Id));
    }
  }

  mp_Dialog->hide();

  return SelectedLayersIds;
}