示例#1
0
void BuilderHomeButton::setLabelText(std::string LabelText)
{
  Gtk::Label * Label = Gtk::manage(new Gtk::Label(LabelText, Gtk::ALIGN_LEFT));
  Label->set_line_wrap(true);
  Label->set_visible(true);
  mp_InnerBox ->pack_end(*Label);
}
    inline virtual void updateGui()
    {
      _singleValueLabel.set_visible(false);
      for (size_t i(0); i < 4; ++i)
	_scalarvalues[i].hide();

      bool singlevalmode = singleValueMode();

      if (_components && singlevalmode)
	{
	  _singleValueLabel.set_visible(true);
	  for (size_t i(0); i < _components; ++i)
	    _scalarvalues[i].show();
	}

      _componentSelect.clear_items();
      if (singlevalmode || !_enableDataFiltering)
	_componentSelect.set_visible(false);
      else
	{
	  _componentSelect.set_visible(true);

	  Gtk::TreeModel::iterator iter = _comboBox.get_active();
	  std::tr1::shared_ptr<Attribute> ptr = (*iter)[_modelColumns.m_ptr];

	  _componentSelect.append_text("Raw Data");
	  _componentSelect.append_text("Magnitude");
	  _componentSelect.append_text("X");
	    
	  if (ptr->components() > 1)
	    _componentSelect.append_text("Y");
	  if (ptr->components() > 2)
	    _componentSelect.append_text("Z");
	  if (ptr->components() > 3)
	    _componentSelect.append_text("W");
	  
	  //Default to coloring using the magnitude
	  _componentSelect.set_active(1);
	}

      for (size_t i(0); i < _components; ++i)
	_scalarvalues[i].set_sensitive(singlevalmode);
    }
    BuilderFrame()
    {
        set_shadow_type(Gtk::SHADOW_ETCHED_IN);
        set_border_width(5);

        m_Label = Gtk::manage(new Gtk::Label());
        m_Label->set_padding(3, 0);
        m_Label->set_visible(true);

        set_label_widget(*m_Label);
    }
