コード例 #1
0
ファイル: main.cpp プロジェクト: Klendathu/minichan
void boardView(bool destroy=true) {
	///Show/hide widgets for viewing all of the threads on a board
	
	Gtk::ScrolledWindow *boardlist = 0;
	builder->get_widget("scrolledwindow1", boardlist);
	boardlist->set_visible(false);
	boardlist->hide();
	
	Gtk::Paned *threadview = 0;
	builder->get_widget("paned1", threadview);
	threadview->set_visible(true);
	threadview->show();
	
	if(INIT) { //To be run only the first time a board is viewed
		Gtk::Window *window = 0;
		builder->get_widget("window1", window);
		int w = 0;
		int h = 0;
		window->get_size(w, h);
		threadview->set_position((1-2/(1+sqrt(5)))*w);
		
		Gtk::TextView *view = 0;
		builder->get_widget("textview1", view);
		GtkSpellChecker* spell = gtk_spell_checker_new ();
		gtk_spell_checker_set_language (spell, setlocale(LC_ALL,NULL), NULL);
		gtk_spell_checker_attach (spell, GTK_TEXT_VIEW (view->gobj()));
		
		INIT = false;
	}
	
	Gtk::ToolItem *boardback = 0;
	builder->get_widget("toolbutton3", boardback);
	boardback->set_visible(true);
	boardback->show();
	
	Gtk::ToolItem *threadback = 0;
	builder->get_widget("toolbutton4", threadback);
	threadback->set_visible(false);
	threadback->hide();
	
	Gtk::Button* button;
	builder->get_widget("button1", button);
	button->signal_clicked().connect(sigc::ptr_fun(&on_board_back_clicked));
	button->set_visible(true);
	button->show();
	
	Gtk::ScrolledWindow *threadlist = 0;
	builder->get_widget("scrolledwindow2", threadlist);
	threadlist->set_visible(true);
	threadlist->show();
	
	Gtk::ScrolledWindow *postlist = 0;
	builder->get_widget("scrolledwindow4", postlist);
	postlist->set_visible(false);
	postlist->hide();
	
	Gtk::ScrolledWindow *webview = 0;
	builder->get_widget("scrolledwindow3", webview);
	webview->set_visible(true);
	webview->show();
	
	Gtk::ToolButton* refresh;
	builder->get_widget("toolbutton5", refresh);
	refresh->set_visible(true);
	refresh->show();
	
	gtk_widget_show(GTK_WIDGET(pWebKitView));
	
	Gtk::Label *title = 0;
	builder->get_widget("label2", title);
	title->set_text(BOARD+" - "+LONGBOARD);
	
	Gtk::ToolButton *refresh1 = 0;
	builder->get_widget("toolbutton5", refresh1);
	refresh1->set_visible(true);
	refresh1->show();
	
	Gtk::ToolItem *refresh2 = 0;
	builder->get_widget("toolbutton6", refresh2);
	refresh2->set_visible(false);
	refresh2->hide();
	
	Gtk::MenuItem *item3 = 0;
	builder->get_widget("menuitem3", item3);
	item3->set_sensitive(false);
	
	Gtk::ToolButton *post_but;
	builder->get_widget("toolbutton8", post_but);
	post_but->set_visible(true);
	post_but->show();
}
コード例 #2
0
ファイル: main.cpp プロジェクト: Klendathu/minichan
void threadView() {
	///Hide or show widgets for viewing a thread
	
	Gtk::ScrolledWindow *boardlist = 0;
	builder->get_widget("scrolledwindow1", boardlist);
	boardlist->set_visible(false);
	boardlist->hide();
	
	Gtk::Paned *threadview = 0;
	builder->get_widget("paned1", threadview);
	threadview->set_visible(true);
	threadview->show();
	
	Gtk::ToolItem *boardback = 0;
	builder->get_widget("toolbutton4", boardback);
	boardback->set_visible(true);
	boardback->show();
	
	Gtk::ToolItem *listback = 0;
	builder->get_widget("toolbutton3", listback);
	listback->set_visible(false);
	listback->hide();
	
	Gtk::Button* button;
	builder->get_widget("button2", button);
	button->signal_clicked().connect(sigc::ptr_fun(&on_thread_back_clicked));
	button->set_visible(true);
	button->show();
	
	Gtk::ScrolledWindow *threadlist = 0;
	builder->get_widget("scrolledwindow2", threadlist);
	threadlist->set_visible(false);
	threadlist->hide();
	
	Gtk::ScrolledWindow *postlist = 0;
	builder->get_widget("scrolledwindow4", postlist);
	postlist->set_visible(true);
	postlist->show();
	postlist->get_vadjustment()->set_value(0);
	
	Gtk::Label *title = 0;
	builder->get_widget("label2", title);
	title->set_text("#"+THREAD+" - "+BOARD+" - "+LONGBOARD);
	
	Gtk::ToolItem *refresh1 = 0;
	builder->get_widget("toolbutton5", refresh1);
	refresh1->set_visible(false);
	refresh1->hide();
	
	Gtk::ToolItem *refresh2 = 0;
	builder->get_widget("toolbutton6", refresh2);
	refresh2->set_visible(true);
	refresh2->show();
	
	Gtk::MenuItem *item3 = 0;
	builder->get_widget("menuitem3", item3);
	item3->set_sensitive(true);
	
	Gtk::ToolButton *post_but;
	builder->get_widget("toolbutton8", post_but);
	post_but->set_visible(true);
	post_but->show();
}
コード例 #3
0
ファイル: Info.cpp プロジェクト: VaysseB/openfluid
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();
}