Example #1
0
Gtk::Box* PreferencesPanel::createPanelBox()
{
  Gtk::VBox* PanelBox = Gtk::manage(new Gtk::VBox(false, 5));

  PanelBox->set_border_width(10);

  PanelBox->set_visible(true);

  return PanelBox;
}
void ModelStructureModule::compose()
{
  mp_MainPanel = Gtk::manage(new Gtk::VPaned());

  Gtk::VBox* ButtonsPanel = Gtk::manage(new Gtk::VBox());
  ButtonsPanel->pack_start(*mp_StructureListToolBox->asWidget(),Gtk::PACK_SHRINK);
  ButtonsPanel->set_visible(true);

  Gtk::HBox* TopPanel = Gtk::manage(new Gtk::HBox());
  TopPanel->set_border_width(5);
  TopPanel->pack_start(*mp_ModelStructureMVP->asWidget(),Gtk::PACK_EXPAND_WIDGET,5);
  TopPanel->pack_start(*ButtonsPanel, Gtk::PACK_SHRINK,5);
  TopPanel->pack_start(*mp_ModelFctDetailMVP->asWidget(),Gtk::PACK_SHRINK,5);
  TopPanel->set_visible(true);
  TopPanel->set_border_width(6);

  Gtk::HBox* BottomPanel = Gtk::manage(new Gtk::HBox());
  BottomPanel->set_border_width(5);
  BottomPanel->pack_start(*mp_ModelParamsPanel->asWidget());
  BottomPanel->set_visible(true);
  BottomPanel->set_border_width(6);

  BuilderFrame* TopFrame = Gtk::manage(new BuilderFrame());
  TopFrame->setLabelText(_("Model definition"));
  TopFrame->set_visible(true);
  TopFrame->add(*TopPanel);

  BuilderFrame* BottomFrame = Gtk::manage(new BuilderFrame());
  BottomFrame->setLabelText(_("Model parameters"));
  BottomFrame->set_visible(true);
  BottomFrame->add(*BottomPanel);

  mp_MainPanel->pack1(*TopFrame, true,false);
  mp_MainPanel->pack2(*BottomFrame, true,false);
  mp_MainPanel->set_visible(true);
}
Example #3
0
void ResViewerViewImpl::setFileContentsByName(std::map<std::string,
    Glib::RefPtr<Gtk::TextBuffer> > FileContents)
{
  Glib::ustring ExistingTabSelection = "";
  if (mp_Notebook->get_current())
    ExistingTabSelection = mp_Notebook->get_current()->get_tab_label_text();

  int TabToSelect = 0;

  while (mp_Notebook->get_n_pages() > 1)
    mp_Notebook->remove_page(1);

  for (std::map<std::string, Glib::RefPtr<Gtk::TextBuffer> >::iterator it =
      FileContents.begin(); it != FileContents.end(); ++it)
  {
    Gtk::TextView* TextView = Gtk::manage(new Gtk::TextView(it->second));
    TextView->set_editable(false);
    TextView->set_visible(true);

    Gtk::ScrolledWindow* Win = Gtk::manage(new Gtk::ScrolledWindow());
    Win->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    Win->set_visible(true);
    Win->set_shadow_type(Gtk::SHADOW_ETCHED_IN);
    Win->add(*TextView);

    Gtk::Label* TabLabel = Gtk::manage(new Gtk::Label(it->first));
    Gtk::Label* MenuLabel = Gtk::manage(new Gtk::Label(it->first,
        Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER));

    Gtk::Button* SingleGNUplotButton = Gtk::manage(new Gtk::Button(
        _("Plot file with GNUplot\n(All-in-one window)")));
    Gtk::Button* MultiGNUplotButton = Gtk::manage(new Gtk::Button(
        _("Plot file with GNUplot\n(Multiple windows)")));

    Gtk::VBox* RightButtonsBox = Gtk::manage(new Gtk::VBox());
    RightButtonsBox->pack_start(*SingleGNUplotButton, Gtk::PACK_SHRINK);
    RightButtonsBox->pack_start(*MultiGNUplotButton, Gtk::PACK_SHRINK, 5);
    RightButtonsBox->show_all_children(true);
    RightButtonsBox->set_visible(true);

#if WIN32
    SingleGNUplotButton->set_sensitive(false);
    MultiGNUplotButton->set_sensitive(false);
#else
    if (ViewWithGNUplot::IsGNUplotAvailable())
    {
      SingleGNUplotButton->signal_clicked().connect(sigc::bind<Glib::RefPtr<
          Gtk::TextBuffer>, std::string, std::string, std::string, bool>(
          sigc::mem_fun(*this, &ResViewerViewImpl::onGNUplotClicked),
          (Glib::RefPtr<Gtk::TextBuffer>) (it->second), m_DateFormat, m_ColSep,
          m_CommentChar, true));
      SingleGNUplotButton->set_sensitive(true);

      MultiGNUplotButton->signal_clicked().connect(sigc::bind<Glib::RefPtr<
          Gtk::TextBuffer>, std::string, std::string, std::string, bool>(
          sigc::mem_fun(*this, &ResViewerViewImpl::onGNUplotClicked),
          (Glib::RefPtr<Gtk::TextBuffer>) (it->second), m_DateFormat, m_ColSep,
          m_CommentChar, false));
      MultiGNUplotButton->set_sensitive(true);
    }
    else
    {
      SingleGNUplotButton->set_sensitive(false);
      MultiGNUplotButton->set_sensitive(false);
    }
#endif

    Gtk::HBox* MainHBox = Gtk::manage(new Gtk::HBox());
    MainHBox->pack_start(*Win, Gtk::PACK_EXPAND_WIDGET, 5);
    MainHBox->pack_start(*RightButtonsBox, Gtk::PACK_SHRINK, 5);
    MainHBox->set_border_width(8);
    MainHBox->set_visible(true);

    int PageNum = mp_Notebook->append_page(*MainHBox, *TabLabel, *MenuLabel);

    if (it->first == ExistingTabSelection)
      TabToSelect = PageNum;

    mp_Notebook->set_tab_reorderable(*Win, true);
  }

  mp_Notebook->set_current_page(TabToSelect);
}