示例#4
0
Gtk::Widget* PreferencesPanel::createSubTitle(Glib::ustring SubTitle)
{
  Gtk::Label* SubLabel = Gtk::manage(new Gtk::Label());

  SubLabel->set_markup(Glib::ustring::compose("<b>%1</b>", SubTitle));

  SubLabel->set_alignment(0, 0.5);

  SubLabel->set_visible(true);

  return SubLabel;
}
示例#5
0
void DomainIDataViewImpl::setTreeModel(Glib::RefPtr<Gtk::TreeModel> TreeModel,
    DomainIDataColumns* Columns)
{
  mp_TreeView->remove_all_columns();
  mp_TreeView->set_model(TreeModel);

  if (TreeModel->get_n_columns() < 2)
    return;

  mp_TreeView->append_column("Unit ID", *Columns->getIdColumn());
  mp_TreeView->get_column(0)->set_sort_column(*Columns->getIdColumn());

  std::map<std::string, Gtk::TreeModelColumn<std::string>*> ColumnsByTitle =
      Columns->getByTitleColumns();

  for (std::map<std::string, Gtk::TreeModelColumn<std::string>*>::iterator it =
      ColumnsByTitle.begin(); it != ColumnsByTitle.end(); ++it)
  {
    int ColIndex = mp_TreeView->append_column_editable("", *it->second) - 1;

    /*
     * use of a widget label instead of a column title because
     * in column title, underscores have to be escaped by another one
     * (same as Label::set_use_underline(true))
     */
    Gtk::Label* TitleLabel = Gtk::manage(new Gtk::Label(it->first));
    TitleLabel->set_visible(true);
    mp_TreeView->get_column(ColIndex)->set_widget(*TitleLabel);

    mp_TreeView->get_column(ColIndex)->set_sort_column(*it->second);

    Gtk::CellRendererText* CellRend =
        (Gtk::CellRendererText *) mp_TreeView->get_column_cell_renderer(
            ColIndex);

    CellRend->signal_edited().connect(sigc::bind<std::string>(sigc::mem_fun(
        *this, &DomainIDataViewImpl::onDataEdited), it->first));
  }

  mp_TreeView->get_selection()->signal_changed().connect(sigc::mem_fun(*this,
      &DomainIDataViewImpl::onUnitSelectionChanged));

}
示例#6
0
void Info::show(std::string ClassName, std::set<int> UnitIDs)
{
  mp_IDLabel->set_label("");
  mp_ProcessOrderLabel->set_label("");
  mref_ListStoreFrom->clear();
  mref_ListStoreTo->clear();
  mref_ListStoreParent->clear();
  mref_ListStoreChildren->clear();
  mref_ListStoreIDs->clear();
  m_InputDataNames.clear();
  if (!m_InputDataLineTable.empty())
  {
    std::map<Gtk::Label*, std::pair<Gtk::Entry*, Gtk::Button*> >::iterator iter;
    for (iter = m_InputDataLineTable.begin(); iter
    != m_InputDataLineTable.end(); ++iter)
    {
      delete((*iter).first);
      delete((*iter).second.second);
      delete((*iter).second.first);
    }

  }
  m_InputDataLineTable.clear();

  mp_NameClassLabel->set_label(ClassName);
  mp_TreeViewIDs->set_name("");

  std::set<int>::iterator it;
  for (it = UnitIDs.begin(); it != UnitIDs.end(); it++)
  {
    Gtk::TreeRow Row = *mref_ListStoreIDs->append();
    Row[m_ModelColumnIDs.m_ID] = *it;

    m_InputDataNames
    = mp_CoreRepos->getUnit(ClassName, *it)->getInputData()->getInputDataNames();

    if(m_InputDataNames.empty())
      mp_InputDataTable->set_visible(false);
    else
    {
      mp_InputDataTable->resize((m_InputDataNames.size() * 2) - 1, 3);
      mp_InputDataTable->set_homogeneous(false);
      mp_InputDataTable->set_spacings(5);

      int compt = 0;
      for (unsigned int i = 0; i < (m_InputDataNames.size() * 2) - 1; i++)
      {
        if ((i % 2) == 0)
        {
          Gtk::Label* InputDataLabel = Gtk::manage(
              new Gtk::Label(m_InputDataNames[compt]));

          mp_InputDataTable->attach(*InputDataLabel, 0, 1, i, i + 1,
              Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);

          Gtk::Entry* InputDataValueEntry = Gtk::manage(new Gtk::Entry());
          InputDataValueEntry->set_name(InputDataLabel->get_label());
          mp_InputDataTable->attach(*InputDataValueEntry, 1, 2, i, i + 1,
              Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
          InputDataValueEntry->signal_activate().connect(
              sigc::bind<std::string>(
                  sigc::mem_fun(*this, &Info::onEntryInputDataChanged),
                  InputDataValueEntry->get_name()));
          InputDataValueEntry->signal_focus_out_event().connect(
              sigc::bind<std::string>(
                  sigc::mem_fun(*this, &Info::on_focus_out_event),
                  InputDataValueEntry->get_name()));
          InputDataValueEntry->set_activates_default(true);

          Gtk::Button* RestoreDefaultButton = Gtk::manage(
              new Gtk::Button(_("Restore"), false));
          mp_InputDataTable->attach(*RestoreDefaultButton, 2, 3, i, i + 1,
              Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);

          std::pair<Gtk::Entry*, Gtk::Button*> TempPairEntryButton =
              std::make_pair(InputDataValueEntry, RestoreDefaultButton);
          m_InputDataLineTable.insert(
              std::pair<Gtk::Label*, std::pair<Gtk::Entry*, Gtk::Button*> >(
                  InputDataLabel, TempPairEntryButton));

          InputDataLabel->set_visible(true);
          InputDataValueEntry->set_visible(true);
          RestoreDefaultButton->set_visible(true);
          RestoreDefaultButton->set_sensitive(false);
          compt++;
        } else
        {
          mp_InputDataTable->attach(*ToolBox::setHSeparator(), 0, 3, i, i + 1,
              Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
        }
      }
      mp_InputDataTable->set_visible(true);
    }
  }

  if(! mref_ListStoreIDs->children().empty())
      mp_TreeViewIDs->get_selection()->select(mref_ListStoreIDs->children()[0]);


  if (mp_Dialog->run() == Gtk::RESPONSE_OK)
  {

  }

  mp_Dialog->hide();
}